diff --git a/.claude/tasks/contracts/2026-10-20-rust-r4-final-1000.md b/.claude/tasks/contracts/2026-10-20-rust-r4-final-1000.md index 50b2ecaf..9842fdd0 100644 --- a/.claude/tasks/contracts/2026-10-20-rust-r4-final-1000.md +++ b/.claude/tasks/contracts/2026-10-20-rust-r4-final-1000.md @@ -173,28 +173,29 @@ Q: the memory bench's five dimensions? / A: `scripts/browser/r4-memory-bench.mjs Q: where does the import security classification live? / A: `docs/development/PDF_IMPORT_HARDENING.md` §6, one row per open point of §5 and of BDR-058 / BDR-059 / BDR-063, class ∈ {fixed with proof, accepted temporarily, blocking before merge, before public exposure}. [gated 2026-10-20] Q: J1/J2 device list? / A: plan OD-6 verbatim: the computer with Chrome and Firefox, the iPhone with Safari iOS, the low-end Android phone with its browser; every result cell stays NON TESTÉ until the owner fills it. [gated 2026-10-20] Q: `pnpm check:all` needs Docker; may the verifier run `pnpm check` instead? / A: yes; `check:all` is run by the orchestrator and its log cited. [gated 2026-10-20] +Q: (internal, orchestrator, after verifier pass 1) the vitest binary path of criteria 2–7? / A: oracle defect: the package-local `./node_modules/.bin/vitest` of `apps/app` and `packages/core-wasm`, assertions unchanged. Criterion 4 keeps its no-feature cargo command on purpose: it is the regression proof of the default-feature build defect found by pass 1 (criterion 16). [gated 2026-10-20] ## ACCEPTANCE CRITERIA 1. PDF read and write contracts: every cargo suite of the core (reader, inflate, JSON, layout, PNG, content, serialiser, session, budget, robustness, compare) passes with every feature on. CHECK: cd crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --features cli --quiet > /tmp/r49-cargo.log 2>&1) && ! grep -q "FAILED\|panicked" /tmp/r49-cargo.log && grep -c "test result: ok" /tmp/r49-cargo.log | awk '$1 >= 25 {print "CARGO_OK"}' EXPECT: CARGO_OK 2. v2 / v3 compatibility: the 612 legacy leaves migrate through the worker's import path and the v2 PDFs round-trip (app suites `migration.leaves`, `pdf.roundtrip`, `routes.HomeRoute.messages` on the O2 / O3 / O7 / O8 corpora). - CHECK: cd apps/app && ../../node_modules/.bin/vitest run tests/unit/migration.leaves.test.ts tests/unit/pdf.roundtrip.test.ts tests/unit/routes.HomeRoute.messages.test.ts > /tmp/r49-compat.log 2>&1 && grep -q "Test Files 3 passed" /tmp/r49-compat.log && echo COMPAT_OK + CHECK: cd apps/app && ./node_modules/.bin/vitest run tests/unit/migration.leaves.test.ts tests/unit/pdf.roundtrip.test.ts tests/unit/routes.HomeRoute.messages.test.ts > /tmp/r49-compat.log 2>&1 && grep -q "Test Files 3 passed" /tmp/r49-compat.log && echo COMPAT_OK EXPECT: COMPAT_OK 3. Archives and attachments: the envelope suites and the N-1 reader read the R4 attachments; the cargo session suite proves the self-check (`archive.envelopes`, `n-1.reader`, `pdf.goldens`; cargo `pdf_session`, `pdf_serialize`). - CHECK: cd apps/app && ../../node_modules/.bin/vitest run tests/unit/archive.envelopes.test.ts tests/unit/n-1.reader.test.ts tests/unit/pdf.goldens.test.ts > /tmp/r49-arch.log 2>&1 && grep -q "Test Files 3 passed" /tmp/r49-arch.log && cd ../../crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --features cli --test pdf_session --test pdf_serialize --quiet > /tmp/r49-arch2.log 2>&1) && ! grep -q "FAILED" /tmp/r49-arch2.log && echo ARCHIVE_OK + CHECK: cd apps/app && ./node_modules/.bin/vitest run tests/unit/archive.envelopes.test.ts tests/unit/n-1.reader.test.ts tests/unit/pdf.goldens.test.ts > /tmp/r49-arch.log 2>&1 && grep -q "Test Files 3 passed" /tmp/r49-arch.log && cd ../../crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --features cli --test pdf_session --test pdf_serialize --quiet > /tmp/r49-arch2.log 2>&1) && ! grep -q "FAILED" /tmp/r49-arch2.log && echo ARCHIVE_OK EXPECT: ARCHIVE_OK 4. Anatomical rendering: the R3 compose and layer oracles and the export's request SVGs against the frozen compose oracle (cargo `anatomy_compose`, `anatomy_layer`, `anatomy_canvas_op`; core-wasm `pdf-export.session.test.ts`). - CHECK: cd crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --test anatomy_compose --test anatomy_layer --test anatomy_canvas_op --quiet > /tmp/r49-anat.log 2>&1) && ! grep -q "FAILED" /tmp/r49-anat.log && cd ../packages/core-wasm && ../../node_modules/.bin/vitest run tests/pdf-export.session.test.ts > /tmp/r49-anat2.log 2>&1 && grep -q "Test Files 1 passed" /tmp/r49-anat2.log && echo RENDER_OK + CHECK: cd crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --test anatomy_compose --test anatomy_layer --test anatomy_canvas_op --quiet > /tmp/r49-anat.log 2>&1) && ! grep -q "FAILED" /tmp/r49-anat.log && cd ../packages/core-wasm && ./node_modules/.bin/vitest run tests/pdf-export.session.test.ts > /tmp/r49-anat2.log 2>&1 && grep -q "Test Files 1 passed" /tmp/r49-anat2.log && echo RENDER_OK EXPECT: RENDER_OK 5. Controlled refusals: the hostile corpora answer closed kinds and the validated messages (cargo `pdf_robustness`, `pdf_import`, `pdf_budget`, `svg_sanitiser`; app `routes.HomeRoute.import`, `routes.HomeRoute.rescueCopy`, `routes.HomeRoute.archive`). - CHECK: cd crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --features cli --test pdf_robustness --test pdf_import --test pdf_budget --test svg_sanitiser --quiet > /tmp/r49-ref.log 2>&1) && ! grep -q "FAILED" /tmp/r49-ref.log && cd ../apps/app && ../../node_modules/.bin/vitest run tests/unit/routes.HomeRoute.import.test.tsx tests/unit/routes.HomeRoute.rescueCopy.test.tsx tests/unit/routes.HomeRoute.archive.test.tsx > /tmp/r49-ref2.log 2>&1 && grep -q "Test Files 3 passed" /tmp/r49-ref2.log && echo REFUSALS_OK + CHECK: cd crates && (. ../scripts/rust-env.sh; cargo test -p faunosteo-core --features cli --test pdf_robustness --test pdf_import --test pdf_budget --test svg_sanitiser --quiet > /tmp/r49-ref.log 2>&1) && ! grep -q "FAILED" /tmp/r49-ref.log && cd ../apps/app && ./node_modules/.bin/vitest run tests/unit/routes.HomeRoute.import.test.tsx tests/unit/routes.HomeRoute.rescueCopy.test.tsx tests/unit/routes.HomeRoute.archive.test.tsx > /tmp/r49-ref2.log 2>&1 && grep -q "Test Files 3 passed" /tmp/r49-ref2.log && echo REFUSALS_OK EXPECT: REFUSALS_OK 6. Data kept on error: a refused import, a crashed or timed-out worker, a stopped engine and a failed export leave the draft, the archive and the file untouched (app `routes.coreStopped`, `state.coreFailures`, `routes.EditorRoute.export`, `routes.EditorRoute.degraded`). - CHECK: cd apps/app && ../../node_modules/.bin/vitest run tests/unit/routes.coreStopped.test.tsx tests/unit/state.coreFailures.test.tsx tests/unit/routes.EditorRoute.export.test.tsx tests/unit/routes.EditorRoute.degraded.test.tsx > /tmp/r49-keep.log 2>&1 && grep -q "Test Files 4 passed" /tmp/r49-keep.log && echo KEPT_OK + CHECK: cd apps/app && ./node_modules/.bin/vitest run tests/unit/routes.coreStopped.test.tsx tests/unit/state.coreFailures.test.tsx tests/unit/routes.EditorRoute.export.test.tsx tests/unit/routes.EditorRoute.degraded.test.tsx > /tmp/r49-keep.log 2>&1 && grep -q "Test Files 4 passed" /tmp/r49-keep.log && echo KEPT_OK EXPECT: KEPT_OK 7. The TypeScript PDF engines are gone and cannot return: no tracked file under `packages/pdf`, no `pdf-lib` / `@pdf-lib` / `@resvg` in the lockfile, no `@faunosteo/pdf` or `@faunosteo/domain` import under `apps/app/src` or `packages/core-wasm/src`, and the census suite passes. - CHECK: [ "$(git ls-files packages/pdf | wc -l)" = 0 ] && ! grep -q "pdf-lib\|@pdf-lib\|@resvg" pnpm-lock.yaml && ! grep -rq "@faunosteo/pdf\|@faunosteo/domain" apps/app/src packages/core-wasm/src && cd apps/app && ../../node_modules/.bin/vitest run tests/unit/r4.census.test.ts > /tmp/r49-census.log 2>&1 && grep -q "Test Files 1 passed" /tmp/r49-census.log && echo GONE_OK + CHECK: [ "$(git ls-files packages/pdf | wc -l)" = 0 ] && ! grep -q "pdf-lib\|@pdf-lib\|@resvg" pnpm-lock.yaml && ! grep -rq "@faunosteo/pdf\|@faunosteo/domain" apps/app/src packages/core-wasm/src && cd apps/app && ./node_modules/.bin/vitest run tests/unit/r4.census.test.ts > /tmp/r49-census.log 2>&1 && grep -q "Test Files 1 passed" /tmp/r49-census.log && echo GONE_OK EXPECT: GONE_OK 8. Test coverage kept after the cleanup: the ledger holds 301 frozen cases, none pending, every target present (`node scripts/r4-ledger.mjs` prints the census and exits 0). CHECK: node scripts/r4-ledger.mjs > /tmp/r49-ledger.log 2>&1 && [ "$(tail -n +2 crates/core/tests/pdf/LEDGER.tsv | wc -l)" = 301 ] && ! grep -qi "pending" crates/core/tests/pdf/LEDGER.tsv && echo LEDGER_OK @@ -220,3 +221,6 @@ Q: `pnpm check:all` needs Docker; may the verifier run `pnpm check` instead? / A 15. Scope: no merge into develop, no R5 file, no production change: HEAD is on `feature/rust-r4-pdf-core`, develop's tip is unchanged (66909b6 is its merge-base), and no deploy or DNS file changed. CHECK: [ "$(git rev-parse --abbrev-ref HEAD)" = feature/rust-r4-pdf-core ] && [ "$(git merge-base develop HEAD)" = "$(git rev-parse 66909b6)" ] && [ -z "$(git diff --name-only 66909b6..HEAD -- DEPLOY.md docker/nginx.conf | grep -v DEPLOY.md)" ] && echo SCOPE_OK EXPECT: SCOPE_OK +16. The core builds, lints and tests with no feature (the workspace run unifies the wasm crate's features and hid a gated path), and `rust:check` runs that build. + CHECK: cd crates && (. ../scripts/rust-env.sh; cargo clippy -p faunosteo-core --all-targets --locked -q -- -D warnings > /tmp/r49-nofeat.log 2>&1 && cargo test -p faunosteo-core --locked -q >> /tmp/r49-nofeat.log 2>&1) && ! grep -q "FAILED\|error\[" /tmp/r49-nofeat.log && grep -q "cargo clippy -p faunosteo-core --all-targets --locked" ../scripts/rust-check.sh && echo NOFEAT_OK + EXPECT: NOFEAT_OK