Skip to content

Commit eb7ed64

Browse files
docs(catalog): define opaque raw preimages
agent-identity: dev3.direct.omp.2cshu64q agent-persona: generalist agent-supervisor: unavailable agent-tool: OMP agent-tool-version: 18.0.9 agent-runtime: OMP 18.0.9 tooling-profile: dotfiles@b607597
1 parent 46485b7 commit eb7ed64

3 files changed

Lines changed: 45 additions & 42 deletions

File tree

README.md

Lines changed: 25 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@ st2 catalog apply --catalog "$CATALOG" --prepared ./prepared \
156156
--input-sha256 <afterRootSha256> --expect-sha256 <rootSha256> --json
157157
```
158158

159-
If the incumbent Agent Specs cannot be parsed, bind a one-time repair to their
160-
exact structural declaration bytes instead:
159+
If the incumbent declarations cannot be parsed or must remain opaque to the
160+
current parser, bind a one-time repair to their exact structural bytes instead:
161161

162162
```sh
163163
st2 catalog snapshot --catalog "$CATALOG" --output ./invalid-preimage \
@@ -169,11 +169,12 @@ st2 catalog apply --catalog "$CATALOG" --prepared ./prepared \
169169
--raw-preimage --json
170170
```
171171

172-
Raw-preimage mode has its own hash and receipt schemas. It refuses a
173-
strictly-valid incumbent, still fully validates the prepared and applied
174-
catalogs, and requires a readable external PTY-root declaration that remains
175-
unchanged. It is a generic invalid-preimage transaction, not a validation
176-
bypass or migration-policy engine.
172+
Raw-preimage mode has its own hash and receipt schemas. It makes no semantic
173+
assertion about the live bytes—including validity, profiles, the catalog
174+
envelope, or effective PTY root—while still fully validating the prepared and
175+
applied catalogs. The caller-supplied raw-domain digest is the exact live
176+
precondition. This is a byte-oriented transaction, not a validation bypass or
177+
migration-policy engine.
177178

178179
To publish that exact snapshot as a new, absent catalog:
179180

@@ -182,18 +183,19 @@ st2 catalog bootstrap --catalog "$NEW_CATALOG" --prepared ./prepared \
182183
--input-sha256 <rootSha256> --json
183184
```
184185

185-
`catalog apply` is policy-free. It rejects state/control content, symlinks,
186-
unprojected workspace facts, catalog-local/default PTY roots, and effective
187-
PTY-root changes. Bootstrap is a separate create-only declaration transaction,
188-
not an apply mode. It atomically publishes absence or the complete catalog,
189-
initializes its persistent lock and generation before visibility, and never
190-
reads or writes the external PTY registry. Process adoption and PTY-root
191-
migration remain separate because that registry has independent producers. A
192-
crash during apply leaves a durable marker and content-addressed stage;
193-
`st2 catalog apply --catalog "$CATALOG" --resume --json` resumes without the
194-
original prepared source. Snapshots own the complete bounded `_templates`
195-
library and empty canonical per-agent `.workspace` directory facts, but never
196-
traverse, hash, copy, or delete workspace content.
186+
Ordinary `catalog apply` is policy-free. It rejects state/control content,
187+
symlinks, unprojected workspace facts, catalog-local/default PTY roots, and
188+
effective PTY-root changes. Raw-preimage apply replaces those live semantic
189+
checks with its exact byte-domain CAS. Bootstrap is a separate create-only
190+
declaration transaction, not an apply mode. It atomically publishes absence or
191+
the complete catalog, initializes its persistent lock and generation before
192+
visibility, and never reads or writes the external PTY registry. Process
193+
adoption and PTY-root migration remain separate because that registry has
194+
independent producers. A crash during apply leaves a durable marker and
195+
content-addressed stage. `st2 catalog apply --catalog "$CATALOG" --resume --json`
196+
resumes without the original prepared source. Snapshots own the complete
197+
bounded `_templates` library and empty canonical per-agent `.workspace`
198+
directory facts, but never traverse, hash, copy, or delete workspace content.
197199

198200
The compact declaration shape is:
199201

@@ -687,9 +689,10 @@ evals retain their flat bus and completion semantics.
687689
declaration-plane writer. Each admits the complete prospective catalog under a
688690
compare-and-swap lock before making one atomic change.
689691
`st2 catalog digest --catalog ROOT --prepared DIR` computes the exact desired
690-
projection digest consumed by apply, including for raw-preimage repair where the
691-
invalid incumbent cannot support semantic diff. Ordinary valid-catalog workflows
692-
reuse `afterRootSha256` from the required policy-inspection diff instead.
692+
projection digest consumed by apply. Raw-preimage repair uses it for the fully
693+
validated successor while binding the opaque incumbent through the separate
694+
raw-domain digest. Ordinary valid-catalog workflows reuse `afterRootSha256`
695+
from the required policy-inspection diff instead.
693696
`st2 catalog bootstrap --catalog ROOT --prepared DIR --input-sha256 ROOT_HEX`
694697
is the create-only writer for an absent catalog. An exact completed replay is
695698
`unchanged`; any different or incomplete existing target fails closed.

