Skip to content

proof-carrying-adaptive-packs-2026-07-13 M1: Shadow-corpus staging + replay harness - #769

Open
CueCrux-Myles wants to merge 1 commit into
mainfrom
feat/adaptive-packs-m1-install-gate
Open

proof-carrying-adaptive-packs-2026-07-13 M1: Shadow-corpus staging + replay harness#769
CueCrux-Myles wants to merge 1 commit into
mainfrom
feat/adaptive-packs-m1-install-gate

Conversation

@CueCrux-Myles

Copy link
Copy Markdown
Contributor

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/extensions and the studio-library install read default_install_state() and hand it 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. 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 lands staged — staged rather than refused, because a pack has to be installed before POST /v1/extensions/{id}/replay has anything to replay. The gate refuses an unproved pack without stranding a good one.

Unchanged by construction:

  • a pack shipping no pack.conformance.v1 block (it promised nothing, so there is nothing a replay could contradict),
  • anything at all while the gate is advisory — the shipped default,
  • 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_lifecycle takes gate as 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

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