Authority and reuse transitions in seeded .om
These are the .om replacements for the transition logic currently held by the legacy C authority
and reuse owners (src/runtime/rx_capq, rx_caproot, rx_semantic). They are pure transition
functions: they validate a record, bind identities, check authority, and advance a state. They do
not mint authority, perform I/O, persist a transition or dispatch an effect. The durable store and
dispatcher are the next phase; the C owner remains active until every consumer is cut over.
| File | Role |
|---|---|
action.om | operation lifecycle: ready/in-flight/unknown/performed, attempts, limit, generation, expiry, identity binding |
delegate.om | child capability derivation and subset checks |
reuse.om | exact-key reuse checks, including whole-token prefix identity |
store.om | durable 32-word record and generation file: temp write, fsync, atomic rename, exact 256-byte read; torn/short files refused |
dispatch.om | persists in-flight, runs /bin/true and a static execpure effect, records performed/unknown, and marks unknown if the generation changes during the effect |
lock.om | cross-process O_EXCL pid lock with bounded retry and stale-pid reclaim; serializes read-check-persist, not the effect |
lock-test.om | exclusive acquire, busy refusal, release, forked waiter, stale-pid reclaim, failed-release reporting, a live owner with pid 32 (not a read error) and the retry-bound refusal (43) |
dispatch-fault-test.om | injected actlost, actrecon, record-write and release failures; checks dispatch codes 76..79 and that the lock is released on every path |
*-test.om | transition and store checks; no provider simulation |
*-gate.om | source + test concatenation for the current single-file compiler |
dispatch.om holds lock.om across read, generation check, start and the in-flight write, releases
before the effect, and reacquires before recording the outcome. The dispatch gate therefore exercises
the locked path (37 checks).
action-gate.om, delegate-gate.om and reuse-gate.om are committed concatenations because the
seeded compiler currently reads one source file. Module/import support is a compiler capability
dependency; it is not a reason to keep a legacy implementation.
OM2 composition regression
action.om also composes into OM2 units. Its identity-binding local is named ix,
because at is reserved in OM2. The transition logic is unchanged. The dedicated
fixture checks equal identities and a mismatch in each of the 24 identity words.
Run from the repository root, using a fresh output directory:
out=$(mktemp -d)
{ printf 'om2\n'; cat seed/authority/action.om seed/authority/action-om2-test.om; } > "$out/action-om2.om"
seed/out/omc < "$out/action-om2.om" > "$out/action-om2"
chmod +x "$out/action-om2"
"$out/action-om2"
Run
seed/out/omc < seed/authority/action-gate.om > build/action-gate
chmod +x build/action-gate
./build/action-gate
Expected output and exit:
| Gate | Output | Exit |
|---|---|---|
| action | action checks=219 000 | 0 |
| delegate | delegate checks=074 000 | 0 |
| reuse | reuse checks=074 000 | 0 |
| store | store checks=077 000 | 0 |
| dispatch | dispatch checks=037 000 | 0 |
| lock | lock checks=10 fails=0 | 0 |
| dispatch-order | dispatch order checks=3 fails=0 | 0 |
| store-exact | store exact checks=4 fails=0 | 0 |
| store-cleanup | store cleanup cases=18 fails=0 | 0 |
| dispatch-fault | dispatch fault checks=10 fails=0 | 0 |
The authority gates and the standalone lock gate are run by
seed/qualification/security673/gate669.om as part of the security qualification; the dispatcher
also exercises the lock in its 37-check gate. A failure is a failed check count or a nonzero exit; a compile failure is
INVALID, not a pass. The three newer regressions run after the existing authority gates,
each with its own fresh child working directory beneath build/security673-native. Their
relative build/authority-store fixtures cannot overwrite each other or the earlier gates.
This filesystem separation is not a sandbox. See the coordinator README for retained artifacts
and native verification limits.
Cutover rule
The lock is integrated in the dispatcher, but no production consumer uses this store yet. The C authority/reuse
sources are deleted only after the .om owner has a durable store, dispatch, revocation and budget
behaviour, and every consumer uses it. A parallel production authority path is not an end state.
Dispatcher acquisition-order regression
dispatch-order-gate.om links the production action, store and dispatch sources with a
test-only lock-acquisition schedule from dispatch-order-test.om, rather than lock.om.
The acquisition double writes a performed record before granting the lock. A dispatcher that
reads before acquiring sees stale ready state and misses the required duplicate refusal (22).
The other two named assertions require release on a failed protected read (70), and require an
acquisition error (80) to return without a read or release. No timing or scheduler luck is used.
This checks dispatcher ordering; it does not qualify pid-lock exclusion, stale-owner recovery,
revocation fencing, or production concurrent execution.
In a fresh disposable Linux AArch64 checkout, after rebuilding the existing approved compiler:
mkdir -p build
seed/out/omc < seed/authority/dispatch-order-gate.om > build/dispatch-order-gate
readelf -h build/dispatch-order-gate
chmod +x build/dispatch-order-gate
build/dispatch-order-gate
Run each command only after its predecessor succeeds; never execute failed compiler output.
Expected: dispatch order checks=3 fails=0, exit 0. This regression is also wired into
gate669; the existing dispatch and lock gates remain in that campaign.
The negative control is the same compilation unit with only dispatch.om restored to the base
revision's pre-acquisition read. It must exit 1 and print FAIL dispatch acquired-record refusal;
the pre-acquisition read also fails the other two assertions (no release after a failed read,
and a read before the acquisition error). A compiler failure, signal, or timeout is INVALID,
not a passing control.
Committed concatenations are the byte-for-byte sequences below (no extra separators):
dispatch-gate.om: action, store, lock, dispatch, dispatch-test.dispatch-order-gate.om: action, store, dispatch, dispatch-order-test.
Native run (2026-10-31, Linux AArch64, seed/out/omc sha256 7a8b84fc, after sh seed/omega-from-seed.sh
reproduced it): positive dispatch order checks=3 fails=0, exit 0; negative control with dispatch.om
from main 1db94162 printed all three FAIL dispatch ... lines, exit 1. The 37-check dispatch-gate.om
passes on both sources, so it does not detect the read-before-acquire order; this regression does.
Exact store-input consumption regression
readrec accepts exactly 256 bytes and readgen accepts exactly 8 bytes. Both now probe for
EOF before decoding. A trailing byte or an error in that probe is refused through the existing
record error (22) or generation error (sgerr=32, returned value 0). This is exact stream
consumption, not authentication or a defense against concurrent file replacement/writes.
store-exact-gate.om is exactly store.om followed by store-exact-test.om. It uses real
store writes/reads and appends a synthetic byte with Linux O_WRONLY | O_APPEND (1025).
It checks the exact-length positives and both trailing-byte refusals. In a fresh disposable
Linux AArch64 checkout, using the reconstructed and approved existing compiler:
mkdir -p build
seed/out/omc < seed/authority/store-exact-gate.om > build/store-exact-gate
readelf -h build/store-exact-gate
chmod +x build/store-exact-gate
build/store-exact-gate
Run each command only after its predecessor succeeds. Expected output is
store exact checks=4 fails=0, exit 0. The negative control concatenates the unmodified
store.om from a35697e94b5eeb72efadfee6edab7f14344aea43 with this test; it must report
FAIL store trailing-record refusal and FAIL store trailing-generation refusal, exit 1.
The test deliberately has no dependency on the new EOF-probe scratch buffer, so the old-source
control remains a valid compilation unit. Failed compilation, signals and timeouts are INVALID.
Run the existing store, dispatch, dispatcher-order and complete security gates as regressions.
This gate is also wired into gate669. Native run (2026-10-31, Linux AArch64,
seed/out/omc 7a8b84fc): positive store exact checks=4 fails=0, exit 0; negative controls with
store.om from main 1db94162 and from a35697e9 each printed both FAIL store trailing-... lines,
exit 1.
store-gate.om has been regenerated as store.om followed by store-test.om. Its prior copy
also lacked the already-existing sgerr generation-error interface; it now tests the current
implementation rather than preserving that stale copy.
Lock release errors
lrm/lrel return 0 only when unlink succeeds, and 41 on unlink failure (including
an absent path). The lock gate checks ordinary release, directory refusal and
missing-path refusal. Its directory fixture is removed with rmdir; run gates
only in disposable test working directories, never against an active store.
The pre-effect dispatcher release check returns 78 on this failure. Since DRA-419 every later
release goes through dfinish, which releases and keeps an earlier failure code, or returns 78
when the release is the only failure. This change does not redesign stale-lock reclamation.
Return codes added by the DRA-419 critical profile
seed/profile/profile.om refused the pre-fix modules (dropped results, unbounded loops, host words
outside declared effect functions). The fixes add these codes:
| Code | Function | Meaning |
|---|---|---|
| 43 | lacq | more than 1000 tries requested; refused before any attempt (the retry loop is bounded by 1000) |
| 40 | ltry | the owner pid file could not be read (lerr set by lread: 32 open, 33 close, 34 short read). lread used to return 32..34 as the pid itself, so a live owner with pid 32 looked like a read error |
| 76 | dispatch | reconcile (actrecon) refused the receipt; the current (still in-flight) record is persisted unchanged by the following record write |
| 77 | dispatch | the post-effect record write failed, on the reconcile, lost-generation or normal path (lost-generation and reconcile write errors were dropped before) |
| 78 | dispatch | the lock release failed and no earlier failure is set (post-effect release errors were dropped before) |
| 79 | dispatch | actlost refused to mark the record unknown after a generation change (the error was overwritten before) |
dispatch-fault-gate.om is action.om, store.om, then dispatch.om with the lines
err = actlost r, err = actrecon r s and err = writerec r calling factlost, factrecon and
fwriterec, then dispatch-fault-test.om, which replaces lock.om with a counting double.
seed/profile/check.om regenerates it with the same line replacements, compares, runs it, and runs the same injection over
the frozen pre-fix seed/profile/cases/dispatch-943d955.om. The pre-fix module fails cases 2, 3, 4, 5, 7
and 8 (79, 77, 78, 79, 77, 78). Cases 0, 1, 6 and 9 (0, 60, 76, 77 normal path) are regressions that the
old code also passed. This is fault injection at the call results, not a qualification of real disk or
lock failure, and it is not yet in gate669.
Native run (2026-10-31, Linux AArch64, seed/out/omc 7a8b84fc): lock checks=8 fails=0, exit 0.
Negative control with lock.om from main 1db94162 (lrm returns 0 on unlink failure): no pass
line, exit 1 (the gate's failed-check exit; its setup errors exit 100..102).
Fixture source correction (2026-10-24)
The dispatcher-order fixture now uses global/text names within the existing
compiler's eight-character limit and copies its scheduled record into a local
array before calling writerec; global arrays cannot be function arguments.
The exact-store fixture likewise uses global/text names within that limit.
These correct known source compilation blockers without changing the test
scenarios or production sources. Declared concatenated gates are regenerated
from this revision's own component sources. Source review is not compiler
acceptance; the native runs are recorded in the section above.
Historical evidence is unchanged.
Store write failure cleanup
writerec and writegen close their opened descriptor once on failed/short
write and failed fsync, preserving the primary errors (11/12 and 41/42) even
if cleanup also fails. Close is never retried. Successful-path close errors
remain 13/43, and record rename is skipped after any earlier error.
store-cleanup-test.om provides 18 handwritten deterministic fake-effect cases.
The committed store-cleanup-gate.om contains a test-only derivation of store.om
followed by this test verbatim. It checks effect order, exactly-one close,
descriptor identity and primary error precedence. It does not test real syscalls,
fd ownership, durability or hardware. Production code has no test hooks.
Derivation and manual source-correspondence review
New first-party runners/automation must be seeded .om. The temporary shell
composer used during preparation is removed from active source; it was disposable
authoring validation, not a supported runner. No replacement compiler or runner
is introduced. Keep the handwritten test and committed .om gate reviewable.
To derive the store prefix, preserve every line and scalar argument of store.om
except these exact effect-call prefixes (ignore note comments):
| Production prefix | Test-only prefix |
|---|---|
fopen spath | cfopen |
write int fd sb | cwrite int fd |
fsync int fd | cfsync int fd |
fclose int fd | cfclose int fd |
renames spkt | crenames |
The omitted global-buffer arguments cannot be passed to ordinary Omega functions;
buffer contents are outside this test. Append store-cleanup-test.om unchanged.
Before any approved compilation, manually compare the gate prefix against
store.om: only the five substitutions above may differ. Compare its remaining
suffix byte-for-byte against the test. Check that no executable fopen, write,
fsync, fclose or renames token remains in the derived store prefix; reject
any unrecognized call shape rather than leave a real write-side effect behind.
The store read functions retain real read primitives but are never called by
this fixture. The harness alone uses real stdout for its success message.
For approved Linux AArch64 replay, compile the committed store-cleanup-gate.om
with the existing reconstructed compiler, inspect the output, and execute only
a successfully compiled artifact. Expected output: `store cleanup cases=18
fails=0`, exit 0. For the negative control, apply the same reviewed derivation
to store.om from 95529421e9a0e6d6d63ca5d8b8cdfaf443e0ef78, followed by the
current test unchanged. That prefix must differ only by four missing cleanup
calls. Expected: exit 1 without the success message. Compilation failure,
signal or timeout is INVALID, not a passing control.
The historical preparation checks in
store-write-cleanup/REVIEW.md
remain unchanged as evidence of checks observed then; its removed shell-helper
commands are not current replay instructions. The manual derivation above and
committed gate supersede those commands. Current source correspondence, absence
of unmatched write-side effects, and metadata checks pass. This gate is wired
into the existing security coordinator with its own fresh child working
directory; the standalone replay and negative control remain available.
Native run (2026-10-31, Linux AArch64, seed/out/omc 7a8b84fc after sh seed/omega-from-seed.sh
reproduced it): the derivation above applied to this revision's store.om plus the test is
byte-identical to the committed store-cleanup-gate.om; positive store cleanup cases=18 fails=0,
exit 0. Negative control with the same derivation applied to store.om from 95529421 (differs only
by the four missing cleanup = cfclose int fd lines): compiled, no output, exit 1 (the gate prints
no per-case lines; exit 1 is its failed-case exit). Security qualification on hardware remains
NOT_RUN.
Native replay and compiler register bound (2026-10-25)
The original cleanup gate at 08bd7aa7d7b73864e56163772ccceaa9cc91de0b
failed compilation with error 12 at line 274. Moving its unchanged three-part
assertion into cbadcase reduces live register pressure in main. The committed
concatenation, ending with the handwritten test verbatim, now compiles. No
production store behavior or expected outcome changes.
Linux AArch64 native replay with the reconstructed compiler
66b4cf34e5cd2c8ff003bd142e7309f52178b66c2380f78ac313b6eb8b67471b
passed dispatch-order (3), store-exact (4), lock (8), and cleanup (18).
Compiled controls restoring read-before-lock, accepting a trailing record byte,
masking unlink failure, and omitting the four error-path closes each compiled
successfully and exited 1 from their fixture assertions. The cleanup control
fails cbadcase; the lock control fails its accumulated release-result checks.
These are not crashes or failed-build controls. The exact-input control covers
the record probe only; it does not claim the generation-probe mutant was run.
Raw bindings and output are in ../qualification/security673/repairs/native.json.
The .om mutation producer in that directory requires exactly the declared
number of source matches before writing a mutant. Historical NOT_RUN statements
above describe their original preparation; this replay supersedes them only for
these four positive fixtures and these four controls. The full coordinator,
production revocation fencing, stale-pid ABA exclusion, actual concurrent
effects, power loss and durable aggregate accounting remain unqualified here.
Replay on 2026-10-31 with the current seed compiler 7a8b84fc after merging
#688 at 101823e5 reproduced every source and executable SHA-256, exit and stdout
of that replay, including the error 12 for the pre-cbadcase gate; see
../qualification/security673/repairs/replay-7a8b84fc.json. Host execution
only; hardware security qualification remains NOT_RUN.
Arboris world-step signing
The Spark host gate builds world-signer from arboris-signer.om, the seeded SHA-256/SHA-512 units and the Ed25519 verifier. Launch one instance per retired step in the world’s private receipt directory. The trusted supervisor holds the world writer lock and supplies the following descriptors.
| FD | Owner and content |
|---|---|
| 0 and 1 | Private request and reply pipes to the worker. The request is the 184-byte ARBSTP02 claim and the reply is the 64-byte Ed25519 signature. |
| 3 | Supervisor policy for the admitted dispatch. Supply claim bytes 0–127 followed by bytes 176–183. Derive these 136 bytes from the admitted grant, immutable inputs, installed kernel and dispatch controls. |
| 4 | The world’s pinned 32-byte Ed25519 public key. |
| 5 | A connected socket to the dedicated OpenSSH signing agent holding the world identity. |
The signer verifies the agent response and records the 248-byte claim and signature under their lowercase SHA-256 before replying. It syncs the file and directory. A retry verifies any existing record byte for byte. The worker independently verifies the signature and its current grant before the epoch store. The optional --arboris-signed-silicon probe takes the public-key descriptor on FD9 and private request and reply descriptors on FD10 and FD11 respectively. FD12 carries the signing policy from the trusted pre-submission path to the signer’s FD3.