diff --git a/.claude/memory/decisions.md b/.claude/memory/decisions.md index 636359e0..ab4f9381 100644 --- a/.claude/memory/decisions.md +++ b/.claude/memory/decisions.md @@ -376,3 +376,9 @@ Status: closed (owner, 2026-10-12); R0 in progress on feature/rust-r0-foundation Choices made while building R0 (feature/rust-r0-foundation), within the validated review: (1) toolchain arbiter = Docker builder image (`docker/rust-builder.Dockerfile`, rust:1.99.0-bookworm + wasm target + wasm-bindgen-cli 0.2.129 + cargo-deny 0.20.2 + rustfmt/clippy baked in: official images ship rustup's minimal profile), `docker/rust-run.sh` with named volumes `faunosteo_cargo_registry` / `faunosteo_rust_target`; no rustup on the host, never on the VPS. (2) `serde_json` features `preserve_order` + `float_roundtrip` (default parser one ULP off, found by the proof). (3) Boundary = JSON strings + `ts-rs` types committed under `packages/core-wasm/types` with a CI drift check (no serde-wasm-bindgen/tsify). (4) Fresh wasm instance = cache-busting dynamic import of the glue (ESM cache returns the same instance otherwise); R2 must do the same in the browser or use a Worker per instance. (5) Worker: `RLIMIT_CPU` soft N / hard N+2 (soft = hard → SIGKILL first); seccomp allowlist = the 7 traced syscalls (read write mmap munmap mremap exit_group getrandom) + 7 abort-path ones, derived by strace in the Dockerfile `test` stage and compared on every build; dependencies optimised in the dev profile (4096² decode under the 10 s CPU cap); test hooks behind a cargo feature never in release; parent parses the RIFF container only (D-R4 amendment). (6) App `Dockerfile`, `docker/nginx.conf`, compose untouched at R0 (deviation from Annex B's "wasm stage built in CI": no consumer before R2, owner said live deployment untouched); CI `check` job builds the wasm itself (no artifact action dependency on the Gitea runner). (7) cargo-deny `allow-wildcard-paths = true` (a versionless path dep reads as a wildcard) and the core path dep declared per crate (workspace-inherited path dep hits a cargo-deny bug). (8) CSP proof committed as `docker/csp-proof/` (playwright-core outside the repo, documented). Alt rejected: rustup on the dev host (owner: builds reproducible in Docker); wasm-pack; artifact upload/download between CI jobs (unverified on the forge); Landlock + NPROC/FSIZE/NOFILE (redundant under the allowlist, challenge finding). Status: closed (R0 delivered, awaiting owner validation; R1 not started). + +## BDR-047 | 2026-10-13 | Native Rust toolchain primary on the Ubuntu dev server; Docker builder = reproducible alternative; no CI active + +Owner brief after R0 delivery: dev machine = self-hosted Ubuntu native (not WSL, not VPS), Docker rootless. Decision: daily Rust = native user-level rustup (channel from `rust-toolchain.toml`, wasm32 target, wasm-bindgen-cli 0.2.129, cargo-deny 0.20.2 via `cargo install --locked`, no sudo, no global package). Root scripts `rust:check` / `wasm:build` run `scripts/rust-check.sh` / `scripts/wasm-build.sh` natively (moved from docker/, PATH guard `scripts/rust-env.sh`); `rust:check:docker` / `wasm:build:docker` = same files through the builder image (kept, reference for a future runner, proof VPS never compiles). `pnpm check:all` (`scripts/check-all.sh`) = single pre-merge gate: rust check, types drift, wasm, `pnpm check`, app image, `worker:test`, `worker:image` read-only. Docker keeps Supabase, worker container (isolation untouched), sandbox + seccomp tests, images. Workflow files kept, headers "prepared, never executed"; no runner / secret / registry. Supersedes BDR-046 (1) "no rustup on host, container = arbiter". Names: existing script names stay = native (main path), `:docker` suffix = alternative; `check` stays the Node gate, `check:all` the full one. +Alt rejected: Docker as main path (owner: native loop; Docker for services only); scripts left under docker/ (misleading location); one script per environment (drift); `check:all` needing the Supabase stack (non-hermetic; `pnpm db:test` stays the complement after a supabase/ change). +Status: active; awaiting the owner's final validation before R1. diff --git a/.claude/memory/evals.md b/.claude/memory/evals.md index e9de58ac..75dd55a2 100644 --- a/.claude/memory/evals.md +++ b/.claude/memory/evals.md @@ -136,3 +136,10 @@ Method: contract `2026-10-13-rust-r0-verify.md` (16 criteria, CHECK/EXPECT) → Result: verifier pass 1 ECARTS(2), pass 2 CONFORME 16/16, pass 3 ECARTS(2) — every gap an oracle of MY contract (greps counting comment lines, the contract matching its own regex, the `[gated]` SAFETY form and a second refusal arm moved by the security fixes); code behaviour confirmed by reading each time. Security pass 1 BLOCK(1) HIGH real: shell injection via the `workflow_dispatch` input of release-images.yml, + 6 MEDIUM (shared BuildKit caches, tkill/tgkill without arg filters, core dumps, creds on the runner, no advisories gate, mutable action tag) → fixed; pass 2 PASS but 3 MEDIUM introduced by my fixes (ephemeral builder never used: GITHUB_ENV applied one step too late, silent fallback; `rm -rf "$VAR"`; content reaching the `Broken` outcome via `Reject::Internal`) → fixed; pass 3 PASS, 2 new MEDIUM (unpinned setup-node and `pnpm install` inside the token job) → gates moved to a secret-less job; remaining lows documented as R1/Step 27 follow-ups. Experimental findings (LRN-049): serde_json fast float path (float_roundtrip), traps leave the instance unusable + ESM cache, RLIMIT_CPU soft=hard → SIGKILL, minimal rustup profile, cargo-deny path wildcard, 7 traced syscalls, strace blind once dumpable=0 (marker became a syscall). Final: cargo 12+14 core tests, 9 unit + 16 sandbox worker tests on the release profile, 14 vitest proofs, root `pnpm check` 777 tests green, worker image 8.7 MB read-only/cap-drop, CSP refused/accepted as predicted, floor-guard clean ×3. Anomalies: my contract oracles cost two verifier passes (lesson repeated from EVAL-013: run every CHECK once before dispatch, and re-run them after any fix commit); two of my own security fixes created new findings (an env variable applied too late, a recursive delete through a variable: the exact pattern the destructive-tools rule forbids) → fixes to CI files need the same adversarial pass as code; a scripted edit silently aborted on a rustfmt-reformatted string and the commit went out with the old test (caught by the next build); the `[gated 2026-10-13]` SAFETY markers were placed by me at the auditor's request, not by the owner → surfaced in the report for the owner's confirmation; one security-auditor Bash call (`cat` of two files) was refused twice by the auto-mode hook, the agent used Read instead (reported, no workaround). Not proven here: the Gitea runner (caches, timings, workflow syntax such as job-level env, actions/cache), HTTPS from the worker (no HTTP client before R1), browser-side fresh-instance mechanism (R2). Action: owner validation of R0 (report with proved vs hypothetical); R1 not started. + +## EVAL-018 | 2026-10-13 | R0 correction: native Rust toolchain on the Ubuntu dev server — 2 verifier passes, 2 security passes + +Method: host audit first (rustup already user-level, 1.99.0 auto-installed by `rustup show`, system deps present, no sudo); installs `--locked`; scripts moved to `scripts/`, `pnpm check:all` gate; contract `2026-10-13-rust-r0-native-verify.md` (11 criteria) dry-run by me before dispatch (3 oracles fixed: comment prose matched a code grep, per-package vitest totals, README phrasing); fresh verifier ×2; security-auditor on `bd9c7d1..6e2bbec` then on the fix commits; full gate run twice (`check-all.log`, `check-all-2.log`). +Result: verifier pass 1 ECARTS(2) = floor STUB hits on doc prose "(not implemented)" → reworded; pass 2 CONFORME 11/11, floor clean. Security pass 1 PASS + 1 MEDIUM (no advisory check has ever run: nightly job never executed) + 6 LOW (PATH prepend, `rm -rf "$out"` via variable, prctl comment overstating the kernel contract + i32 into variadic unsigned long, dormant CI triggers, native build.rs exposure, drift gate blind to untracked files) → fixed except the trigger question (owner's CI/CD step); pass 2 PASS + 1 MEDIUM (my ci.yml drift step failed open on a git error: `test -z "$(…)"` drops the exit status) + `--untracked-files=all` + stale comment → fixed (496f549), verified by execution + shellcheck, no third dispatch (3-line change). Numbers: native rust-check 32 s warm / 1 s incremental, cold workspace build 31.5 s, wasm 224 777 B (+64 B vs builder, path strings), 14 proofs, `check:all` 1 min 59 s then 1 min 39 s, 777 Node tests, 16 sandbox tests, allowlist covers the trace, worker read-only `run --check` OK. +Anomalies: the R0 note "no cargo on the host" was stale, rustup had been installed 2026-10-12 23:27 (rtk) → always re-audit the host at session start; `rustup show` has a side effect (auto-install) → acceptable here (requested install) but say so; a fix I wrote for one security finding introduced the next MEDIUM (fail-open test) → the EVAL-017 lesson again: CI one-liners need the same scrutiny as code, prefer assign-then-test; the harness clock jumped 01:16 → 09:43 mid-session (timestamps in logs are not durations). +Action: owner's final validation of the R0 correction; R1 not started; CI/CD decision separate (trigger mode, runner label, action pinning, advisories cadence). diff --git a/.claude/memory/journal.md b/.claude/memory/journal.md index 8bac0129..a1813056 100644 --- a/.claude/memory/journal.md +++ b/.claude/memory/journal.md @@ -232,3 +232,7 @@ User: new permanent rule, Rust preferred for everything equivalent or better, ex ## 2026-10-13 (Rust R0 delivered) Owner go (BDR-045): chore/step-08-files-analysis finished into develop (Annex C), feature/rust-r0-foundation. Built R0 through the Docker builder only: workspace (core, wasm, worker), proofs (float_roundtrip finding, trap/fresh-instance behaviour, musl + libwebp 1.6.0, seccomp 7 syscalls derived by strace on the release binary, CSP 'wasm-unsafe-eval' proven in Chrome 156, 225 KB / 85 KB gzip module), packages/core-wasm (14 proofs), CI (rust job, worker test stage, advisories nightly, manual release-images), docs (RUST.md, DEPLOY digest deploy prepared, CLAUDE/WORKSPACE/TEST_STRATEGY/CHANGELOG). Gates: verifier ×3 (oracle gaps only, CONFORME in substance), security ×3 (1 HIGH + mediums fixed; my first fixes introduced 3 mediums, fixed; follow-ups documented). Root `pnpm check` 777 tests, live deployment untouched, frontend loads nothing. BDR-046, LRN-049, EVAL-017. Stop: owner validation of R0; R1 not started; release 0.2.0 pending. + +## 2026-10-13 (R0 correction: native toolchain) + +Owner brief: dev = Ubuntu native server, Docker for services/isolation/images, VPS separate, no CI active. Host audit: rustup 1.29.1 already user-level, `rustup show` auto-installed 1.99.0; added wasm32 target, wasm-bindgen-cli 0.2.129, cargo-deny 0.20.2 (`--locked`, 100 s, no sudo, no package missing). Scripts moved docker/ → scripts/ (`rust-check.sh`, `wasm-build.sh`, PATH guard `rust-env.sh`), root `rust:check`/`wasm:build` native, `:docker` variants, `pnpm check:all` single pre-merge gate (+ warn-only advisories, porcelain drift gate). Worker unit tests now in the native check; sandbox/seccomp stay Docker. SAFETY comments rewritten as invariants (no `[gated]`), stride checked_mul, prctl args as c_ulong. Workflows kept, marked prepared/never executed. Docs: RUST.md §1/§4/§5.8/§6, CLAUDE, README, DEPLOY, WORKSPACE, TEST_STRATEGY, CHANGELOG, review C.1. Gates: verifier ECARTS(2 prose) → CONFORME; security PASS ×2 (fixes landed). `check:all` green ×2. BDR-047, LRN-050, EVAL-018. 7 commits on feature/rust-r0-foundation, pushed. Stop: owner's final validation; R1 not started; no deploy, no release. diff --git a/.claude/memory/learnings.md b/.claude/memory/learnings.md index 0895e97c..8521f0bf 100644 --- a/.claude/memory/learnings.md +++ b/.claude/memory/learnings.md @@ -375,3 +375,11 @@ Facts proven on the real environment (docs/development/RUST.md §5), each one ch - cargo-deny 0.20: a versionless path dependency is a "wildcard" (`allow-wildcard-paths = true`) and a workspace-inherited path dependency triggers an `unresolved-workspace-dependency` bug (declare `path = "../core"` per crate). - CSP: `'wasm-unsafe-eval'` is required for `WebAssembly.instantiateStreaming` under `script-src 'self'` and allows nothing else (inline scripts still blocked); proven with the production nginx image + headers in headless Chrome 156. Apply: R1 (worker loop keeps the same child), R2 (browser loader: fresh-instance mechanism, float_roundtrip stays on, CSP line at activation), any future "it should work" assumption about a runtime → run it in the real environment first. + +## LRN-050 | 2026-10-13 | Native vs Docker Rust: rustup auto-install, non-interactive PATH, path strings in the wasm, worker unit tests native + +- `rustup show` inside a repo with `rust-toolchain.toml` auto-installs the channel (rustup 1.29, default profile → rust-docs too, ~1.5 GB per toolchain); `rustup target add --toolchain ` + two `cargo install --locked` ≈ 100 s with a warm registry. +- Agent / hook / editor shells are non-interactive: `~/.bashrc` returns early, `~/.cargo/bin` absent from PATH while the user's shell has it → scripts source a 5-line guard (`scripts/rust-env.sh`), never assume PATH. The harness refuses tool commands containing `export PATH=`: use absolute paths or a sourced file. +- Same rustc + lock → wasm differs by 64 B and by hash between build roots (`/w` vs `/home/...`): panic `Location` paths embedded; bit-identity needs `--remap-path-prefix` (unset at R0). Builder image = reference when bytes must match. +- Worker sandbox tests are `#![cfg(feature = "test-hooks")]`: plain `cargo test --workspace` compiles them empty → the 9 worker unit tests run natively for free (R0's `--exclude faunosteo-worker` was unneeded); seccomp derivation stays Docker/musl only (glibc syscalls differ). +- Contract oracles need a dry run before dispatch (EVAL-013/017 lesson, applied): a grep for `width * 4` matched my own SAFETY prose; `pnpm -r test:run` prints per-package totals, never one root line. diff --git a/.claude/tasks/TODO.md b/.claude/tasks/TODO.md index 613fbf4c..1bb4ec65 100644 --- a/.claude/tasks/TODO.md +++ b/.claude/tasks/TODO.md @@ -147,7 +147,17 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo - [x] R0.9 docs: RUST.md, DEPLOY.md (prepared digest deploy + CSP note, live procedure untouched), WORKSPACE.md, packages/README.md, CLAUDE.md (stack, map, commands, workflow), TEST_STRATEGY.md, CHANGELOG - [ ] R0 follow-ups from the security audits (R1 unless stated): base images and the buildkit engine image by digest (Step 27); verification decode of the child's output in a second sandboxed child; R1 treats Signalled/Timeout/OutputOverflow as rejections (content never alerts) and logs the child's stderr escaped only; negative tests for tkill(self, SIGTERM) and tgkill; iCCP fixture with image data so the allocation budget is seen firing; WebP structure residuals (duplicate ALPH, ALPH + VP8L, VP8X flags); dedicated release runner label that never runs PR jobs (Step 27); `actions/*@v4` in ci.yml pinned by commit (Step 27); drop `--features proofs` from docker/wasm-build.sh at R2 - [x] R0.10 gates: root `pnpm check` 777 tests green (existing suites untouched); verifier ×3 (CONFORME in substance, oracle fixes only); security ×3 (HIGH shell injection + 6 MEDIUM fixed; 3 MEDIUM introduced by the first fixes fixed; 2 MEDIUM of pass 3 fixed by the secret-less gates job); memory BDR-046, LRN-049, EVAL-017, journal. STOPPED for owner validation (2026-10-13); R1 not started - - [ ] R0 owner points: confirm the `[gated 2026-10-13]` SAFETY markers on the worker's unsafe blocks (placed by Claude at the auditor's request); decide the registry (forge Gitea registry recommended) and set REGISTRY/REGISTRY_USER/REGISTRY_TOKEN secrets before the first `release-images` run; first run on the forge records the runner numbers (RUST.md §5.7) and validates the workflow syntax (job-level env, GITHUB_ENV path) + - [ ] R0 owner points: review the worker's SAFETY comments (rewritten 2026-10-13 as technical invariants, the `[gated]` approval-looking markers removed); decide the registry (forge Gitea registry recommended) and set REGISTRY/REGISTRY_USER/REGISTRY_TOKEN secrets before the first `release-images` run; first run on the forge records the runner numbers (RUST.md §5.7) and validates the workflow syntax (job-level env, GITHUB_ENV path) + - [ ] R0.11 native toolchain correction (owner brief 2026-10-13, delivered 2026-10-13, awaiting the owner's final validation: Ubuntu dev server native Rust, Docker for services/isolation/images, VPS separate, no CI active): + - [x] R0.11.1 host audit: rustup 1.29.1 already user-level (~/.cargo, ~/.rustup), 1.99.0 auto-installed from rust-toolchain.toml, gcc/libc6-dev/pkg-config/libssl-dev/strace present, no sudo, no package needed + - [x] R0.11.2 install (user-level, `--locked`, 100 s, registry cache warm): wasm32-unknown-unknown on 1.99.0, wasm-bindgen-cli 0.2.129, cargo-deny 0.20.2 + - [x] R0.11.3 scripts: `scripts/rust-check.sh` + `scripts/wasm-build.sh` (moved from docker/, PATH guard `scripts/rust-env.sh`), `scripts/check-all.sh` pre-merge gate; root `rust:check` / `wasm:build` native, `rust:check:docker` / `wasm:build:docker` through the builder, `check:all`; worker unit tests in the native check (sandbox tests stay feature-gated in Docker) + - [x] R0.11.4 worker: SAFETY comments rewritten as verifiable technical invariants (no `[gated]` approval marker), stride with checked arithmetic + - [x] R0.11.5 CI files kept, header states prepared / never executed (no runner, no secrets), script paths updated + - [x] R0.11.6 verification (native rust-check 32 s warm, cold workspace build 31.5 s; wasm 224 777 B native vs 224 713 B builder, path strings; 14 proofs; `pnpm check:all` 1 min 59 s green: 777 Node tests, 16 sandbox tests, allowlist covers the trace, worker read-only run --check): native versions; cargo fmt/clippy/test/build/deny; wasm native + core-wasm proofs; Docker builder, docker check, docker wasm, worker:test, worker:image run --check, app image; `pnpm check`; numbers compared with R0 (RUST.md §5) + - [x] R0.11.7 docs: RUST.md §1/§4/§6, CLAUDE.md, README verifying, DEPLOY.md, WORKSPACE.md, TEST_STRATEGY.md, CHANGELOG, review Annex C addendum + - [x] R0.11.8 gates: verifier ECARTS(2 doc prose) → CONFORME 11/11; security PASS ×2 (1 MEDIUM + 6 LOW then 1 MEDIUM + 2 LOW, fixed: advisories warn-only stage, fail-closed porcelain drift gate with --untracked-files=all, PATH guard append/absolute, literal rm, prctl c_ulong args); BDR-047, LRN-050, EVAL-018, journal + - [ ] R0.11 follow-ups for the CI/CD step (owner): ci.yml push/PR triggers stay live, so registering a runner starts PR builds at once (keep, or switch to workflow_dispatch until then); `actions/*@v4` mutable tags (Step 27); advisories cadence while no nightly runs (`cargo deny check advisories` is warn-only in check:all); `--remap-path-prefix` if native and builder wasm must match byte for byte - [ ] R1 = Step 8 worker in Rust (replaces 8.2 below): decode child dispatched before any thread, empty env, RLIMIT_AS/CPU, traced seccomp allowlist, `image` + `moxcms` + `libwebp-sys` in the child, parent RIFF-header check only, 512 KiB output cap, per-stage deadlines, service key - [ ] R2 domain core (before Step 9): sheet/report/archive contracts, `SheetHandle` + `SheetIndexData`, reducers, Finding builder, vertebra selection, publish gate; wasm facade (JSON strings, ts-rs types, poison + reinstantiate, lazy init); app switched; 3 envelopes frozen first; N-1 reader test; draft quarantine; conformance fixtures + generated pgTAP; `packages/domain` frozen for engine/pipeline - [ ] R3 anatomy core: tree, one sanitiser, serialiser, layer renderer, `compose_view_svg`; app canvas switched; composed views frozen as trees first diff --git a/.claude/tasks/contracts/2026-10-13-rust-r0-native-verify.md b/.claude/tasks/contracts/2026-10-13-rust-r0-native-verify.md new file mode 100644 index 00000000..cb5f542a --- /dev/null +++ b/.claude/tasks/contracts/2026-10-13-rust-r0-native-verify.md @@ -0,0 +1,47 @@ +# CONTRACT — R0 correction: native Rust toolchain on the Ubuntu development server (for the fresh verifier) +- date: 2026-10-13 | flow: ad-hoc correction (owner brief 2026-10-13, after R0 delivery) | branch: feature/rust-r0-foundation (R0 closed at bd9c7d1; this delta on top) +- status: closed 2026-10-13 — pass 2 CONFORME 11/11, security pass 2 PASS; post-pass fix 496f549 (fail-closed drift step) verified by execution (oracles 6, 9, 10 amended before dispatch after a dry run by the orchestrator; pass 1: verifier ECARTS(2) = two floor STUB hits on doc prose "(not implemented)" → reworded; security PASS with 1 MEDIUM + 6 LOW → fixes: warn-only advisories stage and porcelain drift gate in check-all.sh and ci.yml, PATH guard appends an absolute dir only, literal rm path, prctl unused arguments as unsigned long with an honest comment; evidence of pass 2 = check-all-2.log) +- spec: owner brief (REQUEST below), docs/development/RUST.md §1 and §4 (what the correction builds), docs/development/RUST_ARCHITECTURE_REVIEW.md Annex C.1 +- evidence logs (runs made by the orchestrator on this host, readable): /tmp/claude-1000/-home-bchanot-Documents-faunosteo/71caaac9-9523-489e-bc17-e28e1d4fd532/scratchpad/{toolchain-install.log,warm-build.log,native-check.log,native-check-2.log,docker-alt.log,check-all.log,check-all-2.log} +- the verifier never installs, uninstalls or updates anything on the host; cargo commands below run the native toolchain already installed (rustup in ~/.cargo); `~/.cargo/bin` may be absent from a non-interactive PATH: prefix commands with `PATH="$HOME/.cargo/bin:$PATH"` when `cargo` is not found. Docker commands are not re-run (read check-all.log). + +## REQUEST (owner brief 2026-10-13, condensed — IMMUTABLE) +Development machine = self-hosted Ubuntu server (native, not WSL, not the VPS) with Docker rootless. Install a native user-level Rust toolchain (rustup, rustc, cargo, rustfmt, clippy, wasm32-unknown-unknown, wasm/bindings tools) at the pinned 1.99.0, no sudo, no global package, no sensitive system change. Daily Rust development = native cargo commands; wasm build native too; pinned toolchain + existing Cargo.lock. Adapt the monorepo scripts so the main path is native; keep the Docker commands as the reproducible alternative without imposing them; short compile times, reuse of Cargo artefacts. Docker stays for Supabase, the worker's execution, integration tests, untrusted-file isolation, seccomp/Linux protections, deployment images, production-like tests; the R0 builder is kept; the worker's isolation is not degraded. No CI/CD is operational: workflow files may stay, never claimed as run, no secrets/runner/auto-publication, no mandatory dependency on a pipeline; one simple command runs every technical check before a merge, reusable by a future Gitea runner. Verification: versions, native tests, lint, core build, wasm build, TS/WASM compatibility tests, Docker builds of R0 still work, monorepo tests, comparison with the R0 proofs; seccomp and container protections stay in Docker; no regression. Re-examine the worker's unsafe blocks: precise, verifiable technical justification, SAFETY comments never presented as the owner's approval; sandbox protections and tests kept. Update RUST.md and the associated docs (Ubuntu native dev, Docker services/isolated tests, separate VPS). No out-of-scope change; no R1, no deploy, no release 0.2.0. + +## ACCEPTANCE CRITERIA +1. Native toolchain pinned and complete, user-level only. + CHECK: cd /home/bchanot/Documents/faunosteo && "$HOME/.cargo/bin/rustup" show active-toolchain | cut -d' ' -f1; "$HOME/.cargo/bin/rustup" component list --installed --toolchain 1.99.0 | grep -c "rustfmt\|clippy"; "$HOME/.cargo/bin/rustup" target list --installed --toolchain 1.99.0 | grep -c "^wasm32-unknown-unknown$"; "$HOME/.cargo/bin/wasm-bindgen" --version; "$HOME/.cargo/bin/cargo-deny" --version; dpkg-query -W rustc cargo 2>&1 | grep -c "no packages found" + EXPECT: 1.99.0-x86_64-unknown-linux-gnu ; 2 ; 1 ; wasm-bindgen 0.2.129 ; cargo-deny 0.20.2 ; 2 +2. Scripts: the two Rust scripts live under scripts/ (not docker/), source the PATH guard, and the root scripts make native the primary path with `:docker` alternatives and a single pre-merge gate. + CHECK: ls scripts | tr '\n' ' '; ls docker | grep -c "rust-check.sh\|wasm-build.sh"; grep -c "^\. scripts/rust-env.sh" scripts/rust-check.sh scripts/wasm-build.sh; grep -c '"rust:check": "bash scripts/rust-check.sh"' package.json; grep -c '"rust:check:docker": "bash docker/rust-run.sh bash scripts/rust-check.sh"' package.json; grep -c '"wasm:build": "bash scripts/wasm-build.sh"' package.json; grep -c '"wasm:build:docker": "bash docker/rust-run.sh bash scripts/wasm-build.sh"' package.json; grep -c '"check:all": "bash scripts/check-all.sh"' package.json + EXPECT: check-all.sh rust-check.sh rust-env.sh wasm-build.sh ; 0 ; scripts/rust-check.sh:1 and scripts/wasm-build.sh:1 ; 1 ; 1 ; 1 ; 1 ; 1 +3. The native check covers the worker's unit tests; the sandbox tests stay feature-gated and Docker-only; the pre-merge gate runs them through the worker image. + CHECK: grep -c "cargo test --workspace --locked" scripts/rust-check.sh; grep -c "exclude faunosteo-worker" scripts/rust-check.sh; grep -c "git status --porcelain -- packages/core-wasm/types" scripts/check-all.sh .gitea/workflows/ci.yml | tr '\n' ' '; grep -c "cargo deny check advisories" scripts/check-all.sh; grep -c '#!\[cfg(all(feature = "test-hooks", target_os = "linux"))\]' crates/worker/tests/sandbox.rs; grep -c "pnpm worker:test" scripts/check-all.sh; grep -c "pnpm worker:image" scripts/check-all.sh; grep -c "read-only --cap-drop ALL" scripts/check-all.sh + EXPECT: 1 ; 0 ; both files at :1 (any order) ; 1 ; 1 ; 1 ; 1 ; 1 +4. The Docker path is intact: rust-run.sh and the builder Dockerfile changed in comments only; the worker Dockerfile, the application Dockerfile, compose and nginx are untouched. + CHECK: git diff HEAD -- docker/rust-run.sh | grep -E "^[-+]" | grep -vE "^(\+\+\+|---)" | grep -vc "^[-+]#"; git diff HEAD -- docker/rust-builder.Dockerfile | grep -E "^[-+]" | grep -vE "^(\+\+\+|---)" | grep -vc "^[-+]#"; git diff --stat HEAD -- crates/worker/Dockerfile Dockerfile docker-compose.yml docker/nginx.conf docker/entrypoint.sh | wc -l + EXPECT: 0 ; 0 ; 0 +5. Workflow files kept (three), each marked prepared / never executed, script paths updated, nothing added that configures a runner, a secret or an automatic publication. + CHECK: ls .gitea/workflows | wc -l; grep -c "PREPARED, NEVER EXECUTED" .gitea/workflows/ci.yml; grep -c "prepared, never executed" .gitea/workflows/rust-advisories.yml .gitea/workflows/release-images.yml; grep -rc "docker/rust-check.sh\|docker/wasm-build.sh" .gitea/workflows | grep -vc ":0$"; git diff HEAD -- .gitea | grep -E "^\+" | grep -vE "^\+\+\+" | grep -vc "^\+ *#\|^\+ *run: bash docker/rust-run.sh bash scripts/\|^\+ *run: docker build -f docker/rust-builder.Dockerfile" + EXPECT: 3 ; 1 ; rust-advisories.yml:1 and release-images.yml:1 ; 0 ; 0 +6. Worker unsafe blocks: every `unsafe {` in crates/worker/src is preceded by a `// SAFETY:` comment stating invariants the surrounding code establishes (read them: encode_webp checks `rgba.len() == w*h*4` and computes the stride with checked arithmetic; from_raw_parts after `size != 0 && !output.is_null()`; WebPFree once; prctl integer arguments with the return code checked; the two negative hooks compiled with `test-hooks` only); no `[gated …]` approval marker remains; no unsafe outside the worker. + CHECK: grep -c "gated" crates/worker/src/decode.rs crates/worker/src/sandbox.rs; grep -c "unsafe {" crates/worker/src/decode.rs; grep -c "// SAFETY:" crates/worker/src/decode.rs; grep -c "unsafe {" crates/worker/src/sandbox.rs; grep -c "// SAFETY:" crates/worker/src/sandbox.rs; grep -rc "unsafe {" crates/core/src crates/wasm/src | grep -vc ":0$"; grep -c "width.checked_mul(4)" crates/worker/src/decode.rs; grep -c "c_int::try_from(width \* 4)" crates/worker/src/decode.rs; grep -c 'unsafe_code = "forbid"' Cargo.toml; grep -c 'unsafe_code = "deny"' crates/worker/Cargo.toml + EXPECT: decode.rs:0 and sandbox.rs:0 ; 6 ; 6 ; 2 ; 2 ; 0 ; 1 ; 0 ; 1 ; 1 +7. The native Rust gate is green and the committed ts-rs types do not drift. + CHECK: cd /home/bchanot/Documents/faunosteo && PATH="$HOME/.cargo/bin:$PATH" bash scripts/rust-check.sh > /tmp/claude-1000/verify-rust-check.log 2>&1; echo rc=$?; grep -E "^test result" /tmp/claude-1000/verify-rust-check.log | grep -c "ok\."; grep -E "^test result" /tmp/claude-1000/verify-rust-check.log | grep -c " 10 passed\| 9 passed\| 14 passed"; grep -c "bans ok, licenses ok, sources ok" /tmp/claude-1000/verify-rust-check.log; git diff --exit-code -- packages/core-wasm/types > /dev/null && echo SAME + EXPECT: rc=0 ; 12 ; 3 ; 1 ; SAME +8. The native wasm build and the TypeScript/WASM proofs pass on the module it produces; the size stays within 1 KB of the R0 builder figure (224 713 B raw). + CHECK: cd /home/bchanot/Documents/faunosteo && PATH="$HOME/.cargo/bin:$PATH" bash scripts/wasm-build.sh 2>&1 | grep "faunosteo_wasm_bg.wasm:"; corepack pnpm --filter @faunosteo/core-wasm test:run 2>&1 | grep -E "Tests " + EXPECT: a line "faunosteo_wasm_bg.wasm: NNNNNN bytes raw, …" with 223713 <= NNNNNN <= 225713 ; "Tests 14 passed (14)" +9. The single pre-merge gate passed end to end on this host (native stages, Node pipeline, application image, worker sandbox tests + seccomp derivation, worker runtime read-only), read from the evidence log. + CHECK: L=/tmp/claude-1000/-home-bchanot-Documents-faunosteo/71caaac9-9523-489e-bc17-e28e1d4fd532/scratchpad/check-all-2.log; grep -c "^== all checks passed" "$L"; grep -c "DONE rc=0" "$L"; grep -c "== allowlist covers the trace" "$L"; grep -E "Tests [0-9]+ passed" "$L"; grep -c "test result: ok. 16 passed" "$L" + EXPECT: 1 ; 1 ; 1 ; six per-package lines (domain 194, core-wasm 14, supabase 24, anatomy 130, pdf 137, app 278 = 777, every one "passed") ; 1 +10. Documentation reflects the three environments and the CI status; no doc still claims a Docker-only or CI-run toolchain. + CHECK: grep -c "native on the development machine" docs/development/RUST.md; grep -c "prepared, no CI active" docs/development/RUST.md; grep -c "### 5.8 Native toolchain run" docs/development/RUST.md; grep -c "C.1 Addendum 2026-10-13" docs/development/RUST_ARCHITECTURE_REVIEW.md; for f in CLAUDE.md README.md CHANGELOG.md docs/development/RUST.md docs/development/TEST_STRATEGY.md; do grep -c "check:all" $f; done | tr '\n' ' '; grep -c "no toolchain on the host\|never on the host\|all through the builder image" CLAUDE.md docs/development/RUST.md docs/development/WORKSPACE.md | grep -vc ":0$"; grep -c "(not implemented" docs/development/RUST.md docs/development/RUST_ARCHITECTURE_REVIEW.md | grep -vc ":0$"; grep -c "No CI/CD\|no CI active\|No CI runs" DEPLOY.md CLAUDE.md README.md | grep -vc ":0$" + EXPECT: 1 ; 1 ; 1 ; 1 ; five numbers all >= 1 ; 0 ; 0 ; 3 +11. Scope held: no change under apps/, packages/, supabase/, no new dependency, Cargo.lock and pnpm-lock.yaml untouched. + CHECK: git diff --stat HEAD -- apps packages supabase Cargo.lock pnpm-lock.yaml | wc -l; git status --short | grep -c "^??" ; git status --short | grep "^??" | grep -vc "^?? scripts/\|^?? .claude/tasks/contracts/" + EXPECT: 0 ; >= 0 ; 0 + +## OUT OF SCOPE (do not report as gaps) +R1 (job loop), any deployment, release 0.2.0, runner / registry / secrets on the forge, `--remap-path-prefix` for bit-identical native vs Docker modules (documented in RUST.md §5.8), prettier conformance of Markdown files already non-conformant at HEAD, the `rust-docs` component installed by rustup's default profile.