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
@@ -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