Skip to content

Ariadne: a link: hole or channel grant with no mode is read-only - #1599

Merged
transfix merged 1 commit into
masterfrom
ariadne/link-mode-fail-closed
Nov 28, 2026
Merged

transfix merged 1 commit into
masterfrom
ariadne/link-mode-fail-closed

Conversation

@transfix

Copy link
Copy Markdown
Owner

A mount's link: hole and channels: grant written as a map with no mode: were read-write. They are now read-only, as both comments beside the code and docs/ARIADNE.md §7.4 already said.

- load: panel.ari
  link:
    theme: ui.theme                     # read-write, as before (the scalar form)
    fleet: { to: shared.fleet }         # was read-write; now read-only
    risk:  { to: risk.x, mode: rw }     # read-write, as before
  channels:
    feed:  { to: news.feed }            # was read-write; now read-only

Why

A hole is a module's only way out of its sandbox, so the map form is meant to fail closed: only an exact rw grants write. e85009b made a mistyped mode (mode: readonly) read-only and wrote "a missing / mistyped mode is treated as read-only" beside it. It kept str(v, "mode", "rw"), though, so a missing mode still meant rw, and its test asserted that (EXPECT_TRUE(b->writable); // no mode -> rw default). The channel grant copied the same default under the comment "Fail-closed on mode, like link:".

Found while writing the normative spec (#1595), whose §9 lists this as a libcvc defect.

Who it affects

  • Shipped documents: nobody. None of the 204 has a map-form hole or grant without a mode (checked by script).
  • Other documents: only one written as name: { to: target } that writes through the hole. It must now say mode: rw, or use the scalar form name: target.

Changes

  • src/cvc/ariadne/loader.cpp: expand_load's link: and channels: parsing default a map's mode to ro, and the comments say so.
  • src/cvc/ariadne/schema/ari.v1.schema.json: the two descriptions now say which form is read-write and which read-only.
  • src/cvc/tests/ariadne_loader_test.cpp:
    • AriadneMount.LinkModeFailsClosed expects a missing mode to be read-only, and to warn about nothing; an unknown mode still warns.
    • AriadneChannels.MountGrantLowersToLinkHole gains a map-form grant with no mode, which must be read-only.

Verified locally

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

  • ariadne_loader_test: 282 pass, including the two changed tests.
  • ariadne_host_test: 69 pass.
  • ariadne_schema_test: 14 pass, plus 1 skip by design (the without-validator case). This includes
    EveryShippedDocumentIsValid.
  • git clang-format leaves the change as it is.

Not verified: Linux and macOS (CI covers them).

When this and #1595 have both merged, the spec's §9 row and the note in the guide's §7.4 come out. Whichever merges second takes them out.

A mount's link: hole and channels: grant written as a map with no
mode: were read-write: expand_load defaulted the mode to "rw", though
the comments beside it, and docs/ARIADNE.md 7.4, say the map form fails
closed and only an exact "rw" is writable. e85009b made a mistyped
mode read-only but kept that default, and its test asserted it. A
missing mode now means ro; the scalar form name: target stays
read-write. No shipped document has a map-form hole or grant without
a mode.

LinkModeFailsClosed now expects a missing mode to be read-only, with
no warning, and MountGrantLowersToLinkHole gains a map-form grant with
no mode. The schema's two descriptions say which form is which.
@transfix
transfix merged commit fc507d7 into master Nov 28, 2026
30 checks passed
@transfix
transfix deleted the ariadne/link-mode-fail-closed branch November 28, 2026 00:26
transfix added a commit that referenced this pull request Nov 28, 2026
#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.
transfix added a commit that referenced this pull request Nov 28, 2026
* Ariadne: a normative spec for .ari documents (ARIADNE_SPEC.md)

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.

* Ariadne spec: drop the link: mode row, fixed by #1599

#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.

* AriadneMounts: budget tests that don't depend on runner speed

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 added a commit that referenced this pull request Nov 28, 2026
* Ariadne: a normative spec for .ari documents (ARIADNE_SPEC.md)

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.

* Ariadne spec: drop the link: mode row, fixed by #1599

#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.

* Ariadne loader: keep the rules ARIADNE_SPEC.md 9 listed as defects

- A static load: fragment is gated by its own meta.min_libcvc, as a
  mounts: entry is: read_fragment checks it first for every fragment,
  and one too new for this build warns and is an empty group.
- A repeated key warns at its place and is removed from the parsed
  node, so lookups, iteration (units:, state:, ...) and the schema
  check all read the first; before, iteration and yaml_to_json read
  the last. yaml_to_json keeps the first as well (ari validate). An
  alias shares its anchor's map, so it is walked and warned once.
- A second YAML document in a file warns (the document, a library, a
  fragment), even when it does not parse; the first is read as before.
- An import's optional: and a unit's fallback: are flags, in every
  spelling flag() takes; only the text "true" counted.
- A document with both root: and children: warns, and reads root:.

background: needed nothing: parse_background already ignores it off
windows, overlays and groups, with a warning; a test pins that.
nav_lab_scrub.ari gave the Camera combo the same values: twice; one
is removed. AriadneSpec.* in ariadne_loader_test checks each rule;
five of the six fail on the old loader.

* Ariadne spec: no defects left in 9; correct fallback: and optional:

The loader now keeps the rules spec 9 listed, so its rows go, with
"None known" in their place. 2.1 says a reader reads the first of a
repeated key wherever it reads the map; 3 says what a fragment too new
for the reader does; 8's children: entry says a reader warns.

fallback: is a document's own unit's flag, not an import's: 4.4, 8
import: and 8 units: now say so, and import:'s optional: is described
as the loader reads it (a missing library is silent, one that does not
parse still warns). The background: row was wrong: the loader already
kept that rule. The guide's 5.2 says a load: fragment is gated, as a
mounts: entry is. The status line names #1609.
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