Files
faunosteo/.claude/rules/schemas.md

21 lines
1.4 KiB
Markdown

---
paths: ["crates/core/src/domain/**", "packages/core-wasm/tests/n-1/**"]
---
# Schemas
- The data contracts live in Rust since R2 (`crates/core/src/domain/{sheet,report,archive}`, Zod semantics
reproduced: strict where Zod was strict, optional absent, nullable required, Zod schema field order);
`packages/domain` was deleted at R5.7; its byte-identical Zod copy under `packages/core-wasm/tests/n-1` is the
permanent N-1 reader. Never change a contract
without bumping the version on a breaking change (additive optional fields keep it); a change touches the
Rust struct, the regenerated ts-rs types and the N-1 test. A new optional field of the sheet document is omitted when
absent and refuses `null` (`skip_serializing_if`, `js::present`, `ts(optional)`), so existing fingerprints stay
equal and the ts-rs type stays assignable to N-1; the V1-2.6 category keys also need the proofs of
`docs/development/V1-2-6_UX_COMPATIBILITY.md` §8 (T2)
- Every report entering the store comes from the core (new report, draft restore, import, reducer outputs);
form values are plain assignments (D-R7)
- Report version 3: zones by `(annotationId, viewId)`, findings by `(findingZoneId, path)`, severities
`mild|moderate|severe`, `sheet` reference; v2 is migrated through `report-migration-map.json`
(`migrateReportV2ToV3`, never throws on content, `unresolved: true` marks what the sheet no longer holds);
v1 and unknown versions are refused with a typed error