chore(memory): V1-2.2 checkpoint, evidence, BDR-086, LRN-097/098, TODO

This commit is contained in:
bchanot committed 2026-10-29 14:05:28 +01:00
1 parent ca31b787b6
commit 17d919971e
8 files changed
+213 -4

No files matched your search

+11 -2
View File
@@ -537,7 +537,7 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- [x] owner ratified O1-O23 (brief « V1-2.0 : ratification des arbitrages O1 à O23 et consolidation du contrat », 2026-10-28, BDR-082)
- [ ] consolidation (docs only): contract rewritten (decisions §17, contradictions C1-C14 §19.2, steps §16 with 9 headings each); IMPLEMENTATION_PLAN §0 + Steps 13/17 notes, ANATOMICAL_SHEET_MODEL stale Zod/TS mentions + V1-2 pointer, OPEN_QUESTIONS conflicts 1-2, V1-1 §5.4 pointer (N1 amended), rule sheet-model, CLAUDE.md pointer; 3 fresh challengers (business CONCERNS 3 major, security FATAL 1 arbitration + 6 major, simplicity CONCERNS 5 major) integrated (contract §19.3); commit + push branch; STOP at checkpoint: owner final review, no V1-2.1
- [x] AR-1 ratified option B by the owner 2026-10-28 (BDR-083): `aal2` on every platform role change; contract §5.7 (rule, inventory, bootstrap, factors, recovery, sessions), F17-F19, M4 scope, tests §15, DEV order §16.11 (enrol before M4); docs only; independent security review then commit + push; no code, migration or DEV change
- [ ] V1-2.1 server access and workflow (M4, M5): owner go 2026-10-28 (brief « V1-2.1 : SQL, habilitations et cycle de vie »); sandbox only, DEV untouched; STOP at checkpoint (report §14). State 2026-10-28: BUILT + TESTED on sandbox, checkpoint report delivered, awaiting owner validation; BDR-084, LRN-095
- [ ] V1-2.1 server access and workflow (M4, M5): owner go 2026-10-28 (brief « V1-2.1 : SQL, habilitations et cycle de vie »); sandbox only, DEV untouched; STOP at checkpoint (report §14). State 2026-10-28: BUILT + TESTED on sandbox, checkpoint report delivered; VERIFIED by the owner 2026-10-29 at ac71c5b (M4/M5 accepted for the branch, not for DEV or production); BDR-084, LRN-095
- [x] A prep: worktree deps; sandbox (old schema) service_role grants recorded (ALL on 7 tables → 0 after F12); F1-F17,F19 reproduced on old schema (repro_old.out), F18 two-session race
- [x] B M4 `20261028100000_sheet_access_hardening`: grants table + rights RPCs; has_mfa / has_aal2_session / grant_active / caller_has; catalogue reader predicate + policies; can_edit_sheet on capability (F14); AR-1 B role RPCs + private writers (F19), F17, F18 advisory lock; F1 F3 F5 F6 F8 F9 F12 F13 F15 F16; historical-sheet + asset triggers; fork/visibility/personal-create dropped; shim auth.sessions + auth.mfa_factors; pgTAP 015 + 001/003/004 adapted
- [x] C M5 `20261028110000_sheet_review_workflow`: version/sheet columns, version guards (content/revision/author, freeze, publish gate, deprecation), rounds/comments/acks, lifecycle + review + publish(review_id) RPCs, species RPCs, working copy, read RPCs, upload (register, confirm with storage check F7, INSERT policy, 2 MiB), operator read RPC, mirror dropped + `sheet_all_reviewed`, superseded signatures dropped; pgTAP 016 + 005/006/007 rewritten, 008/011 deleted, Rust generator trimmed + ledger retargeted
@@ -563,7 +563,16 @@ Order (BDR-071): P0 docs + decisions → V1-1 clients and animals → V1-2 sheet
- [x] H4 gates: pgTAP fresh + upgraded, PGlite + unit, sandbox suite ×2, concurrency, fresh + M3→M5 (M7 rehearsal), types, check:all; fresh verifier + security on final HEAD; DEV metadata before/after — sandbox done on 7eca441 (pgTAP 1352 ×2 per stack, suite 86/86 ×2 per stack, types match, M7 diff = bucket + service_role only, DEV containers untouched: same ids, start times, restart counts; nothing on DEV read); check:all + reviews on final HEAD pending
- [x] H6 review findings on 1281667 (verifier ECARTS(6), security PASS + 1 MEDIUM): number-exponent amplification → raw OOM (bounded number-text pre-sum, closed code, pgTAP); AR-1 B §15 matrix (015); rights RPCs refused for non-owners (015); `publish.species.other` alone (017); docs §1, §9.5, §12.2 vectors, evidence §3; then gates again + fresh reviews — done 3eba6d8/5620399: pgTAP 1807 ×2 per stack, suite 86/86 ×2 per stack, PGlite 128, bomb proof on real image; second reviews on 7c4bf12: verifier ECARTS(1) LOW (raw red-on-old log → committed .out), security BLOCK(1) HIGH quadratic number walk → linear 538d103, perf fixture 2379d28; rerun 2379d28: pgTAP 1808 ×2 per stack, suite 87/87 ×2 per stack; final: check:all green on 532c61e; security PASS on 1f9fa8b (code = final); verifier ECARTS(3) LOW docs on 1f9fa8b → fixed, delta verifiers → CONFORME on 532c61e. Open for V1-2.3: `e2e:avatar` targets DEV (verifier O3), quadratic status walks, ingress body cap, schema_version 2.0 raw 22P02
- [x] H5 memory (BDR M6/size, journal), commit + push branch, final report
- [ ] V1-2.2 core verdict, preview, change list, edit primitives, SVG cleaning · V1-2.3 drawings and worker verification (M6) · V1-2.4 wireframes (editor, review, admin entry) · V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11)
- [x] V1-2.2 core: verdict, PreviewSheet, edit primitives, SVG cleaning (owner brief 2026-10-29 « Autorisation de démarrer V1-2.2 », V1-2.1 VERIFIED at ac71c5b; contract §16.3; sandbox only, DEV untouched; no SQL, no screen; STOP at checkpoint, no V1-2.3; state 2026-10-29: READY FOR REVIEW, owner checkpoint). Owner answers 2026-10-29: editor exports (Inkscape/Illustrator/Figma) supplied by the owner, cairo + ImageMagick exports committed meanwhile; strict-parse failure = `verification.integrity.document` (§6.5; §6.7 wording aligned); PreviewSheet draft = caps + missing drawings reported, published/deprecated = fatal
- [x] A size: `domain/sheet/size.rs` PostgreSQL jsonb text measure (`octet_length(content::text)`, numbers as `numeric` prints them, linear); oracle: corpus measured by the sandbox PostgreSQL + the pgTAP 017 vectors (cap − 1, cap, cap + 1, 3- and 4-byte, dense, exponent numbers)
- [x] B review model: element keys, caps report (SnapshotCaps, all), completeness (statuses, vet referrals, uncited), groups + digests (general, view:, zone:, removal groups, coverable), change list vs base
- [x] C verdict: `domain/sheet/verdict.rs` pure function (binding, document text, base text, drawings with row sha256/size/bytes) → verdict in the shape M5 reads (`groups[{key,digest,coverable}]`, `drawings[{asset_id,sha256}]`, `fingerprint`); closed codes `verification.integrity.*` / `verification.validation.*`; not exposed to the browser (O15)
- [x] D PreviewSheet: builder (drawings by sha256 checked, read once), draft / published / deprecated, failures `drawing_missing`, `drawing_hash_mismatch`, `fingerprint_mismatch`, `invalid_document`, `caps`; `replace_document`, `add_drawing`, `view.canvas` shared with LoadedSheet, `preview.state` (report, drawings, index tables)
- [x] E `sheet.edit` primitives (insert, update, remove, move, set_status, mark_reviewed) with §6.6 status rules; `sheet.dependents`
- [x] F SVG classification + cleaning (§9.2): active/external removals classed in the sanitiser walk, `clean_svg(bytes)` (clean / cleanable / rejected), cleaned bytes ≤ 2 MiB, fixpoint property test, hostile corpus, cairo + ImageMagick exports (owner editor exports pending)
- [x] G wasm facade (`PreviewBuilder`, `PreviewSheet`, `clean_svg`, free ops) + ts-rs types + index; core-wasm proofs (equine preview = bundle index + fingerprint, mismatches, replace without re-read, hostile corpus in fresh instances)
- [x] H docs (RUST.md §12, contract §6.7/§8.1/§9.2/§10/§17.4, CLAUDE.md, sheet-model rule), gates, fresh reviews, evidence, memory, commit + push. Reviews: verifier ECARTS(6) then ECARTS(3) (A6 owner exports, A12 covered by check:all, helper recorded); security PASS ×2, every MEDIUM fixed except owner decisions below. check:all green on 741c25c and 8294d54 (rerun on final). Open for owner: dangling #id across inlined drawings (scope ids per view or refuse), clean file uploaded as original bytes (§9.2), stricter-than-table refusals and the edit-command reading (§8.1, §9.2 « for the owner's confirmation »), cairo rgb() colours lost on cleaning, editor exports pending. Open for V1-2.3: M6 must accept a failed verdict without groups/drawings; R2 view.parent.cycle quadratic; PreviewSheet under CoreRuntime poison/recovery at V1-2.5
- [ ] V1-2.3 drawings and worker verification (M6) · V1-2.4 wireframes (editor, review, admin entry) · V1-2.5 catalogue, admin space, rights, species, MFA · V1-2.6 editor level 1 · V1-2.7 preview, review, publication UI · V1-2.8 equine working copy and review preparation · V1-2.9 FR/EN acceptance and closure (owner checkpoints V1-2.3, V1-2.4, V1-2.6, V1-2.7, V1-2.8, V1-2.9 + each DEV operation of contract §16.11)
## Release readiness track (owner 2026-10-25, distinct from the functional roadmap; nothing here authorises a release or exposure)
Inventory: `.claude/audits/2026-10-25-functional-inventory.md`. Each item: treat or qualify before any release or public exposure; not fixed now unless an active critical flaw is shown.
@@ -0,0 +1,70 @@
# Contract: V1-2.2 core (verdict, PreviewSheet, edit primitives, SVG cleaning)
Source of truth: `docs/development/V1-2_ANATOMICAL_SHEETS.md` (the "V1-2 contract"), §16.3 for the
step, with the sections it cites. Owner brief 2026-10-29 « Autorisation de démarrer V1-2.2 ». Base
commit `ac71c5b` (V1-2.1 verified by the owner). Diff under review: `ac71c5b..HEAD` on
`feature/v1-2-anatomical-sheets`.
## Scope (§16.3)
1. The verdict function: strict parse, issues, caps, drawings, fingerprint, completeness, groups,
digests, removal groups, change list (§6.3, §6.4, §6.5, §6.6, §6.7).
2. `PreviewSheet` as the catalogue, preview and editor handle, with `view.canvas` on it (§8.1, §10).
3. `sheet.edit` primitives with the status rules of §6.6; `dependents` (§8.1).
4. SVG classification and cleaning (§9.2).
5. Application changes limited to the wasm facade and the ts-rs types; no SQL change; no screen.
## Acceptance criteria (§16.3, §15 « Core »)
- A1 Hash and fingerprint mismatches refused by `PreviewSheet`.
- A2 The equine draft previews with the same index and fingerprint as from the bundle.
- A3 An invalid draft draws with its issues.
- A4 A document replacement redraws without re-reading the drawings.
- A5 The groups of a derived version that deletes a zone include its removal group.
- A6 Vector-tool exports cleaned and hostile files refused (see owner decision D1 below).
- A7 Every edit primitive outputs a strictly parseable document, keeps existing keys and applies the
status rules (property tests).
- A8 Groups, digests and removal groups; the change list; the verdict function tested.
- A9 SVG classification and cleaning tested on committed vector-tool exports and the hostile corpus;
the cleaning fixpoint proven by a property test.
- A10 Caps fixtures at cap − 1, cap, cap + 1 and with astral characters.
- A11 The document size computed in the measure of §12.2 (`octet_length(content::text)`, the jsonb
text form, never `JSON.stringify`), reusing the pgTAP 017 vectors.
- A12 Wasm facade and ts-rs types; the N-1 reader untouched; the frozen oracles green.
- A13 None of the protected readers is modified: `crates/core/src/domain/{archive/read,report/rebase,
report/read,session}.rs`, `crates/core/src/pdf/{read,json_js,import}.rs`, the frozen
`packages/core-wasm/tests/n-1` copies. Any change there is a deviation.
- A14 The verdict is never computed or accepted from a page (O15): no RPC or browser path makes a
verdict authoritative.
- A15 Verdict shape compatible with what the M5 SQL (`supabase/migrations/20261028110000_sheet_review_workflow.sql`)
reads: `verdict->'groups'` items `{key, digest, coverable}`, `verdict->'drawings'` items
`{asset_id, sha256}`, `verdict->>'fingerprint'`.
- A16 No DEV operation, no SQL migration, no merge, no change outside the scope above beyond the
documents that record it.
## Owner decisions taken during the step (2026-10-29, contract §17.4)
- D1 The editors' exports (Inkscape, Illustrator, Figma, Affinity) are supplied by the owner later,
under `crates/core/tests/fixtures/svg/exports/owner/`; the exports of tools installed on the
development machine (cairo, ImageMagick) are committed meanwhile. A6 is therefore partially met
until the owner's files arrive; the report must say so.
- D2 A document that does not read strictly fails as `verification.integrity.document` (§6.5); the
19 rule errors are `verification.validation.rules`.
- D3 `PreviewSheet` of a draft reports caps excess and missing drawings; a published or deprecated
version refuses them (`caps`, `drawing_missing`); hash mismatch and an unreadable document refuse
every mode.
## Where to look
- Core: `crates/core/src/domain/sheet/{size,keys,caps,review,report,verdict,preview,edit}.rs`,
`crates/core/src/anatomy/svg/{clean,sanitize,mod}.rs`, `crates/core/src/{ops,facade}.rs`.
- Wasm: `crates/wasm/src/lib.rs`; `packages/core-wasm/{src,types,tests/preview.test.ts}`.
- Tests: `crates/core/tests/{sheet_size,sheet_review,sheet_verdict,sheet_preview,sheet_edit,svg_clean}.rs`,
oracle `crates/core/tests/oracles/v1-2-2/`, fixtures `crates/core/tests/fixtures/svg/exports/`.
- Records: `docs/development/RUST.md` §12, the contract's §6.7, §9.2, §10, §17.4.
## Commands
- `pnpm rust:check` (fmt, clippy, all core feature suites, ts-rs export, cargo deny).
- `pnpm wasm:build` then `pnpm --filter @faunosteo/core-wasm test:run` (the size budget is 600 000 B).
- `cargo test -p faunosteo-core --test sheet_verdict` (and the other five suites).