Registry Mirror
Skip to content

Conversation

@avrabe

@avrabe avrabe commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Closes #921. Additive to synth-wcet-v1; .text unchanged.

{"status":"declined","name":"f","reason":"unmodeled-op",
 "note":"op not classified by the cycle model","op":"I64Ldr","offset":8}

Both fields are optional and absent for every other reason, so existing consumers are unaffected.

Two design choices worth flagging

The doc comment was false

WcetDecline::UnmodeledOp claimed it was "never emitted in a released build (the classifier is exhaustive with no wildcard)". op_cost does have no wildcard arm — exhaustive in the compiler's sense — but many arms return Unmodeled deliberately: the i64 pseudo-ops and the whole MVE/Helium f32 family. Exhaustive over variants is not costed for every variant, and #921 is that difference showing up on the first real object. Corrected.

Measured, not assumed

I nearly shipped "it'll be the i64 family, timestamps are 64-bit" as fact. Testing it:

shape result
i64.load declines — I64Ldr
i64.add bounded
i64.ge_s bounded
i64.extend_i32_u bounded

The selector expands most i64 ops before the WCET pass sees them. Which op @avrabe's object actually trips is what the new field answers — on their object, not by inference from mine.

What caught the bug in the fix

Threading the site through function_wcet alone left op null in every real sidecar, because the CLI goes through the composer (wcet_compose). Unit tests on the patched path passed throughout. The end-to-end run found it, so the regression test is end-to-end too and red-first verified — reverting the composer patch reproduces the exact JSON from the issue and fails the test.

The test also refuses to pass over an empty set: if I64Ldr ever becomes costed, it fails loudly rather than silently asserting nothing.

clippy clean, 133 test suites green.

gale got 9 of 31 functions declined with {name, reason, note} and nothing else
— the second-largest category, actionable only by hand-bisecting the object.
Adds optional `op` + `offset` to the decline record, additive so existing
consumers are unaffected.

`op` is derived from Debug, not a hand-maintained table (no mirror to drift).
`offset` comes from the REAL encoder, the same source WcetLoopBound uses, and
is OMITTED rather than estimated when it cannot be computed — a drifted offset
is worse than none.

CORRECTS A FALSE DOC CLAIM: the variant said it was 'never emitted in a released
build (the classifier is exhaustive with no wildcard)'. op_cost indeed has no
wildcard, but many arms return Unmodeled deliberately — exhaustive over variants
is not costed for every variant.

Threading it through function_wcet alone left op null in every REAL sidecar,
because the CLI goes through the composer; the unit path passed regardless. The
end-to-end run caught it, so the regression test is end-to-end and red-first
verified: reverting the composer patch reproduces gale's exact JSON and fails.

Measured, not assumed: i64.load reproduces (I64Ldr); i64.add / i64.ge_s /
i64.extend_i32_u come out BOUNDED because the selector expands them first.

clippy 0, 133 test suites green.

Refs #921, #778
@codecov

codecov Bot commented Aug 7, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 94.73684% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/synth-cli/src/main.rs 0.00% 3 Missing ⚠️
crates/synth-backend/src/wcet.rs 97.50% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

