When differential testing, fuzzing, red-teaming, or correspondence audits uncover a soundness defect in Anneal's capture, MIR semantics, or TCB auditing, landing a permanent root-cause fix (Trusted.MirSemantics, correspondence proofs, and check_guard_mutation.py refutations) can take days. Leaving the soundness hole open on main in the meantime risks admitting unsound code.
Anneal separates emergency containment from permanent fixes using a Phase 0 -> Phase 1 workflow:
status: "unsupported" emitting [PHASE0_TRIPWIRE:<bug_id>] in capture, or .fault .unsupported at runtime) without altering semantics on surviving inputs.FaultUb parity.This document and tripwires.rs standardize five canonical tripwire prefixes matching ^(?:ITREE|DIFF|RT|LMIRI|MINIRUST)-[A-Z][A-Z0-9_]*-[0-9a-f]{12}$:
ITREE-<CATEGORY>-<12hex> — issues uncovered in the multi-step observable-trace differential test suite (under tests/itree_diff/).DIFF-<CATEGORY>-<12hex> — standalone differential harness bugs outside itree_diff.LMIRI-<CATEGORY>-<12hex> — Lean-Miri correspondence or TCB gaps (context: MirCorrespondenceProof).MINIRUST-<CATEGORY>-<12hex> — MiniRust operational/spec correspondence gaps (context: MiniRustProof).RT-<KIND>-<12hex> — red-team containment, preflight, and proof-hack vectors.Every public PHASE0_TRIPWIRE! entry must track a public GitHub issue in google/zerocopy titled [anneal][<subsystem>] <BUG_ID>: <concise summary> with label anneal and a reference to its owning [anneal][*] subsystem umbrella ([anneal][mir], [anneal][capture], [anneal][audit], [anneal][theory], [anneal][ffi-isa], [anneal][specs], or [anneal][ux]):
PHASE0_TRIPWIRE!: Per AGENTS.md and rustc workarounds, an unvetted upstream compiler soundness or security defect—and any embargoed security report—must stay under private disclosure until a public issue exists in google/zerocopy or rust-lang/rust. Do not register embargoed defects in PHASE0_TRIPWIRE!, assign public soundness bug IDs, emit [PHASE0_TRIPWIRE:<bug_id>], add RUSTC-WORKAROUND anchors, or reference a private report in code or tests. Instead, place any needed fail-closed capture guard directly in rustc-capture naming only its neutral fail-closed invariant (confirming necessity privately at Gate 5), and convert or anchor it only once responsible disclosure opens #<N>.needs_human_review for non-oracle RT-* reports): Red-team reports lacking executable-oracle (rustc/Miri) confirmation—either a candidate Trusted.MirSemantics fix with a machine-checked incorrectness + canary-preservation proof, or a structured prose incorrectness claim—enter needs_human_review before triage. Humans confirm incorrectness first; validated candidate semantics patches seed Phase 1 directly.open -> triaged): Once public disclosure applies, file the issue on google/zerocopy before merging Phase 0 containment, capturing a minimal reproducible witness and collapsing syntactic variants onto the same root-cause issue. If a public Phase-0 tripwire guards an evaluated upstream compiler or toolchain limitation, also anchor it with RUSTC-WORKAROUND(#NNNN) per rustc workarounds and link the owning [anneal][*] umbrella.mitigated_phase0, issue stays OPEN): Link Phase-0 PRs using Mitigates #<N> (never Fixes #<N>), and record the exact public issue URL https://github.com/google/zerocopy/issues/<N> in the tripwire's issue: field alongside a live Cargo negative regression test executed by CI asserting [PHASE0_TRIPWIRE:<bug_id>] refusal.fixed, closes #<N>): Only after deleting the tripwire, flipping the regression test off [PHASE0_TRIPWIRE:<bug_id>], and replaying all retained duplicate witnesses cleanly on the un-tripwired Phase-1 tree, close #<N> with Fixes #<N>. Any surviving witness that still fails Phase-1 verification opens a distinct [anneal][...] issue instead of closing #<N>.rustc-capture tripwire (tripwires.rs)Default Phase-0 mechanism. Hooks check_crate and check_mir_body in capture.rs inspect crate-level flags/features (including --stdlib-crate captures without leaking taint into normal manifest fields) and raw &mir::Body<'_> across callable local bodies, --instantiate targets, transitive local callees, and whole-crate Const/AssocConst/AnonConst CTFE MIR prior to extraction. check_crate executes in after_analysis before capture-side item enumeration, mir_for_ctfe, const_eval_poly, and MIR extraction, short-circuiting immediately via Failure::unsupported (it does not prevent compiler-internal ICEs earlier during rustc analysis). Leaving ACTIVE_PHASE0_TRIPWIRES empty incurs zero production change; SYNTHETIC_DEMO_TRIPWIRE (ITREE-DEMO-000000000001) and SYNTHETIC_DEMO_CRATE_TRIPWIRE (ITREE-DEMO_CRATE-000000000001, optional ANNEAL_PHASE0_TRIPWIRE_SELFTEST_FEATURE filter) activate only on explicit --env ANNEAL_PHASE0_TRIPWIRE_SELFTEST=... in selftest tests.
Phase 0 Setup checklist:
#<N> in google/zerocopy ([anneal][<subsys>] <BUG_ID>) and allocate <BUG_ID> (for embargoed upstream defects without a public issue, use a neutral invariant guard outside PHASE0_TRIPWIRE! per rustc workarounds).// === PHASE 0 MUTABLE REGISTRY START === and END in tripwires.rs to add a PHASE0_TRIPWIRE! entry with issue: "https://github.com/google/zerocopy/issues/<N>" and activation: TripwireActivation::Always. Keep the macro definition, synthetic selftest hooks, check_crate, check_mir_body, and #[cfg(test)] unit tests unchanged.anneal/tests/{rustc-capture,itree_diff}/tests/*.rs matching *phase0* or *tripwire* (#[test], never #[ignore]) asserting both [PHASE0_TRIPWIRE:<BUG_ID>] and refusal (unsupported / error exit).anneal-rustc-capture tests pass locally, then open a PR with Mitigates #<N>.Phase 1 Teardown checklist:
rustc-capture / Trusted.MirSemantics).PHASE0_TRIPWIRE! rule and any helper predicates completely from tripwires.rs (zero commented-out or disabled stubs).regression_test path::fn, flipping it from [PHASE0_TRIPWIRE:<BUG_ID>] refusal to positive verification or FaultUb parity, and replay all retained duplicate witnesses cleanly.<BUG_ID> references remain under anneal/trusted/, then merge with Fixes #<N>.Trusted.MirSemantics fallback (.fault .unsupported)Fallback mechanism used only when a static MIR-shape predicate in tripwires.rs would reject unrelated valid proof crates too broadly.
Phase 0 Setup checklist:
tripwires.rs is over-broad in #<N> (Mitigates #<N>).StepResult.fault .unsupported in Trusted/MirSemantics/ (Boundary.lean's WellFormed[V2] quantifies universally over all FaultKind values, so converting an unsound step to .fault .unsupported remains sound on surviving runs). Annotate immediately above with -- PHASE0_TRIPWIRE(...)..fault .unsupported refusal (FaultKind.unsupported, which carries no runtime string payload) and tagging <BUG_ID> in the assertion failure context.trusted/root-manifest.sha256, check_guard_mutation.py, correspondence/, cargo test -p anneal-audit-tests), and complete full Pass 2 semantic review before merge.Phase 1 Teardown checklist:
.fault .unsupported guard with the real operational rule and delete the -- PHASE0_TRIPWIRE(...) comment and any bug-ID mentions across all of anneal/trusted/.MirCorrespondenceProof and MiniRustProof proofs, add a negative refutation theorem and guard entry to check_guard_mutation.py, and refresh trusted/root-manifest.sha256 if tracked manifests change.FaultUb parity, replay retained witnesses, and land with Fixes #<N>.check_phase0_tripwires.py (backed by modular helpers under anneal/ci/tripwire_checker/ and test_check_phase0_tripwires.py) provides three structural hygiene modes (--repo-root, --head, --json apply across modes):
--mode tree (runs automatically in CI): Wired into anneal-ci-tests via run_anneal_check.sh. Validates PHASE0_TRIPWIRE! rules in tripwires.rs and trusted comment markers across anneal/trusted/**/*.{rs,lean}, canonical IDs, public google/zerocopy issue URLs, valid dates, CI-wired Rust/Python regression tests (anneal/Cargo.toml, crate Cargo.toml, and ci/checks.toml/run_anneal_check.sh when present) citing <bug_id> refusal without skips or disabling #[cfg(...)], and zero raw struct literals, type aliases, disabled stubs, or unreferenced top-level helpers in tripwires.rs. Supports --known-bugs and --strict-mitigated-link.--mode phase0-diff (local Git-history check): Compares --base against --head (or working tree, with optional --diff-files check) to confirm regular-file containment edits stay inside tripwires.rs's mutable registry plus bound *phase0*/*tripwire* Rust test files (preserving existing active entries and adding new tripwires) unless --allow-runtime-semantics-fallback is requested with a new -- PHASE0_TRIPWIRE(...) annotation in each edited MirSemantics file.--mode phase1-cleanup (local Git-history check): Compares against --base, --resolved-bug, --test-ref, and/or --known-bugs to confirm resolved bug IDs leave zero residual PHASE0_TRIPWIRE or <bug_id> references in anneal/trusted/**/*.{rs,lean} while retaining flipped active tests (allowing permanent CLI exit-code assertions for trusted_comment entries).Static capture containment and structural CI hygiene linting catch common accidental omissions and syntactic stubs, and never substitute for Gate 1, Gate 2, or Gate 5 code review or AGENTS.md Pass 1 / Pass 2 semantic gates.