docs/vrs/requirements.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -219,12 +219,13 @@ accepted.
219219
caller-supplied input digest before locking or mutation, rechecks the incumbent
220220
root digest under the exclusive lock, durably stages the desired bytes, and resumes
221221
after interruption solely from a closed marker and its content-addressed
222-
stage. A distinct raw-preimage projection may bind a repair to the exact
223-
structural declaration bytes of an invalid incumbent without interpreting
224-
those bytes. It has a separate hash and receipt type, refuses a strictly valid
225-
incumbent, admits only a fully valid prepared result, and persists its mode in
226-
the recovery marker. Version 1 requires one explicit external PTY root and
227-
rejects effective PTY-root changes. Fresh-catalog bootstrap is a distinct create transaction,
222+
stage. A distinct raw-preimage projection may bind a repair or migration to
223+
the exact structural declaration bytes of any incumbent without interpreting
224+
those bytes. It has a separate hash and receipt type, admits only a fully
225+
valid prepared result, and persists its mode in the recovery marker. Raw mode
226+
makes no semantic assertion about the incumbent, including its validity or
227+
effective PTY root; the caller's exact raw-domain digest is the complete live
228+
precondition. Fresh-catalog bootstrap is a distinct create transaction,
228229
not a catalog-apply mode: it binds an exact captured prepared projection to a
229230
caller-supplied digest, initializes the persistent authoring lock and first
230231
catalog generation before visibility, and publishes the complete catalog by

docs/vrs/spec.md

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -307,15 +307,14 @@ covers normalized relative paths, file bytes, executable bits, and empty
307307
workspace directory facts.
308308

309309
`st2 catalog snapshot --catalog ROOT --output DIR --raw-preimage --json`
310-
exists only to externalize CAS for an invalid incumbent. Under the same shared
311-
lock it structurally captures `catalog.kdl`, canonical
310+
externalizes a byte-oriented CAS preimage. Under the same shared lock it
311+
structurally captures `catalog.kdl`, canonical
312312
`agents/<host>/<identity>/agent.kdl` leaves, their bounded static bundle files,
313313
the bounded `_templates` tree, and existing canonical `.workspace` directory
314-
facts without parsing Agent Spec bytes. The ordinary state/control exclusions
314+
facts without parsing declaration bytes. The ordinary state/control exclusions
315315
still apply. Every captured input must be a safe real file or directory with no
316-
symlink or hard-link alias. The incumbent catalog envelope must parse and name
317-
an external PTY root. A catalog that passes strict projection, live workspace
318-
validation, and full admission is refused. Its root uses the distinct
316+
symlink or hard-link alias. No live validity, catalog-envelope, profile, or
317+
effective PTY-root assertion exists in this mode. Its root uses the distinct
319318
`st2.catalog-raw-preimage-root.v1` hash domain and the receipt schema is
320319
`st2.catalog-raw-preimage-snapshot.v1`; it is not interchangeable with a strict
321320
snapshot root. Create-only retry rechecks both the raw root and output link
@@ -471,18 +470,18 @@ External lock execution and bypass flags are not part of the contract.
471470
`st2 catalog apply --catalog ROOT --prepared DIR --input-sha256 INPUT_HEX --expect-sha256 HEX
472471
--raw-preimage --json` is the only writer that accepts the raw-preimage root.
473472
It first captures and fully admits `DIR` through the ordinary strict prepared
474-
projection. Under EX it refuses a strictly valid incumbent, requires the
475-
incumbent catalog envelope to parse, proves the effective external PTY root is
476-
unchanged, structurally reprojects the invalid live declaration plane, and
477-
checks its raw-domain root against `HEX` before any declaration, workspace,
478-
state, writer-temporary, marker, or stage mutation. A successful CAS reuses the
479-
ordinary durable stage, generation commit, leaf publication, strict live
480-
verification, and fsync sequence. Its receipt schema is
473+
projection. Under EX it structurally reprojects the opaque live declaration
474+
plane and checks its raw-domain root against `HEX` before any declaration,
475+
workspace, state, writer-temporary, marker, or stage mutation. It never parses
476+
or semantically validates the live bytes, including their catalog envelope,
477+
profiles, validity, or effective PTY root. A successful CAS reuses the ordinary
478+
durable stage, generation commit, leaf publication, strict live verification,
479+
and fsync sequence. Its receipt schema is
481480
`st2.catalog-raw-preimage-apply.v1`; its durable marker schema is
482481
`st2.catalog-raw-preimage-apply-incomplete.v1`. The marker schema preserves the
483482
projection type, so source-free `--resume` emits the truthful raw-preimage
484483
receipt after converging from the strictly validated stage. This mode owns no
485-
policy for interpreting or transforming invalid bytes.
484+
policy for interpreting or transforming incumbent bytes.
486485

487486
`st2 catalog bootstrap --catalog ROOT --prepared DIR --input-sha256 HEX --json`
488487
is the create-only declaration transaction for an absent catalog. `ROOT` must

0 commit comments

Comments
 (0)