Skip to content

[anneal] Add Tarjan SCC .olean sharding and BinChunkTree proof bridge - #4234

Merged
joshlf merged 1 commit into
mainfrom
joshlf-anneal-scc-sharding
Nov 26, 2026
Merged

joshlf merged 1 commit into
mainfrom
joshlf-anneal-scc-sharding

Conversation

@joshlf

@joshlf joshlf commented Nov 23, 2026 •

Copy link
Copy Markdown
Member

Partition large MIR captures (N > shard_min_bodies, default budget: 20 min / 20 max bodies, 2500 max AST nodes) into an acyclic condensation DAG of Lean 4 module-mode Captured.Shard_<k> .olean modules and prove whole-crate soundness compositionally at O(log N) root proof depth in pure zero-TCB Lean theory, leaving anneal/trusted/lean/ and anneal/trusted/audit/ untouched.

Capture sharding (anneal/trusted/rustc-capture):

  • Exhaustively extract static intra-crate ty::FnDef call edges from MIR assign rvalues and call/tail-call/branch/assert/yield terminators (including diverging target: None calls) with pinned rust-lang/rust citations (extract.rs, ir.rs), and include Profile v2 IR variants plus rendered Body.identity _root_.String.ofList / _root_.Char.ofNat nodes in Body::ast_nodes.
  • Compute permutation-invariant Tarjan strongly connected components in deterministic callee-first topological order, pack adjacent components up to --shard-max-bodies and --shard-max-ast-nodes while keeping multi-body recursive cycles together and marking single oversized cyclic/large SCCs (shard.rs). When sharding is active, Captured.program.bodies is reordered into canonical callee-first order (remapping intra-crate Terminator::Call callee indices) and entryDefId := 0 names canonical body 0, so sharded specs must identify targets by Body.identity.
  • Emit Lean 4 module-mode Captured/Shard_<k>.lean per-shard modules, a module-mode balanced binary Captured.lean assembly (preserving mir_profile_version and overflow_checks), and capture_shards.json (is_lean_module: true) with SHA-256 digests, callee_shards DAG edges, global_def_id_range, and id_tree_sha256 (lean.rs, publication.rs, lib.rs, shard.rs), so sharding stays transparent to module-mode proofs.

Zero-TCB theory bridge (anneal/theory/Anneal/SccSharding*):

  • Add Anneal.SccSharding.BinChunkTree (re-exported by Anneal.SccSharding and registered in bundle-manifest.json): balanced BinChunkTree container, guaranteed O(log N)-depth ByteDecisionTree (splitByte, splitTag, splitLex) identity uniqueness checker (allIdx, checkBodyIdentityAt), LocalBodyVerified, TreeLocalVerified, non-unfolding root builders (toList_branch, size_branch, wf_branch, allIdx_branch), and programVerified_of_shardedTree / crateTheorem_of_shardedTree.
  • Add Anneal.SccSharding.InterprocCallModel and InterprocCallCanary as standalone zero-TCB operational models of direct, cyclic, and mutually recursive BinChunkTree call dispatch (not yet bridged to CrateTheorem or UnitTheorem obligations), plus splitTag/splitLex rfl evaluation canaries.

Orchestration, receipt inspection, and first-customer coverage:

  • Add cargo anneal shard-plan (--write / --check) and --verify-shard-plan drift checks across cargo-anneal and anneal-rustc-capture (cli.rs, shard.rs, verify.rs) and document the sharding workflow, Receipt v3 shard fields, and numeric ShardPlan v1 vs planned nominal mode in trusted/cargo-anneal/skills/cargo-anneal/SKILL.md and docs/build-systems-and-receipts.md.
  • Validate capture_shards.json structural, is_lean_module: true, DAG, total_sccs, cyclic_sccs, scc_ids partition, and oversized_scc singleton invariants (shard.rs), generate module-mode Proof.IdTree identically across capture and verification, and record capture_shards_sha256 and shards in Schema v3 receipts.
  • Extend pure cargo anneal inspect (core/inspect/{schema,diff, render}.rs) to parse, validate, diff, and render capture_shards_sha256 and shards (binding Proof.IdTree and Captured.Shard_* hashes against audit.sources), and update inspect --verify-artifacts (inspect.rs) to hash capture/capture_shards.json (with manifest parity) and resolve sharded Proof.IdTree under generated/Proof/IdTree.lean.
  • Extend OleanCache (olean_cache.rs, stage.rs, verify.rs) beyond TrustedBoundary (CacheKind::Inspector) and bundled libraries to cache sandboxed target shard outputs (Proof.IdTree, Captured.Shard_*, Proof.Shard_*) with v2 transitive import Merkle keys, skipping target shard reads/writes under unsandboxed elaboration (SandboxMode::Unsandboxed / ActiveSandbox::None) and keeping --no-rebuild-bundled fail-closed on inspector and bundled misses.
  • Add regression tests in tests/rustc-capture/tests/typed_capture.rs, tests/cargo-anneal/tests/{cli,inspect}.rs, tests/cargo-anneal/tests/suite/{anti_vacuity_and_e2e, sharded_capture_and_cache}.rs, ratchet anneal/ci/perf_budgets.json verified_units_count from 4 to 5 (and update test_perf_{tracking,workflow}.py fixtures), plus add the verbatim 25-item module-mode zerocopy/proofs/05_sharded_tryfrombytes unit and anneal/skills/proof-scaling/SKILL.md guidance.

Authored by an AI agent acting on joshlf's behalf.

@joshlf joshlf added the anneal Primary scope: Anneal verification stack (`anneal/` and `exocrate/`) label Nov 23, 2026
@joshlf

joshlf commented Nov 23, 2026

Copy link
Copy Markdown
Member Author

Verification Receipt (post-final-edit on 3c1ec9d7bef1be0924f96dce46337c2f6e9c8ce6, tree de7dd14ee1020006a88e5d9fb9926ac726e424bb)

  • Gate-1 trust-review & change-review: PASS (0 P0 / 0 P1 / 0 P2).
  • Static & repository hygiene checks:
    • ./ci/check_fmt.sh, ./ci/check_todo.sh, git diff --check origin/main, ci/test_check_skills.py (22 tests OK): passed.
    • ./anneal/ci/check_todo.sh, ./anneal/ci/check_actions.sh, ./anneal/ci/check_job_dependencies.sh, ./anneal/ci/check_non_stable_version.sh, sha256sum --check --strict trusted/root-manifest.sha256, regenerate_bundle -- --root . --check, unittest discover -s ci (182 tests OK): passed.
    • cargo clippy (-D warnings) across cargo-anneal (--no-default-features), cargo-anneal-tests --test cli (--no-default-features), --workspace --exclude anneal-rustc-capture --exclude anneal-rustc-capture-tests --all-targets, and +nightly-2026-05-31 anneal-rustc-capture / anneal-rustc-capture-tests: passed.
  • Lean kernel audit & guard-mutation checks:
    • anneal-audit --anneal-root . --require-correspondence --json: replay: true, correspondenceReplay: true, miriReplay: true, axioms: ["propext", "Classical.choice", "Quot.sound"], kernelDeclarations: 1760, replayedDeclarations: 12436, correspondenceDeclarations: 2680, correspondenceReplayedDeclarations: 2680, miriReplayedDeclarations: 39088.
    • ci/check_guard_mutation.py: 46/46 killed (100.0%), 0 survived, 0 errors.
  • Verbatim zerocopy first-customer verification (ci/verify_zerocopy.py, 5/5 units in 173.548s, all selected_unit_verified in linux_bwrap, axioms ["propext"]):
    • 01_usize_pointer_metadata (58.437s)
    • 02_unit_pointer_metadata (57.555s)
    • 03_macros_unsafe (57.34s)
    • 04_substantive_and_frombytes_markers (59.799s)
    • 05_sharded_tryfrombytes (58.42s, 25 selected bodies across 2 SCC shards)
  • Rust test suites:
    • anneal-rustc-capture --lib --bins: 47 passed; 0 failed
    • anneal-rustc-capture-tests --all-targets: compiler_session 23 passed; 0 failed, typed_capture 60 passed; 0 failed
    • cargo-anneal --no-default-features --lib --bin cargo-anneal: 137 passed; 0 failed
    • cargo-anneal-tests --no-default-features --test cli: 21 passed; 0 failed
    • anneal-audit --lib --bin anneal-audit: 12 passed; 0 failed
    • cargo-anneal --lib --bin cargo-anneal: 163 passed; 0 failed
    • cargo-anneal-tests: cli (25 passed), harness (7 passed; 1 ignored internal subprocess fixture), sandbox_escape (7 passed), suite (30 passed, including sharded_cyclic_crate_verifies_cross_shard_dag_id_tree_and_incremental_cache and verifies_crate_with_over_100_long_identity_bodies_at_default_max_rec_depth), support_paths (20 passed; 2 ignored internal subprocess fixtures), support_regressions (12 passed; 2 ignored internal subprocess fixtures), support_signals (3 passed)
  • Not run locally: installed_smoke (2 ignored; requires CI-installed artifacts) and verify_starnix_e2e (external Starnix repository).

