Repository navigation
Compose a WIT closure for a consumer, and gate it as a system - #230
Merged
Merged
Conversation
`varve export-wit --package ns:name@ver --out D` writes that package plus its transitive closure into `<ns>/<name>/<version>.wasm` — the layout `wkg`'s local backend reads — from packages already in the verified store, offline. The closure comes from the packages' own signed bytes, not from a list in `layer.toml`. `--registry NAME` prints the wkg stanza rather than editing anyone's configuration. REQ-SYSTEST-002 clause 5 held the command back until a system gate exercised it, which is the right order and is why this is a separate commit from #229. tools/systest/wit-export.sh is that gate. Two separately-encoded binary WIT packages are deposited as `kind = "wit"` payloads, signed, installed, verified, and composed. What only a system run shows: the bytes cross deposit, signing, an OCI layout, install and verification before anything decodes them, and they come out BYTE-IDENTICAL to the fixtures — the "copy, not a conversion" claim of DD-036, which is what makes the digest in the layer and the digest on disk the same number. The command is asked for one package and must write the other beside it. Two refusals close it: a package the layer does not carry, and a layer carrying the app but not its dependency, which must write nothing at all. The gate was negative-controlled: `closure` was mutated to return only the root, the mutation was confirmed present in the rebuilt binary ("exported 1 package(s)"), and the gate went red on the dependency it did not write. `systest_sign_spec_and_pin` is extracted from `systest_make_layer` so the new gate signs its spec through the same code the self-host gate does, rather than a second copy to keep in step with deposit-layer.yml. THREE GATE DEFECTS FOUND ON THE WAY, all of the shape this repo keeps finding. The docs gate kept a second list of markers beside the match that actually parses each block, so a documented wkg stanza was reported unclassified while the arm checking it ran. Whether a block reached a parser is now READ from the match, and cannot drift from it. The first version of that stanza check was vacuous: it extracted the registry and root from the block, fed them back to `wkg_stanza`, and compared — which passes for any block of that shape. A negative control caught it. It now compares TEMPLATES with both values blanked, so a change to the key path, the field name or the quoting fails; controlled by renaming `root` to `path` in `wkg_stanza` and reading the verdict. And nothing noticed that the `ExportWit` clap variant had been pasted INSIDE `ExportSdk`'s doc comment, so `export-wit --help` described SDK relocation and `export-sdk --help` was blank. Every gate stayed green: the docs gate checks a TOPIC exists, which it did. `every_subcommand_says_what_it_does` closes it — blank is the signature of a stolen doc comment — controlled by deleting `export-vsix`'s. DD-036 CORRECTED. It said the export path emits WIT text. It does not, and the gap is not cosmetic: of the five consumers #220 measured, `wkg` and `rules_wasm_component`'s `wkg_wit_deps` read this tree directly, while `wit-bindgen`, `cargo-component` and the vendored Bazel path want a `wit/` SOURCE tree. They can decode it with `wasm-tools`, which is in the realm, but that is a step and not a path. Printing from varve means carrying `WitPrinter` — `wit-parser` 0.259 has none, `wit-component` does — and so widening the production trusted base to emit a form varve does not sign, against the read-only decoding dependency #229 recorded. That is a dependency decision for the maintainer, raised on the PR with the measurement. The decision text and the docs topic now say what actually holds, including which tools this does not serve. VER-WIT-001 records the gate; REQ-WIT-001 moves to `implemented`. It is not `verified`: the producer cannot yet PLAN a wit payload (the spec here is written by hand, as it is for crates), and clause 5 — how a composed tree is REACHED — is REQ-WITREACH-001 and DD-036, deferred to v0.44.0. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_019TNtfRjLNhEz82G2ggeeNu
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
varve export-wit --package ns:name@ver --out Dwrites that package plus itstransitive closure into
<ns>/<name>/<version>.wasm— the layoutwkg's localbackend reads — from packages already in the verified store, offline. The
closure comes from the packages' own signed bytes, never from a list in
layer.toml.--registry NAMEprints the wkg stanza rather than editinganyone's configuration.
#229 deliberately stopped short of this: REQ-SYSTEST-002 clause 5 ratchets on
clap's
export-*list, so the subcommand could not ship until a system gateexercised it. That gate is the substance of this PR.
The gate
tools/systest/wit-export.shdeposits two separately-encoded binary WITpackages as
kind = "wit"payloads, signs them, installs, verifies, andcomposes them.
What only a system run shows. The unit tests index packages from bytes
handed to them directly. Here the bytes cross deposit, signing, an OCI layout,
install and verification before anything decodes them — and the gate asserts
they come out byte-identical to the deposited fixtures. That is DD-036's
"copy, not a conversion" claim, and it is what makes the digest in the layer
and the digest on disk the same number.
The command is asked for
acme:app@0.3.0alone and must writeacme:base@2.0.0beside it, because the app's own signed bytes say it importsit. Two refusals close clause 4: a package the layer does not carry, and a
layer carrying the app but not its dependency — which must write nothing at
all, because a tree one package short parses far enough to fail inside
wit-bindgen with a message about an interface.
The gate was negative-controlled.
witclosure::closurewas mutated toreturn only the root; the mutation was confirmed present in the rebuilt binary
(
exported 1 package(s)), and the gate went red on the dependency it did notwrite.
Three gate defects found on the way
All the same shape, and worth reading as a set.
The docs gate kept a second list beside the match that parses each block.
A documented wkg stanza was reported unclassified while the arm checking it
ran. Whether a block reached a parser is now read from the match, so the
two cannot drift.
The first version of that stanza check was vacuous. It extracted the
registry and root from the block, fed them back to
wkg_stanza, andcompared — which passes for any block of that shape. A negative control
caught it. It now compares templates with both values blanked, so a
change to the key path, the field name or the quoting fails. Controlled by
renaming
roottopathinwkg_stanzaand reading the verdict.Nothing noticed that
ExportWithad been pasted insideExportSdk's doccomment.
export-wit --helpdescribed SDK relocation;export-sdk --helpwas blank. Every gate stayed green — the docs gate checks that a topic
exists, which it did.
every_subcommand_says_what_it_doescloses it (blankis the signature of a stolen doc comment), controlled by deleting
export-vsix's.systest_sign_spec_and_pinis extracted fromsystest_make_layerso the newgate signs its spec through the same code the self-host gate does, rather than
a second copy to keep in step with
deposit-layer.yml.A correction to DD-036, and a decision that is yours
DD-036 said "the export path emits WIT text", offered as part of the
mitigation for the auditability cost of signing a compiled package. It does
not, and I did not make it. I have corrected the decision text rather than
leave it contradicting the code — but the correction is not a tidy one, because
of what #220 measured:
wkgrules_wasm_component(wkg_wit_deps)wit-bindgenwit/source treecargo-componentwit/source treerules_wasm_component(vendored)Three of the five consumers #220 measured want text, and this export does
not produce it. They can decode it themselves —
wasm-tools component wit <file>, andwasm-toolsis in the realm — but that is a step, not a path.The decision is a dependency one and it is yours.
wit-parser0.259carries no printer;
WitPrinterlives inwit-component, which would addwasm-encoderandwasm-metadatato the production trusted base in order toproduce a form varve does not sign. #229 recorded the decoding dependency as
deliberately read-only, and I am not reversing that on my own.
Three options, in the order I would take them:
wasm-tools. Cheapest, and honest — the docs topic now names exactly whichtools this does not serve.
--emit-wit, opt-in, binary still the artifact of record. Costs thewit-componentdependency and its own system gate.change, and it re-opens DD-036's core choice rather than its mitigation.
I have taken (1) for this PR because it is the one that does not need you.
Say the word and I will do (2).
Traceability
VER-WIT-001 records the gate. REQ-WIT-001 moves to
implemented, notverified: the producer cannot yet plan awitpayload (the spec here iswritten by hand, as it is for crates), and clause 5 — how a composed tree is
reached, copy or link — is REQ-WITREACH-001 and DD-036, deferred to v0.44.0.
🤖 Generated with Claude Code
https://claude.ai/code/session_019TNtfRjLNhEz82G2ggeeNu