docs(docs): R5.3 second final round: shape alignment, residual risks measured, R2 derive leniency raised to the owner; audits, TODO
This commit is contained in:
1 parent
776c7095b3
commit
42bbc48fcc
4 files changed
+258
-7
No files matched your search
@@ -2885,7 +2885,7 @@ until the switch; no fingerprint change; the cleaned `horse.svg` is read as froz
|
||||
re-cleaned; the review drawings and the two Markdown reports are R5.4. Contract
|
||||
`.claude/tasks/contracts/2026-10-22-rust-r5-draft.md`.
|
||||
|
||||
`crates/core/src/curation/draft` (2,718 lines, feature `curation`):
|
||||
`crates/core/src/curation/draft` (2,846 lines, feature `curation`):
|
||||
|
||||
| Module | Ports |
|
||||
|---|---|
|
||||
@@ -2916,16 +2916,17 @@ Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`,
|
||||
- the 612 legacy leaves through the core's `read_report_document` on the produced map: 442
|
||||
identical, 141 moved, 29 removed, every resolved leaf a leaf of the produced document, the
|
||||
29 flagged paths exactly those the map sends to null, the FR snapshots kept;
|
||||
- 64 synthetic changesets on the mini sheet (`oracles/r5/curation-synthetic.json`,
|
||||
- 74 synthetic changesets on the mini sheet (`oracles/r5/curation-synthetic.json`,
|
||||
generator `packages/anatomy/tests/r5.curation-synthetic-oracles.test.ts`): 11 accepted
|
||||
cases (every op kind, numeric and anchored positions, subtree scopes with skipped equal
|
||||
values, the review rule on levels A, B and C, the five rename cascades and a reference
|
||||
rename, re-homing, two chained changes, the two migration-map debt cases below) byte for
|
||||
byte on the formatted document, the records, the stats, the migration map and the seed
|
||||
SQL; 51 refusals (19 schema, `null` on `scope`, `position` and `field` included, 32
|
||||
applier, integrity and shape gates included) refused alike, with the same reason: the
|
||||
same message for an op or change refusal (change id and op index included), the same
|
||||
stage for a schema or gate refusal; 5 references files refused alike; two declared
|
||||
SQL; 61 refusals (23 schema, `null` on `scope`, `position` and `field` and the shape
|
||||
family below included, 38 applier, integrity and shape gates included) refused alike, with
|
||||
the same reason: the same message for an op or change refusal (change id and op index
|
||||
included), the same stage for a schema or gate refusal; 7 references files refused alike;
|
||||
two declared
|
||||
differences below (one refusal, one acceptance), each held by its own test.
|
||||
|
||||
Differences declared (none reachable by the committed files, since the folders are
|
||||
@@ -2960,6 +2961,15 @@ findings only (33) and no reference, so the equine map is untouched. A future ch
|
||||
renaming a view, zone, region, category or a cited reference must not be published before
|
||||
the fix (a declared behaviour change on both sides, after R5).
|
||||
|
||||
Aligned on Zod, not a difference: serde's derives read a struct from a positional array
|
||||
(`"title": ["Titre", "Title"]`, a whole change or reference as an array) and a unit enum
|
||||
variant from a one-key map (`"level": {"A": null}`, `scope`, `review_status`, `laterality`,
|
||||
the reference `type`); Zod refused both. Each authored file and the curated document are
|
||||
compared, by shape, with their typed reading serialised back (`draft/shape.rs`): an object
|
||||
stays an object, an array an array of the same length, a scalar a scalar of its kind (found by
|
||||
the final verifier's 55,000-changeset differential; 10 changesets and 2 references files frozen
|
||||
from the TypeScript). The R2 contracts carry the same derives (open item below).
|
||||
|
||||
Kept as the TypeScript: invalid UTF-8 in the two curation files becomes U+FFFD
|
||||
(`readFile(path, 'utf8')`, as R5.2 kept for the catalog); a repeated key in either file keeps its first position and its last
|
||||
value (`JSON.parse`, through the core's `parse_json`; tested on a change and a reference);
|
||||
@@ -2999,10 +3009,32 @@ checked after every op); `--out` writes were not exclusive after the claim (fixe
|
||||
`create_dir` and `create_new`); `..`, a missing parent and a destination inside the seed are
|
||||
refused, the destination printed before writing, a non-UTF-8 argument refused; the binary's
|
||||
refusals are tested against the built binary (`out_refuses_every_unsafe_destination_and_writes_nothing`).
|
||||
Second final round on 314cf04: verifier ECARTS(3) (the serde shape family above, in the
|
||||
authored files and the gate, plus a missing-list message) and security PASS (MEDIUM memory,
|
||||
LOW: quadratic depth walk, `--check` and reads following symbolic links, residual
|
||||
check-then-use window, `write_exclusive` accepting any component, lossy normalisation, a test
|
||||
aimed at the real seed). Fixed: the shape comparison; `document has no list` for a missing
|
||||
list; every read a regular file under 16 MiB, never a link; `--check` lists a link without
|
||||
walking into it; `write_exclusive` takes plain names only and re-checks the claimed folder;
|
||||
the seed refusal tested on the pure check (`inside`), no test targets the real seed. Kept and
|
||||
declared: the measured residual risks above.
|
||||
|
||||
### 11.13 Checkpoint R5.3
|
||||
|
||||
Residual risks: the `--check` allowance for the six R5.4 files hides nothing about the
|
||||
Open item for the owner (outside R5.3, gated readers): the serde leniency above is in the R2
|
||||
derives of `domain/sheet/schema.rs` and very likely of the report and archive contracts, so
|
||||
the readers of imported PDFs (`archive/read.rs`, `report/read.rs`, `pdf/import.rs`) would
|
||||
accept an object written as an array or an enum written as a map where the frozen Zod reader
|
||||
refused it. Not probed on those readers, not changed: a fix there needs the owner's per-file go.
|
||||
|
||||
Residual risks, measured by the final security gate and kept: memory has no cap beyond the
|
||||
16 MiB read bound (a hostile 211 KB changeset of subtree sets on a 2,000-node addition asks
|
||||
for more than 2 GB, as the TypeScript's clones would); the depth check walks the document
|
||||
after every op (a 2.4 MB changeset takes about 10 s); `--out` assumes a single-user machine
|
||||
(a concurrent process able to write the destination's parent could still swap a component
|
||||
between a check and its use, never overwriting: every file is `create_new`); invalid UTF-8
|
||||
and repeated keys are read as the TypeScript read them. Residual risks of the slice: the
|
||||
`--check` allowance for the six R5.4 files hides nothing about the
|
||||
produced files but means the draft folder is not yet compared whole (R5.4 removes it); the
|
||||
touch marks are a reserved prefix (a NUL character starts it), refused in any authored value
|
||||
at parse and in any field path segment at the op, and removed after each change, so no mark
|
||||
|
||||
Reference in new issue
Block a user