proof-carrying-adaptive-packs-2026-07-13 M1: Shadow-corpus staging + replay harness - #769
Open
CueCrux-Myles wants to merge 1 commit into
Open
proof-carrying-adaptive-packs-2026-07-13 M1: Shadow-corpus staging + replay harness#769CueCrux-Myles wants to merge 1 commit into
CueCrux-Myles wants to merge 1 commit into
Conversation
M1 landed the pre-enable replay gate on `set_lifecycle`, which is the only
lifecycle *transition* — and every transition into `active` goes through it.
But installing a pack live is not a transition. `POST /v1/extensions` and the
studio-library install both read `default_install_state()` and hand the result
straight to `install_extension`, so with `CORECRUXD_PACK_REPLAY_GATE=1` and
`CORECRUXD_PACK_STAGING` off — the shipped default for the staging flag — a
declaring pack was installed **live and never replayed**. The operator who
turned the gate on got it on the promotion route and nowhere else, which is
the route a pack takes second, if at all.
New `pack_lifecycle::initial_install_state(default_state, gate, manifest)`
decides the state a fresh install actually starts in, and both HTTP install
sites call it. A declaring pack under an enforced gate lands `staged`; it is
staged rather than refused because a pack has to be installed before
`POST /v1/extensions/{id}/replay` has anything to replay, so the gate refuses
an unproved pack without stranding a good one. Nothing changes for a pack that
ships no `pack.conformance.v1` block (it promised nothing, so there is nothing
a replay could contradict), nothing changes while the gate is advisory, which
is the shipped default, and `CORECRUXD_PACK_STAGING` still wins where it
already applied. Both env reads stay at the HTTP boundary, so the new function
is a pure function of its arguments like `set_lifecycle`'s `gate` parameter.
Gate: an envelope-violating pack is caught before it goes live — on both of
the paths that take a pack live, verified by
`a_declaring_pack_is_not_installed_live_while_the_gate_is_enforced` (the
decision itself, including the three cases that must not change) and
`an_enforced_install_lands_staged_and_goes_live_only_on_a_passing_replay`
(end to end: enforced install lands staged, promotion refused while nothing
is proved, a passing replay of that exact build promotes it). Corpus:
`shadow-notes-v1`, the in-test shadow corpus the M1 harness fixtures use.
cargo test --workspace: 8507 passed, 0 failed. clippy --locked --workspace
-D warnings, fmt, typos, licence headers, agent-docs and the unwrap ratchet
all clean.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
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.
Completes the M1 gate clause on the path it did not yet cover.
What was open
M1 (#768) put the pre-enable replay gate on
set_lifecycle, the one function every lifecycle transition goes through. Installing a pack live is not a transition:POST /v1/extensionsand the studio-library install readdefault_install_state()and hand it straight toinstall_extension. So withCORECRUXD_PACK_REPLAY_GATE=1andCORECRUXD_PACK_STAGINGoff — the shipped default for the staging flag — a declaring pack was installed live and never replayed. An operator who turned the gate on got it on the promotion route only, and that is the route a pack takes second, if at all.The change
pack_lifecycle::initial_install_state(default_state, gate, manifest)decides the state a fresh install actually starts in; both HTTP install sites call it. A declaring pack under an enforced gate landsstaged— staged rather than refused, because a pack has to be installed beforePOST /v1/extensions/{id}/replayhas anything to replay. The gate refuses an unproved pack without stranding a good one.Unchanged by construction:
pack.conformance.v1block (it promised nothing, so there is nothing a replay could contradict),CORECRUXD_PACK_STAGING, which still wins where it already applied.Both env reads stay at the HTTP boundary, so the new function is a pure function of its arguments, matching how
set_lifecycletakesgateas a parameter.Gate
An envelope-violating pack is caught before it goes live — now on both of the paths that take a pack live:
a_declaring_pack_is_not_installed_live_while_the_gate_is_enforced— the decision itself, with the three cases that must not change.an_enforced_install_lands_staged_and_goes_live_only_on_a_passing_replay— end to end: the enforced install lands staged, promotion is refused while nothing has been proved, and a passing replay of that exact build promotes it.Corpus:
shadow-notes-v1, the in-test shadow corpus the M1 harness fixtures use.cargo test --workspace: 8507 passed, 0 failed.clippy --locked --workspace -D warnings, fmt, typos, licence headers, agent-docs and the unwrap ratchet all clean.🤖 Generated with Claude Code