Skip to content

Commit 00e9afb

Browse files
authored
Merge pull request #92 from Accenture/fix/loose-ends-2026-11-30
fix: the loose-ends round - YAML 1.2.2 in both packs, and one rule for a URL, a time, a number and a switch
2 parents 723ab44 + e978c96 commit 00e9afb

48 files changed

Lines changed: 26900 additions & 3684 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎CHANGELOG.md‎

Lines changed: 138 additions & 40 deletions
Large diffs are not rendered by default.

‎docs/guides/ai-agent-guide.md‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@ authored on the engine — use the
2222
3. Function is stateless. State belongs to the calling flow/graph.
2323
4. Orchestration-shaped logic (sequencing, retries, branching) → STOP; author an
2424
Event Script flow or MiniGraph graph on the engine instead.
25+
5. Every YAML file (`application.yml`, `rest.yaml`) is YAML 1.2.2: write `true`/`false`, plain
26+
decimal numbers, `0x` for hex, and quotes around any text that looks like a boolean, a number,
27+
a date or null. Never `yes`/`no`/`on`/`off`, `010`, `0o10`, `0b101`, `1:30`, `16_000`, an
28+
unquoted date or the merge key `<<` — the Java engine reads those another way
29+
([the rule](configuration-reference.md#how-a-yaml-file-is-read)).
2530

2631
## The contract
2732

‎docs/guides/config-logging-actuators.md‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ otel.service.name: 'my-python-functions'
8282
```
8383
8484
With `otel.forwarding=true` (the switch is the only thing that turns it on — `false` by
85-
default, and `-Dotel.forwarding=true` at run time is enough), the host also hands each
85+
default, `-Dotel.forwarding=true` at run time is enough, and a value that is neither `true`
86+
nor `false` stops the start by name), the host also hands each
8687
dataset to the engines' extension route `distributed.trace.forwarder`, where the built-in
8788
forwarder registers itself at start-up (private, two workers; an application that registers
8889
its own function on that route wins). Each dataset becomes **one OpenTelemetry span carrying

‎docs/guides/configuration-reference.md‎

Lines changed: 92 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,32 +16,117 @@ keywords: [configuration, reference, keys, substitution, overrides]
1616
2. The configuration file: `resources/application.yml` | `.yaml` | `.properties` next to
1717
the application file (the file `mercury-serve` is given, or the script `python app.py`
1818
ran), never in the working directory; or `--config <path>`.
19-
3. `${ENV_VAR:default}` substitution inside values: environment first, then a base
20-
configuration key of that name, then the default.
19+
3. `${ENV_VAR:default}` substitution inside values: the environment variable first, then the
20+
configuration key of that name — a `-D` override of it before the file's value, as a key is
21+
read — then the default. A reference that leads back to a key being resolved is logged
22+
(`Config loop for 'key' detected`, as the engines log it) and has no value, so its default
23+
stands. A value its references leave empty is no value either, as in the Java engine: with
24+
`llm.effort: '${LLM_EFFORT:}'` and the variable unset, the key reads as its default — the
25+
idiom for an optional setting — while an empty text written as one (`key: ''`) stays one.
26+
27+
## How a YAML file is read
28+
29+
Every YAML file of the pack — `application.yml`, `rest.yaml`, `app-log-context.yaml`, an
30+
extension's own file — is read by **YAML 1.2.2**, the same way by the Python pack and the Node.js
31+
pack. A scalar written without quotes is resolved by the core schema of the
32+
specification (section 10.3.2), its rows tried in this order:
33+
34+
| Written | Read as |
35+
|---------|---------|
36+
| nothing, `~`, `null`, `Null`, `NULL` | no value: the key reads as a key that is not there, so its default applies |
37+
| `true`, `True`, `TRUE`, `false`, `False`, `FALSE` | a boolean |
38+
| `[-+]?[0-9]+` — `16000`, `-5`, `010` | an integer in base 10, exact at any size: `010` is 10 |
39+
| `0o[0-7]+` — `0o17` | an integer in base 8 |
40+
| `0x[0-9a-fA-F]+` — `0x1F` | an integer in base 16 |
41+
| `[-+]?[0-9]+(\.[0-9]*)?([eE][-+]?[0-9]+)?` with a point or an exponent, or `[-+]?\.[0-9]+([eE][-+]?[0-9]+)?` — `1.5`, `16000.0`, `1e3`, `.5` | a float |
42+
| `.inf`, `.Inf`, `.INF`, also with a sign; `.nan`, `.NaN`, `.NAN` | a float |
43+
| anything else, and anything in quotes | text |
44+
45+
So `yes`, `no`, `on`, `off`, `y` and `n`, a number with an underscore (`16_000`), in base 2
46+
(`0b101`) or in base 60 (`1:30`), `-0x10`, a date (`2026-11-30`), `=` and `<<` are text, and `<<`
47+
as a key is a key like any other, not the merge key. A switch or a flag written `yes` is refused by
48+
name (`rest.automation must be true or false`), never read as on and never as off. Under an
49+
explicit tag a scalar is valid when the tag is one of the core schema's (`!!str`, `!!int`,
50+
`!!float`, `!!bool`, `!!null`) and its content one of that tag's rows; a file with any other tag
51+
(`!!binary`, `!!timestamp`, `!!set`) does not load.
52+
53+
### Write YAML 1.2.2, and none of the additional syntax of YAML 1.1
54+
55+
This is the recommendation for whoever writes a file, a developer or an AI assistant. The Java
56+
engine's reader (SnakeYAML) reads YAML 1.1 and still accepts the older syntax, so a file that uses
57+
it reads one way in the Java engine and another way in the packs. The Rust engine reads YAML 1.2 as
58+
well; its library departs from the core schema in three spellings, which the table shows:
59+
60+
| Do not write | The Java engine reads | The Rust engine reads | The packs read | Write |
61+
|--------------|-----------------------|-----------------------|----------------|-------|
62+
| `yes`, `no`, `on`, `off` | a boolean | text | text | `true`, `false` |
63+
| `010`, `08` | 8 (base 8), text | text | 10, 8 | `10`, `8` — or `'010'` when it is text |
64+
| `0o10` | text | 8 | 8 | `8` |
65+
| `0b101` | 5 | 5 | text | `5` |
66+
| `-0x10` | -16 | -16 | text | `-16` |
67+
| `1:30` | 90 (base 60) | text | text | `90` — or `'1:30'` when it is text |
68+
| `16_000` | 16000 | text | text | `16000` |
69+
| `2026-11-30` | a date, written in the time zone of its JVM | text | text | `'2026-11-30'` |
70+
| `<<: *base` | the merge key | a key named `<<` | a key named `<<` | the keys themselves |
71+
72+
`yes`/`no`/`on`/`off`, `0b101`, `1:30`, `16_000` and the merge key are syntax of YAML 1.1 only. A
73+
number with a leading zero (`010`, `08`), `0o10` and an unquoted date are valid YAML 1.2.2 and are
74+
to be avoided all the same, because the Java engine reads them another way and the Rust engine keeps a
75+
number with a leading zero as text. `y` and `n`, booleans
76+
in YAML 1.1 itself, are text in every runtime. The forms every runtime reads alike: `true` and `false`; a plain decimal number without a leading zero, an underscore or a
77+
colon (`16000`, `-5`, `1.5`, `1e3`); `0x` for base 16 (`0x1F`); and quotes around any text that
78+
could be read as a boolean, a number, a date or no value (`'true'`, `'010'`, `'1e3'`,
79+
`'2026-11-30'`, `'null'`).
80+
81+
### The text of a value
82+
83+
As text — what `get_property` returns, and what a reference inside a longer text is replaced by — a
84+
boolean is `true` or `false` and a float keeps its point (`1.0`, never `1`), so
85+
`info.app.version: 1.0` reads `1.0` in both packs; a float is written as Python writes one, which
86+
is the Java engine's text too between 0.001 and 10,000,000. A mapping key YAML read as something
87+
other than text (`True:`, `8080:`) is the text of that value (`true`, `8080`). A tab is read as two
88+
spaces, as the Java engine reads a file, so one indented with tabs loads. A file whose document is
89+
not a mapping has no keys, and the last of two equal keys stands.
90+
91+
## A number, a duration and a switch
92+
93+
The settings of the host read these by one rule, the same in both packs; a value that is none of
94+
them stops the start by name instead of being read as off or as a default:
95+
96+
- **a whole number** — a number with a whole value (`16000`, `16000.0`), or text of the digits
97+
`0`-`9` with white space around them at most, up to 9007199254740991. A sign, an underscore, a
98+
point or an exponent in text and a digit of another script are refused
99+
(`rest.upload.max.bytes must be a whole number >= 0`);
100+
- **a duration** — such a number, in seconds, or the number and, right after it, one of `ms`, `s`,
101+
`m`, `h`, `d`: `30`, `30s`, `500ms`, `2m`
102+
(`event.stream.keep.alive must be a duration such as 30s, 2m or 500ms (seconds, ms, s, m, h, d), or 0 for none`);
103+
- **a switch** — the boolean `true` or `false`, or that text in any letter case; no value and an
104+
empty one are the default (`rest.automation must be true or false`).
21105

22106
## Well-known keys (shared with the engines)
23107

24108
| Key | Meaning | Default |
25109
|-----|---------|---------|
26110
| `application.name` | application identity in logs, `/info` and `/health` | `application` |
27-
| `rest.server.port` | Event API + actuator port | `8085` |
111+
| `rest.server.port` | Event API + actuator port: a whole number up to 65535, `0` for one the system picks | `8085` |
28112
| `log.format` | `text`, `json` (pretty-printed) or `compact` (single-line JSONL) | `text` |
29113
| `log.level` | log level; the `LOG_LEVEL` environment variable wins | `INFO` |
114+
| `app.log.context` | the application log context: a `context` block on every structured log line inside a traced request ([guide](function-patterns.md#trace-context-and-span-lineage)); a switch — `false` opts out, any value but `true` or `false` stops the start | `true` |
30115
| `info.app.version` | version reported by `/info` | package version |
31116
| `info.app.description` | description reported by `/info` | `application.name` |
32117
| `show.env.variables` | opt-in list of environment variables shown by `/env` | (empty) |
33118
| `show.application.properties` | opt-in list of configuration keys shown by `/env` | (empty) |
34119
| `mandatory.health.dependencies` | routes of health check functions that decide `/health` | (empty) |
35120
| `optional.health.dependencies` | health check routes reported but never affecting status | (empty) |
36-
| `rest.automation` | REST automation on: the entries of `rest.yaml` served in front of the functions ([guide](rest-automation.md)) | `false` |
121+
| `rest.automation` | REST automation on: the entries of `rest.yaml` served in front of the functions ([guide](rest-automation.md)); a switch — any value but `true` or `false` stops the start | `false` |
37122
| `yaml.rest.automation` | the one location of `rest.yaml`: `classpath:` the resources folder, `file:` an absolute path, a relative path under the application file's folder | `classpath:/rest.yaml` |
38-
| `rest.upload.max.bytes` | the bound on one upload: its files and its text fields together, counted in bytes (413 beyond it) | `16777216` |
123+
| `rest.upload.max.bytes` | the bound on one upload: its files and its text fields together, counted in bytes (413 beyond it); a whole number | `16777216` |
39124
| `http.trace.id.header` | the trace-id header a traced entry reads when no W3C `traceparent` arrives (`trace.id.header` overrides it per entry) | `X-Trace-Id` |
40125
| `http.correlation.id.header` | the business correlation-id header, always ensured and echoed (`correlation.id.header` per entry) | `X-Correlation-Id` |
41126
| `http.traceparent.header` | a custom name for the W3C `traceparent` header, read only when the standard one is absent (`traceparent.header` per entry) | `traceparent` |
42-
| `event.stream.keep.alive` | the keep-alive comment interval of a Server-Sent Events reply (`/api/event` and streaming entries); `0` disables | `30s` |
127+
| `event.stream.keep.alive` | the keep-alive comment interval of a Server-Sent Events reply (`/api/event` and streaming entries): a duration up to 2147483647 ms (about 24.8 days, the longest a timer of the Node.js pack holds); `0` disables | `30s` |
43128
| `static.html.folder` | the folder of static web content the host serves for the paths nothing else claims — relative to the application file's folder ([guide](config-logging-actuators.md#static-content-the-engines-public-folder)) | `resources/public` |
44-
| `otel.forwarding` | the OpenTelemetry forwarder's master switch ([guide](config-logging-actuators.md#distributed-tracing-the-opentelemetry-forwarder-opt-in)) | `false` |
129+
| `otel.forwarding` | the OpenTelemetry forwarder's master switch ([guide](config-logging-actuators.md#distributed-tracing-the-opentelemetry-forwarder-opt-in)); a switch — any value but `true` or `false` stops the start | `false` |
45130
| `otel.exporter.otlp.endpoint` | the OTLP/HTTP traces URL including the signal path | `http://localhost:4318/v1/traces` |
46131
| `otel.exporter.otlp.headers` | request headers, `k=v` or `k: v`, comma-separated (re-read per export) | (none) |
47132
| `otel.exporter.otlp.timeout` | per-export timeout in milliseconds | `10000` |

‎docs/guides/function-patterns.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,9 @@ engines' app-log-context feature, on by default) - the standard trace context
132132
`parentSpanId`, `service`, `timestamp`) - so application logs and the
133133
distributed-trace records correlate in one aggregation. Customize with your
134134
own `resources/app-log-context.yaml` (`context:` section mapping output keys
135-
to reserved `$tokens` or constants, `${ENV:default}` supported), opt out with
136-
`app.log.context=false`, and add per-request key-values from a handler with
135+
to reserved `$tokens` or constants, `${ENV:default}` supported; read as every YAML
136+
file of the pack is), opt out with `app.log.context=false` (a switch: any value but
137+
`true` or `false` stops the start), and add per-request key-values from a handler with
137138
`update_context("tenant", "acme")` (a logging-only sink; reserved keys are
138139
guarded; `None` removes).
139140

0 commit comments

Comments
 (0)