Skip to content

RQ-59-FRESHNESS (#977): all 48 named stale-artifact sites converted — freshness coverage 7/58 -> 58/58 - #1028

Merged
avrabe merged 7 commits into
mainfrom
fix/freshness-guards-977
Aug 21, 2026
Merged

RQ-59-FRESHNESS (#977): all 48 named stale-artifact sites converted — freshness coverage 7/58 -> 58/58#1028
avrabe merged 7 commits into
mainfrom
fix/freshness-guards-977

Conversation

@avrabe

@avrabe avrabe commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

RQ-58-FLAKE's stated residual, closed: the 48 sites #1006 named as unable to notice a stale artifact are all converted (or, for shapes the guard does not fit, closed with the same discipline). Freshness coverage over the survey's 58 compile-then-parse sites goes 7/58 -> 58/58. No second guard was written — every conversion routes through artifact_guard (#1006), which grew exactly one delegating variant (compile_artifact_with_output, for gates that assert on the compiler's own stderr; compile_artifact now delegates to it).

How the sites were ranked

By what a stale read would RE-CERTIFY, the way frozen_codegen_bytes.rs re-certified the SHA-256 anchors:

  1. Flip/byte-identity gates first — their assertions COMPARE two artifacts (off vs on). A stale arm silently reduces the gate to comparing last run's bytes with itself: the rollback proof for a default-on lever is re-confirmed by evidence this run never produced. These are the CI-pinned opt-out proofs the North Star table leans on.
  2. Validator/attestation gates — VCR-VER-003's read-back records, the ProvenSafeBoundsChecker: elide software bounds checks using scry's proven-safe verdicts #901 elision attestation sidecar, the Parity benchmark: reproducible wasm→synth-AOT vs native-C→LLVM comparison — counter the 'wasm is ~40% slower' claim with measured cycles+bytes #735/Codegen: close the 3.9× size gap vs LLVM on the gust hot path (regalloc + addressing-mode folding) #390 measured pins. A stale read re-certifies a validator verdict or an attestation.
  3. Structure/linkability/DWARF/provenance gates — symbol/section/reloc shape claims.
  4. The helper-split trio — named structurally resistant in RQ-58-FLAKE (#977): the flake was a shared output path — and the silent direction was reading a STALE ELF and passing #1006; see below.
  5. The conformance suite and the feature-gated trio last: wast_compile.rs was the one file already checking .exists() (loud on the missing-file half), and the fact_spec trio needs the --features verify build to run its own oracle.

Batches, each with its oracle and the SILENT-direction demonstration

Every batch ends green with its own pinned evidence unchanged — that is the byte-identity oracle: the artifacts the gates read after conversion are the same bytes the pinned goldens describe. Nothing the compiler EMITS changed; frozen anchors are 10/10 in the full workspace run.

Batch Files (sites) Oracle Silent-direction demonstration
1 — flip gates base_cse_flip_468 (1), const_cse_reduction_242 (2), flag_flip_wave_242 (1), spill_realloc_242 (1), rv32_cmp_select_flip_472 (1), rv32_local_promo_flip_472 (1), volatile_segment_flag_543 (1), volatile_segment_phase2_543 (1), vcr_ver_001_gate_242 (1) pinned goldens unchanged (base_cse sha256 pair, const_cse FNV pair, no-grow + non-vacuity floors) freshness_guard_refuses_stale_flip_artifact_977 (base_cse_flip_468.rs)
2 — validator/attestation vcr_ver_003_addr_777 (2), proven_safe_bounds_901 (3), size_attribution_390 (1), parity_benchmark_735 (1), promotion_exhaustion_fallback_474 (1), wsc_facts_ingestion_494 (1) measured pins unchanged (parity 84 B, proven-safe 138/80/50 partition, promotion off≡on byte-identity, .wasm_data record bytes) freshness_guard_refuses_stale_validator_artifact_977 (vcr_ver_003_addr_777.rs)
3 — structure/linkability dwarf_debug_line_emit_394 (2), elf_tooling_637_656 (1), multi_memory_406 (1), heterogeneous_table_676 (1), cabi_arena_bind_418 (2), cabi_arena_realloc_linkability_418 (1), call_indirect_275_selfcontained (3), async_intrinsics_gate (1), provenance_reconciliation_396 (1), provenance_introduced_origin_944 (1) all symbol/section/DWARF/provenance assertions green; llvm-dwarfdump (independent parser) still verifies; the co-link test's REAL linker still links the guarded artifacts freshness_guard_refuses_stale_structure_artifact_977 (multi_memory_406.rs)
4 — helper-split trio, THREADED multi_sp_rebase_707 (1), static_downshift_678 (1), static_above_sp_739 (2) pinned structure numbers unchanged (addends 576/616/4200/0x10000C, bss 584/512/4096, slot vectors) freshness_guard_refuses_stale_reloc_artifact_977 (static_above_sp_739.rs)
5 — conformance suite wast_compile (10: the helper behind 20 tests + 9 inline sites) all 32 tests green (magic/e_machine/e_type/BL-resolution unchanged) freshness_guard_refuses_stale_conformance_artifact_977 (wast_compile.rs)
6 — feature-gated + cross-crate fact_spec_clamp/bounds/div_494 (3), linker_integration_test (synth-backend, 1) ran with the fact-spec CI job's own invocation (--features verify): 12/12 green incl. the flag-off ≡ baseline byte-identity gates covered by the guard's own always-run artifact_guard_* demos; the linker site is not a compile-then-parse (see below)

Each demonstration proves the counterfactual the way #1006 did: (1) plant a VALID artifact minted by that batch's own compile shape and assert it parses and carries the very thing the batch's gates assert on (.text, .wasm_data, .synth.wasm_mem_1, the __synth_wasm_data addend, the ARM e_machine) — i.e. the pre-conversion shape WOULD have passed on last run's bytes; (2) run a FAILING compile at that exact path; (3) require the guard to refuse naming the COMPILE (never the parser) and to leave NOTHING at the path. All five run in CI on every push, alongside the four artifact_guard_* guard-observation tests from #1006.

The structurally-resistant shape dissolved

#1006 left the trio (multi_sp_rebase_707, static_above_sp_739, static_downshift_678) because compile and read were split across helpers taking a &str path. The small contained change that closes it: every reader (bss_size, global_slots, wasm_data_addends, max_wasm_data_addend, has_baked_pair_in_window) now takes BYTES, and bytes are only handed out by a guarded compile. After this the split cannot recur in these files — a reader physically cannot open a path a previous run populated. No gate file was restructured beyond its own helpers.

Stated remaining boundary

  • Refusal-only sites are out of scope by the survey's own definition (a site = a compile whose artifact is READ BACK). Tests that expect a FAILING compile and assert only on exit/stderr keep their Output-returning helpers (multi_memory refusals, the static_* straddle/flag-honesty refusals, cabi bad-sig, call_indirect imports/skip-target, vcr_ver_003 span refusals). A few still name fixed /tmp paths, at which nothing is produced or read.
  • linker_integration_test.rs is not a compile-then-parse — a library API (generate_to_file) writes the file; there is no Command for the guard to wrap and duplicating the guard was refused. Closed with the same discipline the guard encodes: per-process-unique path + remove-first ahead of the write.
  • External-tool reads are by-path by nature: the dwarf helper and elf_tooling hand a PATH to llvm-dwarfdump / the real linker. The artifact is proven fresh (remove-first + status + exists/non-empty) at hand-out and stays in place for the tool; each path has a single writer in a single test.
  • Python harnesses unchanged, per RQ-58-FLAKE (#977): the flake was a shared output path — and the silent direction was reading a STALE ELF and passing #1006's audit: all five flagged were false positives, and the CI steps that produce their objects run under bash -e on ephemeral runners.

Gates

cargo fmt --all clean · cargo clippy --workspace --all-targets -- -D warnings clean · cargo clippy -p synth-cli --features verify --all-targets clean · cargo test --workspace TRUE exit 0 (146 green result lines; frozen anchors 10/10) · cargo test -p synth-cli --features verify --test fact_spec_* 12/12 · python3 scripts/claim_check.py claims.yaml 50/50 · python3 scripts/model_coverage_audit.py --check ok. No .wat added; no compiler source touched — only how harnesses READ artifacts changed, never what the compiler emits.

Refs #977

🤖 Generated with Claude Code

https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L

avrabe and others added 7 commits August 21, 2026 19:20
…y gates

Convert the 10 highest-stakes remaining compile-then-parse sites — the
flip-gate family whose assertions COMPARE two artifacts (off vs on): a stale
read there does not fail, it re-confirms last run's golden as this run's
rollback evidence.

Converted through artifact_guard (unique-per-call path + remove-first +
status/exists/non-empty, #1006 — no second guard written):
  base_cse_flip_468.rs, const_cse_reduction_242.rs (2 sites),
  flag_flip_wave_242.rs, spill_realloc_242.rs, rv32_cmp_select_flip_472.rs,
  rv32_local_promo_flip_472.rs, volatile_segment_flag_543.rs,
  volatile_segment_phase2_543.rs, vcr_ver_001_gate_242.rs.

artifact_guard grows compile_artifact_with_output (compile_artifact now
delegates to it) for spill_realloc_242's SYNTH_SPILL_REPORT stderr asserts —
same guard, same order, one implementation.

Oracle: all 9 files' gates pass with their pinned goldens UNCHANGED
(base_cse sha256 pair, const_cse FNV pair) — the artifacts read are
byte-identical to pre-conversion, so no emitted byte moved. Silent-direction
demonstration (freshness_guard_refuses_stale_flip_artifact_977): a planted
VALID ELF parses and carries .text (the old shape WOULD have passed), then a
failing compile at that path must be refused naming the compile — not the
parser — and must leave nothing at the path.

Refs #977

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
…tion gates

Convert 9 sites across 6 files whose stale read would re-certify validator or
attestation evidence:
  vcr_ver_003_addr_777.rs (gale #757 regression gate + a new compile_read for
    the three RV32 .wasm_data read-back tests; section_bytes(path) became
    section_from_bytes(bytes) so nothing parses a path a previous run may
    have populated; the stderr-only compile() stays for refusal tests that
    never read an artifact),
  proven_safe_bounds_901.rs (3 sites — the elision ATTESTATION sidecar
    derives its path from the elf path, so the unique elf path makes the
    sidecar fresh by construction; per-call artifacts removed after read),
  size_attribution_390.rs, parity_benchmark_735.rs,
  promotion_exhaustion_fallback_474.rs, wsc_facts_ingestion_494.rs.

Oracle: all 6 files green with their MEASURED pins unchanged (parity 84 B /
232 B pins, size-attribution pins, proven-safe partition costs 138/80/50,
promotion-off byte-identity) — the artifacts read are the same bytes as
before the conversion. Silent-direction demonstration
(freshness_guard_refuses_stale_validator_artifact_977): a planted VALID RV32
object parses and carries .wasm_data (the old path-based shape WOULD have
re-confirmed last run's records), then a failing compile at that path must
be refused naming the compile and must leave nothing behind.

Refs #977

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
…lity gates

Convert 14 sites across 10 files whose stale read would re-confirm ELF
structure, DWARF, linkability, or provenance evidence:
  dwarf_debug_line_emit_394.rs (2 — the shared compile helper keeps its
    fixed-path signature but goes remove-first + guarded, leaving the
    artifact in place for the llvm-dwarfdump oracle; the self-contained
    honest-fail site gets a unique path),
  elf_tooling_637_656.rs (guard inside the path-returning helper — the
    co-link test's REAL linker consumes the returned path, so the artifact
    is proven fresh before it is handed out and stays in place),
  multi_memory_406.rs (new guarded compile_read for the two green
    structure tests; the refusal-only compile() stays),
  heterogeneous_table_676.rs, cabi_arena_bind_418.rs (2 + mixed inline),
  cabi_arena_realloc_linkability_418.rs, call_indirect_275_selfcontained.rs
  (3 read-back sites; the two refusal sites never read an artifact),
  async_intrinsics_gate.rs, provenance_reconciliation_396.rs,
  provenance_introduced_origin_944.rs (the provenance SIDECAR derives its
  path from the now-unique elf path, so it is fresh by construction).

Oracle: all 10 files' gates green — symbol/section/DWARF/provenance
assertions unchanged, and the llvm-dwarfdump independent-parser gate still
verifies the emitted DWARF. Silent-direction demonstration
(freshness_guard_refuses_stale_structure_artifact_977): a planted VALID
relocatable object parses and carries .synth.wasm_mem_1 (the old shape
WOULD have passed), then a failing compile at that path must be refused
naming the compile and must leave nothing behind.

Refs #977

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
…plit trio

The three files #1006 named as structurally resistant — compile and read
split across helpers taking a &str path, so no scan could attribute a read
to its compile — turn out to be threadable as a small contained change:
convert every reader (bss_size, global_slots, max_wasm_data_addend,
wasm_data_addends, has_baked_pair_in_window) to take BYTES, and hand those
bytes out only from a guarded compile. After this the split shape cannot
recur in these files: a reader physically cannot open a path a previous run
populated.

  multi_sp_rebase_707.rs — compile() now returns guarded bytes (both tests
    are read-backs); 1 site.
  static_downshift_678.rs — new guarded compile_read for the three
    read-back tests; the straddle refusal keeps the Output-returning
    compile() (it never reads an artifact); 1 site.
  static_above_sp_739.rs — compile_read + the #746 i64 inline site; the
    flag-honesty refusal keeps compile(); 2 sites.

Oracle: all 12 tests green with their pinned structure numbers unchanged
(addends 576/616/4200/2060/0x10000C, bss 584/512/4096, slot vectors).
Silent-direction demonstration
(freshness_guard_refuses_stale_reloc_artifact_977): a planted VALID object
carries the asserted __synth_wasm_data addend (the old path-based readers
WOULD have re-confirmed it), then a failing compile at that path must be
refused naming the compile and must leave nothing behind.

Refs #977

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
… (wast_compile.rs)

The one file the v0.58 survey found already checking .exists() — but that
check only ever covered the MISSING-file half of the failure; a stale valid
ELF at the fixed temp path passed every structural check. Convert all 10
sites: compile_wast (the helper behind 20 conformance tests, now returning
guarded bytes) and the nine inline sites (unique-per-call paths + the
guarded read; each site's own status assert stays in place ahead of it).

Oracle: all 32 tests green — magic/e_machine/e_type/BL-resolution
assertions unchanged. Silent-direction demonstration
(freshness_guard_refuses_stale_conformance_artifact_977): a planted VALID
ELF passes the file's own magic and ARM e_machine checks (the old shape
WOULD have passed), then a failing compile at that path must be refused
naming the compile and must leave nothing behind.

Refs #977

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
…ate site

fact_spec_{clamp,bounds,div}_494.rs (3 sites): same contained conversion as
the other attestation gates — unique elf path + compile_artifact_with_output
(stderr keeps feeding the certificate/decline assertions). Verified with the
fact-spec CI job's own invocation: cargo test -p synth-cli --features verify
--test fact_spec_* — all 12 tests green, including the byte-identity gates
(flag-off ≡ baseline), so no emitted byte moved.

linker_integration_test.rs (synth-backend, 1 site): NOT a compile-then-parse
— the library API generate_to_file writes /tmp/test_linker.ld and the test
reads it back, so there is no Command for the guard to wrap and no helper
was duplicated. The class is closed with the same discipline the guard
encodes: per-process-unique path + remove-first ahead of the write, so the
read can only see this invocation's output.

Refs #977

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YJK5LZZEkV5smCY1jKn18L
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe
avrabe merged commit 2f3d859 into main Aug 21, 2026
61 checks passed
@avrabe
avrabe deleted the fix/freshness-guards-977 branch August 21, 2026 18:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant