Skip to content

chore: Shan-readiness — docs/AGENTS/.bazelversion + Verus quickstart doc#32

Merged
avrabe merged 1 commit into
mainfrom
chore/shan-readiness-cleanup
May 3, 2026
Merged

chore: Shan-readiness — docs/AGENTS/.bazelversion + Verus quickstart doc#32
avrabe merged 1 commit into
mainfrom
chore/shan-readiness-cleanup

Conversation

@avrabe
Copy link
Copy Markdown
Contributor

@avrabe avrabe commented May 1, 2026

Summary

Punch-list items from the second-pass "Shan reviewer" audit. Lands the in-progress Verus quickstart doc together with the doc hygiene needed for it to be honest. Companion to #31 (the Verus parse-error fix); this PR is doc/process only — no Rust source touched.

Changes

# File What
1 `AGENTS.md` Drop `nix develop --command` prefix from the four `bazel test` invocations (no flake.nix in the repo). Add a one-paragraph note about nix-build on PATH for rules_rocq_rust.
2 `.bazelversion` (new) Pin Bazel 9.1.0 (matches what bazelisk currently resolves to on Linux runners and locally on macOS). Without it, default would silently drift on the day of next release.
3 `docs/safety/verification-honesty.md` Append "Trusted code: `external_body`, `assume_specification`, `--no-cheating`" section. Closes the only real correctness gap — the doc was silent on Verus's trusted-base annotations. New table enumerates 133 `external_body` + 2 `assume_specification` calls per file (net_buf 36, pm 22, ipc 22, mmu 20, usage 18, thread_lifecycle 5, sched 4, poll 3, mpu 3).
4 `README.md` Anchor the headline "805 verified, 0 errors" claim with a footnote linking to verification-honesty.md and stating the number is gated by `formal-verification.yml`. No change to the number itself; PR #31 is the companion fix that gets the Verus job back green.
5 `docs/research/verus-quickstart-for-shan.md` (new) The hand-off doc for @arsene1995 (Shan) following microsoft/verus-proof-synthesis#45, with the two punch-list patches applied: `--verify-module` whole-crate-parse caveat + `assume_specification` listed under `--no-cheating`.

Audit cross-references

This PR addresses items from the punch list:

  • Item 1 (BLOCKER) — handled by fix(verus): paren-wrap struct literal in ring_buf ensures (CI red 8+ runs) #31 (separate PR; needs to land first or together for the README claim's footnote to stop being aspirational)
  • Item 2 (Doc warn that `--verify-module` parses whole crate) — applied to Shan doc + acknowledged via the parse-error footnote in verification-honesty.md
  • Item 3 (`--no-cheating` description missing `assume_specification`) — applied to Shan doc + full new section in verification-honesty.md
  • Item 4 (README line numbers into external verus.bzl) — disclaimer about line numbers already in the Shan doc
  • Punch-list "punch list" items 2-6 (this PR) — all applied

Test plan

🤖 Generated with Claude Code

…kstart

Punch-list items from the second-pass "Shan reviewer" audit. Lands
the in-progress quickstart doc together with the surrounding doc
hygiene needed for it to be honest:

1. AGENTS.md L107-121 — drop `nix develop --command` prefix from the
   four bazel test invocations. There is no flake.nix in the repo;
   the prefix was misleading. Replaced with plain `bazel test ...`
   plus a one-paragraph note that nix-build must be on PATH (and
   how to put it there) because rules_rocq_rust pulls Nix for
   toolchain resolution.

2. .bazelversion — new file pinning Bazel 9.1.0 (matches what
   bazelisk currently resolves to on Linux runners and locally on
   macOS). Without the pin, Bazelisk's default would silently drift
   the day a new release lands.

3. docs/safety/verification-honesty.md — append a "Trusted code:
   external_body, assume_specification, --no-cheating" section.
   Closes the only real correctness gap in the honesty story: the
   doc was silent on Verus's trusted-base annotations. New table
   enumerates 133 external_body instances + 2 assume_specification
   calls per file (net_buf 36, pm 22, ipc 22, mmu 20, usage 18,
   thread_lifecycle 5, sched 4, poll 3, mpu 3). Notes that today's
   CI does NOT pass --no-cheating, intentionally, and that a
   --no-cheating run would correctly fail until those trust units
   are discharged.