Human review surface

  • Comparison tuple: (target_base=e86eb0281380bdc278f4b4b3788dc9525ef59035, merge_base=e86eb0281380bdc278f4b4b3788dc9525ef59035, head=3c1ec9d7bef1be0924f96dce46337c2f6e9c8ce6)
  • Policy relaxations: none
  • Touched surfaces:
    • trusted/rustc-capture/src/{extract,ir,lean,lib,publication,shard}.rs
    • trusted/cargo-anneal/src/{cli,lib,olean_cache,shard,stage,verify}.rs
    • theory/bundle-manifest.json & trusted/cargo-anneal/src/bundled_theory.json
    • theory/Anneal.lean & theory/Anneal/SccSharding*.lean
    • zerocopy/proofs/05_sharded_tryfrombytes/*, zerocopy/proofs/README.md, skills/proof-scaling/SKILL.md, and tests/{cargo-anneal,rustc-capture,testkit}/*
    • Untouched TCB/CI: trusted/lean/, trusted/audit/, trusted/correspondence/, trusted/root-manifest.sha256, ci/, .github/

Authored by an AI agent acting on joshlf's behalf.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 23, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T23:09:00.363675Z 3c1ec9d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@codecov-commenter

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.99%. Comparing base (e86eb02) to head (3c1ec9d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4234   +/-   ##
=======================================
  Coverage   92.99%   92.99%           
=======================================
  Files          16       16           
  Lines        2469     2469           
=======================================
  Hits         2296     2296           
  Misses        173      173           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3c1ec9d7be

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread anneal/skills/proof-scaling/SKILL.md Resolved
Comment thread anneal/trusted/rustc-capture/src/ir.rs Resolved
Comment thread anneal/trusted/cargo-anneal/src/cli.rs Resolved

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2_tcb, Round 1)

  • Identity: one:128cb1c4514c2fdebb68712a5bcfdf5ea9a40ac0:de7dd14ee1020006a88e5d9fb9926ac726e424bb:197c299738a201b4a731b7a3cf1fe71b6794d14fc8f42b9e994e339efcb30841 (base=e86eb0281380, head=3c1ec9d7bef1, tree=de7dd14ee102)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 32 inspected, 0 inapplicable, 0 blocked (of 32 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 8 734s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed findings 4 980s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 895s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R1-01 P1 1 (seat2) static_verified anneal/trusted/cargo-anneal/src/olean_cache.rs:368 --no-rebuild-bundled fails open for TrustedBoundary (CacheKind::Inspector), silently recompiling the inspector on cache miss instead of failing closed.
G2-R1-02 P1 1 (seat2) static_verified anneal/trusted/cargo-anneal/src/stage.rs:411 Disk .olean caching for untrusted Proof.Shard_* modules lacks sandbox isolation, allowing a tainted --allow-unsandboxed-elaboration run to populate cache entries silently reused by subsequent untainted sandboxed runs.
G2-R1-03 P1 1 (seat2) static_verified anneal/trusted/cargo-anneal/src/stage.rs:447 Target-shard OleanCache keys hash only direct imports (edge_list) instead of the transitive import closure, causing stale .olean cache hits and false kernel-replay failures when a two-hop upstream module changes without altering the intermediate .olean.
G2-R1-04 P2 2 (seat1, seat2) static_verified anneal/trusted/cargo-anneal/src/olean_cache.rs:12 The olean cache docs still say only the inspector and bundled Trusted./Anneal. modules are cached, but this PR also caches target Captured.Shard_/Proof.Shard_/Proof.IdTree outputs, and the Human review surface reports no policy relaxation.
G2-R1-05 P2 1 (seat1) static_verified anneal/trusted/cargo-anneal/src/cli.rs:71 The PR adds user-visible behavior (default-on sharding above 20 bodies that reorders DefIds, a shard-plan subcommand, --shard-/--verify-shard-plan flags, Captured/Shard_.lean and capture_shards.json artifacts, reserved Proof.IdTree/Captured./Expected. modules, shards/capture_shards_sha256 receipt fields) without updating the bundled cargo-anneal SKILL user doc.
G2-R1-06 P2 1 (seat1) static_verified anneal/trusted/rustc-capture/src/extract.rs:744 New trusted callee extraction works with rustc structures (ty::FnDef, Instance::try_resolve, TerminatorKind::Call func/args, Rvalue operands) but quotes no pinned rust-lang/rust source and silently skips other operand positions, so the documented call-edge DAG is only partial.
G2-R1-07 P3 1 (seat1) static_verified anneal/trusted/cargo-anneal/src/olean_cache.rs:206 Caching target shard modules adds new per-edit entries to the per-user disk cache, which has no eviction, so the cache grows without bound during proof iteration.
G2-R1-08 P3 1 (seat1) static_verified anneal/trusted/cargo-anneal/src/shard.rs:420 ByteDecisionTree, ShardPlan/CaptureShardsManifest schemas, schema versions and default budgets are hand-duplicated in two trusted crates, kept in sync only by the id_tree_sha256 digest check and serde schemas.
G2-R1-09 P3 1 (seat1) static_verified anneal/trusted/rustc-capture/src/ir.rs:879 Body::try_new is now only called from tests but stays in production trusted code behind #[cfg_attr(not(test), allow(dead_code))].
G2-R1-10 P3 1 (seat1) static_verified anneal/trusted/rustc-capture/src/lean.rs:406 Sharded capture permutes Program.bodies (the theorem subject's DefIds) into callee-first SCC order, but the trusted code does not explain why that leaves the theorem's meaning unchanged, and the ENTRY_DEF_ID comment's 'first captured body' now depends on shard CLI flags that the request does not record.
G2-R1-11 P3 1 (seat1) static_verified anneal/trusted/rustc-capture/src/shard.rs:131 The new anneal-shards.json is a generated numeric-shard topology lockfile, which conflicts with the existing design doc's anneal-shards.json (a human-authored map from shard names to DefPath sets with Expected/Shard_* obligations), and the doc was not reconciled.

G2-R1-01 [P1] (anneal/trusted/cargo-anneal/src/olean_cache.rs:368, Pass 2 §3 (trusted/cargo-anneal), static_verified): --no-rebuild-bundled fails open for TrustedBoundary (CacheKind::Inspector), silently recompiling the inspector on cache miss instead of failing closed.

  • Invariant: VerifyArgs::no_rebuild_bundled (anneal/trusted/cargo-anneal/src/verify.rs:247-249) contracts to fail closed rather than compiling Trusted.*, Anneal.*, or TrustedBoundary when absent from prebuilt or local .olean caches.
  • Evidence: stage.rs:3034-3036 looks up the inspector with OleanCacheKeyInput { kind: CacheKind::Inspector, module: "TrustedBoundary".to_owned(), ... }. olean_cache.rs:368 narrows the failure guard to if self.no_rebuild_bundled && is_cacheable_bundled_module(&input.module), where is_cacheable_bundled_module (olean_cache.rs:197-201) checks only matches!(module, "Trusted" | "Anneal") || module.starts_with("Trusted.") || module.starts_with("Anneal.") and therefore returns false for "TrustedBoundary". On an inspector cache miss under --no-rebuild-bundled, lookup_bytes returns Ok(None) and stage.rs silently compiles TrustedBoundary.lean. Guard with input.kind == CacheKind::Inspector || is_cacheable_bundled_module(&input.module) and add a regression test for CacheKind::Inspector.

G2-R1-02 [P1] (anneal/trusted/cargo-anneal/src/stage.rs:411, Pass 2 §3 (trusted/cargo-anneal), static_verified): Disk .olean caching for untrusted Proof.Shard_* modules lacks sandbox isolation, allowing a tainted --allow-unsandboxed-elaboration run to populate cache entries silently reused by subsequent untainted sandboxed runs.

  • Invariant: THREAT_MODEL.md §2.1 and Receipt v3's Uniform Flag-Driven Taint Law require untainted sandboxed verification runs (taint_reasons: [], elaboration_sandbox: "linux_bwrap" / "linux_landlock_seccomp") never to silently accept untrusted TargetRole::Proof artifacts elaborated only outside the OS sandbox.
  • Evidence: verify.rs:2243-2249 sets SandboxMode::Unsandboxed under --allow-unsandboxed-elaboration while keeping checker.set_use_olean_cache(!args.no_cache). stage.rs:411-414 and olean_cache.rs:206-210 enable disk caching for authored Proof.Shard_* modules (TargetRole::Proof, exempt from syntactic preflight and allowed to execute by_elab/run_cmd). prepare_module_cache (stage.rs:439-448) builds OleanCacheKeyInput (olean_cache.rs:66-75) without sandbox state, and finish_module_artifacts (stage.rs:477-483, called from stage.rs:2720-2730) unconditionally calls olean_cache.store_compiled even when runtime.backend == ActiveSandbox::Unsandboxed. A subsequent untainted run computes the identical key, skips sandboxed Lean elaboration via cache hit, and emits an untainted sandboxed receipt for a Proof.Shard_* module that can depend on unsandboxed host access and fail under bwrap/Landlock. Disable target-shard disk cache reads/writes whenever sandbox_mode == SandboxMode::Unsandboxed (or ActiveSandbox::Unsandboxed).

G2-R1-03 [P1] (anneal/trusted/cargo-anneal/src/stage.rs:447, Pass 2 §3 (trusted/cargo-anneal), static_verified): Target-shard OleanCache keys hash only direct imports (edge_list) instead of the transitive import closure, causing stale .olean cache hits and false kernel-replay failures when a two-hop upstream module changes without altering the intermediate .olean.

  • Invariant: Content-addressed .olean caching for classic (is_lean_module: false) Lean modules must invalidate whenever any transitively imported .olean in the module's elaboration environment changes.
  • Evidence: write_setup_json_to_path (stage.rs:178) supplies transitive_import_closure(&adm.graph, imports) to lean --setup, whereas prepare_module_cache (stage.rs:447) constructs OleanCacheKeyInput.imports via build_import_bindings(edge_list, &adm.artifacts, path_sha_cache) (olean_cache.rs:907-940), hashing only direct imports. In Lean 4.34.1 classic .olean serialization (Lean/Environment.lean:109-128 ModuleData, Lean/Setup.lean:25-34 Import), .olean files record import names/flags and ConstantInfo terms without hashing imported .oleans. When an upstream module A changes a definition body (e.g., SpecHelper -> Spec -> Proof.Shard_000, or Captured.Shard_000 -> Proof.Shard_000 -> Proof.Shard_001) while intermediate B only references A symbolically or re-exports it, B.olean stays byte-identical, C (Proof.Shard_*) gets a stale cache hit skipping re-elaboration, and target-audit falsely rejects valid proof source during fresh kernel replay until --no-cache or cache eviction. Bind all transitive import artifact digests in OleanCacheKeyInput.imports.

G2-R1-04 [P2] (anneal/trusted/cargo-anneal/src/olean_cache.rs:12, Pass 2 §3 (trusted/cargo-anneal), static_verified): The olean cache docs still say only the inspector and bundled Trusted./Anneal. modules are cached, but this PR also caches target Captured.Shard_/Proof.Shard_/Proof.IdTree outputs, and the Human review surface reports no policy relaxation.

  • Invariant: AGENTS.md Commenting in trusted/: trusted code must state accurate rationale, invariants and contracts; Code Review Rules: the Human review surface and commit body must disclose every intentional policy relaxation.
  • Evidence: olean_cache.rs:12-17 still reads 'Only the static inspector (TrustedBoundary.lean) and static bundled Trusted.* / Anneal.* runtime modules are cached', and line 63 describes OleanCacheKeyInput as 'for an inspector or bundled module'. Meanwhile olean_cache.rs:206-210 adds is_cacheable_target_shard_module and stage.rs is_cacheable_module enables it for target_rejection compiles, so outputs of untrusted proof modules now persist in the per-user disk cache across runs and crates. The cache keeps no record of how an entry was produced (e.g. sandbox mode). The PR's Human review surface block says 'Policy relaxations: none'. Integrity rests on content keys plus target-audit replay, which looks sufficient, but the documented cache-scope invariant was widened without updating the trusted doc or disclosing the change.

G2-R1-05 [P2] (anneal/trusted/cargo-anneal/src/cli.rs:71, General / Documentation, static_verified): The PR adds user-visible behavior (default-on sharding above 20 bodies that reorders DefIds, a shard-plan subcommand, --shard-/--verify-shard-plan flags, Captured/Shard_.lean and capture_shards.json artifacts, reserved Proof.IdTree/Captured./Expected. modules, shards/capture_shards_sha256 receipt fields) without updating the bundled cargo-anneal SKILL user doc.

  • Invariant: AGENTS.md Standing rules > Documentation: add or update affected docs, examples and links in the same PR; docs-reviewer: flag stale text and missing guidance.
  • Evidence: cli.rs:71 adds ShardPlan; verify.rs adds ShardArgs, verify_shard_plan and receipt fields; rustc-capture shard.rs DEFAULT_SHARD_MIN_BODIES=20 makes sharding the default and permutes Program.bodies. trusted/cargo-anneal/skills/cargo-anneal/SKILL.md (printed by cargo anneal skill) is not in the diff: its proof_failed triage step still says to compare capture/Captured.lean (where body definitions no longer live in sharded mode), it never mentions shard-plan or the flags, and the Receipt v3 section omits the new fields and reserved module names. Existing >20-body proofs that refer to Captured.body_N or body indices will see different bodies, with no migration guidance.

G2-R1-06 [P2] (anneal/trusted/rustc-capture/src/extract.rs:744, Pass 2 §2 (trusted/rustc-capture), static_verified): New trusted callee extraction works with rustc structures (ty::FnDef, Instance::try_resolve, TerminatorKind::Call func/args, Rvalue operands) but quotes no pinned rust-lang/rust source and silently skips other operand positions, so the documented call-edge DAG is only partial.

  • Invariant: AGENTS.md: trusted/ code modeling Rust semantics or rustc structures must explain the correspondence and quote and cite rust-lang/rust at a pinned commit; trust-review Pass 2 §2 upstream citations.
  • Evidence: extract.rs:741-819 (resolve_local_callee_identity, collect_operand_callee, collect_block_callees) carry only short docs with no pinned quote for Instance::try_resolve or the Call/Rvalue field semantics. collect_block_callees scans only Use/UnaryOp/Cast/BinaryOp and Call/SwitchInt, with _ => {} at lines 801 and 816, so fn items in Aggregate, Repeat or other positions are dropped without a stated rationale. ir.rs:870-875 describes callees as 'extracted from MIR call terminators and function-item operands', and the commit presents callee_shards and the anneal-shards.json drift check as authenticated call topology. Body order and the theorem's meaning are unaffected, but the plan check can miss topology changes, and the trusted code lacks the required correspondence comments.

G2-R1-07 [P3] (anneal/trusted/cargo-anneal/src/olean_cache.rs:206, Pass 2 §3 (trusted/cargo-anneal), static_verified): Caching target shard modules adds new per-edit entries to the per-user disk cache, which has no eviction, so the cache grows without bound during proof iteration.

  • Invariant: Robust, operationally bounded orchestrator behavior; base cache scope was a bounded set of bundled modules per toolchain.
  • Evidence: olean_cache.rs contains no eviction/prune/LRU logic. sharded_capture_and_cache.rs:505-511 shows that each 1-body edit adds 2 new entries while keeping all old ones. Repeated edits to Proof.Shard_* and Captured.Shard_* therefore accumulate entries in XDG_CACHE_HOME/anneal/olean-cache indefinitely.

G2-R1-08 [P3] (anneal/trusted/cargo-anneal/src/shard.rs:420, Pass 2 §2/§3 (trusted/rustc-capture, trusted/cargo-anneal), static_verified): ByteDecisionTree, ShardPlan/CaptureShardsManifest schemas, schema versions and default budgets are hand-duplicated in two trusted crates, kept in sync only by the id_tree_sha256 digest check and serde schemas.

  • Invariant: AGENTS.md trusted/ parsimony: limit bespoke TCB code; robust-code single source of truth.
  • Evidence: cargo-anneal/src/shard.rs:390-512 and rustc-capture/src/shard.rs:372-516 implement the same decision-tree builder (with different initial best_thr/best_score values that happen not to matter), and both files define DEFAULT_SHARD_* and *_SCHEMA_VERSION. Divergence fails closed through the digest compare in verify.rs, but it doubles the human audit surface and creates a latent drift risk for the defaults (capture defaults are bypassed only because cargo-anneal passes explicit flags).

G2-R1-09 [P3] (anneal/trusted/rustc-capture/src/ir.rs:879, Pass 2 §2 (trusted/rustc-capture), static_verified): Body::try_new is now only called from tests but stays in production trusted code behind #[cfg_attr(not(test), allow(dead_code))].

  • Invariant: trusted/ parsimony / zero dead code in the TCB.
  • Evidence: ir.rs:879 adds #[cfg_attr(not(test), allow(dead_code))] to try_new after extract.rs switched to try_new_with_callees. The wrapper could be #[cfg(test)] or removed instead of carrying a dead-code allowance in the capture TCB.

G2-R1-10 [P3] (anneal/trusted/rustc-capture/src/lean.rs:406, Pass 2 §2 (trusted/rustc-capture), static_verified): Sharded capture permutes Program.bodies (the theorem subject's DefIds) into callee-first SCC order, but the trusted code does not explain why that leaves the theorem's meaning unchanged, and the ENTRY_DEF_ID comment's 'first captured body' now depends on shard CLI flags that the request does not record.

  • Invariant: AGENTS.md Commenting in trusted/: document rationale and invariants of capture-to-theorem-subject transformations.
  • Evidence: rustc-capture shard.rs:667-677 builds a permutation and calls Manifest::reorder_bodies (ir.rs:1292-1332). lean.rs:398-408 still says 'a specification that reads the program's own entry sees the first captured body', which is now the topologically first body when N > --shard-min-bodies, and those flags are not part of request_sha256. The change is benign under ProgramVerified (every body is checked via entryProgForBody, specs are identity-keyed), but no trusted comment states this argument.

G2-R1-11 [P3] (anneal/trusted/rustc-capture/src/shard.rs:131, General / Documentation, static_verified): The new anneal-shards.json is a generated numeric-shard topology lockfile, which conflicts with the existing design doc's anneal-shards.json (a human-authored map from shard names to DefPath sets with Expected/Shard_* obligations), and the doc was not reconciled.

  • Invariant: Documentation review: flag stale text and conflicting guidance in affected docs.
  • Evidence: docs/build-systems-and-receipts.md:286-301 (§5) specifies nominal mode consuming a checked-in anneal-shards.json mapping stable human-readable shard names to Rust DefPath sets, plus Expected/Shard_.lean obligations and Proof/Link.lean. The PR ships ShardPlan (rustc-capture shard.rs:131-146, cargo-anneal shard.rs:142-157) under the same filename with incompatible semantics (generated numeric shards, IdTree, BinChunkTree assembly) and leaves that doc untouched.

Executed Sandbox Probes

  • seat3 pass1_hygiene_and_diff_scan: outcome=passed (rc=0)
  • seat3 rust_sharding_differential_and_scc_probe: outcome=passed (rc=0)
  • seat3 zerocopy_05_sharded_tryfrombytes_consistency: outcome=passed (rc=0)
  • seat3 lean_lock_and_trusted_boundary_syntax_scan: outcome=passed (rc=0)
  • seat3 lean_j1_standalone_kernel_probe: outcome=env_limited (rc=1)
  • seat3 rust_coarsening_stress_and_axiom_scan: outcome=passed (rc=0)
  • seat3 root_manifest_and_bundle_parity: outcome=passed (rc=0)

Comment thread anneal/trusted/cargo-anneal/src/cli.rs Resolved
Comment thread anneal/trusted/rustc-capture/src/ir.rs Resolved

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2_tcb, Round 2)

  • Identity: one:128cb1c4514c2fdebb68712a5bcfdf5ea9a40ac0:de7dd14ee1020006a88e5d9fb9926ac726e424bb:197c299738a201b4a731b7a3cf1fe71b6794d14fc8f42b9e994e339efcb30841 (base=e86eb0281380, head=3c1ec9d7bef1, tree=de7dd14ee102)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 32 inspected, 0 inapplicable, 0 blocked (of 32 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 5 985s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed findings 2 1391s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 1413s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R2-01 P2 2 (seat1, seat2) static_verified anneal/trusted/cargo-anneal/src/olean_cache.rs:12 The TCB module invariant 'Only the static inspector and static bundled Trusted./Anneal. runtime modules are cached' is now false: the cache also stores compiled outputs of authored target proof modules and generated capture/IdTree modules.
G2-R2-02 P2 1 (seat2) static_verified anneal/trusted/cargo-anneal/src/olean_cache.rs:368 --no-rebuild-bundled fails open for TrustedBoundary (CacheKind::Inspector) because is_cacheable_bundled_module("TrustedBoundary") returns false.
G2-R2-03 P2 1 (seat1) static_verified anneal/trusted/rustc-capture/src/extract.rs:741 New trusted MIR traversal (resolve_local_callee_identity / collect_operand_callee / collect_block_callees) has none of the required pinned rust-lang/rust quotes or citations and no rationale for its selective operand/terminator coverage, and the ir.rs callees doc overstates what is collected.
G2-R2-04 P3 1 (seat1) static_verified anneal/theory/Anneal/SccSharding/InterprocCallModel.lean:28 Bundled theory defines its own call semantics (evalInterprocStep / InterprocReturns), but nothing links it to Trusted.MirSemantics (which faults on any reachable call), and the module docs do not disclose this gap.
G2-R2-05 P3 1 (seat1) static_verified anneal/trusted/cargo-anneal/src/cli.rs:71 User-facing cargo-anneal guidance is not updated for the new shard-plan subcommand, the --shard-*/--verify-shard-plan flags, the default sharded Captured/Shard_k layout with body reordering above 20 bodies, or the new receipt fields.
G2-R2-06 P3 1 (seat1) static_verified anneal/trusted/rustc-capture/src/lean.rs:492 render_sharded_root is documented as a 'thin O(K) root' but emits one alias definition per body (O(N)).

G2-R2-01 [P2] (anneal/trusted/cargo-anneal/src/olean_cache.rs:12, Pass 2 §3 (trusted/cargo-anneal), static_verified): The TCB module invariant 'Only the static inspector and static bundled Trusted./Anneal. runtime modules are cached' is now false: the cache also stores compiled outputs of authored target proof modules and generated capture/IdTree modules.

  • Invariant: AGENTS.md 'Commenting in trusted/' (explicit, accurate invariants and contracts for human TCB review); trust-review Pass 2 §3/§5 cache policy must be accurately documented and justified.
  • Evidence: olean_cache.rs:206 is_cacheable_target_shard_module admits 'Proof.IdTree' and any module name with prefix 'Captured.Shard_' or 'Proof.Shard_' (so any authored module named Proof.Shard_ qualifies); stage.rs:411-414 enables it when target_rejection is set, and :483-489 stores authored-module .oleans in the per-user disk cache for reuse across runs. The module doc at :12-13 still says only the inspector and bundled modules are cached, and the commit body says only 'enable incremental shard compilation caching' without stating that untrusted authored proof outputs now persist and are reused. Safety still rests on source/import-digest keying and target-audit replay (doc lines 14-17), but the stated invariant no longer matches the code.

