Skip to content

Ariadne: a normative spec for .ari documents (ARIADNE_SPEC.md) - #1595

Merged
transfix merged 4 commits into
masterfrom
ariadne/spec
Nov 28, 2026
Merged

transfix merged 4 commits into
masterfrom
ariadne/spec

Conversation

@transfix

@transfix transfix commented Nov 27, 2026 •

Copy link
Copy Markdown
Owner

Ariadne gets a normative specification: docs/ARIADNE_SPEC.md. The .ari schema stays its structural half, saying which keys a document may have and what shape each value takes. The new file is the other half: when each part is read, what it does, and what a reader reports. ARIADNE.md stays the guide, and it is informative.

This is the first part of gap item 9 in the scene-format plan. It covers the document as a whole, plus one entry for each top-level block. The scene's node semantics (gap items 1 to 8), the widget types and the DSL's built-ins are listed in its §10 as the parts still to write.

What the spec says

  1. Conformance. BCP 14 keywords; two classes, a conforming document and a conforming reader. The schema governs structure. Warn and refuse are defined once and used throughout.
  2. Document text.
    • YAML 1.2, UTF-8, one YAML document per file.
    • Anchors are allowed. Merge keys and tags are not part of the format, and a key must not repeat.
    • How scalars read: flags, numbers, programs; quoting does not change a value.
    • The three uses of one file shape: run, imported as a library, mounted as a fragment.
    • x- extension keys.
  3. The version gate. How min_libcvc compares. It is checked before anything else, so a document too new for this build is refused unchecked. It selects no behaviour.
  4. Loading.
    • The twelve load steps in order.
    • The schema check: when it runs, on what, and how deep.
    • The full list of what refuses a load.
    • Composition: include:, import:, load:, functions:, mounts: and URIs, with every limit.
    • The 256-level nesting limit.
    • Host blocks.
  5. Starting. The nine start steps (requires:, args:, data:, keys:, state:, init:, residents, scene, tree), then reload and Restart.
  6. Frames. The deferred-intent rule and its three exceptions, what the drain does, what the walk does.
  7. Programs and state paths.
    • The bind rule and scopes.
    • Confinement and link: holes.
    • Isolation.
    • The read and action lanes, with their budgets.
    • Resident handlers: their events and their restart policy.
  8. Top-level blocks. One entry for each of the schema's 39 top-level keys, grouped (the document, composition, state and programs, the user interface, the scene, host blocks). Each entry gives the key's schema definition, the step it acts in, its meaning and the guide's section.
  9. Where libcvc 4.0.10 differs (below).
  10. Not yet specified.