4. README.md L21 — anchor the headline "805 verified, 0 errors"
   claim with a footnote linking to verification-honesty.md and
   stating that the number is gated by the formal-verification.yml
   CI job (i.e., when that job is red, the number is stale until it
   goes green again). No change to the number itself; PR #31 is the
   companion fix that gets the Verus job back green.

5. docs/research/verus-quickstart-for-shan.md — new file. The
   hand-off doc for arsene1995 (Shan) following
   microsoft/verus-proof-synthesis#45. Includes the two table-cell
   patches from the punch list:
     - --verify-module: caveat that Verus parses the whole crate
       from src/lib.rs before isolating to the named module, so a
       parse error elsewhere poisons even targeted runs.
     - --no-cheating: now lists assume_specification alongside
       assume / admit / external_body, and points at the trusted-
       base inventory in verification-honesty.md.

Companion to PR #31 (which fixes the parse error in src/ring_buf.rs
that has had formal-verification.yml red on main since Apr 24).
This PR is doc/process hygiene only — no Rust source touched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@codecov
Copy link
Copy Markdown

codecov Bot commented May 2, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@avrabe avrabe merged commit 1efcca8 into main May 3, 2026
56 of 59 checks passed
@avrabe avrabe deleted the chore/shan-readiness-cleanup branch May 3, 2026 05:47
avrabe added a commit that referenced this pull request May 10, 2026
Pushed the wasm-cross-LTO experiment all the way to a buildable bench
ELF integrated via wasm-ld+arm-ar+linker-substitute. Discovered an
additional synth backend bug while attempting silicon measurement:

  synth's emitted memset/memcpy/memmove don't terminate correctly on
  Zephyr's startup `memset(bss, 0, sizeof(bss))` invocation. The chip
  hangs in memset+0x4c forever, bouncing between offsets 0x668 and
  0x67e in a tight inner loop. The synth disassembly reveals i64
  shift instructions (`subs.w r3, r2, #32; rsb r3, r2, #32;
  lsl.w r3, r1, r3`) lowered into what should be a byte-counter loop
  — same root cause as the u64-packed FFI return codegen issue
  documented earlier: synth's i64 codegen is incomplete.

End-to-end status:

  - wasm-ld static-merging: WORKS. shim.wasm.o + libgale_ffi.a → 1MB
    merged.wasm with z_impl_k_sem_give and gale_k_sem_give_decide both
    present.

  - synth inlining at merged-module scope: STRUCTURALLY WORKS. The
    output `z_impl_k_sem_give` body has zero bl gale_k_sem_give_decide
    instructions. Verified by disassembly. 138 bytes vs LLVM-LTO's
    82 bytes — 1.68x larger but inlined.

  - Bench integration: BUILDS. CMake bench builds with
    -DGALE_WASM_LTO_OVERRIDE_SEM_GIVE=1 + custom libgale_ffi.a +
    --allow-multiple-definition. Final ELF 219 KB FLASH, 66 KB RAM.

  - Chip boot: BLOCKED. PC stuck in synth-emitted memset. Workarounds
    via objcopy --weaken-symbol, --strip-symbol, --redefine-sym all
    failed to evict synth's broken memset bytes from the final ELF.

Three synth backend issues filed against pulseengine/synth, ordered:

  1. (blocker) memset/memcpy/memmove i64-codegen non-termination —
     prevents the merged-wasm bench from booting at all.
  2. u64-packed FFI return unpacking — ~50% of the LTO-parity size
     delta. Same i64-codegen root cause as #1.
  3. wasm linear-memory access lowering — ~20% of the size delta.
     Cosmetic compared to #1 and #2.

Plus one issue against pulseengine/loom:

  - Z3 SortDiffers panic in inline_functions pass on i64-heavy
    wasm modules. Without loom, the verified-LTO claim doesn't hold.

The structural claim — "wasm-cross-LTO via PulseEngine pipeline
dissolves the C↔Rust seam at wasm IR level" — is **proven by
disassembly**. The cyclical claim — "silicon timing matches LLVM-LTO"
— is **blocked on synth's memset codegen**. Neither is a fundamental
architectural barrier; both are well-scoped engineering work.

This commit only updates the NOTES with the integration findings.
The bench source is restored to clean state (the gale_sem.c
#ifndef edit was transient) and verified building unchanged at
27 KB FLASH at the canonical rustc-direct path.

Co-Authored-By: Claude Opus 4.7 (1M context) <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.

1 participant