G2-R2-02 [P2] (anneal/trusted/cargo-anneal/src/olean_cache.rs:368, Pass 2 §3 (trusted/cargo-anneal), static_verified): --no-rebuild-bundled fails open for TrustedBoundary (CacheKind::Inspector) because is_cacheable_bundled_module("TrustedBoundary") returns false.

  • Invariant: VerifyArgs::no_rebuild_bundled (anneal/trusted/cargo-anneal/src/verify.rs:246-248) requires failing closed rather than compiling Trusted., Anneal., or TrustedBoundary when absent from prebuilt or local .olean caches.
  • Evidence: anneal/trusted/cargo-anneal/src/stage.rs:3034-3065 calls self.olean_cache.lookup_bytes with OleanCacheKeyInput { kind: CacheKind::Inspector, module: "TrustedBoundary", ... }. At anneal/trusted/cargo-anneal/src/olean_cache.rs:368, the diff narrows if self.no_rebuild_bundled to if self.no_rebuild_bundled && is_cacheable_bundled_module(&input.module). Because is_cacheable_bundled_module (olean_cache.rs:197-201) matches only "Trusted", "Anneal", "Trusted.", and "Anneal.", "TrustedBoundary" evaluates to false; on a cache miss, lookup_bytes returns Ok(None) and stage.rs silently recompiles TrustedBoundary.lean instead of failing closed. The new unit test target_shard_cache_policy_allows_shards_while_no_rebuild_bundled_stays_strict (olean_cache.rs:1329-1388) only exercises CacheKind::Module ("Anneal.SccSharding"), missing CacheKind::Inspector. Gate on input.kind == CacheKind::Inspector || is_cacheable_bundled_module(&input.module) and add a CacheKind::Inspector miss test under --no-rebuild-bundled.

G2-R2-03 [P2] (anneal/trusted/rustc-capture/src/extract.rs:741, Pass 2 §2 (trusted/rustc-capture), static_verified): New trusted MIR traversal (resolve_local_callee_identity / collect_operand_callee / collect_block_callees) has none of the required pinned rust-lang/rust quotes or citations and no rationale for its selective operand/terminator coverage, and the ir.rs callees doc overstates what is collected.

  • Invariant: AGENTS.md 'Commenting in trusted/': code in trusted/ modeling rustc structures must explain the correspondence and quote and cite rust-lang/rust at a pinned commit; trust-review Pass 2 §2 upstream citations.
  • Evidence: extract.rs:741-820 interprets ty::FnDef operand types, Instance::try_resolve, Rvalue::{Use,UnaryOp,Cast,BinaryOp} and TerminatorKind::{Call,SwitchInt} with a two-line doc and no upstream links, while the base file carries 82 pinned f8a08b68 citations (e.g. check_call_source at extract.rs:609-619, terminator() at :635-651). The traversal silently skips Aggregate/Repeat/Ref operands and TailCall/Drop terminators without rationale, yet ir.rs:870 says the edges are 'extracted from MIR call terminators and function-item operands'. Because returning calls are refused at capture time (extract.rs:646-647), the edges come only from diverging calls and fn-item operands and drive shard packing, callee_shards and anneal-shards.json drift detection, not the claim, so the impact is reviewability and accuracy of plan metadata rather than soundness.

G2-R2-04 [P3] (anneal/theory/Anneal/SccSharding/InterprocCallModel.lean:28, Pass 1 / General, static_verified): Bundled theory defines its own call semantics (evalInterprocStep / InterprocReturns), but nothing links it to Trusted.MirSemantics (which faults on any reachable call), and the module docs do not disclose this gap.

  • Invariant: trust-review Pass 1 §4 seam integrity (no vacuous or disconnected intermediate predicates presented as verification capability); docs-reviewer accuracy.
  • Evidence: Module doc (lines 26-34) says it 'Mechanizes multi-frame TerminatorKind.call push/return execution' and the PR body calls these 'zero-TCB theory models of direct, cyclic, and mutually recursive call verification', but Trusted.MirSemantics/Step.lean:744 maps .call to .fault .unsupported (Boundary.lean:174). No lemma relates InterprocReturns/InterprocExecutes to WellFormed/BodyVerified, so proofs about this model cannot discharge any CrateTheorem/UnitTheorem obligation. The module ships to all users via bundled_theory.json and the Anneal umbrella. Not unsound (the kernel checks Expected.claim), but it can mislead proof authors about what is supported.

G2-R2-05 [P3] (anneal/trusted/cargo-anneal/src/cli.rs:71, General (documentation), static_verified): User-facing cargo-anneal guidance is not updated for the new shard-plan subcommand, the --shard-*/--verify-shard-plan flags, the default sharded Captured/Shard_k layout with body reordering above 20 bodies, or the new receipt fields.

  • Invariant: AGENTS.md Standing rules: Documentation (add or update affected docs in the same PR); docs-reviewer stale-text check.
  • Evidence: cli.rs:71 adds Command::ShardPlan and verify gains global shard flags (verify.rs ShardArgs flatten). The bundled skill printed by cargo anneal skill (trusted/cargo-anneal/skills/cargo-anneal/SKILL.md, unchanged) mentions none of these, and its step-0 triage at line 95 still says to compare 'capture/Captured.lean', which in sharded mode holds only aliases while the bodies are in capture/Captured/Shard_.lean. Sharding is on by default (DEFAULT_SHARD_MIN_BODIES=20) and reorders bodies into callee-first order, which changes body indices and Captured.body_N meaning for existing proofs over larger captures; this is undocumented outside code comments.

G2-R2-06 [P3] (anneal/trusted/rustc-capture/src/lean.rs:492, Pass 2 §2 (trusted/rustc-capture), static_verified): render_sharded_root is documented as a 'thin O(K) root' but emits one alias definition per body (O(N)).

  • Invariant: AGENTS.md 'Commenting in trusted/' accuracy of trusted code comments.
  • Evidence: lean.rs:492 doc says 'Render the thin O(K) root Captured.lean module', while the loop over shards and 0..num_bodies emits a def body_{global_idx} alias for every body, so the root size grows with N, not K.

Executed Sandbox Probes

  • seat3 Pass 1 repo hygiene, modes, TODOs, headers, root-manifest.sha256, and bundle-manifest parity: outcome=Exit 0: 32 changed regular 100644 UTF-8 files, 0 symlinks in changed set, 0 case/NFC collisions, 0 TODO markers, 0 private leaks, Fuchsia 2026 headers present on all new files, root-manifest.sha256 4/4 match, bundle-manifest 22/22 SHA-256 match.
  • seat3 Lean TrustedBoundary static rules, markdown links/wrapping, and bundled_theory.json byte-exactness: outcome=Exit 0: all 9 changed .lean files satisfy prelude/module/import-all/forbidden-token checks and Init imports are in foundation-lock.json/library-lock.json; bundled_theory.json matches render_bundled_theory byte-for-byte (777022 bytes); zero broken relative links/anchors.
  • seat3 05_sharded_tryfrombytes index, Spec, and verify_zerocopy.discover_units validation: outcome=Exit 0: verify_zerocopy.discover_units discovers 5 units incl. 05_sharded_tryfrombytes; all 25 roots verified against Spec.lean, Shard_000 (0..19), Shard_001 (20..24), and Proof.lean; Spec04 predicates preserved.
  • seat3 Compiled Rust differential fuzzing of candidate rustc-capture/src/shard.rs and cargo-anneal/src/shard.rs: outcome=Exit 0: ByteDecisionTree UTF-8/prefix/empty/duplicate edge cases and rustc<->cargo render_id_tree_module parity passed; 50 randomized Tarjan SCC permutation-invariance, coarsening, ShardPlan parity, and cargo-anneal validation trials passed.
  • seat3 anneal/ci Python stdlib unit test suites: outcome=Exit 0 across the 11 stdlib suites (1 skipped: test_real_usr_bin_time_isolates_small_child_rss). Earlier unfiltered run failed in test_check_todo (missing rg) and test_check_job_dependencies (missing yq).
  • seat3 Standalone Lean 4.34.1 ByteDecisionTree UTF-8/prefix kernel check under prlimit --nproc=64: outcome=Exit 1 before parsing/elaboration: Lean C++ worker initialization failed with 'failed to create thread: Resource temporarily unavailable' under RLIMIT_NPROC=64 (--threads=0 panics in IO.Promise.new).

Comment thread anneal/trusted/cargo-anneal/src/cli.rs Resolved
@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from 3c1ec9d to 64cc25e Compare November 24, 2026 13:52
@joshlf

joshlf commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Dispositions & Verification Receipt

  • Comparison tuple: (9c15182c5e2cf6b9fd4ebf6998dc64c82e88fb8f, 9c15182c5e2cf6b9fd4ebf6998dc64c82e88fb8f, 64cc25e5588bdf88b5bd2ad70708327b80762092) (tree = ed47bcd73a1bba3c87d0c7ab193a5e139b5d3fa6; git merge-tree --write-tree origin/main HEAD clean against a3bdc4f43ce3)
  • Rebase adjustments (#4238, #4218, #4214):
    • Preserved #4238 transitive import Merkle bindings (OleanCache v2 transitive_sha256 covers Captured.Shard_*, Proof.Shard_*, and Proof.IdTree).
    • Preserved #4218 --artifacts directory preflight in verify.rs.
    • Extended shared cargo_compilation and ShardPlanArgs (-F/--features, --all-features, --no-default-features with --request conflict guards) to preserve #4214 Cargo cfg resolution, "rlib" target selection, and tests/benches/examples filtering across verify and shard-plan.

Finding Dispositions (Codex R0, Gate 2 Round 1, Gate 2 Round 2)

Finding Sev Disposition Resolution in 64cc25e5588b
Codex SKILL.md:64 P1 Fixed Added Agent-authored-by: AI agent acting on joshlf's behalf commit trailer and refreshed PR description via commit-to-pr-body --prose-disclosure.
Codex rustc-capture/src/shard.rs:465 P2 Fixed Replaced linear byte peeling with balanced O(log N) byte/length/lexicographic splits in ByteDecisionTree (rustc-capture + cargo-anneal) and BinChunkTree / ByteDecisionTree Lean proofs.
Codex rustc-capture/src/ir.rs:1081 P2 Fixed Included rendered Body.identity _root_.String.ofList and _root_.Char.ofNat constructor nodes in Body::ast_nodes.
Codex rustc-capture/src/extract.rs:754 P1 Fixed Added verbatim quotes and links pinned to rust-lang/rust commit f8a08b688cbe (nightly-2026-05-31).
Codex cargo-anneal/src/cli.rs:71 P2 Fixed Updated trusted/cargo-anneal/skills/cargo-anneal/SKILL.md with shard-plan, --shard-*, --verify-shard-plan, Captured/Shard_*, Proof.IdTree, Body.identity migration, and Receipt v3 shard fields.
Codex cargo-anneal/src/shard.rs:250 P2 Fixed Validated total_sccs, cyclic_sccs <= total_sccs, 0..total_sccs partition across scc_ids, and oversized_scc => scc_ids.len() == 1 in validate_capture_shards_manifest.
G2-R1-01 / G2-R2-02 (olean_cache.rs:368) P1 Fixed --no-rebuild-bundled now fails closed on input.kind == CacheKind::Inspector || is_cacheable_bundled_module(&input.module), with an exit-2 inspector cache-miss regression test.
G2-R1-02 (stage.rs:411) P1 Fixed Gated target-shard disk .olean cache reads and writes on active sandboxing (target_rejection && self.sandbox_mode != SandboxMode::Unsandboxed && runtime.backend != ActiveSandbox::None), with unit-test coverage ensuring unsandboxed runs neither read nor write disk cache entries.
G2-R1-03 (stage.rs:447) P1 Fixed Resolved by rebasing onto #4238 (7364f31f6): OleanCache v2 binds transitive_sha256 across the transitive import closure for all cached modules, including Captured.Shard_*, Proof.Shard_*, and Proof.IdTree.
G2-R1-04 / G2-R2-01 (olean_cache.rs:12) P2 Fixed Updated olean_cache.rs module/key documentation and commit/review-surface disclosures to state that sandboxed target_rejection runs also cache Captured.Shard_*, Proof.Shard_*, and Proof.IdTree outputs (re-checked via fresh kernel replay in target-audit).
G2-R1-05 / G2-R2-05 (cli.rs:71) P2 Fixed Updated bundled trusted/cargo-anneal/skills/cargo-anneal/SKILL.md.
G2-R1-06 / G2-R2-03 (extract.rs:744) P2 Fixed Added pinned f8a08b688cbe quotes/links and replaced open _ => {} matches in collect_block_callees with exhaustive Rvalue and TerminatorKind matches (Repeat, Aggregate, WrapUnsafeBinder, TailCall, Assert, Yield traversed; indirect/closure/drop/inline-asm rationale documented), and aligned Body.callees docs in ir.rs.
G2-R1-07 (olean_cache.rs:206) P3 Acknowledged Target-shard entries share the content-addressed XDG_CACHE_HOME/anneal/olean-cache store (--no-cache bypasses disk reads/writes); cache pruning/LRU eviction is left to a dedicated follow-up.
G2-R1-08 (cargo-anneal/src/shard.rs:420) P3 Intentional cargo-anneal (+stable, crates.io-only deps) and anneal-rustc-capture (+nightly-2026-05-31 rustc_private) intentionally share no workspace library crate; lockstep parity is enforced fail-closed via id_tree_sha256, serde schema validation, and explicit --shard-* flag forwarding.
G2-R1-09 (rustc-capture/src/ir.rs:879) P3 Fixed Gated Body::try_new behind #[cfg(test)].
G2-R1-10 (rustc-capture/src/lean.rs:406) P3 Fixed Updated ENTRY_DEF_ID documentation in lean.rs to explain why CrateTheorem / UnitTheorem quantify over DefId membership/lookup in Program.bodies independently of body permutation order.
G2-R1-11 (rustc-capture/src/shard.rs:131) P3 Fixed Added §5 reconciliation note in anneal/docs/build-systems-and-receipts.md distinguishing shipped v1 numeric ShardPlan (anneal-shards.json) from the planned human-authored nominal shard map.
G2-R2-04 (InterprocCallModel.lean:28) P3 Fixed Documented in InterprocCallModel.lean, InterprocCallCanary.lean, and the commit body that InterprocCallModel is a standalone zero-TCB operational model of BinChunkTree call dispatch not yet bridged to Trusted.MirSemantics.evalStep (which faults .unsupported on returning TerminatorKind.call).
G2-R2-06 (rustc-capture/src/lean.rs:492) P3 Fixed render_sharded_root documentation explicitly describes importing the K Captured.Shard_* modules and re-exporting the N Captured.body_<idx> aliases.

Local Verification Executed on 64cc25e5588b (9bd5283d1 -> 64cc25e55 differs only in 1 typed_capture.rs test)

  • Hygiene & manifests: regenerate_bundle --root anneal --check, sha256sum --check --strict anneal/trusted/root-manifest.sha256 (4/4 OK), git diff --check, ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, ./anneal/ci/check_non_stable_version.sh — all exit 0.
  • Clippy (-D warnings): +stable workspace --all-targets, +stable -p cargo-anneal --no-default-features --lib --bins, +stable -p cargo-anneal-tests --no-default-features --test cli, +nightly-2026-05-31 --manifest-path anneal/trusted/rustc-capture/Cargo.toml --all-targets — all exit 0.
  • Python CI tests: python3 -B -m unittest discover -s anneal/ci -p "test_*.py" — 187/187 OK.
  • Trusted unit & CLI tests:
    • anneal-rustc-capture --lib: 49 passed; 0 failed
    • anneal-audit --lib: 12 passed; 0 failed
    • cargo-anneal --lib: 177 passed; 0 failed (--no-default-features --lib: 150 passed; 0 failed)
    • cargo-anneal-tests --test cli: 27 passed; 0 failed (--no-default-features --test cli: 23 passed; 0 failed)
  • Audit & capture / Lean e2e suites:
    • anneal-audit --require-correspondence --lean <lean-4.34.1> --anneal-root anneal: replay: true (13807 decls / 1760 theorems), correspondenceReplay: true (2680), miriReplay: true (39088), axioms: ["propext", "Classical.choice", "Quot.sound"]
    • anneal-rustc-capture-tests --test typed_capture: 61 passed; 0 failed (including tarjan_scc_sharding_partitions_cyclic_calls_and_verifies_plan)
    • cargo-anneal-tests --test suite -- sharded_capture_and_cache: 1 passed; 0 failed
    • cargo-anneal-tests --test suite -- anti_vacuity_and_e2e: 6 passed; 0 failed
    • anneal/ci/verify_zerocopy.py: 5/5 real zerocopy units verified (including 05_sharded_tryfrombytes)
  • Not executed locally (covered by CI): boundary_audit, target_audit, remaining non-sharding suite modules, installed_smoke, nix build.

Human review surface (9c15182c5e2c..64cc25e5588b, tree ed47bcd73a1b)

  • Trusted capture (anneal/trusted/rustc-capture/src/{extract,ir,lean,main,request,shard}.rs):
    • Static MIR direct-callee DefPath extraction (resolve_local_callee_identity, exhaustive collect_block_callees over Rvalue and TerminatorKind), Body.identity rendering, iterative Tarjan SCC condensation + greedy topological bin-packing (shard.rs), balanced ByteDecisionTree generation, and sharded Captured/Shard_*.lean + Captured.lean + capture_shards.json emission (default-on at >= 20 captured bodies).
  • Trusted orchestrator (anneal/trusted/cargo-anneal/src/{cli,lean_syntax,olean_cache,shard,stage,verify}.rs):
    • cargo anneal shard-plan (anneal-shards.json v1), --shard-* and --verify-shard-plan flags (with Cargo feature parity -F/--features, --all-features, --no-default-features), Proof.IdTree staging, Proof.Shard_* DAG admission, Receipt v3 shards / capture_shards_sha256 fields, and --no-rebuild-bundled fail-closed enforcement on CacheKind::Inspector.
    • Intentional cache-scope expansion: OleanCache now caches sandboxed target_rejection outputs for Captured.Shard_*, Proof.Shard_*, and Proof.IdTree (strictly disabled under SandboxMode::Unsandboxed / ActiveSandbox::None, bound by #4238 v2 transitive_sha256 Merkle import digests, and always re-verified from scratch by target-audit kernel replay).
  • Trusted Lean & TrustedBoundary: 0 lines changed (root-manifest.sha256 4/4 unchanged from base).
  • Zero-TCB theory/ (Anneal.SccSharding.{BinChunkTree,ByteDecisionTree,InterprocCallModel,InterprocCallCanary}):
    • Kernel-checked O(log N) lookup bridge to Program.findBody? and standalone BinChunkTree interprocedural call-dispatch model (InterprocCallModel, explicitly documented as not yet bridged to Trusted.MirSemantics.evalStep).
  • First-customer zerocopy fixture & docs: anneal/examples/zerocopy/05_sharded_tryfrombytes/, anneal/skills/proof-scaling/SKILL.md, anneal/trusted/cargo-anneal/skills/cargo-anneal/SKILL.md, and anneal/docs/{architecture,build-systems-and-receipts,trust-model}.md.

@joshlf

joshlf commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Rebase onto #4244 & Comment-Wrap Verification Receipt

  • Comparison tuple: (dfdc3ee94993f24d198ac243bcc36abcd26f90f6, dfdc3ee94993f24d198ac243bcc36abcd26f90f6, a7a63e92ef458b16108ebb6ef088ca8f6572a09d) (tree = d43fc1a90264a3700a6c0abd41395a1ea3a23c06)
  • Delta since 64cc25e5588b (#issuecomment-7133492026): Rebased cleanly onto origin/main (dfdc3ee94993, #4244) and wrapped two comment lines in anneal/trusted/rustc-capture/src/ir.rs:1079,1093 to <= 80 columns (0 code changes; all R0, Gate-2 Round 1, and Gate-2 Round 2 dispositions from #issuecomment-7133492026 carry forward unchanged).

Local Verification Executed on a7a63e92ef45

  • Hygiene & manifests: regenerate_bundle --root anneal --check, sha256sum --check --strict anneal/trusted/root-manifest.sha256 (4/4 OK), git diff --check, ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, ./anneal/ci/check_non_stable_version.sh — exit 0.
  • Capture lints & unit tests: +nightly-2026-05-31 clippy --manifest-path anneal/trusted/rustc-capture/Cargo.toml --all-targets -- -D warnings and anneal-rustc-capture --lib (49 passed; 0 failed) — exit 0 (full anneal-audit, typed_capture 61/61, cargo-anneal --lib 177/177 + 150/150 NDF, cli 27/27 + 23/23 NDF, sharded_capture_and_cache 1/1, anti_vacuity_and_e2e 6/6, verify_zerocopy.py 5/5, and 187/187 Python CI tests carried forward from identical code in 64cc25e5588b; boundary_audit, target_audit, installed_smoke, and nix build run in CI/MQ).

Human review surface (dfdc3ee94993..a7a63e92ef45, tree d43fc1a90264)

  • Trusted capture (anneal/trusted/rustc-capture/src/{extract,ir,lean,lib,publication,shard}.rs): Static MIR direct-callee DefPath extraction (resolve_local_callee_identity, exhaustive collect_block_callees over Rvalue and TerminatorKind), Body.identity rendering, iterative Tarjan SCC condensation + greedy topological bin-packing (shard.rs), balanced ByteDecisionTree generation, and sharded Captured/Shard_*.lean + Captured.lean + capture_shards.json emission (default-on at >= 20 captured bodies).
  • Trusted orchestrator (anneal/trusted/cargo-anneal/src/{cli,lib,olean_cache,shard,stage,verify}.rs, anneal/trusted/cargo-anneal/src/bundled_theory.json): cargo anneal shard-plan (anneal-shards.json v1), --shard-* and --verify-shard-plan flags (with Cargo feature parity -F/--features, --all-features, --no-default-features), Proof.IdTree staging, Proof.Shard_* DAG admission, Receipt v3 shards / capture_shards_sha256 fields, and --no-rebuild-bundled fail-closed enforcement on CacheKind::Inspector. Intentional cache-scope expansion: OleanCache caches sandboxed target_rejection outputs for Captured.Shard_*, Proof.Shard_*, and Proof.IdTree (disabled under SandboxMode::Unsandboxed / ActiveSandbox::None, bound by v2 transitive_sha256 Merkle import digests, and re-verified by target-audit kernel replay).
  • CI performance budgets (anneal/ci/{perf_budgets.json,test_perf_tracking.py,test_perf_workflow.py}): Benchmark budget registration and workflow tests for 05_sharded_tryfrombytes.
  • Trusted Lean & TrustedBoundary: 0 lines changed (root-manifest.sha256 4/4 unchanged from base).
  • Zero-TCB theory/ (anneal/theory/Anneal.lean, anneal/theory/Anneal/SccSharding.lean, anneal/theory/Anneal/SccSharding/{BinChunkTree,InterprocCallCanary,InterprocCallModel}.lean, anneal/theory/bundle-manifest.json): Kernel-checked O(log N) lookup bridge to Program.findBody? and standalone BinChunkTree interprocedural call-dispatch model (InterprocCallModel, documented as not yet bridged to Trusted.MirSemantics.evalStep).
  • First-customer zerocopy fixture, skills & docs: zerocopy/proofs/05_sharded_tryfrombytes/, zerocopy/proofs/README.md, anneal/skills/proof-scaling/SKILL.md, anneal/trusted/cargo-anneal/skills/cargo-anneal/SKILL.md, and anneal/docs/build-systems-and-receipts.md.

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from 64cc25e to a7a63e9 Compare November 24, 2026 16:59

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — CLEAN (tier2a_core_tcb, Round 3)

  • Identity: one:82c0cdf282466f67d0ad6ab42a4a113aed5b44f5:d43fc1a90264a3700a6c0abd41395a1ea3a23c06:552a896a27dd37b94606e67df52992c21e665fce517e0676324b9090f37e7013 (base=dfdc3ee94993, head=a7a63e92ef45, tree=d43fc1a90264)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 37 inspected, 0 inapplicable, 0 blocked (of 37 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 2200s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 2011s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 1233s

No unresolved P0-P2 findings raised across completed seats.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R3-A01 [P3] (anneal/docs/testing-architecture.md:136): File-tree listings for cargo-anneal/src and rustc-capture/src omit the new shard.rs modules (file not touched by this PR).
  • G2-R3-A02 [P3] (anneal/trusted/cargo-anneal/skills/cargo-anneal/SKILL.md:91): Says sharding is 'transparent for Proof' while later stating that positional proofs over more than 20 bodies must change.
  • G2-R3-A03 [P3] (anneal/trusted/cargo-anneal/src/stage.rs:2481): Pass literal false instead of target_rejection for allow_target_shard_cache in the unsandboxed branch.
  • G2-R3-A04 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:964): The reserved-module tightening (any Captured.* / Expected.* first segment) is not mentioned in the commit body.
  • G2-R3-A05 [P3] (anneal/trusted/rustc-capture/src/ir.rs:1312): reorder_bodies remaps only selected[].body_index; it would silently mis-target call callees once capture emits DefId-bearing call terminators.
  • G2-R3-A06 [P3] (anneal/trusted/rustc-capture/src/lean.rs:409): In sharded runs, body order and entryDefId := 0 depend on --shard-* flags that are recorded in neither request_sha256 nor the receipt.

Executed Sandbox Probes

  • seat3 Pass 1 hygiene, headers, Lean excluded-token scan, and trusted/root-manifest.sha256 check in bwrap: outcome=passed
  • seat3 Static parity, bundle/skill consistency, doc link/wrap audit, and zerocopy/05 cross-check in bwrap: outcome=passed
  • seat3 Extracted Rust Tarjan SCC, bucket packing, and ByteDecisionTree compilation + adversarial fuzzing via rustc --test in bwrap: outcome=passed
  • seat3 Theory Init.* import lock and tactic allowlist scan in bwrap: outcome=passed
  • seat3 CI Python unittest suite execution in bwrap: outcome=passed_with_skip
  • seat3 Standalone Lean 4.34.1 UTF-8 encoding probe in bwrap: outcome=errored_env_limit
  • seat3 Mandatory workflow permissions/auth/secret-containment checklist (.github/workflows/*.yml): outcome=inapplicable

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from a7a63e9 to d3b0627 Compare November 24, 2026 21:10
@joshlf

joshlf commented Nov 24, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Rebase onto #4236 / #4229 / #4217 & Verification Receipt

  • Comparison tuple: (target_base, merge_base, head) = (9be5762cf8b1c31cae6ba72b4e99fdb01a7a60a1, 6d09dbc2ff9845dd39409da1d84291d9683dca3a, d3b06271e0e37201c5786456a506d696bb27fc2a) (tree = 0c13b72bdf90877b948a5d49e297851cb2ec8b12)
  • Delta since a7a63e92ef45 (#issuecomment-7138518270, Gate-2 Round 3 CLEAN):
    1. Rebased onto origin/main (6d09dbc2ff98, incorporating #4236, #4229, #4217, #4089, and #4270): aligned anneal/theory/Anneal.lean and anneal/theory/bundle-manifest.json (21 bundled modules, 0 *Canaries* per #4236; Anneal.SccSharding.InterprocCallCanary stays decoupled and Pass-1 audited via scan_lean_tree), and regenerated anneal/trusted/cargo-anneal/src/bundled_theory.json.
    2. Preserved #4229's module-mode stage.rs unit tests alongside target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed (sharded Captured/Shard_*.lean, sharded Captured.lean, Proof/IdTree.lean, and 05_sharded_tryfrombytes continue to compile in legacy non-module mode with is_lean_module: false under #4229's per-module source_starts_with_module_keyword / expected_is_module handling).
    3. Ported #4217's --stdlib-crate capability across anneal/trusted/cargo-anneal/src/verify.rs (run_capture_process forwarding and bidirectional capture.json configuration.stdlib_crate authentication on both unsharded and sharded paths, plus Scope::SelectedUnit enforcement in run_shard_plan) and anneal/trusted/rustc-capture/src/{lib,shard}.rs.

Local Verification Executed on d3b06271e0e3

  • Hygiene, manifests & lints: regenerate_bundle --root anneal --check, sha256sum --check --strict anneal/trusted/root-manifest.sha256 (4/4 OK), git diff --check, ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, and cargo clippy --all-targets -- -D warnings on both anneal and anneal-rustc-capture — exit 0.
  • Boundary, unit, CLI, Pass-1 kernel replay & sharded E2E suites:
    • anneal-rustc-capture --lib: 53/53 OK
    • cargo-anneal --lib: 181/181 OK
    • anneal-audit-tests --test boundary_audit: 59/59 run checks passed (theory_umbrella_and_manifest_exclude_canaries_and_match 1/1 OK, enforces_bundled_resources_parity_and_regular_files 1/1 OK)
    • cargo-anneal-tests --test cli -- stdlib (2/2 OK), --test cli -- shard (1/1 OK), and anneal-rustc-capture-tests --test stdlib_capture (7/7 OK)
    • cargo-anneal-tests --test suite -- sharded_capture_and_cache: 1/1 OK
    • anneal-audit --anneal-root anneal: PASS (19 Trusted / 90 Theory modules; 1760 Trusted kernel declarations; 15363 total replayed declarations + 2680 Correspondence replayed declarations, including Anneal.SccSharding.* and decoupled InterprocCallCanary; axioms ["propext", "Classical.choice", "Quot.sound"])
    • anneal/ci/verify_zerocopy.py: 5/5 real zerocopy units verified (module-mode 01..04 + sharded 05_sharded_tryfrombytes, ["propext"] ceiling preserved; correspondence, target_audit, installed_smoke, and nix build run in CI/MQ).

Human review surface (6d09dbc2ff98..d3b06271e0e3, tree 0c13b72bdf90)

  • Trusted capture (anneal/trusted/rustc-capture/src/{extract,ir,lean,lib,publication,shard}.rs): Static MIR direct-callee DefPath extraction (resolve_local_callee_identity, exhaustive collect_block_callees over Rvalue and TerminatorKind), Body.identity rendering, iterative Tarjan SCC condensation + greedy topological bin-packing (shard.rs), balanced ByteDecisionTree generation, and sharded Captured/Shard_*.lean + Captured.lean + capture_shards.json emission (is_lean_module: false, default-on at > 20 captured bodies; unsharded Captured.lean preserves #4229 module mode).
  • Trusted orchestrator (anneal/trusted/cargo-anneal/src/{cli,lib,olean_cache,shard,stage,verify}.rs, anneal/trusted/cargo-anneal/src/bundled_theory.json): cargo anneal shard-plan (anneal-shards.json v1), --shard-* and --verify-shard-plan flags, #4217 --stdlib-crate forwarding/authentication and Scope::SelectedUnit check in run_shard_plan, Proof.IdTree staging, Proof.Shard_* DAG admission, Receipt v3 shards / capture_shards_sha256 fields, and --no-rebuild-bundled fail-closed enforcement on CacheKind::Inspector. Intentional cache-scope expansion: OleanCache caches sandboxed target_rejection outputs for Captured.Shard_*, Proof.Shard_*, and Proof.IdTree (disabled under SandboxMode::Unsandboxed / ActiveSandbox::None, bound by v2 transitive_sha256 Merkle import digests, and re-verified by target-audit kernel replay).
  • CI performance budgets (anneal/ci/{perf_budgets.json,test_perf_tracking.py,test_perf_workflow.py}): Benchmark budget registration and workflow tests for 05_sharded_tryfrombytes.
  • Trusted Lean & TrustedBoundary: 0 lines changed (root-manifest.sha256 4/4 unchanged from base).
  • Zero-TCB theory/ (anneal/theory/Anneal.lean, anneal/theory/Anneal/SccSharding.lean, anneal/theory/Anneal/SccSharding/{BinChunkTree,InterprocCallCanary,InterprocCallModel}.lean, anneal/theory/bundle-manifest.json): Kernel-checked O(log N) lookup bridge to Program.findBody? and standalone BinChunkTree interprocedural call-dispatch model (InterprocCallModel, documented as not yet bridged to Trusted.MirSemantics.evalStep).
  • First-customer zerocopy fixture, tests, skills & docs: zerocopy/proofs/05_sharded_tryfrombytes/, zerocopy/proofs/README.md, anneal/tests/{cargo-anneal,rustc-capture,testkit}/**, anneal/skills/proof-scaling/SKILL.md, anneal/trusted/cargo-anneal/skills/cargo-anneal/SKILL.md, and anneal/docs/build-systems-and-receipts.md. Policy relaxations: intentional sandboxed shard .olean cache-scope expansion noted above.

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 4)

  • Identity: multi:9be5762cf8b1c31cae6ba72b4e99fdb01a7a60a1:d3b06271e0e37201c5786456a506d696bb27fc2a (base=9be5762cf8b1, head=d3b06271e0e3, tree=0c13b72bdf90)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 37 inspected, 0 inapplicable, 0 blocked (of 37 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 2930s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 3061s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed findings 1 3004s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R4-01 P1 1 (seat3) probe_confirmed anneal/trusted/rustc-capture/src/lean.rs:480 Default Tarjan SCC sharding (N > 20 bodies) emits non-module Captured/Captured.Shard_*/Proof.IdTree files (is_lean_module: false), forcing Expected.lean to drop module (verify.rs:2554) and causing Lean 4.34.1 to reject any module-mode Proof.lean (including fresh cargo anneal init / skill --example scaffolds and 01..04-style proofs) with error: cannot import non-'module' Expected from 'module', contradicting SKILL.md:102 ('Sharding is transparent for Proof unless Proof/Shard_.lean is authored').

G2-R4-01 [P1] (anneal/trusted/rustc-capture/src/lean.rs:480, anneal/trusted/rustc-capture/src/lean.rs:480,513; anneal/trusted/cargo-anneal/src/shard.rs:30,233; anneal/trusted/cargo-anneal/src/verify.rs:2554; anneal/trusted/cargo-anneal/skills/cargo-anneal/SKILL.md:75-115, probe_confirmed): Default Tarjan SCC sharding (N > 20 bodies) emits non-module Captured/Captured.Shard_*/Proof.IdTree files (is_lean_module: false), forcing Expected.lean to drop module (verify.rs:2554) and causing Lean 4.34.1 to reject any module-mode Proof.lean (including fresh cargo anneal init / skill --example scaffolds and 01..04-style proofs) with error: cannot import non-'module' Expected from 'module', contradicting SKILL.md:102 ('Sharding is transparent for Proof unless Proof/Shard_.lean is authored').

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R4-A01 [P3] (anneal/skills/proof-scaling/SKILL.md:64): The pass1-bundled-modules list omits Anneal.SccSharding.InterprocCallModel even though it is registered in theory/bundle-manifest.json.
  • G2-R4-A02 [P3] (anneal/trusted/cargo-anneal/src/olean_cache.rs:25): The stated rationale that cached target shard .oleans are 'replayed by target-audit (0 new TCB assumptions)' is overstated for Capture-role Captured.Shard_* modules.
  • G2-R4-A03 [P3] (anneal/trusted/cargo-anneal/src/stage.rs:2605): The unsandboxed cache-skip test does not fail if either guard alone is removed, and the guard for SandboxMode::Auto falling back to no sandbox (ActiveSandbox::None) is untested.
  • G2-R4-A04 [P3] (anneal/trusted/cargo-anneal/src/stage.rs:5298): Unit test target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed does not seed a pre-existing disk cache entry to dynamically exercise the unsandboxed read-skip path.
  • G2-R4-A05 [P3] (anneal/trusted/rustc-capture/src/extract.rs:830): Comment says InlineAsm terminators contain no static ty::FnDef targets, but InlineAsmOperand::SymFn exists at the pinned rustc commit.
  • G2-R4-A06 [P3] (anneal/trusted/rustc-capture/src/lean.rs:161): Sharding turns on by default above 20 bodies and renumbers program.bodies and the Captured.body_N aliases, so an unchanged spec or proof that refers to bodies by position silently changes subject after upgrading.
  • G2-R4-A07 [P3] (anneal/trusted/rustc-capture/src/shard.rs:949): verify_shard_plan_file prints the staged plan_path in its drift remediation hint when invoked via cargo anneal verify --verify-shard-plan.

Executed Sandbox Probes

  • seat2 ci/check_skills.py in isolated bwrap (--unshare-all --clearenv --ro-bind): outcome=Passed with zero errors. (rc=0)
  • seat2 CI Python unittest suite (test_perf_tracking, test_perf_workflow, test_render_perf_dashboard, test_verify_zerocopy, test_prebuild_bundled_oleans) in isolated bwrap: outcome=Ran 58 tests in 16.937s: OK (57 passed, 1 skipped for unavailable /usr/bin/time). (rc=0)
  • seat2 verify_zerocopy.discover_units on candidate zerocopy/proofs in isolated bwrap: outcome=Discovered all 5 proof units cleanly (01 through 05_sharded_tryfrombytes). (rc=0)
  • seat3 repo_hygiene_static: outcome=passed
  • seat3 workflow_permissions_auth_secret_containment_checklist: outcome=not_applicable
  • seat3 bwrap_root_manifest_sha256: outcome=passed
  • seat3 bwrap_parity_and_ci_python_unittests: outcome=passed
  • seat3 bwrap_rust_tarjan_decision_tree_and_tamper_fuzz: outcome=passed
  • seat3 bwrap_lean4_seam_equivalence_and_module_import_check: outcome=failed

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from d3b0627 to 29f4c95 Compare November 25, 2026 08:02
@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (Post-#4237 Rebase + Lean 4 module-Mode Sharding Fix)

  • Comparison tuple (target_base, merge_base, head): 0fd98bf034e14dfcba33b171c43ea1c1517ccdf0, 0fd98bf034e14dfcba33b171c43ea1c1517ccdf0, 29f4c95d2621534279d5b7532d4466f40dff50c6 (tree: 4275cd0cede837acbc8e303bcf93dcdbec2d1534)
  • Review finding disposition (vs prior head d3b06271e0e3):
    • Resolved (anneal/trusted/rustc-capture/src/lean.rs): Updated render_shard_module, render_sharded_root (also preserving manifest.program.mir_profile_version() rather than hardcoding 1), and Proof.IdTree generation in both rustc-capture and cargo-anneal to emit Lean 4 module-mode files (@[expose] public section, is_lean_module: true), and enforced is_lean_module: true in parse_and_validate_capture_shards. Migrated zerocopy/proofs/05_sharded_tryfrombytes/ and sharded_capture_and_cache.rs to module mode, and added sharding_is_transparent_to_unsharded_module_mode_proofs confirming that standard unsharded module-mode proofs verify transparently when sharding activates.
    • Advisory cleanups: Documented Anneal.SccSharding.InterprocCallModel in anneal/skills/proof-scaling/SKILL.md, clarified olean_cache.rs module doc comments, and tightened the InlineAsm note in extract.rs.
    • Post-#4237 rebase: Preserved Profile v2 support across verify.rs, ir.rs (exhaustive Profile v2 ast_nodes), extract.rs, stage.rs, typed_capture.rs, zerocopy/proofs/README.md, and InterprocCallModel.lean (coreCall), and regenerated bundle-manifest.json (21 modules) and bundled_theory.json (--check passed).
  • Independent delta review: PASS (0 P0, 0 P1, 0 P2, 1 non-blocking P3 note about adding a dedicated Profile v2 + sharding unit test).
  • Local verification on 29f4c95d2621:
    • cargo clippy --locked --all-targets -- -D warnings: clean across cargo-anneal, cargo-anneal-tests, anneal-audit-tests, and +nightly-2026-05-31 anneal-rustc-capture
    • Unit tests: anneal-rustc-capture --lib 58/58, cargo-anneal --lib shard:: 2/2, olean_cache:: 10/10, target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed 1/1, anneal/ci test_perf_*.py 36/36
    • Integration tests: boundary_audit umbrella 1/1 & enforces_bundled_resources_parity_and_regular_files 1/1, cli -- shard 1/1, typed_capture -- tarjan_scc_sharding 1/1
    • anneal-audit --anneal-root anneal: PASS (19 Trusted modules, 90 Theory modules, 2,191 Trusted kernel declarations, 16,115 replayed declarations, 160 Vendor Miri closure modules / 39,088 replayed, Correspondence 3,039 replayed / 20,828 reachable, axioms=["propext","Classical.choice","Quot.sound"])
    • cargo test --locked -p cargo-anneal-tests --test suite -- sharded_capture_and_cache: 2/2 passed (sharding_is_transparent_to_unsharded_module_mode_proofs + sharded_cyclic_crate_verifies_cross_shard_dag_id_tree_and_incremental_cache, linux_bwrap)
    • python3 -B anneal/ci/verify_zerocopy.py: 5/5 passed (01..04 + verbatim 25-item module-mode 05_sharded_tryfrombytes selected_unit_verified, axioms=["propext"], elaboration_sandbox="linux_bwrap")
    • sha256sum --check --strict anneal/trusted/root-manifest.sha256: 4/4 OK; ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, git diff --check: clean
    • git merge-tree --write-tree origin/main HEAD: clean against 492f0b7e7826
  • Human review surface:
    • anneal/trusted/rustc-capture/src/{lean.rs,shard.rs,ir.rs,extract.rs,lib.rs,publication.rs} (Lean 4 module-mode shard emission, profile_version propagation, Tarjan SCC sharding, Profile v2 ast_nodes)
    • anneal/trusted/cargo-anneal/src/{shard.rs,verify.rs,stage.rs,olean_cache.rs,cli.rs} (is_lean_module: true enforcement, Proof.IdTree parity, sandbox-gated target shard OleanCache, shard-plan)
    • anneal/theory/Anneal/SccSharding/{BinChunkTree,InterprocCallModel,InterprocCallCanary}.lean
    • zerocopy/proofs/05_sharded_tryfrombytes/ and anneal/tests/cargo-anneal/tests/suite/sharded_capture_and_cache.rs

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from 29f4c95 to e6f6d65 Compare November 25, 2026 12:26
@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (Post-#4250 Rebase)

  • Comparison tuple (target_base, merge_base, head): 5614acd991564099e39db9d3c1f74ab4185483a4, 4b2791214e2f02de47397dc3f5bc98c8e78f88d6, e6f6d653451f60bef1227be9a2c12e0f33219c2d (tree: 06d35ccebadda05736142901256ae5110c291bfb)
  • Delta vs prior head (29f4c95d2621): Rebased cleanly onto origin/main after #4250 (4b2791214e2f, retiring monolithic Anneal.lean): dropped the obsolete theory/Anneal.lean edit (0 bare import Anneal lines; Anneal.SccSharding stays a dedicated domain umbrella), kept both #4246's Profile v2 units (06_*, 08_*) and 05_sharded_tryfrombytes in zerocopy/proofs/README.md, and regenerated bundle-manifest.json (23 modules) and bundled_theory.json (--check passed). Zero Lean or Rust semantic changes beyond the prior verified 29f4c95d2621 head.
  • Independent delta review: PASS (0 P0, 0 P1, 0 P2, 1 non-blocking P3 note about adding a dedicated Profile v2 + sharding unit test).
  • Local verification on e6f6d653451f:
    • anneal-audit --anneal-root anneal --require-correspondence: PASS (19 Trusted modules, 99 Theory modules, 2,191 Trusted kernel declarations, 18,611 replayed declarations, 160 Vendor Miri closure modules / 39,088 replayed, Correspondence 3,083 replayed / 21,094 reachable, axioms=["propext","Classical.choice","Quot.sound"])
    • cargo test --locked -p anneal-audit-tests --test boundary_audit -- theory_umbrella_and_manifest_exclude_canaries_and_match --exact: 1/1 passed
    • cargo test --locked -p anneal-audit-tests --test boundary_audit -- enforces_bundled_resources_parity_and_regular_files --exact: 1/1 passed
    • cargo test --locked -p cargo-anneal --lib: target::tests 18/18, shard:: 2/2, olean_cache:: 10/10
    • python3 -B -m unittest discover -s anneal/ci -p 'test_perf_*.py': 37/37 OK
    • python3 -B anneal/ci/verify_zerocopy.py --unit 05_sharded_tryfrombytes: selected_unit_verified (60.3s, axioms=["propext"], elaboration_sandbox="linux_bwrap") on verbatim 25-item zerocopy/src/ targets
    • sha256sum --check --strict anneal/trusted/root-manifest.sha256: 4/4 OK; ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, git diff --check: clean
  • Human review surface:
    • anneal/trusted/rustc-capture/src/{lean.rs,shard.rs,ir.rs,extract.rs,lib.rs,publication.rs}
    • anneal/trusted/cargo-anneal/src/{shard.rs,verify.rs,stage.rs,olean_cache.rs,cli.rs,bundled_theory.json}
    • anneal/theory/{bundle-manifest.json,Anneal/SccSharding.lean,Anneal/SccSharding/{BinChunkTree,InterprocCallModel,InterprocCallCanary}.lean}
    • zerocopy/proofs/{README.md,05_sharded_tryfrombytes/} and anneal/tests/cargo-anneal/tests/suite/sharded_capture_and_cache.rs

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 5)

  • Identity: multi:cf81f0e51aeff036a58ccf0b42d4f52adeaf255e:e6f6d653451f60bef1227be9a2c12e0f33219c2d (base=cf81f0e51aef, head=e6f6d653451f, tree=06d35ccebadd)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 36 inspected, 0 inapplicable, 0 blocked (of 36 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 1 2012s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 1660s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 1445s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R5-01 P2 1 (seat1) static_verified anneal/trusted/cargo-anneal/src/stage.rs:5839 The regression test for the unsandboxed target-shard cache gate passes even if the gate at stage.rs:2706 is deleted, because its module order contains no bundled module, so the disk cache context is never created.

G2-R5-01 [P2] (anneal/trusted/cargo-anneal/src/stage.rs:5839, Pass 2 §3 (trusted/cargo-anneal) / General test adequacy, static_verified): The regression test for the unsandboxed target-shard cache gate passes even if the gate at stage.rs:2706 is deleted, because its module order contains no bundled module, so the disk cache context is never created.

  • Invariant: Security-relevant guards must have regression tests that fail when the guard is disabled (Code Review Rules: test adequacy and negative-test sensitivity). The claimed invariant (olean_cache.rs module docs; stage.rs:2704-2708) is that unsandboxed runs never read or write target-shard disk cache entries shared with sandboxed runs.
  • Evidence: In compile_lean_modules_parallel, cache_ctx is Some only if has_cacheable, which is computed with allow_target_cache_context = target_rejection && sandbox_mode != Unsandboxed (stage.rs:2530-2546). The test's order is [Proof.IdTree, Captured.Shard_000, Proof.Shard_000] (stage.rs:5903) with SandboxMode::Unsandboxed, so has_cacheable is false, cache_ctx is None, and prepare_module_cache returns CompileNeeded(None) before ever consulting allow_target_shard_cache (stage.rs:2706-2708). Replacing that guard with plain target_rejection still yields 3 compiles and no disk cache, so the test passes. In production the guard is load-bearing: target.rs:1195 compiles demand-driven bundled Anneal.* modules in the same batch, and the generated Proof.IdTree always imports Anneal.SccSharding.BinChunkTree when sharding is active, so cache_ctx is Some and only stage.rs:2706 keeps unsandboxed shard oleans out of the shared cache. Fix: add a bundled module (e.g. Trusted.MirAst or Anneal.SccSharding.BinChunkTree) to the test's order/sources/imports so cache_ctx is created, and keep asserting no target-shard entries are written or read.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R5-A01 [P3] (anneal/tests/cargo-anneal/tests/cli.rs:2495): The CLI --verify-shard-plan drift test uses a fake-capture stub that ignores --verify-shard-plan, exercising verify.rs's post-capture compare_shard_plan fallback rather than anneal-rustc-capture's pre-publication check.
  • G2-R5-A02 [P3] (anneal/theory/Anneal/SccSharding/BinChunkTree.lean:39): Doc comment wraps an inline-code span across two lines (same check warning in InterprocCallCanary.lean:298,399 and rustc-capture/src/extract.rs:1354).
  • G2-R5-A03 [P3] (anneal/trusted/cargo-anneal/src/cli.rs:302): Exit codes differ between verify --verify-shard-plan drift (exit 2) and shard-plan --check drift (exit 1), though both fail closed.
  • G2-R5-A04 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:2075): Passing the private staged copy work/expected-shard-plan.json to anneal-rustc-capture --verify-shard-plan causes capture's drift hint to cite the temporary staging path instead of the operator-supplied plan path.
  • G2-R5-A05 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:2478): The Human review surface block could not be checked: no Review Receipt or branch handoff was supplied, only the commit/PR body, which does disclose the wider target-shard olean cache scope.
  • G2-R5-A06 [P3] (anneal/trusted/rustc-capture/src/lean.rs:568): Body order and the body that entryDefId := 0 names now depend on --shard-* flags, which are not recorded in request_sha256 or in the receipt's shards manifest; replaying a receipt requires knowing those flags.
  • G2-R5-A07 [P3] (anneal/trusted/rustc-capture/src/shard.rs:758): Hygiene script flags missing upstream SHA citation note and a wrapped inline-code comment span, plus cross-crate ByteDecisionTree rendering duplication with cargo-anneal.

Executed Sandbox Probes

  • seat3 repo_hygiene_and_unicode_audit: outcome=passed
  • seat3 lean_template_hygiene_and_token_scan: outcome=passed
  • seat3 manifest_bundle_and_merge_tree: outcome=passed
  • seat3 zerocopy_unit_discovery_and_callgraph_check: outcome=passed
  • seat3 python_ci_unittests_bwrap: outcome=passed
  • seat3 probe_a_tarjan_and_decision_tree_rustc_bwrap: outcome=passed
  • seat3 probe_b_lean_olean_shards_and_utf8_bwrap: outcome=passed
  • seat3 probe_c_manifest_validation_and_ast_nodes_rustc_bwrap: outcome=passed
  • seat3 workflow_checklist_item_1_permissions_least_privilege: outcome=na
  • seat3 workflow_checklist_item_2_untrusted_triggers: outcome=na
  • seat3 workflow_checklist_item_3_secret_containment: outcome=na
  • seat3 workflow_checklist_item_4_release_environments: outcome=na
  • seat3 workflow_checklist_item_5_checkout_and_pinned_shas: outcome=na
  • seat3 workflow_checklist_item_6_script_injection: outcome=na
  • seat3 workflow_checklist_item_7_cache_artifact_trust: outcome=na
  • seat3 workflow_checklist_item_8_no_guard_relaxation: outcome=na

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from e6f6d65 to 9ffed1c Compare November 25, 2026 18:22
@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (Post-#4330/#4336 Rebase + Unsandboxed Shard-Cache Regression Fix)

  • Comparison tuple (target_base, merge_base, head): 81186ff9f212bb76b3c688dd24f5ff5eaa1244ac, 81186ff9f212bb76b3c688dd24f5ff5eaa1244ac, 9ffed1c23604c6002f680bc41763e596a78d0ca9 (tree: 77dd5339f78fcd138ffb304ffe0b2664e072d301)
  • Review finding disposition (vs prior head e6f6d653451f):
    • Resolved (anneal/trusted/cargo-anneal/src/stage.rs): Upgraded target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed to include bundled Anneal.SccSharding.BinChunkTree in the module batch (matching production sharded verification) so cache_ctx is created and the per-module allow_target_shard_cache guard is directly exercised: Run 0 populates only the bundled entry (1 v2 entry, 0 target shards), Run 1 hits the bundled entry while recompiling all 3 target shards, and Run 2 pre-seeds a valid Captured.Shard_000 cache entry via OleanCache::store_compiled and confirms unsandboxed elaboration refuses to read it (still compiles all 3 shards and writes 0 new entries). Verified empirically that disabling the allow_target_shard_cache guard causes the test to fail (4 != 1 v2 cache entries on Run 0).
    • Post-#4330 / #4336 rebase onto 81186ff9f212:
      • Preserved overflow_checks through reorder_bodies (Program::try_new_with_overflow_checks), render_sharded_root (overflowChecks := ...), run_capture_process (--overflow-checks forwarding and configuration.overflow_checks authentication), cargo_compilation / ShardPlanArgs, and cli.rs / shard.rs tests.
      • Added the | partialTuple _ exhaustiveness arm in Anneal/SccSharding/InterprocCallModel.lean for LocalSlot.partialTuple (stepStack continues to fail closed with .fault .unsupported).
      • Auto-merged anneal/skills/proof-scaling/SKILL.md, updated anneal/theory/bundle-manifest.json (34 -> 37 modules), and regenerated anneal/trusted/cargo-anneal/src/bundled_theory.json (--check passed).
  • Independent delta review: PASS (0 P0, 0 P1, 0 P2, 1 non-blocking P3 note about adding a dedicated Profile v2 + sharding unit test).
  • Local verification on 9ffed1c23604:
    • cargo clippy --locked -p cargo-anneal -p anneal-rustc-capture -p cargo-anneal-tests -p anneal-audit-tests --all-targets -- -D warnings: clean (0 warnings)
    • cargo test --locked -p anneal-audit-tests --test boundary_audit: theory_umbrella_and_manifest_exclude_canaries_and_match 1/1, enforces_bundled_resources_parity_and_regular_files 1/1
    • cargo test --locked -p anneal-rustc-capture --lib: shard:: + lean:: 12/12 (including sharded overflowChecks := false and overflowChecks := true propagation)
    • cargo test --locked -p cargo-anneal --lib: target::tests 18/18, shard:: 2/2, olean_cache:: 10/10, target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed 1/1 (plus empirical mutation kill verified)
    • cargo test --locked -p cargo-anneal-tests --test cli: 29/29
    • cargo test --locked -p anneal-rustc-capture-tests --test typed_capture: tarjan_scc_sharding_partitions_cyclic_calls_and_verifies_plan + overflow_checks_capture_every_optional_overflow_assert_under_both_panic_strategies 2/2
    • anneal/ci Python tests: test_perf_*.py passed, test_lean_template_hygiene.py passed; ci/check_skills.py passed
    • anneal-audit --anneal-root anneal --require-correspondence --json: PASS (21,503 replayed / 22,819 reachable / 2,213 kernel decls, correspondence 3,086/21,130, Vendor Miri 39,088, axioms=["propext","Classical.choice","Quot.sound"])
    • python3 -B anneal/ci/verify_zerocopy.py --unit 05_sharded_tryfrombytes: selected_unit_verified (115.35s, axioms=["propext"], elaboration_sandbox="linux_bwrap") on verbatim 25-item zerocopy/src/ targets
    • sha256sum --check --strict anneal/trusted/root-manifest.sha256: 4/4 OK; ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, git diff --check: clean
  • Human review surface:
    • anneal/trusted/cargo-anneal/src/stage.rs (upgraded unsandboxed target-shard disk-cache regression test)
    • anneal/trusted/rustc-capture/src/{lean.rs,shard.rs,ir.rs,extract.rs,lib.rs,publication.rs}
    • anneal/trusted/cargo-anneal/src/{shard.rs,verify.rs,olean_cache.rs,cli.rs,lib.rs,bundled_theory.json}
    • anneal/theory/{bundle-manifest.json,Anneal/SccSharding.lean,Anneal/SccSharding/{BinChunkTree,InterprocCallModel,InterprocCallCanary}.lean}
    • anneal/ci/{perf_budgets.json,test_perf_tracking.py,test_perf_workflow.py} and anneal/{skills/proof-scaling/SKILL.md,trusted/cargo-anneal/skills/cargo-anneal/SKILL.md}
    • zerocopy/proofs/{README.md,05_sharded_tryfrombytes/} and anneal/tests/cargo-anneal/tests/suite/sharded_capture_and_cache.rs

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 6)

  • Identity: multi:d5c1f12b6d2a6804ccb6b41f4ec3641875cd20ea:9ffed1c23604c6002f680bc41763e596a78d0ca9 (base=d5c1f12b6d2a, head=9ffed1c23604, tree=77dd5339f78f)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 36 inspected, 0 inapplicable, 0 blocked (of 36 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 701s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 1992s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed findings 1 1403s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R6-01 P2 1 (seat3) probe_confirmed anneal/trusted/rustc-capture/src/extract.rs:1307 resolve_local_callee_identity formats local lifetime-generic method callees using instance_identity (erased '_) while body_inner assigns Body.identity using item_identity (named 'a), silently dropping call edges and splitting Tarjan SCCs.

G2-R6-01 [P2] (anneal/trusted/rustc-capture/src/extract.rs:1307, Pass 2 §2 (trusted/rustc-capture), probe_confirmed): resolve_local_callee_identity formats local lifetime-generic method callees using instance_identity (erased '_) while body_inner assigns Body.identity using item_identity (named 'a), silently dropping call edges and splitting Tarjan SCCs.

  • Invariant: All intra-crate call edges returned by extract::body for captured local bodies must match the canonical Body.identity strings of those target bodies so compute_tarjan_sccs preserves strongly connected components and callee-first topological order.
  • Evidence: body_inner (extract.rs:1758-1801) captures uninstantiated defs whose generics are purely GenericParamDefKind::Lifetime under item_identity(tcx, def.to_def_id()), producing e.g. rust-path-v1::Wrap::<'a>::step_b and rust-path-v1::<Wrap<'a> as MyMarker>::mark. In resolve_local_callee_identity (extract.rs:1307-1331), ty::Instance::try_resolve(tcx, typing_env, def_id, args) succeeds when !args.has_non_region_param() and erases regions to ReErased; because !inst.args.is_empty() (e.g. raw_args_len=1), it returns instance_identity(tcx, inst) (rust-path-v1::Wrap::<'_>::step_b, rust-path-v1::<Wrap<'_> as MyMarker>::mark). Exact lookup node_to_idx.get(callee.as_str()) in anneal/trusted/rustc-capture/src/shard.rs:236 then drops those edges. Confirmed via rustc_private probe (CALLEE_EXIT=0). Lean soundness (ProgramVerified) is unaffected.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R6-A01 [P3] (anneal/ci/perf_budgets.json:103): The verified_units_count floor of 5 is below the 7 proof units present after this PR, so it would not catch the loss of up to two units.
  • G2-R6-A02 [P3] (anneal/docs/architecture.md:556): The architecture theory-module list and directory tree were not updated for theory/Anneal/SccSharding*.
  • G2-R6-A03 [P3] (anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs:130): The large-list balancing test now passes whether or not sharding is active, so the unsharded chunked-list path is no longer exercised end to end for captures over 20 bodies.
  • G2-R6-A04 [P3] (anneal/trusted/cargo-anneal/src/olean_cache.rs:21): Disk-cache reuse now covers Capture-role Captured.Shard_* .olean files, whose definitions are imported directly into the verdict environment, while the module doc still implies target-audit replay covers them.
  • G2-R6-A05 [P3] (anneal/trusted/rustc-capture/src/lean.rs:564): Sharded body order, and therefore what entryDefId := 0 and positional indices denote, depends on --shard-* flags that are not part of request_sha256, and the spec vacuity lint does not flag specs that use entryDefId or positions.

Executed Sandbox Probes

  • seat3 ci_unittest_targeted: outcome=passed
  • seat3 bundle_manifest_and_hygiene: outcome=passed
  • seat3 lean_syntax_and_trust_tier_scan: outcome=passed
  • seat3 bdt_and_tarjan_differential_probe: outcome=passed
  • seat3 ast_nodes_and_tag_probe: outcome=passed
  • seat3 rustc_private_callee_identity_probe: outcome=finding_confirmed
  • seat3 lean_bwrap_compile_boundary_probe: outcome=blocked_by_sandbox_limit

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from 9ffed1c to 277b86a Compare November 25, 2026 19:45
@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (Post-#4341 Rebase + Lifetime-Generic Callee Identity Fix)

  • Comparison tuple (target_base, merge_base, head): 63388fa55d0511df38a1c7d9fbc9c1601ca2d5ee, 63388fa55d0511df38a1c7d9fbc9c1601ca2d5ee, 277b86ac30d9117d990412a9ebf023e6781275b1 (tree: 717c4441497b55088574f5441ac9c98430b99d5b)
  • Review finding disposition (vs prior head 9ffed1c23604):
    • Resolved (anneal/trusted/rustc-capture/src/extract.rs): Replaced resolve_local_callee_identity with collect_local_callee_identities. When Instance::try_resolve resolves a local instance whose generic arguments are purely GenericArgKind::Lifetime (including inherent and trait impl methods on lifetime-generic types such as Wrap::<'a>::step_b and <Wrap<'a> as MyMarker>::mark), it now emits item_identity(tcx, inst.def_id()) (matching uninstantiated body_inner captures with named lifetimes) and, when !inst.args.is_empty(), also emits instance_identity(tcx, inst) (matching explicit --instantiate captures). Added tarjan_scc_sharding_preserves_lifetime_generic_method_and_trait_impl_edges in anneal/tests/rustc-capture/tests/typed_capture.rs verifying both mutual recursion clustering (has_cycle == true, cyclic_sccs == 1) and trait-impl callee-first ordering (callee_shards).
    • Post-#4341 rebase onto 63388fa55d05: Dropped checked-in anneal/trusted/cargo-anneal/src/bundled_theory.json (now generated in build.rs from anneal/theory/bundle-manifest.json), auto-merged anneal/trusted/cargo-anneal/src/lib.rs, and removed the stale / bundled_theory.json mention from the commit message. Zero .lean changes since 9ffed1c23604.
  • Independent delta review: PASS (0 P0, 0 P1, 0 P2, 1 non-blocking P3 note about adding a dedicated Profile v2 + sharding unit test).
  • Local verification on 277b86ac30d9:
    • cargo run --locked -p cargo-anneal --example regenerate_bundle -- --root . --check: exit 0
    • cargo clippy --locked -p anneal-rustc-capture -p anneal-rustc-capture-tests -p cargo-anneal -p cargo-anneal-tests -p anneal-audit-tests --all-targets -- -D warnings: clean (0 warnings)
    • cargo test --locked -p anneal-rustc-capture-tests --test typed_capture: tarjan_scc_sharding_preserves_lifetime_generic_method_and_trait_impl_edges + tarjan_scc_sharding_partitions_cyclic_calls_and_verifies_plan 2/2
    • cargo test --locked -p anneal-rustc-capture --lib: shard:: + lean:: 12/12
    • cargo test --locked -p cargo-anneal --lib: target::tests 18/18, shard:: 2/2, olean_cache:: 10/10, target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed 1/1
    • cargo test --locked -p cargo-anneal-tests --test cli: 29/29
    • cargo test --locked -p anneal-audit-tests --test boundary_audit: theory_umbrella_and_manifest_exclude_canaries_and_match, enforces_bundled_resources_parity_and_regular_files, admits_only_theory_bundle_manifest_and_rejects_deleted_theory_bundle 3/3
    • anneal/ci Python tests: test_perf_*.py passed, test_lean_template_hygiene.py passed; ci/check_skills.py passed
    • python3 -B anneal/ci/verify_zerocopy.py --unit 05_sharded_tryfrombytes: selected_unit_verified (59.83s, axioms=["propext"], elaboration_sandbox="linux_bwrap") on verbatim 25-item zerocopy/src/ targets
    • anneal-audit --anneal-root anneal --require-correspondence --json: carried over from 9ffed1c23604 (zero .lean changes; 21,503 replayed / 22,819 reachable / 2,213 kernel decls, correspondence 3,086/21,130, Vendor Miri 39,088, axioms=["propext","Classical.choice","Quot.sound"])
    • sha256sum --check --strict anneal/trusted/root-manifest.sha256: 4/4 OK; ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, git diff --check: clean
  • Human review surface:
    • anneal/trusted/rustc-capture/src/{extract.rs,lean.rs,shard.rs,ir.rs,lib.rs,publication.rs}
    • anneal/trusted/cargo-anneal/src/{stage.rs,shard.rs,verify.rs,olean_cache.rs,cli.rs,lib.rs}
    • anneal/theory/{bundle-manifest.json,Anneal/SccSharding.lean,Anneal/SccSharding/{BinChunkTree,InterprocCallModel,InterprocCallCanary}.lean}
    • anneal/ci/{perf_budgets.json,test_perf_tracking.py,test_perf_workflow.py} and anneal/{skills/proof-scaling/SKILL.md,trusted/cargo-anneal/skills/cargo-anneal/SKILL.md}
    • zerocopy/proofs/{README.md,05_sharded_tryfrombytes/}, anneal/tests/rustc-capture/tests/typed_capture.rs, and anneal/tests/cargo-anneal/tests/suite/sharded_capture_and_cache.rs

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — CLEAN (tier2a_core_tcb, Round 7)

  • Identity: one:4e27f9228880629176b58ab281734f449f7a8a5e:717c4441497b55088574f5441ac9c98430b99d5b:dc3964d133e91e0ac6470cf583ad69cfb097becb974ad320ee240fac83c73d22 (base=63388fa55d05, head=277b86ac30d9, tree=717c4441497b)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 35 inspected, 0 inapplicable, 0 blocked (of 35 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 603s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 1883s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 423s

No unresolved P0-P2 findings raised across completed seats.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R7-A01 [P3] (anneal/trusted/cargo-anneal/src/shard.rs:453): ByteDecisionTree construction and Lean rendering (~275 lines) are duplicated between rustc-capture/src/shard.rs and cargo-anneal/src/shard.rs.
  • G2-R7-A02 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:1): No Review Receipt / Human review surface block was present in the supplied PR metadata, so its completeness could not be verified (the commit body does disclose the cache-policy expansion and body reordering).
  • G2-R7-A03 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:907): CaptureProgram deserializes bodies as Vecserde::de::IgnoredAny rather than cross-checking capture.json body identities against capture_shards.json shards[*].identities.
  • G2-R7-A04 [P3] (anneal/trusted/rustc-capture/src/ir.rs:1368): Body.callees doc says callees are 'projected into capture_shards.json', but only per-shard callee_shards indices are emitted; raw callee identities are not.
  • G2-R7-A05 [P3] (anneal/trusted/rustc-capture/src/lean.rs:564): Body order, and so what entryDefId := 0 and positional Specs.property terms refer to, depends on --shard-* flags that are not in request_sha256, and the shard config values are not recorded in the receipt.
  • G2-R7-A06 [P3] (anneal/trusted/rustc-capture/src/lean.rs:635): render_shard_module doc places shard_bodies 'inside Proof/Shard_.lean with list literals <= MAX_LIST_CHUNK_LEN', but it is emitted in Captured/Shard_.lean as a balanced append over singleton [body_i] leaves.

Executed Sandbox Probes

  • seat3 Pass 1 repo-wide hygiene scan (modes, symlinks, submodules, Unicode/bidi, caches, TODO, Fuchsia headers, banned Lean tokens): outcome=passed
  • seat3 bwrap sha256sum --check --strict trusted/root-manifest.sha256: outcome=passed
  • seat3 bwrap python3 -B -s -m unittest discover -s ci -p 'test_perf_*.py': outcome=passed
  • seat3 bwrap python3 -B -s ci/test_check_pr_hygiene.py: outcome=passed
  • seat3 bwrap verify_zerocopy.discover_units + expected_unit_profile: outcome=passed
  • seat3 bundle-manifest.json SHA-256 verification: outcome=passed
  • seat3 Differential byte_list_tag vs Lean Trusted.MirSemantics.byteListTag: outcome=passed
  • seat3 bwrap rustc --edition 2024 adversarial ByteDecisionTree::build/eval probe: outcome=passed
  • seat3 bwrap lean 4.34.1 non-module file importing module-mode artifact: outcome=passed
  • seat3 Mandatory workflow permissions/auth/secret-containment checklist: outcome=not_applicable
  • seat3 Full Cargo test suite / lake build / live cargo anneal verify on 05_sharded_tryfrombytes: outcome=skipped_light_mode

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from 277b86a to b5623d1 Compare November 25, 2026 22:11
@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (Post-#4220/#4266/#4342/#4349 Rebase)

  • Comparison tuple (target_base, merge_base, head): 9fe014fb974e94c50fd69a3078c7034b60c3a561, 9fe014fb974e94c50fd69a3078c7034b60c3a561, b5623d1399548d21724182f2872d77a6abdd6752 (tree: b616ea58010453c6d6caf61035eaf6b72dcce6e8)
  • Rebase delta (vs Gate-2 Round 7 CLEAN head 277b86ac30d9):
    • anneal/trusted/cargo-anneal/src/cli.rs (#4220): Merged Inspect and ShardPlan subcommands, validation, dispatch, and CLI unit tests.
    • anneal/trusted/rustc-capture/src/{extract.rs,ir.rs,shard.rs} (#4266): Threaded callees through ExtractedBody::resolve into ir::Body::try_new_with_callees; added Self::Call and Self::SysrootCall arms to Terminator::ast_nodes; remapped Terminator::Call { callee, .. } indices through old_to_new inside Manifest::reorder_bodies prior to Program::try_new_with_overflow_checks validation so intra-crate call targets remain bound to the same bodies after callee-first sharding; added sharding_remaps_intra_crate_call_callee_indices_after_body_reorder unit test in shard.rs.
    • anneal/tests/cargo-anneal/tests/cli.rs (#4266): Bumped fake capture manifest schema_version from 4 to 5.
    • anneal/theory/Anneal/SccSharding/{BinChunkTree,InterprocCallModel,InterprocCallCanary}.lean, anneal/theory/bundle-manifest.json, zerocopy/proofs/05_sharded_tryfrombytes/Proof.lean (#4266): Added !Trusted.MirSemantics.bodyHasAnyCall body to BodyStaticIntrinsic and bodyStaticIntrinsic_of_ofList (so the BinChunkTree intrinsic bridge covers call-free bodies), added callsAdmitted_of_noCall and public bodyStaticAdmitted_and_noCall_of_intrinsic, threaded hNoCall into bodyVerified_of_safe and 05_sharded_tryfrombytes/Proof.lean, added | sysrootCall _ _ _ _ _ => rfl to InterprocCallModel.lean, updated InterprocCallCanary.lean FrameState struct literals for the new optional fields, updated stale comments/commit text, and refreshed bundle-manifest.json SHA-256 digests (37 modules).
  • Independent delta review: PASS (0 P0, 0 P1, 0 P2, 2 non-blocking P3 notes: Profile v2 + sharding unit-test coverage and mentioning the call-free intrinsic bridge / Call.callee remap in the commit body).
  • Local verification on b5623d139954:
    • preflight_syntax_check.py (4/4 SccSharding files): 0 violations; proof_health_scan.py --pass1 (4/4): 0 errors, 0 warnings
    • build_lean_dag.py --strict-warnings (Anneal.SccSharding, Anneal.SccSharding.InterprocCallCanary): 30/30 OK, 0 failed
    • cargo run --locked -p cargo-anneal --example regenerate_bundle -- --root . --check: exit 0
    • cargo test --locked -p anneal-audit-tests --test boundary_audit: theory_umbrella_and_manifest_exclude_canaries_and_match, enforces_bundled_resources_parity_and_regular_files, admits_only_theory_bundle_manifest_and_rejects_deleted_theory_bundle 3/3
    • python3 -B anneal/ci/verify_zerocopy.py --unit 05_sharded_tryfrombytes: selected_unit_verified (65.63s, axioms=["propext"], elaboration_sandbox="linux_bwrap") on verbatim 25-item zerocopy/src/ targets
    • anneal-audit --anneal-root anneal --require-correspondence --json: PASS (22,556 replayed / 23,875 reachable / 2,347 kernel decls, correspondence 4,116/22,526, Vendor Miri 39,088, axioms=["propext","Classical.choice","Quot.sound"])
    • On identical Rust/Python tree (f0d4eab2e8bd): cargo clippy --locked -p anneal-rustc-capture -p anneal-rustc-capture-tests -p cargo-anneal -p cargo-anneal-tests -p anneal-audit-tests --all-targets -- -D warnings (0 warnings), anneal-rustc-capture --lib 13/13, typed_capture 2/2, cargo-anneal --lib 38/38, cli 29/29, Python CI (test_perf_*.py, test_lean_template_hygiene.py, test_verify_zerocopy.py), ci/check_skills.py, ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, sha256sum --check --strict anneal/trusted/root-manifest.sha256 (4/4 OK), git diff --check clean
  • Human review surface:
    • anneal/trusted/rustc-capture/src/{extract.rs,ir.rs,lean.rs,shard.rs,lib.rs,publication.rs}
    • anneal/trusted/cargo-anneal/src/{cli.rs,stage.rs,shard.rs,verify.rs,olean_cache.rs,lib.rs}
    • anneal/theory/{bundle-manifest.json,Anneal/SccSharding.lean,Anneal/SccSharding/{BinChunkTree,InterprocCallModel,InterprocCallCanary}.lean}
    • anneal/ci/{perf_budgets.json,test_perf_tracking.py,test_perf_workflow.py} and anneal/{skills/proof-scaling/SKILL.md,trusted/cargo-anneal/skills/cargo-anneal/SKILL.md}
    • zerocopy/proofs/{README.md,05_sharded_tryfrombytes/}, anneal/tests/rustc-capture/tests/typed_capture.rs, and anneal/tests/cargo-anneal/tests/suite/sharded_capture_and_cache.rs

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — FINDINGS (tier2a_core_tcb, Round 8)

  • Identity: one:1c54a9f3bafed7632aa265eb3b2d228955201f31:b616ea58010453c6d6caf61035eaf6b72dcce6e8:824bb061d480965db51262d32dbed66959fb72b5a0b5854a509bd925d7fa5638 (base=9fe014fb974e, head=b5623d139954, tree=b616ea580104)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 35 inspected, 0 inapplicable, 0 blocked (of 35 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed findings 2 1440s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed findings 3 1337s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed findings 2 1366s

Deduplicated Findings

ID Sev Consensus Verification Location Summary
G2-R8-01 P1 3 (seat1, seat2, seat3) probe_confirmed anneal/trusted/cargo-anneal/src/verify.rs:2521 Generated Proof.IdTree is staged at generated/Proof/IdTree.lean with role proof, but inspect --verify-artifacts resolves non-Anneal proof-role sources under authored/, so retained evidence for every sharded run fails artifact verification.
G2-R8-02 P1 3 (seat1, seat2, seat3) probe_confirmed anneal/trusted/cargo-anneal/src/verify.rs:2958 Sharded verification adds root Receipt v3 fields capture_shards_sha256 and shards that the unchanged inspect schema treats as unrecognized, so default cargo anneal inspect rejects every sharded success receipt.

G2-R8-01 [P1] (anneal/trusted/cargo-anneal/src/verify.rs:2521, Pass 2 §3 (trusted/cargo-anneal), probe_confirmed): Generated Proof.IdTree is staged at generated/Proof/IdTree.lean with role proof, but inspect --verify-artifacts resolves non-Anneal proof-role sources under authored/, so retained evidence for every sharded run fails artifact verification.

  • Invariant: Cross-file contract inside trusted/cargo-anneal: every audit.sources entry in a success receipt must resolve to its retained source under the role-to-directory mapping used by inspect --verify-artifacts.
  • Evidence: Trigger: cargo anneal verify --artifacts <DIR> followed by cargo anneal inspect <receipt.json> --verify-artifacts <DIR> on any sharded verification run (> 20 bodies). verify.rs:2520-2528 writes Proof.IdTree to work.join('generated/Proof/IdTree.lean') with role: TargetRole::Proof; target.rs:1010-1021,1220-1230 retains non-bundled modules in audit.sources with role = 'proof'; retain_stage copies <DIR>/generated/Proof/IdTree.lean. Yet verify_retained_artifacts (inspect.rs:872-878) maps every role == 'proof' entry other than Anneal/Anneal.* strictly to authored/{mod_path}.lean (authored/Proof/IdTree.lean -> ENOENT), forcing exact_match = false and exit 1 even under --passive (inspect.rs:366-370). In addition, inspect.rs:818-828 hashes request.json and capture/capture.json but never hashes capture/capture_shards.json against capture_shards_sha256. Confirmed via bwrap cross-module contract check.

G2-R8-02 [P1] (anneal/trusted/cargo-anneal/src/verify.rs:2958, Pass 2 §3 (trusted/cargo-anneal), probe_confirmed): Sharded verification adds root Receipt v3 fields capture_shards_sha256 and shards that the unchanged inspect schema treats as unrecognized, so default cargo anneal inspect rejects every sharded success receipt.

  • Invariant: Cross-file contract inside trusted/cargo-anneal: receipts emitted by verify must validate under the same binary's default inspect policy, which fails closed on unrecognized root fields unless --passive is given.
  • Evidence: Trigger: verifying any crate/unit with > --shard-min-bodies (20) bodies, such as zerocopy/proofs/05_sharded_tryfrombytes/request.json (25 roots). verify.rs:2956-2960 inserts capture_shards_sha256 and shards into Receipt v3 (and testkit/src/assertions.rs added both fields). In core/inspect/schema.rs:688-1194, parse_success_receipt never visits either field, so root.collect_unrecognized(&mut unknown) (schema.rs:597) populates ['/capture_shards_sha256', '/shards']. Because default cargo anneal inspect runs --check (!args.passive, inspect.rs:357) with --unknown-fields=warn (inspect.rs:160-161) and evaluate_policy (schema.rs:456-469) rejects unrecognized fields in warn+check mode, default inspect exits 1, --unknown-fields=deny exits 2 (inspect.rs:327-332), and inspect --diff exits 1 or 2 (inspect.rs:270-282,302-315). Confirmed via bwrap contract extraction (UNRECOGNIZED_IN_SCHEMA: ['capture_shards_sha256', 'shards']) and grep returning 0 matches in inspect.rs and core/inspect/.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R8-A01 [P3] (anneal/ci/perf_budgets.json:103): Untouched docs still describe the verified-units floor as >= 4 after the budget was raised to 5.
  • G2-R8-A02 [P3] (anneal/trusted/cargo-anneal/src/olean_cache.rs:226): The head-bound Review Receipt lists touched surfaces but has no policy-relaxation line.
  • G2-R8-A03 [P3] (anneal/trusted/cargo-anneal/src/shard.rs:215): Several new fail-closed guards have no negative test.
  • G2-R8-A04 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:1015): reserved_proof_module does not reserve Proof.IdTree when sharding is inactive, allowing authored Proof.IdTree modules that later collide once body count crosses shard_min_bodies
  • G2-R8-A05 [P3] (anneal/trusted/rustc-capture/src/lean.rs:626): Shard budget flags change body order and which body entryDefId 0 names, but are not part of request_sha256 and are not recorded for unsharded runs.

Executed Sandbox Probes

  • seat3 static_hygiene_pass1: outcome=passed
  • seat3 git_diff_check_and_pr_hygiene: outcome=passed
  • seat3 ci_python_unittests: outcome=passed
  • seat3 verify_zerocopy_sharded_receipt_v3: outcome=passed
  • seat3 lean_module_vs_non_module_compat: outcome=passed
  • seat3 markdown_relative_links: outcome=passed
  • seat3 inspect_schema_and_artifacts_contract: outcome=failed
  • seat3 zerocopy_05_sharded_consistency: outcome=passed
  • seat3 rustc_shard_algorithm_probes: outcome=passed
  • seat3 lean_id_tree_splitlex_syntax: outcome=passed
  • seat3 workflow_permissions_checklist: outcome=inapplicable

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from b5623d1 to edf9845 Compare November 25, 2026 23:43
@joshlf

joshlf commented Nov 25, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (edf984558e51 on 11bfd2b07cf3)

Rebased onto origin/main (11bfd2b07cf3, incorporating #4335, #4267, and #4351), resolved the adjacent row merge in zerocopy/proofs/README.md, and addressed both Round 8 review findings for cargo anneal inspect support on sharded runs:

  • capture_shards_sha256 and shards in pure core/inspect: Added ReceiptShardsManifest and ReceiptShardEntry in core/inspect/schema.rs (re-exported from core/inspect/mod.rs), parsing and validating all 9 top-level /shards and 12 per-entry /shards/shards/{i} keys with nested collect_unrecognized, paired presence, scope agreement (crate/unit), is_lean_module == true, total_sccs/cyclic_sccs/scc_ids partitioning, contiguous global_def_id_range, strict DAG callee_shards, unique non-empty identities, selected index bounds, and audit.sources hash/role bindings for Proof.IdTree and every Captured.Shard_*. Extended core/inspect/diff.rs (TierB on capture_shards_sha256, TierC on shards) and core/inspect/render.rs across human, ledger, markdown, and json (leaving unsharded outputs byte-identical).
  • Retained artifact verification for sharded runs (inspect.rs): verify_retained_artifacts now hashes capture/capture_shards.json against capture_shards_sha256 and verifies strict-JSON parity against the receipt's shards manifest (failing closed on serialization error), maps Proof.IdTree (role == "proof") to generated/Proof/IdTree.lean when shards is present (preserving authored/Proof/IdTree.lean on unsharded runs), and checks generated/Proof/IdTree.lean and capture/Captured/Shard_*.lean even if absent from audit.sources.

Local Verification (on edf984558e51, plus live E2E on identical-semantics 8223bb133c90)

  • cargo check --locked --manifest-path anneal/Cargo.toml -p cargo-anneal --no-default-features --lib --target wasm32-unknown-unknown: PASS.
  • cargo clippy --locked --manifest-path anneal/Cargo.toml -p cargo-anneal -p cargo-anneal-tests --all-targets -- -D warnings: PASS (0 warnings; all 5 crates also verified clean on the parent tree).
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal --lib: 224/224 PASS (19/19 core::inspect::* re-verified on edf984558e51).
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal-tests --test inspect: 5/5 PASS on edf984558e51 (including enforce_pure_core_has_no_os_io and verify_artifacts_supports_sharded_proof_id_tree_and_capture_shards_json).
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal-tests --test cli: 29/29 PASS.
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal-tests --test suite -- sharded_capture_and_cache --test-threads=1: 2/2 PASS (250.11s, exercising live sharded verify --artifacts -> inspect --verify-artifacts --require-exact-artifacts --unknown-fields=deny across all 4 formats, tampering generated/Proof/IdTree.lean and capture/capture_shards.json, inspect --diff, and transparent unsharded module-mode proofs).
  • Real first-customer zerocopy/proofs/05_sharded_tryfrombytes/request.json verify --artifacts + cargo anneal inspect --verify-artifacts --require-exact-artifacts --unknown-fields=deny across human, ledger, markdown, and json: PASS (selected_unit_verified, untainted, linux_bwrap, ["propext"], 64/64 retained files verified, 57.64s).
  • cargo test --locked --manifest-path anneal/Cargo.toml -p anneal-audit-tests --test boundary_audit (3 theory/bundle parity tests): 3/3 PASS.
  • Python CI suites (test_perf_tracking, test_perf_workflow, test_verify_zerocopy, test_lean_template_hygiene, test_ci_workflow): 85/85 PASS.
  • ./ci/check_todo.sh, ./anneal/ci/check_todo.sh, sha256sum -c trusted/root-manifest.sha256 (4/4 OK), git diff --check, check_pr_hygiene.py: PASS (ok: true, 0 findings).
  • Independent pre-push review: PASS (0 P0 / 0 P1 / 0 P2).

Human review surface

  • anneal/trusted/cargo-anneal/src/core/inspect/{mod,schema,diff,render}.rs and anneal/trusted/cargo-anneal/src/inspect.rs (optional sharded Receipt v3 parsing/validation/diff/render and retained artifact verification; unsharded receipts remain byte-identical).
  • anneal/trusted/rustc-capture/src/{extract,ir,lean,lib,publication,shard}.rs, anneal/trusted/cargo-anneal/src/{cli,lib,olean_cache,shard,stage,verify}.rs, anneal/theory/Anneal/SccSharding*, and zerocopy/proofs/05_sharded_tryfrombytes/ (unchanged semantically from the prior revision; zerocopy/proofs/README.md keeps both 05_layout_add_scaled_metadata and 05_sharded_tryfrombytes).

@joshlf

joshlf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (d1f452938f39 on c69454f044c7)

Rebased cleanly onto origin/main (c69454f044c7, post-#4215):

  • cli.rs: Preserved #4215's { color, quiet, verbose } fields on Action::{Print, Verify, Inspect} alongside Action::ShardPlan.
  • verify.rs: Added --verify-shard-plan to validate_receipt_out_pre_stage's direct_inputs so --receipt-out cannot alias or overwrite a shard plan, preserved #4215's receipt-out candidate/originals aliasing guards and VerifyPhase::Capture reporting, routed run_capture_process compiler stderr via callback (session.write_compiler_stderr in verify, eprint! in shard-plan), and initialized shard/verify_shard_plan in verify::tests.
  • tests/cargo-anneal/tests/cli.rs: Kept both #4215's new tests and sharding_cli_guards_reserved_modules_missing_shards_and_shard_plan, passing --format json to its JSON-parsing verify checks and adding a --receipt-out / --verify-shard-plan aliasing regression check.

Local Verification (on d1f452938f39 / identical tree 4cab2e48e8fb)

  • cargo check --locked --manifest-path anneal/Cargo.toml -p cargo-anneal --no-default-features --lib --target wasm32-unknown-unknown: PASS (5.43s).
  • cargo clippy --locked --manifest-path anneal/Cargo.toml -p cargo-anneal -p anneal-rustc-capture -p cargo-anneal-tests -p anneal-audit-tests -p anneal-rustc-capture-tests --all-targets -- -D warnings: PASS (0 warnings).
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal --lib (core::inspect::, cli::, shard::, olean_cache::, verify::tests::, target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed): ALL PASS.
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal-tests --test inspect: 5/5 PASS.
  • cargo test --locked --manifest-path anneal/Cargo.toml -p cargo-anneal-tests --test cli: 34/34 PASS.
  • check_pr_hygiene.py --base c69454f044c7 --head d1f452938f39 --json: PASS (ok: true, 0 findings); git diff --check, ./ci/check_todo.sh, ./anneal/ci/check_todo.sh: PASS.
  • Prior live E2E sharded_capture_and_cache (2/2, 250.11s) and real zerocopy/proofs/05_sharded_tryfrombytes verify --artifacts + strict inspect (64/64 files, 57.64s) carry over with zero capture/Lean/inspect logic changes.
  • Independent pre-push review: PASS (0 P0 / 0 P1 / 0 P2).

Human review surface

  • anneal/trusted/cargo-anneal/src/{cli.rs,verify.rs} (post-#4215 merge resolution + --receipt-out/--verify-shard-plan aliasing guard), plus the core/inspect/ and sharding files summarized in the prior receipt.

@joshlf
joshlf force-pushed the joshlf-anneal-scc-sharding branch from edf9845 to d1f4529 Compare November 26, 2026 00:00
Partition large MIR captures (`N > shard_min_bodies`, default budget:
20 min / 20 max bodies, 2500 max AST nodes) into an acyclic
condensation DAG of Lean 4 `module`-mode `Captured.Shard_<k>` `.olean`
modules and prove whole-crate soundness compositionally at `O(log N)`
root proof depth in pure zero-TCB Lean theory, leaving
`anneal/trusted/lean/` and `anneal/trusted/audit/` untouched.

Capture sharding (`anneal/trusted/rustc-capture`):

- Exhaustively extract static intra-crate `ty::FnDef` call edges from
  MIR assign rvalues and call/tail-call/branch/assert/yield
  terminators (including diverging `target: None` calls) with pinned
  `rust-lang/rust` citations (`extract.rs`, `ir.rs`), and include
  Profile v2 IR variants plus rendered `Body.identity`
  `_root_.String.ofList` / `_root_.Char.ofNat` nodes in
  `Body::ast_nodes`.
- Compute permutation-invariant Tarjan strongly connected components in
  deterministic callee-first topological order, pack adjacent components
  up to `--shard-max-bodies` and `--shard-max-ast-nodes` while keeping
  multi-body recursive cycles together and marking single oversized
  cyclic/large SCCs (`shard.rs`). When sharding is active,
  `Captured.program.bodies` is reordered into canonical callee-first
  order (remapping intra-crate `Terminator::Call` callee indices) and
  `entryDefId := 0` names canonical body `0`, so sharded specs must
  identify targets by `Body.identity`.
- Emit Lean 4 `module`-mode `Captured/Shard_<k>.lean` per-shard modules,
  a `module`-mode balanced binary `Captured.lean` assembly (preserving
  `mir_profile_version` and `overflow_checks`), and
  `capture_shards.json` (`is_lean_module: true`) with SHA-256 digests,
  `callee_shards` DAG edges, `global_def_id_range`, and
  `id_tree_sha256` (`lean.rs`, `publication.rs`, `lib.rs`, `shard.rs`),
  so sharding stays transparent to `module`-mode proofs.

Zero-TCB theory bridge (`anneal/theory/Anneal/SccSharding*`):

- Add `Anneal.SccSharding.BinChunkTree` (re-exported by
  `Anneal.SccSharding` and registered in `bundle-manifest.json`):
  balanced `BinChunkTree` container, guaranteed `O(log N)`-depth
  `ByteDecisionTree` (`splitByte`, `splitTag`, `splitLex`) identity
  uniqueness checker (`allIdx`, `checkBodyIdentityAt`),
  `LocalBodyVerified`, `TreeLocalVerified`, non-unfolding root builders
  (`toList_branch`, `size_branch`, `wf_branch`, `allIdx_branch`), and
  `programVerified_of_shardedTree` / `crateTheorem_of_shardedTree`.
- Add `Anneal.SccSharding.InterprocCallModel` and
  `InterprocCallCanary` as standalone zero-TCB operational models of
  direct, cyclic, and mutually recursive `BinChunkTree` call dispatch
  (not yet bridged to `CrateTheorem` or `UnitTheorem` obligations), plus
  `splitTag`/`splitLex` `rfl` evaluation canaries.

Orchestration, receipt inspection, and first-customer coverage:

- Add `cargo anneal shard-plan` (`--write` / `--check`) and
  `--verify-shard-plan` drift checks across `cargo-anneal` and
  `anneal-rustc-capture` (`cli.rs`, `shard.rs`, `verify.rs`) and
  document the sharding workflow, Receipt v3 shard fields, and numeric
  `ShardPlan` v1 vs planned `nominal` mode in
  `trusted/cargo-anneal/skills/cargo-anneal/SKILL.md` and
  `docs/build-systems-and-receipts.md`.
- Validate `capture_shards.json` structural, `is_lean_module: true`,
  DAG, `total_sccs`, `cyclic_sccs`, `scc_ids` partition, and
  `oversized_scc` singleton invariants (`shard.rs`), generate
  `module`-mode `Proof.IdTree` identically across capture and
  verification, and record `capture_shards_sha256` and `shards` in
  Schema v3 receipts.
- Extend pure `cargo anneal inspect` (`core/inspect/{schema,diff,
  render}.rs`) to parse, validate, diff, and render
  `capture_shards_sha256` and `shards` (binding `Proof.IdTree` and
  `Captured.Shard_*` hashes against `audit.sources`), and update
  `inspect --verify-artifacts` (`inspect.rs`) to hash
  `capture/capture_shards.json` (with manifest parity) and resolve
  sharded `Proof.IdTree` under `generated/Proof/IdTree.lean`.
- Extend `OleanCache` (`olean_cache.rs`, `stage.rs`, `verify.rs`) beyond
  `TrustedBoundary` (`CacheKind::Inspector`) and bundled libraries to
  cache sandboxed target shard outputs (`Proof.IdTree`,
  `Captured.Shard_*`, `Proof.Shard_*`) with `v2` transitive import
  Merkle keys, skipping target shard reads/writes under unsandboxed
  elaboration (`SandboxMode::Unsandboxed` / `ActiveSandbox::None`) and
  keeping `--no-rebuild-bundled` fail-closed on inspector and bundled
  misses.
- Add regression tests in `tests/rustc-capture/tests/typed_capture.rs`,
  `tests/cargo-anneal/tests/{cli,inspect}.rs`,
  `tests/cargo-anneal/tests/suite/{anti_vacuity_and_e2e,
  sharded_capture_and_cache}.rs`, ratchet `anneal/ci/perf_budgets.json`
  `verified_units_count` from `4` to `5` (and update
  `test_perf_{tracking,workflow}.py` fixtures), plus add the verbatim
  25-item `module`-mode `zerocopy/proofs/05_sharded_tryfrombytes` unit
  and `anneal/skills/proof-scaling/SKILL.md` guidance.

Agent-authored-by: AI agent acting on joshlf's behalf
@joshlf

joshlf commented Nov 26, 2026

Copy link
Copy Markdown
Member Author

Authored by an AI agent acting on joshlf's behalf.

Review Receipt (7494a33fe588 on 06980c075893)

Rebased cleanly onto origin/main (06980c075893, incorporating #4354 and #4357) to resolve the adjacent-test append conflict at the end of anneal/trusted/cargo-anneal/src/core/inspect/diff.rs. Zero functional or code hunks changed relative to d1f452938f39 (kept both model_system_relation_transitions_classify_regressions_and_upgrades and diff_surfaces_capture_shards_sha256_and_layout_changes; anneal/ci/test_perf_tracking.py auto-merged cleanly).

  • Comparison tuple (target_base, merge_base, head, tree): 06980c075893b447808807c218a61b5e3b69ee91, 06980c075893b447808807c218a61b5e3b69ee91, 7494a33fe5882cc378dc123c592df34125e230b0, d6965bb384e5cb88c50b79478a40b35463f2a8c6
  • Local verification on 7494a33fe588:
    • git diff --check, check_pr_hygiene.py (ok: true, 0 findings), ./ci/check_todo.sh, ./anneal/ci/check_todo.sh: PASS
    • Python CI (test_perf_tracking.py, test_perf_workflow.py, test_verify_zerocopy.py): 59/59 OK
    • Pure-core check (cargo check -p cargo-anneal --no-default-features --lib --target wasm32-unknown-unknown): PASS
    • cargo clippy --all-targets -- -D warnings across all 5 Anneal workspace crates: 0 warnings
    • cargo test -p cargo-anneal --lib (core::inspect::, cli::, shard::, olean_cache::, verify::tests::, target_shard_disk_cache_skips_reads_and_writes_when_unsandboxed): 71/71 PASS
    • cargo test -p cargo-anneal-tests --test cli --test inspect: 34/34 and 5/5 PASS
  • Independent delta review: PASS (0 P0, 0 P1, 0 P2; verified clean rebase delta and bundle-manifest.json SHA-256 parity).
  • Human review surface: unchanged from the prior receipt (anneal/trusted/cargo-anneal/src/core/inspect/, anneal/trusted/cargo-anneal/src/{cli,inspect,lib,olean_cache,shard,stage,verify}.rs, anneal/trusted/rustc-capture/src/{extract,ir,lean,lib,publication,shard}.rs, anneal/theory/bundle-manifest.json, anneal/ci/{perf_budgets.json,test_perf_tracking.py,test_perf_workflow.py}, skills, and zerocopy/proofs/05_sharded_tryfrombytes/).

@joshlf joshlf left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Authored by an AI agent acting on joshlf's behalf.

Gate 2 Independent Cross-Family Review — CLEAN (tier2a_core_tcb, Round 9)

  • Identity: multi:f43546b35cb0b0a90ead160bc2c1fc0c750fed69:7494a33fe5882cc378dc123c592df34125e230b0 (base=f43546b35cb0, head=7494a33fe588, tree=d6965bb384e5)
  • Separation: author_family=agent vs. reviewer_family=multi
  • Coverage: 41 inspected, 0 inapplicable, 0 blocked (of 41 changed file(s))
Seat Family Role Status Verdict Findings Latency
seat1 claude-frontier-thinking tcb_and_api_critic completed clean 0 2309s
seat2 gemini-frontier-thinking tcb_and_spec_critic completed clean 0 1302s
seat3 gemini-executable-falsifier sandboxed_probe_runner completed clean 0 2027s

No unresolved P0-P2 findings raised across completed seats.

Non-blocking advisories (P3, not Gate 2 findings)

These notes do not block merge and do not require another Gate 2 round.

  • G2-R9-A01 [P3] (anneal/tests/cargo-anneal/tests/suite/anti_vacuity_and_e2e.rs:129): balances_large_captured_lists_through_lean_and_target_audit now runs the sharded path by default, so the unsharded balanced bodies_chunk_* path no longer has target-audit e2e coverage.
  • G2-R9-A02 [P3] (anneal/trusted/cargo-anneal/src/shard.rs:1): ByteDecisionTree and render_id_tree_module are duplicated across rustc-capture and cargo-anneal and must stay byte-identical; drift fails closed but adds maintenance risk.
  • G2-R9-A03 [P3] (anneal/trusted/cargo-anneal/src/verify.rs:1043): reserved_proof_module now reserves the Captured.* and Expected.* prefixes (a trusted rule tightening), but the commit/PR body does not mention it.
  • G2-R9-A04 [P3] (anneal/trusted/rustc-capture/src/lean.rs:628): Body order (and which body entryDefId := 0 names) depends on --shard-* flags that are not recorded in request_sha256 or the receipt, so positional or entryDefId-based specs and capture reproduction depend on unrecorded flags.
  • G2-R9-A05 [P3] (zerocopy/proofs/README.md:65): New unit 05_sharded_tryfrombytes reuses the 05_ prefix of the existing 05_layout_add_scaled_metadata.

Executed Sandbox Probes

  • seat3 Pass 1 root-manifest & bundle-manifest SHA-256 verification (bwrap): outcome=passed
  • seat3 Pass 1 git diff --check, check_pr_hygiene.py, and TODO/symlink/unicode scan (bwrap): outcome=passed
  • seat3 verify_zerocopy.discover_units & zerocopy/src target correspondence (bwrap): outcome=passed
  • seat3 CI Python unit tests: test_perf_tracking.py, test_perf_workflow.py, test_verify_zerocopy.py (bwrap): outcome=passed
  • seat3 ByteDecisionTree & render_id_tree_module parity and standalone rustc edge-case probe (bwrap): outcome=passed
  • seat3 TrustedBoundary import/tactic/attribute static check on SccSharding* & 05_sharded_tryfrombytes (bwrap): outcome=passed
  • seat3 Lean 4 module vs non-module cross-import probe under prlimit --nproc=64 (bwrap): outcome=inconclusive_env
  • seat3 Workflow permissions/auth/secret-containment checklist: outcome=not_applicable

@joshlf
joshlf added this pull request to the merge queue Nov 26, 2026
Merged via the queue into main with commit 85efba8 Nov 26, 2026
45 checks passed
@joshlf
joshlf deleted the joshlf-anneal-scc-sharding branch November 26, 2026 02:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

anneal Primary scope: Anneal verification stack (`anneal/` and `exocrate/`)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants