Skip to content

[anneal] Capture Tier 2 structs, payload enums, arrays, and builtins - #4007

Open
joshlf wants to merge 1 commit into
joshlf-anneal-p2-t2a-adtsfrom
joshlf-anneal-p2-t2b-capture
Open

joshlf wants to merge 1 commit into
joshlf-anneal-p2-t2a-adtsfrom
joshlf-anneal-p2-t2b-capture

Conversation

@joshlf

@joshlf joshlf commented Nov 21, 2026

Copy link
Copy Markdown
Member

Human review surface

  • anneal/trusted/rustc-capture/src/{ir,extract,lean,capture}.rs and
    anneal/trusted/cargo-anneal/src/verify.rs
    :
    Bumps the typed capture schema (4 -> 5) and extracts/renders Tier 2
    StructTy, payload EnumTy (variant_fields, Single and Niche tag
    layouts validated against enumAdmittedCore), fixed-length Array types,
    ProjectionElem::{Downcast,Index,ConstantIndex},
    AggregateKind::{Tuple,AdtStruct,AdtEnum,Array}, Rvalue::{Aggregate,Repeat},
    Statement::SetDiscriminant, AssertKind::BoundsCheck (using
    rustc_hir::LangItem::PanicBoundsCheck),
    CoreBuiltin::{CheckedAdd,CheckedSub,CheckedMul,ToLeBytes,FromLeBytes},
    mir::Const::Ty scalar values (emitted by rustc for array lengths in
    BoundsCheck), and a closed sysroot allowlist for
    core::num::<impl {u,i}{8,16,32,64,128,size}>::{MIN,MAX,BITS}. Whole-crate
    scope now admits non-generic structs, payload enums, and non-generic inherent
    impl blocks while continuing to fail closed on crate-local const/AnonConst,
    union, Drop, generic ADTs, and unmodeled types.
  • anneal/theory/Anneal/BitVec.lean and
    anneal/trusted/cargo-anneal/src/bundled_resources.rs
    :
    Adds foundation-only (propext, Quot.sound) range_add_both_overflow_sound
    and range_add_sound lemmas and updates the regenerated bundled resources.
  • anneal/trusted/rustc-capture/tests/typed_capture.rs,
    anneal/trusted/cargo-anneal/tests/{mvp_e2e,integration}.rs, and
    anneal/trusted/cargo-anneal/tests/fixtures/
    :
    Adds Tier 2 capture tests (44/44), updates legacy Tier 1 struct/payload-enum
    fixture expectations to verify payload enums and Wrapper structs end-to-end
    while pinning Union / unreachable_unchecked / anneal:invariant refusals,
    and adds live mvp_e2e Tier 2 verification milestones (tier2_u64_range and
    tier2_make_identity, each with negative mutation checks).

Summary

  • Completes anneal-rustc-capture Tier 2 extraction and Lean rendering atop
    #3999 (T2a) in PR stack #3976.
  • Verifies two end-to-end Tier 2 #![no_std] milestones under cargo-anneal
    (linux_bwrap, exactType: true, replay: true, taint_reasons: [],
    axioms=["propext","Quot.sound"]):
    • Whole-crate U64Range::{new, max, add_range, mul_range} (structs, inherent
      methods, u64::MAX, overflowing_add, checked_mul -> Option<u64>,
      Discriminant, Downcast, and Anneal.BitVec range soundness).
    • Selected-unit make_identity(length: u32, level: u64, offset: u64) -> [u8; 12]
      (to_le_bytes, ConstantIndex array destructuring, 12-byte array
      aggregate, totality, and 8192-byte-aligned injectivity via
      Anneal.BitVec + Anneal.LeBytes).

Verification

  • [kernel-checked proof] anneal-audit --require-correspondence: PASS
    • Pass 1: 3 Trusted modules, 18 Theory modules, 2007 Trusted kernel
      declarations, 6906 total replayed declarations,
      axioms=["propext","Quot.sound"].
    • Pass 2: 160 Vendor Miri closure modules (38728 replayed declarations),
      Correspondence 3638 replayed declarations / 19453 reachable
      declarations, axioms=["propext","Classical.choice","Quot.sound"].
  • [real measurement] regenerate_bundle --check: PASS.
  • [real measurement] anneal-rustc-capture: 22/22 unit, 23/23
    compiler_session, 44/44 typed_capture, clippy --all-targets -- -D warnings.
  • [real measurement] cargo-anneal: 52/52 --lib, 52/52
    --no-default-features --lib, 14/14 cli, 5/5 sandbox_escape,
    7/7 mvp_e2e (incl. verifies_tier2_u64_range_and_make_identity_milestones),
    16/16 integration.
  • [real measurement] anneal-audit: 4/4 unit, 42/42 boundary_audit,
    31/31 target_audit.
  • [real measurement] ci/verify_starnix_e2e.py: PASS (baseline verified +
    zero and masked-identity mutations rejected in audit).
  • [real measurement] cargo clippy --locked (-D warnings),
    cargo publish --dry-run -p cargo-anneal, rustfmt --edition 2024 --config-path /dev/null --check,
    ./ci/check_todo.sh, ./ci/check_actions.sh, ./ci/check_job_dependencies.sh,
    ./ci/check_non_stable_version.sh, and
    sha256sum --check --strict trusted/root-manifest.sha256: PASS.

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

Extends `anneal-rustc-capture` (schema version 4 -> 5) to extract and
render Tier 2 structs, payload and niche-tagged enums, fixed-length
arrays, `Downcast`/`Index`/`ConstantIndex` projections, `Aggregate` /
`Repeat` / `SetDiscriminant`, `BoundsCheck` assertions, Tier 2 core
builtins (`checked_{add,sub,mul}`, `{to,from}_le_bytes`), and a closed
sysroot allowlist for `core::num::<impl {u,i}...>::{MIN,MAX,BITS}`.

Adds foundation-only (`propext`, `Quot.sound`) `range_add_sound` lemmas
to `Anneal.BitVec` and end-to-end Tier 2 verification fixtures covering
whole-crate `U64Range::{new,max,add_range,mul_range}` and selected-unit
`make_identity` totality and injectivity (with negative mutation tests).

Agent-authored-by: AI agent acting on joshlf's behalf
@joshlf
joshlf added this pull request to stack #3976 November 21, 2026 00:09
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 21, 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-21T00:13:18.854524Z 1738c03 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 (9b8262f) to head (1738c03).

Additional details and impacted files
@@                    Coverage Diff                     @@
##           joshlf-anneal-p2-t2a-adts    #4007   +/-   ##
==========================================================
  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.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants