docs(docs): R5.6 active, RUST.md 11.22, CHANGELOG, BDR-070, LRN-077, audits, contract clarification

This commit is contained in:
bchanot committed 2026-10-25 02:24:35 +01:00
1 parent 9e87016399
commit b4f54ba000
9 files changed
+250 -1

No files matched your search

@@ -0,0 +1,167 @@
# Security audit: R5.6 fingerprint switch, activated (9e87016)
Mode audit, fresh and blind. Scope: `git diff 59521dc 9e87016` (31 files, all present at HEAD),
branch `feature/rust-r5-pipeline-core`, working tree clean before and after. Contract:
`.claude/tasks/contracts/2026-10-25-rust-r5-6-rehearsal.md` (S1-S8 + Clarification 2026-10-25) and the
owner's activation brief. No file modified except this report; no network beyond semgrep's rule
download; no service key, no Supabase, no transfer tool, no `pnpm format`.
```
SECURITY — VERDICT: PASS
TOOL: semgrep 1.168.0 — p/security-audit, p/secrets, p/owasp-top-ten
SCOPE: 31 files
BLOCKING:
(none)
REPORTED (non-blocking):
- [LOW] rebase-exact-equality-no-sheet-id (pre-existing, R2) — crates/core/src/domain/report/rebase.rs:43
- [LOW] registry-and-declaration-check-public — crates/core/src/domain/sheet/fingerprint.rs:44, :103
- [LOW] snapshot-assets-outside-fingerprint (pre-existing trust model) — crates/core/src/domain/archive/snapshot_rules.rs:79
- [LOW] caller-built-export-input-trusted (pre-existing, documented) — crates/core/src/pdf/write/input.rs:205
- [LOW] new-lint-allow-in-test-file (not a security suppression) — crates/core/tests/r5_6_switch.rs:8
PROOF: semgrep 129 rules on 31 files → 0 findings; checklist 8 checks → 0 findings in scope (+1 guardrails WARN outside the diff); alias-path review 14 checks → 0 blocking, 5 LOW
```
## Tooling
- semgrep 1.168.0, pinned packs, `--metrics=off`: 129 rules run on the 31 changed files, 0 findings,
0 errors.
- Guardrails scanner (`~/.claude/skills/guardrails/scripts/scan.py --domain api,supabase`): 0 FAIL,
1 WARN, 1 MANUAL. The WARN (`SB-POLICY-NOT-OWNER`,
`supabase/migrations/20261008110000_anatomical_sheets.sql:1177`, `species_select_active`) is in a file
outside the diff: out of scope, not counted. MANUAL not reported.
- Hermetic tests run in the main tree (no file written outside `target/`):
- `cargo test -p faunosteo-core --features cli --locked`: `r5_6_switch` 14/14, `sheet_fingerprint` 11/11
(incl. `nesting_is_bounded_with_a_controlled_error`), `pdf_import` 4/4, `pdf_compare` 16/16;
lib unit `the_registered_pair_holds_one_way_for_its_sheet_only` 1/1.
- vitest `packages/core-wasm/tests/r5-6.n-1.test.ts` 2/2 and `apps/app/tests/unit/r5-6.switch.test.ts`
2/2 (BUILD_STAMP accepted, module current).
- `bash scripts/import-equine.sh --check` (compare-only, read before running): legacy-import 6 files
0 differences, draft 12 files 0 differences.
## Checklist (STEP 3), scoped to the diff
| Check | Result |
|---|---|
| Hardcoded secret / token / key / auth URL | none (added lines grepped; the hex values are public fingerprints) |
| SQL by concatenation | none (no SQL in the diff) |
| Unsanitised render (innerHTML, eval, raw) | none |
| Sensitive endpoint without authz | N/A: no endpoint, RPC or policy in the diff |
| Stack trace / internal path to the user | none new. `facade.rs:56` maps `LoadError::Fingerprint` to `invalid_sheet` with the refusal's Debug text (a recomputed hex or a serde reason about the page's own bundle), no path, no secret |
| Secret / PII in a log | none (no log call added) |
| Tracked `.env` / credential file | only `.env.example` tracked |
| Guardrails scanner | run, nothing in scope (see above) |
Anti-gaming (STEP 4): no new `nosemgrep`, `nosec`, `eslint-disable`, `@ts-ignore` in the diff. One new
`#![allow(clippy::disallowed_methods, clippy::unwrap_used, clippy::expect_used)]` heads the new test file
`crates/core/tests/r5_6_switch.rs:8`. It is the shared header of 20+ integration test files (the core's
no-I/O and no-panic lints, which tests that read fixtures must relax), not a security-rule suppression:
reported LOW, not blocking.
## Alias paths attacked (the brief)
1. **`equivalence` crate-private.** `fingerprint.rs:72` is `pub(crate)`. Its one non-test caller is
`LoadedSheet::recognises_historical_stamp` (`loaded.rs:169`). The wasm crate references no
fingerprint item (`crates/wasm/src` grep empty).
2. **One decision point.** Every alias decision goes through `recognises_historical_stamp`
(`loaded.rs:163-171`): `build_sheet_snapshot` (`snapshot_rules.rs:62-64`, behind `archive.snapshot`
`ops.rs:361-363`), `rebase_report_on_sheet` (`rebase.rs:43-46`, reached by `session.rs:89` draft
restore and `session.rs:127` import), `sheet_line` (`compare/lines.rs:350-358`). The only other
reader of `TRUSTED_ALIASES` in `src` is the generator (`pipeline.rs:185`), which writes the
descriptive list into `sheet-ref.json`; that list is never read back for a decision
(`declared.aliases` is only passed to `check_declared`, `loaded.rs:199-204`).
3. **Forging the private verified state.** `verified_fingerprint` (`loaded.rs:75`) is a private field;
`from_bundle` is the only constructor (`loaded.rs:121-151`), `LoadedSheet` derives neither
`Deserialize` nor `Default`, struct-update syntax is impossible outside the module, and
`unsafe_code = "forbid"` applies to core and wasm (workspace lints, `Cargo.toml:55`, both crates
`[lints] workspace = true`). `Clone` copies the state with the document, which the recomputation then
re-proves. The wasm `SheetHandle` keeps its `LoadedSheet` private (`crates/wasm/src/lib.rs:27`), so a
page cannot mutate it.
4. **Recomputation at the decision.** The predicate requires a verified value, `verified ==
reference.document_sha256`, the registry pair `(sheet_id, alias → verified)` in one direction, and
`document_fingerprint(&self.document) == verified` now. A mutated pub `document` or `reference`, a
cloned sheet re-pointed to another sheet id, a v0 sheet, or a stamp the registry does not bind all
return false (tests `a_mutated_document_or_reference_never_keeps_the_alias`,
`the_historical_value_on_another_sheet_id_is_not_recognised`). A bundle with another sheet id and
the genuine document verifies but never matches the registry (entry pinned to the equine id); a
bundle with the equine id and other content verifies to another value the registry does not bind.
Granting the alias therefore needs the genuine content (SHA-256 preimage otherwise).
5. **Injectivity of the fingerprinted form.** The value hashes the typed reading serialised back. Checked
for collapses that would let two behaviours share a value: no `#[serde(skip)]` or `flatten` in
`sheet/schema.rs`; `skip_serializing_if = "Option::is_none"` (lines 169, 176) round-trips; the
untagged enums (`SheetView`, `Geometry`) carry distinguishing fields. The app consumes the same
typed document, so text-only differences the reading erases are never behaviour.
6. **v0 / v1 and direction.** No block = v0, unverified, no privilege (`check_reference` returns
`Ok(false)`, `loaded.rs:196-198`); an unverified v0 sheet carrying the canonical value still
rebases an old report and its direct export is refused (`SheetMismatch`, test
`the_direct_export_on_an_unverified_v0_sheet_with_the_canonical_value_is_refused`). The registry is
consulted only as alias → canonical, so a v0 (rollback) sheet never recognises a `v1` stamp.
`check_declared` refuses a declared value that is a registered alias or not 64 lowercase hex
(`fingerprint.rs:112-118`).
7. **`null` and malformed blocks.** `present_block` (`loaded.rs:46-50`) turns an explicit `null` into a
shape error; `DeclaredFingerprint` is `deny_unknown_fields` with required `convention` and
`aliases` (`loaded.rs:52-57`); a string block and an unknown key are refused (tests). A misspelt key
on the non-strict `BundledRef` only downgrades to v0: fail-closed, no privilege.
8. **Aliases never from a report, archive or bundle.** Archives cannot carry one: `SheetSnapshotRef`
and the snapshot are `deny_unknown_fields` (`archive/snapshot.rs:42, 59`); the archive reader keeps
strict equality between snapshot and report stamps (`archive/read.rs:116-119`, unchanged).
9. **Export input strict.** `assert_exportable` (`pdf/write/input.rs:204-210`) is unchanged by the diff:
strict sheet id and stamp equality, no registry. The alias only reaches an archive through the
core-built snapshot of a verified sheet.
10. **`report:compare`.** The alias line prints both raw values truncated to 12 chars through `esc`
(`compare/lines.rs:366-376`); `same_sheet` still requires the sheet id; the bin reads the seed's
block through the same `present_block` and `from_bundle` verification (`bin/report_compare.rs:40-44,
66`).
11. **`canonical_json` depth.** Bounded at `MAX_CANONICAL_DEPTH = 128` with `CanonicalError::TooDeep`
(`fingerprint.rs:132-154`), above serde_json's parse limit (127 nested containers accepted), so
every parsed bundle fits and a value built in code beyond it errors instead of overflowing the stack.
Tested at 128 / 129, arrays and objects.
12. **Recomputation cost.** In the predicate the recomputation is the last conjunct, after the registry
match: a forged or unknown stamp costs a string compare, only the registered historical stamp
triggers one recomputation (one per export snapshot, rebase or compare line). The load recomputes
once per `SheetHandle` when a block is present (page runtime, `runtime.ts:322`, and each import
worker, `handler.ts:48`), O(document), 302,794 B for the equine draft. Not attacker-amplifiable:
the bundle is build-time, a report triggers at most one recomputation per call. The 14 switch tests
(loads, imports, exports) run in 0.81 s in a debug build.
13. **Seed artifacts.** Only `draft/sheet-ref.json` and `draft/report-migration-map.json` change.
`document.json` (sha256 27c7383c…), `assets/horse.svg` (0ea5202f…) and `equine_draft.sql`
(c5a24312…) hash identically at 59521dc and HEAD. The committed block is consistent: value
`12d78872…`, convention `v1`, alias `27c7383c…`, which is the registry entry and the old file-bytes
hash. The migration map changes only its `documentSha256`.
14. **Oracles, goldens, N-1.** 0 files changed under `crates/core/tests/oracles`, `crates/core/tests/pdf`,
`apps/app/tests/fixtures`, `packages/core-wasm/tests/n-1`. The new
`crates/core/tests/fixtures/r5-6/pre-switch/{sheet-ref,report-migration-map}.json` are byte-identical
to the 59521dc seed files (sha256 2c0716f1…, 4139c51d…), so the redirected historical tests read
the real pre-switch inputs and cannot mask an anatomical change. Exact-equality semantics are
unchanged and documented as no proof of content (`fingerprint.rs:13-18`).
## Reported findings (LOW, non-blocking)
**L1. Rebase exact-equality branch has no sheet-id check** — `crates/core/src/domain/report/rebase.rs:43`.
Pre-existing since R2, unchanged in meaning: a report of another sheet id stamped with the current
sheet's value skips the rebase. The new alias branch does check the sheet id. Hint: add
`report.sheet.sheet_id == sheet.reference.sheet_id` to the equality branch in a later step (behaviour
change, owner decision).
**L2. Registry and declaration check stay public** — `crates/core/src/domain/sheet/fingerprint.rs:44`
(`TRUSTED_ALIASES`), `:103` (`check_declared`). Neither grants anything by itself and no consumer misuses
them today (integration tests and the generator need them), but a future crate consumer could rebuild an
alias decision from the registry without the recomputation. Hint: `#[doc(hidden)]` plus a doc line, or
move the tests in-crate and make both `pub(crate)`.
**L3. Archived drawings are outside the document fingerprint** —
`crates/core/src/domain/archive/snapshot_rules.rs:79` (`snapshot_assets(sheet)`). A hand-made bundle with
the genuine document but other SVG texts would archive them under the historical (or the canonical)
stamp. Pre-existing trust model (the bundle is trusted for what it declares, `fingerprint.rs:15-18`); the
alias adds no privilege the canonical stamp did not already have. Hint: bind asset hashes into the
document or check `asset_hashes` against the texts at load, if the threat model ever includes
non-build bundles.
**L4. Caller-built export input trusted for its self-consistent report and snapshot** —
`crates/core/src/pdf/write/input.rs:205`. A page script can hand the export any matching pair; the
registry is never consulted there and every reader decides again on import. Documented residual,
unchanged by the diff.
**L5. New lint allow in a test file** — `crates/core/tests/r5_6_switch.rs:8`. Shared test-file
convention for the core's I/O and panic lints, not a security suppression.
SECURITY — VERDICT: PASS
@@ -0,0 +1,9 @@
# R5.6 active state — fresh verifier (Opus) on 9e87016, persisted by the orchestrator (verifier is read-only)
VERIFY — VERDICT: ECARTS(1)
- S1-S6, S8 MET; A1-A5 MET (applied code = verified patch + 4 declared owner adjustments; only sheet-ref.json 03e7f6ab…623b and report-migration-map.json 0e991bc2…e2db changed, value 12d7…74e2, block = registry; document.json, horse.svg, equine_draft.sql identical; no oracle/golden/n-1 change; --check 0 differences; import:equine = Rust, legacy = TS)
- S7 NOT-MET: contract still required an inactive branch; activation authorised by the owner inline → settled by the 2026-10-25 activation Clarification of the contract
- Probe (direct export API): v0 + canonical → SheetMismatch; mutated document / reference / id → refused; other sheet id → refused; reference set to the alias value after load → strict equality on a caller-declared value (documented trust boundary, no alias privilege); v1 block with aliases [] still recognises (declared list descriptive)
- Notes: dangling citations BDR-070 / RUST.md §11.22 (added after); equine_draft.sql header still names packages/anatomy (frozen bytes); scripts/import-equine.sh:3 line long; CHANGELOG added after
- FLOOR clean
+4
View File
@@ -520,3 +520,7 @@ Status: active. R5.1b + R5.2 done 2026-10-22; documentSha256, seed, report contr
## BDR-069 | 2026-10-24 | Refuse three non-canonical v3 report shapes at reader entry
Decision (owner go): `check_v3_shape` on raw value before `Report::deserialize`: `sheet`, `practitioner` must be objects, `severity` string. At `read_report_document` v3 + `parse_envelope`. Rationale: serde derives accepted positional arrays / one-key enum maps Zod refused → crafted file could swap same-typed fields silently. Alternatives: generic shape guard (draft/shape.rs style) on whole contract (wider, not authorised); `deserialize_with` in contract structs (touches contract). Status: applied d502dfa; v2 + other contracts keep serde leniency (not in go). Owner confirmed fingerprint convention `sha256-rfc8785-validated-v1`, one alias `27c7383c…2660`; R5.6 scope files approved, switch not authorised.
## BDR-070 | 2026-10-25 | D-R5.6 active: fingerprint `sha256-rfc8785-validated-v1`, registry alias, M1 option 1
Decision (owner, activation 9e87016): sheet fingerprint = SHA-256(JCS RFC 8785 of R2 typed reading, no integrity error, warnings allowed, depth 128). Equine canonical 12d78872…74e2; old 27c7383c…2660 = sole TRUSTED_ALIASES entry, bound to sheet 503dc301 + content. Alias honoured only via LoadedSheet::recognises_historical_stamp (loader-verified v1 private state + document recomputed at decision + one-way registry pair + same sheet id); equivalence pub(crate). M1 option 1: snapshot of old report keeps its stamp (build_sheet_snapshot); export, archive reader strict. v0 refs (no block) load unverified, no privilege; null/malformed block refused. Rust = sole seed writer, TS legacy until R5.7. Alternatives rejected: A file-bytes (Prettier-bound), C Prettier reproduction; re-stamp at rebase (rewrites reports); export-side alias (M1 defect, no proof). Status: active on feature branch; rollback not transparent for post-switch reports (rebased, nothing lost) → settle before user release.
+5
View File
@@ -366,3 +366,8 @@ R5.4: `draft/{labels,changelog,review_report,drawing,overlay,app_review,svg_comp
## 2026-10-25 (R5.6 M1 fix)
- Cause M1: export sees only snapshot. Fix in build_sheet_snapshot via recognises_historical_stamp (private verified + recompute at use); input.rs strict, unchanged.
- null block refused, warnings allowed (is_publishable), canonical depth 128. Fresh worktree final: all gates green, security PASS, verifier CONFORME 8/8. STOP before activation.
## 2026-10-25 (R5.6 active)
- Owner authorised switch. Patch applied (sha = verified worktree), equivalence pub(crate), comments + trust boundary. Seed: fresh --out, 2 files copied (03e7f6ab, 0e991bc2), --check 0 diff.
- Switch commit 9e87016: rust:check + check:all green; security PASS LOW; verifier 13/14, ECARTS(1)=S7 pre-activation wording → Clarification.
- Rollback measured: new v1 report on pre-switch build → rebased, 0 unresolved, notice shown. BDR-070, LRN-077. STOP, no merge, no R5.7.
+6
View File
@@ -555,3 +555,9 @@ Apply: bound = check before the clone/allocation, at every producer (record push
Context: R5.5 upload tool. 12 loopback-stub tests green; Claude's run vs real local stack refused by permission layer (transfer tool + service key). Owner ran `pnpm e2e:sheet-assets` by hand → PASS 11/11.
Pattern: stub proves tool logic (plan, refusals, retries, no overwrite); only real service proves endpoints, status codes, grants (anon key refused at Storage, not stub). Ship a hand-run e2e script beside stub suite; record each result with its author (simulated by Claude / real by owner), never merge into one "tested".
Apply: any tool touching a real service with a privileged key: stub tests in `cargo test`, owner-run e2e script, both results in RUST.md + TODO separately. Owner validated 2026-10-24.
## LRN-077 | 2026-10-25 | Privilege decision needs proof at the call site holding the evidence
Context: R5.6 M1. Alias granted at export from snapshot's claimed value; export never saw the loaded sheet. Load-time flag alone also insufficient (pub mutable document/reference).
Pattern: put the decision where the evidence object lives (build_sheet_snapshot holds LoadedSheet), keep private verified state set only by the trusted constructor, and recompute the proof at decision time; every other site stays strict equality. Make the raw comparison crate-private so no caller can skip the proof.
Apply: any equivalence/allowlist privilege (aliases, migrations, trust marks): one decision method on the verified object, recompute, strict elsewhere, negative tests on the direct API not just app paths.
+2 -1
View File
@@ -348,7 +348,8 @@ feat/findings-tree-v2 merged (FindingsTreePicker tracked in HEAD); all work belo
- [x] original contexts (O7, O10, R2 Zod, R5.1 ledger, TS golden, app goldens) + separate post-switch tests; rust:check + check:all 00:56:22 green on switched state
- [x] gates: security PASS (1 MEDIUM, 6 LOW), verifier ECARTS(3) = export grants alias without fingerprint_verified (fix needs snapshot_rules.rs, outside scope) → checkpoint, STOP, owner decision
- [x] R5.6 M1 correction + full rehearsal (owner 2026-10-25; snapshot_rules.rs authorised): recognises_historical_stamp, null block refused, warnings allowed, depth 128; fresh worktree r56final: rust:check + check:all 01:53:59 green; security PASS (LOW); verifier CONFORME 8/8 → checkpoint, STOP (activation on signal)
- [ ] R5.6 D-R5 switch (convention, aliases, membership test in gated readers with per-file go, seed regenerated once by the Rust tool, `.prettierignore`, CHANGELOG)
- [x] R5.6 D-R5 switch ACTIVE (owner go 2026-10-25, commit 9e87016): seed sheet-ref 03e7f6ab + migration map 0e991bc2 only, --check 0 diff, rust:check + check:all green, security PASS LOW, verifier ECARTS(1)=S7 wording → Clarification; BDR-070; rollback not transparent for post-switch reports (settle before user release) → checkpoint, STOP, no merge, no R5.7
- [ ] (was) R5.6 D-R5 switch (convention, aliases, membership test in gated readers with per-file go, seed regenerated once by the Rust tool, `.prettierignore`, CHANGELOG)
- [ ] R5.7 consumer census, domain fixtures moved, packages deleted, xmldom + prettier out of the lockfile, docs, ledger; `pnpm check:all`; merge only on the owner's signal
- [ ] DEV hardening (owner 2026-10-24, risk accepted temporarily, not scheduled): Supabase on CLI demo keys + 54321 LAN-open (rootless, UFW allow incoming, no 54321 rule) → own JWT secret/signing keys via env() or narrower 54321 rule before any untrusted device or user (ENVIRONMENTS.md §3.6); never these keys in production; `confirm_sheet_asset_upload` object check before public exposure
- [ ] separate chore (D-R7): form constraints module + PGlite `pg_constraint`/config.toml parity test
@@ -50,3 +50,9 @@ the two generated artifacts; security audit; fresh verifier.
error; the direct export API is tested, not only the application paths. Final state: worktree
`/tmp/claude-1000/-home-bchanot-Documents-faunosteo/3571c861-cd6e-4751-a25e-c26da95beb85/scratchpad/r56final`
(detached at 8e77e37 + the patch, seed switched by the patch).
- 2026-10-25 (owner « Autorisation officielle de la bascule R5.6 »): S7 (isolation) is superseded for the activation: the
owner authorised the official switch on `feature/rust-r5-pipeline-core` (commit 9e87016) with `equivalence` crate-private,
stale comments fixed, the trust boundary documented, and the regeneration of exactly `draft/sheet-ref.json` and
`draft/report-migration-map.json` (procedure: fresh temporary `--out`, comparison, the two files only, `--check`). The other
S7 parts still hold: no database or Supabase mutation, no oracle regenerated, nothing deleted, no merge.
+4
View File
@@ -6,6 +6,10 @@ Versions follow [Semantic Versioning](https://semver.org/).
## [Unreleased]
### Changed (2026-10-25, Rust R5.6: the sheet fingerprint convention `sha256-rfc8785-validated-v1`)
- The equine sheet's fingerprint is now the SHA-256 of the RFC 8785 canonical form of the validated document: `12d78872…74e2` in `draft/sheet-ref.json` (with a `fingerprint` block naming the convention) and in `draft/report-migration-map.json`, the only two seed files changed; `document.json`, the drawing and the SQL seed are byte-identical. The previous value `27c7383c…2660` stays recognised for this sheet only, through the core's compiled registry and a fingerprint recomputed from the loaded document: old reports and PDFs open with no message and no rebase, and a re-export keeps their stamp so older readers keep the archive. A report written after the switch, opened by a build from before it, is rebased with nothing lost. `pnpm import:equine` runs the Rust pipeline; the TypeScript generator stays as `pnpm import:equine:legacy` until R5.7 (`docs/development/RUST.md` §11.22).
### Changed (2026-10-23, Rust R5.5: the sheet-asset upload tool in Rust)
- `pnpm assets:upload [--check] <seed folder>` runs the Rust binary `upload-sheet-assets` (`crates/core`, feature `upload`, `ureq`) in place of the TypeScript script (kept as `assets:upload:legacy` until R5.7). Local stack only: no default destination, `http` with an explicit port on loopback or the configured DEV address, a private-bucket handshake before any transfer; every file checked against `assets.json` and the SVG reader before the first request; an existing object is hashed and never overwritten, a missing or foreign asset row stops the run, a row is confirmed only after its object is read back; bounded retries, resumable; the service key is never printed. Runbook `docs/development/SUPABASE.md` §3.1, `pnpm e2e:sheet-assets` for the local stack, `docs/development/RUST.md` §11.16.
+47
View File
@@ -3635,3 +3635,50 @@ only caller is the proof predicate; make it crate-private at activation); stale
hand the export a self-consistent report and snapshot (no equivalence results, every reader decides again);
the rebase's exact-equality branch has no sheet-id check (since R2); `r5_6_switch` writes its re-export under
`<repo>/target/tmp` regardless of `CARGO_TARGET_DIR`.
### 11.22 R5.6 active: the fingerprint convention `sha256-rfc8785-validated-v1` (2026-10-25)
Owner brief « Autorisation officielle de la bascule R5.6 ». Switch commit **9e87016** on
`feature/rust-r5-pipeline-core` (the verified final patch, plus the owner's adjustments: `equivalence`
crate-private, its test moved inside `fingerprint.rs`; stale comments fixed; the trust boundary documented in
`fingerprint.rs`; two lines of ANATOMICAL_SHEET_MODEL.md; the new-report rollback file written by `r5_6_switch`).
Decision BDR-070.
**Fingerprints.** The equine draft sheet `503dc301-a8b1-50d4-9e44-0919b2fc2916`: canonical `v1` value
`12d788727c1e532641bd5b3a7ecf39dbdd25e70350f8a76be5ca917b262874e2`; historical value (SHA-256 of the
Prettier `document.json` bytes, convention `sha256-prettier-file-bytes-v0`)
`27c7383c445c73dc2001ebf4794a3ea63d416910bbbaa0d7848dd720de7c2660`, the one entry of `TRUSTED_ALIASES`,
honoured only through `LoadedSheet::recognises_historical_stamp`. Report v3 `sheet.documentSha256` keeps 64 hex.
**Seed.** Regenerated once by the Rust tool into a fresh temporary folder, compared file by file, the two
authorised files copied: `draft/sheet-ref.json` `2c0716f1…b285` → `03e7f6ab7ffba62007afa2bd39506c72b7034b07b54367d35adf7f7cc670623b`
(value + `fingerprint` block) and `draft/report-migration-map.json` `4139c51d…fce9` →
`0e991bc2b1e54668797706aa8b21670ff420926fad133b2077bfbae61ba6e2db`. `document.json` (`27c7…`), `assets/horse.svg`
(`0ea5202f…`), `equine_draft.sql` (`c5a24312…`) and every other file byte-identical; the fresh output's
`review/app-main.svg` differs from the committed one only under the R3 trigger-name rule declared since R5.4
(not copied). `pnpm r5:import-equine --check`: 0 differences. `pnpm import:equine` is the Rust pipeline;
`pnpm import:equine:legacy` the TypeScript one until R5.7. The SQL seed's own header still names
`packages/anatomy` (frozen bytes, kept).
**Trust boundary.** Equal fingerprints keep their historical meaning (the same reference string), which is no
proof of content: an API taking caller-built data (an export input, a hand-made bundle, a mutated pub
`reference`) is trusted for what it declares, as before R5.6. An alias, never: it needs the loader-verified
`v1` value and the document recomputed at the decision.
**N-1 and rollback (measured).** An old report (`27c7`) on the active sheet: opens with no rebase, re-exports
with one stamp, read with the snapshot kept by the current reader, the frozen N-1 readers and the pre-switch
build (59521dc: `report-compare` "matches the bundled sheet", import `rebased=false`). A NEW report (`12d7`)
read by the pre-switch build: the archive is kept, `report-compare` says "written on another sheet document",
and the import rebases (0 unresolved zones and findings, the stamp set back to `27c7`): nothing is lost, but
the application shows its rebase notice for what is the same content. **The rollback is not transparent for
reports written after the switch**: accepted while R5 stays on the branch; to be settled before any release to
users (keep the switch with the release, or ship the registry to the build that could be rolled back to).
**Gates on 9e87016.** `pnpm rust:check` green, `pnpm check:all` green 02:10:52, `--check` 0 differences;
`r5_6_switch` 14, `sheet_fingerprint` 11 + the lib unit test, `pdf_import` 4, `pdf_compare` 16, `curation_draft`
20, `curation_review` 12, `archive_rules` 38; vitest N-1 2, app switch 2, goldens 13 + envelopes 3, R2 oracles 7,
anatomy 15. Security PASS, LOW only (`.claude/audits/2026-10-25-rust-r5-6-active-security.md`); fresh verifier:
8 contract clauses and 5 activation criteria met, ECARTS(1) = S7 (isolation) written before the activation was
authorised, settled by the contract Clarification of 2026-10-25
(`.claude/audits/2026-10-25-rust-r5-6-active-verify.md`). Wasm 531,715 B gzip (518,018 before the switch,
+13.7 KB), under the earlier 600 KB reference mark; no budget added.