Facts come from the code at daf6367 (the link-mode rule from fc507d7, where #1599 landed). File and line were checked for the load order, the version gate, fragment gating, duplicate keys, link modes, nesting failures and program confinement.

Where libcvc differs (spec §9)

Each row is a defect in libcvc. This PR fixes none of them; it only records them. (An eighth, a map-form link: hole with no mode: read as read-write, was found here and fixed in #1599. Its row is gone, and so is the guide's §7.4 note about it.)

  • Version gate on fragments. A static load: fragment's min_libcvc is not checked; only mounts: entries are gated.
  • Duplicate keys are not warned about. The loader reads the first of the two, and the schema check reads the last.
  • A second YAML document in one file is ignored without a warning.
  • An import's optional: and fallback: count only the exact text true, though the schema takes any flag spelling.
  • root: with children:. children: is ignored without a warning.
  • background: is read on every widget, though the schema allows it on a few types only.

Guide fixes (ARIADNE.md)

  • The opening named the 2026-10 scoping roadmap as "the normative spec"; it now names ARIADNE_SPEC.md, and calls the roadmap the design history.
  • §5.2 said a static load: fragment is gated by its own min_libcvc; only a mounts: entry is today.
  • §14.2 said the schema check comes before anything else; the version gate comes first.
  • §6.7 quoted only "this document is not checked"; an include: expansion says "this widget is not checked".
  • §5, §14.1 and §14.4 point at the spec. §14.4 says a new top-level block needs its spec entry.

The test

ariadne_schema_test gains AriSpec.EveryTopLevelBlockHasItsEntry. It reads docs/ARIADNE_SPEC.md §8 and checks that each top-level key in $defs/document has exactly one "#### key:" entry there, and that no other key has one. A PR that adds a top-level block now has to say what it means. It runs where the schema's own shape tests run: in a build with nlohmann-json.

Verified locally

Windows, MSVC Release, with the JSON-schema validator and FTXUI (no cvcGL, no pycvc), on master daf6367:

  • ariadne_schema_test: 15 pass, plus 1 skip by design (the without-validator case). This includes
    AriSpec.EveryTopLevelBlockHasItsEntry, which finds all 39 top-level keys with one entry each.
  • The test catches mistakes in both directions. With clock:'s entry renamed clocks:, it
    fails on both: "needs one entry for clock:" and "has an entry for clocks:, which is not a
    top-level key of the schema".
  • git clang-format leaves the test change as it is.

Not verified: Linux and macOS (CI covers them). The spec changes no code.

The .ari schema is the structural half; docs/ARIADNE_SPEC.md is the
other half, what each part means and when it acts. It covers:

- conformance;
- the document text;
- the min_libcvc gate;
- the order of loading, the schema check, what refuses a load,
  composition and the nesting limit;
- the order of starting, reload and Restart;
- the frame's deferred-intent rule;
- the bind rule, scopes, confinement, holes and the two lanes;
- one entry for each of the schema's 39 top-level keys;
- the seven places libcvc 4.0.10 does not yet keep the spec;
- what is not yet specified (scene nodes, widget types, the DSL's
  built-ins).

ARIADNE.md now points at the spec. Its §5.2, §6.7 and §14.2 are
corrected, and §7.4 notes that a missing link: mode is still writable.

ariadne_schema_test's AriSpec.EveryTopLevelBlockHasItsEntry checks
that the spec's §8 has one entry for each top-level key in the schema,
and none for any other.
#1599 made a map-form link: hole with no mode:
read-only, as spec 7.3 says. Its row in spec 9 and the guide's 7.4
note that a missing mode is still read-write come out. The status line
names master fc507d7, where #1599 landed.
ABusyMountIsHeldToItsBudgetWhileTheOthersRun gave the busy mount 5000
steps a frame. Each frame's pump stops at its own backstop
(kPumpMaxSeconds, 0.1 s, half of it CPU time) whatever the mounts'
budgets, and a mount the backstop cut short has not spent its budget,
so it is not held that frame. The loaded Debug coverage runner of
#1595 fit 4000 to 5000 of the busy loop's steps in a pump, so the
mount was held some frames and not others: not held at the end, no
notice, no Quit in the Budgets window. The budget is now 250 steps
(500 after Allow more), several times under that; the checks scale
with it.

TheShippedExamplesKeepWithinTheLocalBudget held every example to the
local default's 25 ms a frame, which is wall-clock time: a loaded
machine stretches a frame without bound while it runs something else.
Each entry's budget.time is now 0, so a hold is its steps' or its
memory's, still checked at the defaults in every build. The seconds
are checked in an optimized build only, on every frame but each
example's 5 busiest.
package-linux / libcvc-debug failed on AriadneMounts.ABusyMountIsHeldToItsBudgetWhileTheOthersRun and on the runtime test's slice256 and threads_auto variants: the wall-clock budget checks that #1605 makes independent of runner speed. #1605 is a single commit (345d0be) to src/cvc/tests/ariadne_runtime_test.cpp. When it squash-merges, master gets the identical change, so this branch still merges clean and its own diff is unchanged.
transfix added a commit that referenced this pull request Nov 28, 2026
ABusyMountIsHeldToItsBudgetWhileTheOthersRun gave the busy mount 5000
steps a frame. Each frame's pump stops at its own backstop
(kPumpMaxSeconds, 0.1 s, half of it CPU time) whatever the mounts'
budgets, and a mount the backstop cut short has not spent its budget,
so it is not held that frame. The loaded Debug coverage runner of
#1595 fit 4000 to 5000 of the busy loop's steps in a pump, so the
mount was held some frames and not others: not held at the end, no
notice, no Quit in the Budgets window. The budget is now 250 steps
(500 after Allow more), several times under that; the checks scale
with it.

TheShippedExamplesKeepWithinTheLocalBudget held every example to the
local default's 25 ms a frame, which is wall-clock time: a loaded
machine stretches a frame without bound while it runs something else.
Each entry's budget.time is now 0, so a hold is its steps' or its
memory's, still checked at the defaults in every build. The seconds
are checked in an optimized build only, on every frame but each
example's 5 busiest.
@transfix
transfix merged commit fd4576c into master Nov 28, 2026
30 checks passed
@transfix
transfix deleted the ariadne/spec branch November 28, 2026 10:14
transfix added a commit that referenced this pull request Nov 28, 2026
#1595 landed as fd4576c. Its squash re-adds docs/ARIADNE_SPEC.md and edits docs/ARIADNE.md as a new commit, so both conflicted with this branch, which carried #1595's own commits. Resolved by taking master's versions of the two files and reapplying this branch's docs commit 8619f4e: the spec is unchanged from 8619f4e, and the guide is master's plus the 5.2 sentence. The PR's diff against master is now its own five files.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant