chore(memory): R2 delivered — BDR-050, LRN-054, BLK-010, EVAL-020, journal, TODO, verify contract
This commit is contained in:
1 parent
e49009e363
commit
651f1fef13
7 files changed
+93
-8
No files matched your search
@@ -81,3 +81,10 @@ Status: open (no real data yet; treat before Step 7+ persistence of user reports
|
||||
|
||||
Security audit Step 6 (MEDIUM, pre-existing since Step 1 import): `PDFDocument.load` decodes every `/ObjStm` and xref stream eagerly with its own uncapped FlateStream; measured 408 KB PDF → 400 MB in 1.4 s, 468 MB RSS; `MAX_PDF_BYTES` 50 MiB allows ~50 GB. Attachment cap (16 MiB) covers the attachment only. Impact: tab freeze/OOM for the practitioner on a crafted PDF, no code execution. Cannot refuse `/ObjStm` (pdf-lib `save()` emits object streams in our own PDFs). Options: parse in a Web Worker (bounded blast radius), or locate the attachment by scanning bytes without a full load, or a capped custom decoder. pdf-lib 1.17.1 unmaintained since 2021 (LOW in the same audit).
|
||||
Status: MITIGATED on the browser import path 2026-10-11 (60ee712: byte-scan attachment reader, no `PDFDocument.load` on untrusted bytes, export without object streams; ObjStm bomb read in 5 ms, +0.5 MiB RSS). Then 3a6e926: inflater fed in 16 KiB slices (Chromium read-ahead defeated the cancel: 4 GiB bomb +2.2 GB → +192 MB measured), shared 16 MiB candidate budget, bounded endstream search; final loop: candidates sorted by offset, JSON depth pre-scan. Audits ×3 PASS; worst measured costs on crafted files: +192 MB single bomb, ~0.5 s / ≤0.4 GB for 32 failing inflations, ~1 s deep JSON (before the pre-scan). GATE STILL OPEN before any external-user import (BDR-040): Firefox/Safari inflater read-ahead unmeasured (no browser test runner), Worker/server import with time+memory budget, pdf-lib replacement decision (unmaintained), report collection caps on read, `<use>` nesting budget, low-end phone measurement. Plan: docs/development/PDF_IMPORT_HARDENING.md §5. Never close on passing tests alone.
|
||||
|
||||
## BLK-010 | 2026-10-14 | Agent worktrees created on a stale base; their cleanup refused by the classifier
|
||||
|
||||
Friction: the three `isolation: worktree` forks of R2 started at 605ee7c (an old develop merge), not at the feature branch HEAD 22fea87; each fork noticed and moved its own temp branch (`git reset --hard` / `checkout -B` on the empty worktree, flagged by the classifier as a security warning). After merging their diffs by hand, `git worktree remove --force` + `git branch -d worktree-agent-*` refused by the auto-mode classifier.
|
||||
Root cause: harness side (base commit of the agent worktree), not reproducible from the repo; the removal refusal is the destructive-command policy.
|
||||
Solution: forks briefed with the exact base commit and told to verify `git log -1`; diffs collected uncommitted and copied by literal paths. Leftover: `.claude/worktrees/agent-{a0cefd439bff650a2,a3f684449d0776ad1,af6ebe79b8f742039}` (3.2 GB) + 3 local temp branches at 22fea87 (merged), owner removes them (`git worktree remove --force <path>`, `git branch -d <branch>`).
|
||||
Status: open (harness); workaround documented.
|
||||
@@ -394,3 +394,9 @@ Status: active; awaiting owner validation (TEST FONCTIONNEL + TEST GRAPHIQUE), n
|
||||
Owner decisions: (1) R1 validated 10/10 manual + graphic → R0 and R1 finished into develop (5cfb6f1, f5865f0; the earlier classifier refusal did not recur); (2) identity final: product/app/site = **Faunosteo**, domain **https://faunosteo.com**, no new brand name, logo/palette/mockups kept; (3) environments: DEV = self-hosted Ubuntu native (Claude Code, git, rustup, Vite, Docker rootless, local Supabase, worker), STAGING = `staging.faunosteo.com` planned not created, PROD = separate VPS, current site preserved, no DNS/cert/proxy/data change; isolation of DB/Storage/secrets/accounts/OAuth/payments/mails/files per env, prod data never copied to DEV, merge ≠ deploy, no CI/CD operational (workflows preparatory); (4) permanent rule: the owner tests from other devices (computer, phone) → every test surface addressed by the DEV origin (LAN address or private name), never 127.0.0.1/localhost, never hard-coded; implemented as `scripts/dev-env.sh` (`FAUNOSTEO_DEV_HOST`, detected via `hostname -I`, prod host refused) + `scripts/supabase.sh` wrapper (config.toml `env()` for api.external_url, auth.site_url, studio.api_url) + `scripts/dev.sh` (`pnpm dev` on the origin, `pnpm dev:offline` without backend) + private-network redirect URLs; (5) exposure: 5173/54321 needed by browsers, Studio 54323 + Mailpit 54324 unauthenticated → private subnet only, PostgreSQL 54322 published by the CLI on 0.0.0.0 (no bind option) → firewall restriction proposed to the owner, not applied; worker no port; (6) Rust native via Cargo, Docker for services/worker/sandbox/images/prod, VPS never compiles.
|
||||
Alt rejected: hard-coded IP in config.toml (first iteration, replaced the same day); Vite `dev:lan` variant (folded into `dev`); binding the CLI ports to loopback (impossible in config.toml).
|
||||
Status: active; `chore/dev-lan-access` awaiting the owner's LAN validation; R2 not started.
|
||||
|
||||
## BDR-050 | 2026-10-14 | R2 implementation choices: Zod semantics in serde, minimal index data, form edits stay Zustand, quarantine, lazy core
|
||||
|
||||
Built on review rev 2 + Annex C; plan `.claude/tasks/plans/2026-10-13-rust-r2-domain-core.md` rev 2 (3 challengers, 45 findings, 1 BLOCKER folded). Choices: (1) JSON read text → `serde_json::Value` (JSON.parse dup-key semantics) → typed; lone surrogate escape → U+FFFD pre-pass (L1, owner to confirm); (2) Zod reproduced by field helpers: `js::present` (optional: absent ok, null refused, skipped), `js::nullable` (required key), `JsInt` (any integer-valued number, JS print), hand-written patterns (no regex crate), `url` crate for `.url()`; unions = untagged enums + literal tag fields at Zod position → byte-equal with `JSON.stringify(Zod.parse(x),null,2)`; PDF label fields in engine dict order → frozen envelopes round-trip byte-equal; (3) quirks ported site by site (Map last-wins, find first-wins, JS truthiness, `??=`, malformed map entry still fails the read); (4) `SheetIndexData` minimal (positions, names, spineIds, nodeKeys as JSON `[zone,...path]`), TS `SheetIndex` = accessors only + `ops`; (5) one core call per user action; form-value observation edits (comment, severity, free text, finding removal) stay Zustand assignments (no per-keystroke wasm, D-R7); store actions answer `{ok}`, callers stop on failure; `hydrateReport` deleted; (6) runtime: sync calls, trap → poison → offline recovery from kept compiled module + pre-imported spare glue record, cap 3, per-generation sheet handles, retry clears all caches; `pkg/` shipped vs `pkg-proofs/`; BUILD_STAMP refuses stale module in tests; (7) quarantine only on content kinds, newest-only keys, source removed after successful copy, pre-rebase raw kept when unresolved > 0; editor never redirects in degraded states; (8) Home and /new read availability from the bundle, core loads at submit / import / editor; (9) import = TS byte scan (until R4) → core `archive.import` (read + rebase one call); export = core `archive.snapshot` → frozen TS engine; (10) publish gate takes the core validator (DI), fails closed; (11) report:compare CLI keeps the frozen domain (R4); practitioner prefill keeps a small Zod schema (D-R7, core not loaded on /new mount); (12) app image wasm stage + gzip_static; DEPLOY: CSP keyword before an R2 image, never built on VPS.
|
||||
Alt rejected: mutation corpus with full outputs (simplicity challenge: drift-free verdict table + characterisation instead); `report.replace_observation` per keystroke; serde internally tagged enums (tag first breaks byte equality); Web Worker for every call (async races in the click chain); unify duplicate-id policies (behaviour change).
|
||||
Status: active; R2 delivered on feature/rust-r2-domain-core, awaiting owner validation, no merge.
|
||||
@@ -150,3 +150,10 @@ Method: contract-level `STORAGE.md` written first; migration + pgTAP by me while
|
||||
Result: verifier pass 1 ECARTS(4) = oracle (`for update` row-lock grep) + FILE SCOPE (tracking files, lockfile) → rev 2 → CONFORME 15/15, floor clean. Security pass 1 PASS (2 MEDIUM: ceiling ratchet by rejected rows, cleartext http any host; 9 LOW) → fixed; pass 2 PASS but my fixes introduced 2 MEDIUM (bypassable host check `127.*`/numeric, ceiling undercount vs contract) → fixed; pass 3 BLOCK(1) HIGH: my purge-queue join let begin spam pin the ceiling with claims → ceiling rewritten on bytes present + cap per pending claim; pass 4 PASS (MEDIUM residual: per-account holding) → 64 MiB per-account budget; pass 5 PASS (LOW hygiene) → comments/doc. e2e 5/5 ×7 (found the Storage API 400-as-404 making purge acks loop: added queue-drained assertion); smoke 18/18 desktop+mobile; final: pgTAP 140 (real stack 420 total), app 300, supabase 37, worker 21+11 native, sandbox 16, allowlist = 7 syscalls unchanged, image 11.6 MB.
|
||||
Anomalies: EVAL-017 lesson again ×3 — each security fix needed its own adversarial pass and twice created a new finding (host check, ceiling join); a security control I added became the attack lever (BLOCK). Fork B's `database.types.ts` hand-write matched the generator byte-for-byte except ordering; fork A found the 400/404 only via e2e. `gitflow finish` of R0 and any `.env*` write refused by the harness classifier; `git config` reads refused too. Verifier sandbox intercepted the literal `pnpm lint` (rtk wrapper) → oracle uses the binary path.
|
||||
Action: owner's manual validation (TEST FONCTIONNEL + TEST GRAPHIQUE), owner runs `gitflow finish` for R0 then R1 after validation; no merge, no deploy, release 0.2.0 untouched.
|
||||
|
||||
## EVAL-020 | 2026-10-14 | Rust R2 domain core — 3 plan challengers, 4 forks, verifier, security ×2, CSP proof on the image
|
||||
|
||||
Method: plan + contract written first (`.claude/tasks/plans/2026-10-13-rust-r2-domain-core.md`), 3 plan-challengers (correctness, robustness, simplicity) before code; freeze-then-switch: envelopes, Zod output oracles, characterisation and verdict tables written by the TS before trusting Rust; forks A/B/C in worktrees on disjoint files (sheet rules + conformance, report/archive rules, editor rules), runtime + app switch by me, fork D adapted the app suites in tree; browser checks with playwright-core from the scratchpad (dev server, prod build, real image under the DEPLOY CSP); contract `2026-10-14-rust-r2-verify.md` (12 criteria, every oracle dry-run before dispatch) → fresh verifier; security-auditor on the whole range, then a focused pass on the fix commit.
|
||||
Result: challengers 45 findings incl. 1 BLOCKER (degraded editor redirect could overwrite an unread draft) → plan rev 2 before any app code; contracts byte-equal to Zod on first run; forks merged with zero conflicts (one stub replaced); fork D found 2 real src bugs (Node source path under happy-dom, failed quarantine reported as success) → fixed with tests. Verifier: 12/12 MET, ECARTS(2) = floor DELETED_TEST (zoneInteraction suite ported to cargo; R0 skip helper replaced by a stricter global setup) → human micro-gate for the owner. Security: PASS (3 MEDIUM nginx false positives pre-existing, 5 LOW) → by-reference deserialisation (also −134 KB raw / −31 KB gzip module) + literal delete paths. Final: cargo core 135, worker+wasm 32, Node 906 (app 313), pgTAP PGlite 12 files / real stack 446, CSP proof 15/15, check:all green ×3, module 1,046,498 B raw / 340,929 B gzip.
|
||||
Anomalies: worktree base stale (BLK-010); harness decodes `\u` escapes in tool inputs (LRN-054); my first runtime test helper reused the pattern Vite rewrites; the CSP proof first failed on its own harness (EN locale, disclaimer modal, caught compile error logs nothing) — proof scripts need the same dry-run discipline as oracles; a security LOW fix improved size, measure before assuming a cost.
|
||||
Action: owner manual LAN validation, L1 decision, approve the 2 deleted test files (floor), then merge go; R3 next, not started.
|
||||
@@ -247,3 +247,7 @@ Owner: R1 10/10 validated, identity final (Faunosteo, faunosteo.com), env DEV/ST
|
||||
- Same day, LAN least privilege (owner brief): measured from a distinct Docker network → Mailpit open without auth, PostgreSQL open, Studio open. Built DEV gateway (nginx, API + Mailpit basic auth on the LAN address), `pnpm dev:gateway`, `pnpm dev:net-check`; gateway proven on alternate ports. Pending owner authorisation: `~/.config/docker/daemon.json {"ip":"127.0.0.1"}` + rootless daemon restart (daemon-wide, only Faunosteo containers on it). LRN-052. Branch not merged; R2 not started.
|
||||
- Same day, owner applied the UFW rules (ENVIRONMENTS.md §3.2) and verified from another device: 54322, 54323, 54324 refused, 54321 answers; app served by the owner's `pnpm dev`. Allowed surfaces 5/5 by dev:net-check. Remaining: owner's 10-step run on computer + phone, then merge go and R2 go.
|
||||
- Owner validated the 10-step path on computer and phone over the LAN; merge go for chore/dev-lan-access. R2 not authorised yet.
|
||||
|
||||
## 2026-10-14 (Rust R2 delivered)
|
||||
|
||||
Owner: LAN validated, R2 go (brief 2026-10-13), 4 new strings validated (recommended wording). feature/rust-r2-domain-core off develop 1a7ee7d. Plan + 3 challengers (45 findings, 1 blocker) → rev 2. Freeze first (envelopes, N-1 copy, Zod oracles, characterisation 84 + verdicts 765 + editor 49 + conformance 26), contracts byte-equal, rules by 3 worktree forks, runtime (lazy, poison, offline recovery, BUILD_STAMP), app switched (sheet, store, click chain, pickers, import, export snapshot, publish gate fail-closed), quarantine, degraded states, Docker wasm stage + gzip_static, CSP proof on the image 15/15. Verifier 12/12 + floor 2 (deleted tests, owner micro-gate); security PASS → by-ref deserialisation (module 341 KB gzip). check:all green. BDR-050, LRN-054, BLK-010, EVAL-020. Stop: owner validation, no merge, R3 not started, release 0.2.0 untouched.
|
||||
@@ -411,3 +411,13 @@ Apply: any DEV service exposure on this machine; future staging compose.
|
||||
- Rootless (slirp/pasta) containers reach the host's own LAN IP by local delivery, never through the LAN interface → firewall refusals on that interface are invisible to any probe run on the host; prove them from another device (`nc -zv -w 3 <ip> <port>`).
|
||||
- Lesson: an "it should apply" assumption about a third-party tool's binding must be tested before handing a procedure to the owner (I flagged it as a hypothesis, but the owner still spent a daemon restart on it).
|
||||
Apply: any exposure work on this machine; staging compose (bind explicitly there).
|
||||
|
||||
## LRN-054 | 2026-10-14 | Porting Zod to serde without drift; wasm in Vite; agent and harness traps
|
||||
|
||||
- serde silently widens Zod: a missing `Option` field defaults to None (use `deserialize_with` to make a nullable key required), `null` reads as None for an optional (use a `present` helper refusing null), `u32` refuses `2.0` that `.int()` accepts (JsInt over f64), internally tagged enums print the tag first (untagged enum + literal tag field at the schema position keeps Zod order). Zod drops a `__proto__` key in `z.record`; JS regex `$` = end of input; `.min/.max` count UTF-16. Prove with byte equality against `JSON.stringify(Schema.parse(x),null,2)` on real documents, a characterisation set frozen from the old functions, and a verdict table run by Zod once.
|
||||
- Vite: `import x from 'pkg/glue.js?url'` emits the wasm-bindgen glue as an asset (no bundling); `import(`${url}?instance=${n}`)` gives a fresh module record in dev (`/@fs/…`) and build; works under CSP `script-src 'self' 'wasm-unsafe-eval'`. In happy-dom suites Vite rewrites `new URL(rel, import.meta.url)` into `/@fs/…` → Node readFile fails: build paths from `fileURLToPath(import.meta.url)`.
|
||||
- A caught `WebAssembly.compile` CSP refusal logs nothing in the console: read the `securitypolicyviolation` event (`blockedURI` = `wasm-eval`). Headless Chromium defaults to en-US: set the page locale before asserting French strings. The DEPLOY CSP also refuses the footer's external credit logo (img-src).
|
||||
- This harness decodes `\uXXXX` in tool inputs (heredocs, Write): build escape sequences with python `chr(92)`.
|
||||
- `isolation: worktree` forks started at an old commit (605ee7c, not HEAD): each fork had to move its temp branch; brief forks to check `git log -1` first. `git worktree remove` / `git branch -d` on those temp branches refused by the auto-mode classifier → leftover worktrees (3.2 GB) for the owner to remove.
|
||||
- Forks with full context + disjoint file ownership + "no commit, I collect the diff" merged with zero conflicts (one deliberate stub replaced).
|
||||
Apply: R3/R4/R5 ports (same oracle stack), any wasm loaded by Vite, any agent fan-out.
|
||||
+10
-8
@@ -166,14 +166,16 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo
|
||||
- [ ] 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
|
||||
- plan + contract: `.claude/tasks/plans/2026-10-13-rust-r2-domain-core.md` (rev 2 after 3 challenges, 45 findings folded); branch `feature/rust-r2-domain-core`; owner wording of the 4 new strings validated 2026-10-13
|
||||
- [x] R2.0 freeze: 3 archive envelopes (demo, v2full, v2unresolved; FR, no logos, fixed time) + verbatim N-1 Zod copy (`packages/core-wasm/tests/n-1`) (3114d67); Zod output oracles of the reference documents (`crates/core/tests/oracles`)
|
||||
- [ ] R2.0b characterisation set of the TS quirks (migrate, rebase, reducers, numeric literals, surrogates) + hostile-input verdict table per constraint site
|
||||
- [ ] R2.1 Rust contracts: js semantics, sheet, report v2/v3/identity/map, snapshot/branding/labels/envelope; ts-rs types; byte-equal on oracles + frozen envelopes
|
||||
- [ ] R2.2 Rust rules: 21 integrity rules + check, create_empty, index + SheetIndexData, read/migrate, rebase, snapshot build/assert, envelope layered read, draft restore; ported domain suites; conformance fixtures + generated pgTAP 011 + drift test
|
||||
- [ ] R2.3 Rust editor rules: zone click + reducers, finding toggle, vertebra initial/sync/select, report new/add/remove/move
|
||||
- [ ] R2.4 facade + runtime: SheetHandle, ops, typed failures; core-wasm runtime (lazy, generation, poison, spare glue, cap 3, retry), Node/browser sources, globalSetup stamp, pkg vs pkg-proofs; trap/load tests; size; checkpoint report to the owner
|
||||
- [ ] R2.5 app switch: provider/useSheet degraded states, SheetIndex class, store `{ok}` actions, persistence + quarantine, click chain, pickers, finding picker, import/export, Home + /new availability, publish gate fail-closed, ESLint restriction, pickLocaleLabel, deletions; suites green, changed assertions listed
|
||||
- [ ] R2.6 images + serving: Dockerfile wasm stage, ignores, nginx compression, check:all, CSP proof on the image (Chromium + Firefox/WebKit if present), measurements
|
||||
- [ ] R2.7 docs (RUST.md R2 + census, CLAUDE.md, WORKSPACE, TEST_STRATEGY, packages/README, DEPLOY note, CHANGELOG), verifier + security gates, memory, LAN manual procedure; STOP (no merge)
|
||||
- [x] R2.0b characterisation frozen from the TS: 84 report/archive cases + 765 Zod verdicts (fork B), 49 editor cases (fork C), 26 conformance fixtures (fork A), horse-slice JSON
|
||||
- [x] R2.1 Rust contracts (ee07008): byte-equal to Zod output on draft + legacy sheets, demo report; the 3 frozen envelopes round-trip byte-equal
|
||||
- [x] R2.2 Rust rules (0c47d0f, 21906c4): integrity rules, check, create, index data, read/migrate (612 leaves), rebase, snapshot, layered read, session restore/import; pgTAP 011 generated (PGlite 12/12, real 446/446)
|
||||
- [x] R2.3 editor rules (3639c87) + facade ops (6c0533c)
|
||||
- [x] R2.4 runtime (343d6f4): lazy, poison, offline recovery, per-generation handles, cap 3, retry, pkg/pkg-proofs, BUILD_STAMP; browser-checked dev + build; measurements (794dfd9)
|
||||
- [x] R2.5 app switch (74fcb37) + publish gate fail-closed (6891f9e); app 313/313 on the real core (fork D adapted 17 files, 24 new tests, found 2 src bugs fixed)
|
||||
- [x] R2.6 image + serving (7be94d4): wasm stage, gzip_static 372 KB served, CSP proof on the image 15/15 (Chromium only; no Firefox/WebKit build here), check:all green 2 min 17 s
|
||||
- [x] R2.7 docs (8e8c58e: RUST.md §8, CLAUDE.md, WORKSPACE, TEST_STRATEGY, packages/README, DEPLOY, CHANGELOG), verifier 12/12 + floor ECARTS(2) (deleted tests, owner micro-gate), security PASS ×2 (follow-ups e49009e), memory BDR-050 LRN-054 BLK-010 EVAL-020; STOP (no merge)
|
||||
- [ ] R2 owner points: manual LAN validation (procedure in the delivery note), L1 decision (lone surrogate → U+FFFD), approve the 2 deleted test files (floor), worktree cleanup (BLK-010), then merge go
|
||||
- [ ] R2 follow-ups: Firefox/WebKit CSP run (no browser build here), import in a Web Worker (R4), React error boundary (not decided), base images by digest (Step 27), wording of the storage-full degraded notice
|
||||
- [ ] R3 anatomy core: tree, one sanitiser, serialiser, layer renderer, `compose_view_svg`; app canvas switched; composed views frozen as trees first
|
||||
- [ ] R4 pdf core: reader (Web Worker, BLK-009 browser measurements) + writer (`pdf-writer`, Std14 AFM, draw log; lines/rects/colours golden frozen with the TS engine first, D-R2) + `report-compare` tool; `packages/pdf` deleted; N-1 scanner reads R4 PDFs
|
||||
- [ ] R5 curation pipeline + importer + upload tool: seed golden regenerated once (new `documentSha256`, D-R5), `packages/anatomy` + `packages/domain` deleted, docs map; all before Step 13
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
# CONTRACT — Rust R2: domain core in Rust, used by the application
|
||||
- date: 2026-10-14 | flow: orchestrator + 4 forks (3 worktrees + 1 in tree), plan challenges ×3, verifier gate | branch: feature/rust-r2-domain-core (off develop 1a7ee7d)
|
||||
- status: dispatched after the implementation, test and doc commits
|
||||
- spec: `.claude/tasks/plans/2026-10-13-rust-r2-domain-core.md` (plan + revision 2 §5, which wins), `docs/development/RUST_ARCHITECTURE_REVIEW.md` VI.2 R2 row, VI.3, VI.4, owner brief 2026-10-13 (R2 go: §2 scope, §3 compatibility, §5 runtime, §6 CSP and measures, §7 no UI redesign, §9 tests, §12 exclusions)
|
||||
- diff range: 1a7ee7d..HEAD (run every CHECK from the repository root; `. scripts/rust-env.sh` first for cargo)
|
||||
|
||||
## REQUEST (IMMUTABLE)
|
||||
Migrate the existing domain core of Faunosteo to Rust and switch the application to it, with no business behaviour change without a separate decision: sheet / report / archive contracts, SheetHandle and index, observation reducers, finding construction, vertebra selection, publish checks, related transformations and validations, in crates/core and the wasm facade; consumers switched; React, DOM, forms and Supabase services stay in their layers. Preserve Report v3, v2 PDF imports, autonomous archives, observations, findings, vertebrae, annotations, sheet versions, unresolved content, FR/EN, old data; freeze the three archive envelopes first; keep a permanent N-1 reader test; JSON rules (absent optionals, nullable, number format) conformant; no silent loss. Lazy wasm, explicit instantiation failures, no reuse after a trap, degraded behaviour when unavailable. CSP with 'wasm-unsafe-eval' only; measure size, init, op times, page impact, memory; no wasm on pages that do not need it. No UI redesign (four new strings validated by the owner). Out: R3, R4, R5, Step 9, CI/CD, deploy, release 0.2.0, merge into develop.
|
||||
|
||||
## ACCEPTANCE CRITERIA
|
||||
1. The native Rust gate is green (fmt, clippy -D warnings, tests, ts-rs export, cargo deny).
|
||||
CHECK: bash scripts/rust-check.sh > /tmp/r2-verify-rust.log 2>&1; echo "exit $?"
|
||||
EXPECT: exit 0
|
||||
2. The core carries at least 135 passing tests (contracts, rules, oracles, conformance).
|
||||
CHECK: . scripts/rust-env.sh && cargo test -p faunosteo-core 2>&1 | grep "test result" | awk '{s+=$4; f+=$6} END {print s, f}'
|
||||
EXPECT: 135 0 (first number ≥ 135, second 0)
|
||||
3. The application sources no longer import the TypeScript domain, and no domain rule or the deleted service is reachable from them by name.
|
||||
CHECK: grep -rln "@faunosteo/domain" apps/app/src | wc -l; grep -rnE "decideZoneClick|collectVertebrae|buildSheetIndex|buildSheetSnapshot|rebaseReportOnSheet|readReportDocument|readArchiveDocument|zoneInteraction" apps/app/src | wc -l; test -e apps/app/src/services/zoneInteraction.ts; echo $?
|
||||
EXPECT: 0 / 0 / 1
|
||||
4. The application suite passes on the real core (313 tests), including the four new R2 suites.
|
||||
CHECK: bash scripts/wasm-build.sh > /dev/null 2>&1; ./node_modules/.bin/pnpm --filter @faunosteo/app exec vitest run 2>&1 | grep -E "^ +Tests "; ls apps/app/tests/unit/ | grep -cE "n-1.reader|state.quarantine|routes.EditorRoute.degraded|state.coreFailures"
|
||||
EXPECT: Tests 313 passed (313) / 4
|
||||
5. The Step 6 goldens, the seed and the other packages' fixtures are untouched by R2, and the three frozen archive envelopes are unchanged since their freeze commit.
|
||||
CHECK: git diff --stat 1a7ee7d..HEAD -- apps/app/tests/fixtures/goldens/step6 supabase/seed packages/domain/tests/fixtures packages/pdf/tests packages/anatomy/tests | wc -l; git diff --stat 3114d67..HEAD -- apps/app/tests/fixtures/goldens/r2 | wc -l
|
||||
EXPECT: 0 / 0
|
||||
6. The shipped module carries no trap export and stays under the 600 KB compressed budget.
|
||||
CHECK: grep -cE "panic_for_test|recurse_for_test" packages/core-wasm/pkg/faunosteo_wasm.d.ts; gzip -9 -c packages/core-wasm/pkg/faunosteo_wasm_bg.wasm | wc -c
|
||||
EXPECT: 0 / a number ≤ 600000
|
||||
7. No auth, account, shell or entry module references the core runtime (the module is only loaded from the sheet pages).
|
||||
CHECK: grep -rl "@/core/" apps/app/src/app/routes/auth apps/app/src/app/routes/app apps/app/src/components/shell apps/app/src/components/account apps/app/src/app/App.tsx apps/app/src/main.tsx | wc -l
|
||||
EXPECT: 0
|
||||
8. Only the content failure kinds set a draft aside, and the core-wasm suite proves the runtime (lazy load, trap, recovery, handle rebuild, cap, retry, size).
|
||||
CHECK: grep -c "outcome.kind !== 'invalid' && outcome.kind !== 'unsupported_version'" apps/app/src/state/reportStore.ts; ./node_modules/.bin/pnpm --filter @faunosteo/core-wasm exec vitest run 2>&1 | grep -E "^ +Tests "
|
||||
EXPECT: 1 / Tests 25 passed (25)
|
||||
9. The publish gate fails closed and runs on the real core; the SQL suite (incl. the generated conformance file 011) passes on PGlite.
|
||||
CHECK: grep -c "refuses publication when the validator cannot run" packages/supabase/tests/anatomical-sheets.test.ts; ./node_modules/.bin/pnpm --filter @faunosteo/supabase exec vitest run 2>&1 | grep -E "^ +Tests "; ./node_modules/.bin/pnpm --filter @faunosteo/supabase exec vitest run tests/db/pgtap.test.ts 2>&1 | grep -E "^ +Tests "
|
||||
EXPECT: 1 / Tests 39 passed (39) / Tests 12 passed (12)
|
||||
10. The four validated strings exist in both dictionaries.
|
||||
CHECK: for k in sheet.core_unavailable sheet.core_retry core.action_failed editor.draft_quarantined home.import.error_core_unavailable; do printf "%s/%s " $(grep -c "'$k'" apps/app/src/i18n/fr.ts) $(grep -c "'$k'" apps/app/src/i18n/en.ts); done
|
||||
EXPECT: 1/1 1/1 1/1 1/1 1/1
|
||||
11. Documentation records the migration (RUST.md §8, DEPLOY.md R2 notes, CHANGELOG).
|
||||
CHECK: grep -c "^## 8. R2" docs/development/RUST.md; grep -c "From R2 on" DEPLOY.md; grep -c "Rust R2" CHANGELOG.md
|
||||
EXPECT: 1 / 1 / 1
|
||||
12. The whole pre-merge gate passes.
|
||||
CHECK: bash scripts/check-all.sh > /tmp/r2-verify-all.log 2>&1; echo "exit $?"; grep -c "== all checks passed" /tmp/r2-verify-all.log
|
||||
EXPECT: exit 0 / 1
|
||||
|
||||
## FILE SCOPE
|
||||
crates/core/**, crates/wasm/**, Cargo.toml, Cargo.lock, packages/core-wasm/**, packages/supabase/{src/anatomical-sheets.ts,src/index.ts,package.json,tests/anatomical-sheets.test.ts,vitest.config.ts}, packages/domain/tests/r2-*.test.ts, apps/app/{src,tests,scripts,eslint.config.js,vitest.config.ts,package.json}, supabase/tests/011_sheet_conformance.sql, scripts/{wasm-build.sh,wasm-stamp.mjs}, Dockerfile, docker/nginx.conf, docker/csp-proof/app-image.{sh,mjs}, .gitignore, .dockerignore, .prettierignore, pnpm-lock.yaml, docs/development/{RUST,WORKSPACE,TEST_STRATEGY}.md, packages/README.md, CLAUDE.md, DEPLOY.md, CHANGELOG.md, .claude/tasks/** (plan, TODO, this contract), .claude/memory/** (registries).
|
||||
Reference in new issue
Block a user