avrabe added 2 commits August 7, 2026 07:13
The clippy and test-helper fixes were applied with a script AFTER the last
`cargo fmt` run, so the formatter never saw them. Format caught it.
@avrabe
avrabe enabled auto-merge (squash) August 7, 2026 11:38
@avrabe
avrabe merged commit 6c3d62a into main Aug 7, 2026
56 checks passed
@avrabe
avrabe deleted the fix/wcet-unmodeled-op-names-921 branch August 7, 2026 12:36
avrabe added a commit that referenced this pull request Aug 13, 2026
… (#957)

* chore(release): v0.56.1 — security patch for #953

One fix: rv32 `(memory 0)` no longer gets a 65532-byte bounds guard. See the
CHANGELOG entry for the mechanism; the short version is that `0` was used as
both a value and a sentinel, which is the #932 disease from v0.56.0 running the
other way.

All four surfaces bumped 0.56.0 -> 0.56.1 and verified by the gate #924 shipped:

    OK: path-dep pins + MODULE.bazel + Cargo.lock + npm/package.json all at 0.56.1

Regenerated, not hand-edited: artifacts/status.json, docs/status/FEATURE_MATRIX.md
(`claim_check.py --emit-status`), Cargo.lock (`cargo metadata`).

Gates on this branch, each read as a real exit code:

    cargo test --workspace     2742 passed / 0 failed
    frozen_codegen_bytes       10/10 bit-identical
    clippy -D warnings         exit 0, 0 diagnostics
    claim_check                43/43
    check_version_pins         0
    oracle_wiring_check        0  (--min-emulation-floor 295710)
    artifact_citation_check    0
    model_coverage_audit       0
    repo_metadata_check        0

The #953 oracle was re-run ON THIS BRANCH rather than trusted from the lane that
wrote it: 9/9, every access to a zero-byte memory traps, matching wasmtime.

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

* plan(v0.57): three issues were invisible to the plan — #935, #936, #944

Board audit found the anti-pattern I wrote INTO this plan two commits ago:
"an untriaged issue is invisible to the release plan and resurfaces as a
release-time surprise." Three open issues had no artifact, so the v0.57 scope I
just landed had a hole in it.

## #935 belongs in Tier 1 — it is the theme almost verbatim

`synth verify` reports verified rules and never the ones it applied and
DECLINED, so a consumer cannot compute a coverage denominator.

    Verification summary: 8 verified, 0 failed, 0 unknown

reads as complete. The same object contains 29 `i32.const`, which BIN-VERIFY
skips as a register operation WITHOUT REPORTING. "8 of 8" is really "8 of 8
computational rules, plus an unreported const rule whose Rocq theorem is
Admitted" — which is #933.

So the two compound: **#933 is the hole and #935 is what makes it invisible.**
Fixing only #933 leaves a consumer unable to see the next one; fixing only #935
honestly reports a gap that is still open. They land together, and #935 is the
cheaper half. Precedent that the shape works: #921/#922 turned an opaque
`unmodeled-op` into an actionable `{op, offset}`.

## #936 is a small ask with the number already known

gale re-ran `--emit-wcet` on a whole `gust:os` composite (31 functions) with
0.55.0: all 9 `unmodeled-op` declines resolve to exactly TWO opcodes —
`I64Const` (6) and `I64Str` (3) — plus 11 cascades behind them. Modelling two
opcodes moves 20 functions from "no bound" to bounded on a real OS composite.

Included BECAUSE the number is known: an optimization with a measured benefit and
a constraint it must not violate (the bound stays SOUND — tighter and wrong is a
regression).

## #944 is triage-first, deliberately `could`

98 branches on a verified isolation module, 56 no-provenance, 9 only-in-synth
(`cabi_realloc`, `tick`, `run_switch`). An object branch with no WASM origin is
an obligation nothing can discharge.

Scoped `could` because the 9 need CLASSIFYING before any schema change: if they
are all compiler-introduced (realloc shims, expansion-internal guards) the right
fix is a provenance record kind for compiler-origin branches, not pretending a
WASM origin exists. Deciding that is the work.

rivet OURS-errors 0; claim_check 43/43; citation check 0.

Refs #935, #936, #944

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
avrabe added a commit that referenced this pull request Aug 13, 2026
… denominator (#935) (#958)

* feat(verify): #935 full rule inventory — applied / verified / declined-with-reason

synth verify previously reported only the rules it verified; declined kinds
(Const/Local/shifts/unmodeled) were skipped WITHOUT reporting, so
'N verified, 0 failed, 0 unknown' read as complete while e.g. 29 i32.const
went unmentioned and no coverage denominator was computable.

- run_verification now returns the FULL per-function inventory: every applied
  op kind as verified/failed/unknown/declined, with occurrence counts, machine
  decline reasons (register-operation / immediate-shift-encoding /
  unmodeled-op), and the Rocq theorem a decline defers to (the #933 join key)
- per-function and module summaries carry the decline half of the denominator
- --emit-verify-report writes a synth-verify-v1 JSON sidecar (the wcet-sidecar
  precedent, #921/#922) for mechanical CI gating
- rule ids are Debug-derived WasmOp variant names (no hand table to drift)
- non-vacuity gate: verify_report_935 test builds a fixture with KNOWN declines
  and asserts they appear with real counts + that applied_rule_kinds equals
  the sum over all four statuses; wired into the fact-spec CI job

Refs #935 #933

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

* proof(#933): close i32_const_correct — normalize I32Const at the WASM model boundary (592 Qed / 2 Admitted)

The theorem was Admitted because it was FALSE AS STATED: it quantified over
raw un-normalized Z representatives (exec_wasm_instr (I32Const n) pushed
VI32 n raw) while the shipped MOVW+MOVT path necessarily produces the
register-normalized I32.repr (I32.unsigned n) (counterexample:
n = 2^32 + 0x10000). Closed via contract (a) of the documented T3 note —
argued, not silent, per the #166 no-weakening gate:

- WasmSemantics.v: I32Const pushes VI32 (I32.repr n). A wasm i32.const
  immediate IS a value of type i32 (the binary format decodes exactly 32
  bits — no real module carries a junk representative); the shallow
  I32.int := Z embedding admitted junk syntactically and the raw const push
  was the ONE remaining un-normalized injection point (every arithmetic op
  already quotients through repr/unsigned). In the Rust half normalization
  is inherent in the i32 type, so the model now matches what ships.
- Compilation.v: small-branch MOVW immediate is the value's bits
  I32.repr (I32.unsigned n) — harmonizing with the large branch (always
  value-derived) and with the shipped encoder (imm16 = value low bits,
  hardware zero-extends). Identity for every in-range n.
- CorrectnessSimple.v: i32_const_correct restated over the value the WASM
  machine actually pushes (I32.repr n) and QED — small branch via
  I32.repr_unsigned, large branch via the already-proven
  i32_const_large_reconstruct. Both changes are identities on the reachable
  domain, so no existing Qed about real programs weakens.

bazel test //coq:verify_proofs PASSES. Ledger + docs bumped together:
claims.yaml 592 Qed / 2 Admitted, CorrectnessSimple.v admits 1 -> 0;
coq/STATUS.md recount + T3 table row moved to the discharged list;
CLAUDE.md / README.md prose; status.json + FEATURE_MATRIX regenerated
(claim_check 43/43).

Closes #933

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

* style: cargo fmt on the #935 inventory code

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

---------

Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

wcet: unmodeled-op declines don't name the op — 9 of 31 functions blocked with nothing to act on

1 participant