feat(domain): R2.1 Rust contracts of the sheet, report and archive documents

Sheet document v2, report v3 / v2 / identity, migration map, sheet snapshot,
branding, PDF labels and archive envelope ported from the Zod schemas with
their exact semantics: strict objects where Zod is strict, optional fields
absent (never null), nullable fields required, integers as JavaScript
numbers, UTF-16 caps, hand-checked patterns, url crate for .url(), lone
surrogate escapes read as U+FFFD (L1, owner confirmation pending).
Fields in Zod schema order (PDF labels in the engine dictionary order):
the curated and legacy sheets, the demo report and the three frozen
archive envelopes print byte for byte as their Zod / attachment form.
ts-rs types regenerated; plan rev 2 after three plan challenges.
This commit is contained in:
bchanot committed 2026-10-14 00:04:01 +02:00
1 parent 3114d67959
commit ee0700887f
87 files changed
+2657 -148

No files matched your search

+10
View File
@@ -164,6 +164,16 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo
- [ ] R0.11 follow-ups for the CI/CD step (owner): ci.yml push/PR triggers stay live, so registering a runner starts PR builds at once (keep, or switch to workflow_dispatch until then); `actions/*@v4` mutable tags (Step 27); advisories cadence while no nightly runs (`cargo deny check advisories` is warn-only in check:all); `--remap-path-prefix` if native and builder wasm must match byte for byte
- [x] R1 = Step 8 worker in Rust (delivered 2026-10-13 on feature/step-08-files-foundation, see Step 8 block; awaiting owner validation): decode child dispatched before any thread, empty env, RLIMIT_AS/CPU, traced seccomp allowlist, `image` + `moxcms` + `libwebp-sys` in the child, parent RIFF-header check only, 512 KiB output cap, per-stage deadlines, service key
- [ ] 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)
- [ ] 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