chore(memory): step 6 verify contract — oracles of criteria 6/7 fixed, scope widened, deleted tests authorised with replacements, docker evidence

This commit is contained in:
bchanot committed 2026-10-11 13:40:55 +02:00
1 parent 83115b484d
commit f2a64bcb0a
1 file changed
+9 -5
@@ -23,11 +23,11 @@ Un PDF Faunosteo doit rester lisible, interprétable et réexportable dans le fu
CHECK: git diff --stat 8b86b92 HEAD -- apps/app/tests/fixtures/goldens | tail -1; cd packages/pdf && corepack pnpm vitest run tests/goldens.test.ts 2>&1 | tail -2; cd ../../apps/app && corepack pnpm vitest run tests/unit/pdf.goldens.test.ts 2>&1 | tail -2
EXPECT: empty diff ; passed ; passed
6. Scenario 6 (hostile/oversized snapshots rejected, report kept): security tests cover caps, cycles, dangling asset, sheet_mismatch, hostile SVG, entity, use bomb, viewBox bomb, inflate bomb, __proto__; every rejection keeps `report`.
CHECK: cd packages/pdf && corepack pnpm vitest run tests/security.test.ts 2>&1 | tail -2; grep -c "snapshotRejected" packages/pdf/tests/security.test.ts
EXPECT: passed ; >= 6
CHECK: cd packages/pdf && corepack pnpm vitest run tests/security.test.ts 2>&1 | grep -E "Tests|✓|passed" | tail -3; grep -cE "^\s*\[?'(five assets|3 MiB|depth 9|1,?025|cycle|dangling|sheet_mismatch)|reason: '" packages/pdf/tests/security.test.ts
EXPECT: 20 passed ; the rejection table lists the 7 cases (count ≥ 7 rows carrying a `reason:`), each asserted to keep `outcome.report` (one shared assertion over the parametrised table is accepted)
7. Scenario 7 (no network): packages/pdf has no `fetch`/DOM usage (lint rule + grep) and its suite runs in vitest `node` environment; the only `fetch(` under apps/app/src/pdf is in branding.ts.
CHECK: grep -rn "fetch(\|window\.\|document\.\|new Image\|DOMParser\|XMLSerializer" packages/pdf/src | grep -v "xmldom" | wc -l; grep -rln "fetch(" apps/app/src/pdf; grep -n "environment" packages/pdf/vitest.config.ts
EXPECT: 0 ; apps/app/src/pdf/branding.ts only ; node
CHECK: grep -rnE "\bfetch\(|\bwindow\.|globalThis\.document|\bnew Image\(|navigator\." packages/pdf/src | wc -l; grep -rln "from '@xmldom/xmldom'" packages/pdf/src | wc -l; grep -rnE "DOMParser|XMLSerializer" packages/pdf/src -l | xargs grep -L "@xmldom/xmldom" | wc -l; grep -rln "fetch(" apps/app/src/pdf; grep -n "environment" packages/pdf/vitest.config.ts; grep -c "no-restricted-globals" packages/pdf/eslint.config.js
EXPECT: 0 ; >= 1 ; 0 (every file using DOMParser/XMLSerializer imports them from xmldom) ; apps/app/src/pdf/branding.ts only ; node ; >= 1
8. Scenario 8 (real raster): resvg-based test renders main and head views with dimension and highlight-colour assertions.
CHECK: cd packages/pdf && corepack pnpm vitest run tests/raster.test.ts 2>&1 | tail -2
EXPECT: passed
@@ -39,9 +39,13 @@ Un PDF Faunosteo doit rester lisible, interprétable et réexportable dans le fu
CHECK: grep -c "home.import.snapshot_reason\." apps/app/src/i18n/fr.ts apps/app/src/i18n/en.ts; grep -c "'pdf\." apps/app/src/i18n/fr.ts
EXPECT: 5 5 ; 0
12. Whole workspace green and buildable: `corepack pnpm typecheck && corepack pnpm lint && corepack pnpm test:run && corepack pnpm build` from the root; `docker build -t faunosteo-step6 .` succeeds.
EVIDENCE: 2026-10-11 orchestrator: root typecheck/lint/test:run (154+21+130+53+222 = 580 tests) and build rc 0 at 9bd5173; `docker build -t faunosteo-step6 .` exit 0 (log in the session scratchpad, image tagged). MET.
13. Docs: docs/PDF-FORMAT.md describes envelope v1, snapshot content, layered reading, rebase, caps, sizes; CLAUDE.md folder map lists packages/pdf and the new apps/app/src/pdf files; CHANGELOG has the Step 6 entry; DEPLOY.md has the rollback note.
CHECK: grep -c "envelopeVersion\|snapshotRejected\|rebase" docs/PDF-FORMAT.md; grep -n "packages/pdf" CLAUDE.md | head -2
EXPECT: >= 3 ; present
## CLARIFICATIONS
- 2026-10-11 (orchestrator, after verifier pass 1 ECARTS(31): oracle defects + scope): CHECKs of criteria 6 and 7 rewritten above (the behaviour was met, the oracles counted the wrong thing). FILE SCOPE widened below to the structurally necessary files. Deleted tests authorised: `apps/app/tests/unit/pdf.attachment.test.ts` → replaced by `packages/pdf/tests/read.test.ts` (roundtrip, no_attachment, oversized) and `apps/app/tests/unit/pdf.import.test.ts`; `pdf.attachment.inflate.test.ts` → `packages/pdf/tests/security.test.ts` (inflate bomb); `pdf.svgToPng.test.ts` → `apps/app/tests/unit/pdf.browserRasterizer.test.ts`. The spec (Part II §18, Phase 4 contract criterion 1) planned the removal of the legacy modules with their tests.
## FILE SCOPE
packages/pdf/**, packages/domain/src/{archive,report/rebase.ts,anatomical-sheet/sheet-index.ts}, packages/anatomy/src/render/compose.ts, apps/app/src/pdf/**, apps/app/src/state/**, apps/app/src/app/routes/{HomeRoute,EditorRoute}.tsx, apps/app/src/i18n/{fr,en}.ts, apps/app/src/sheets/provider.ts, apps/app/vite/sheet-bundle.ts, apps/app/scripts/**, apps/app/tests/**, docs/**, CLAUDE.md, README.md, CHANGELOG.md, DEPLOY.md, Dockerfile, packages/README.md, pnpm-lock.yaml.
packages/pdf/**, packages/domain/** (src/archive, src/report/rebase.ts, src/anatomical-sheet/sheet-index.ts, barrels, package.json, tests), packages/anatomy/src/render/{compose,index}.ts, packages/anatomy/src/curation/app-review.ts, packages/anatomy/tests/render.compose.test.ts, apps/app/package.json, apps/app/src/services/sheetIndex.ts, .claude/** (memory, TODO, contracts), apps/app/src/pdf/**, apps/app/src/state/**, apps/app/src/app/routes/{HomeRoute,EditorRoute}.tsx, apps/app/src/i18n/{fr,en}.ts, apps/app/src/sheets/provider.ts, apps/app/vite/sheet-bundle.ts, apps/app/scripts/**, apps/app/tests/**, docs/**, CLAUDE.md, README.md, CHANGELOG.md, DEPLOY.md, Dockerfile, packages/README.md, pnpm-lock.yaml.