docs(docs): R5.3 fifth final round declared (RUST.md §11.12-11.13), security final5, verify record

This commit is contained in:
bchanot committed 2026-10-23 10:51:40 +02:00
1 parent f245b3ec25
commit c6e0d851a9
3 files changed
+167 -12

No files matched your search

+20 -12
View File
@@ -2901,7 +2901,7 @@ re-cleaned; the review drawings and the two Markdown reports are R5.4. Contract
| `pipeline.rs` | `buildEquineDraft` (CHG-000 from the frozen asset's sha256, byte size and uuid, the head view box parsed from the legacy SVG; the reserved id refused), `renderDraftArtifacts` for the R5.3 files (`document.json`, `assets.json`, `sheet-ref.json` with `document_sha256` = sha256 of the `document.json` bytes, `report-migration-map.json`, `equine_draft.sql`), `parseViewBox` |
| `bin/import_equine.rs` | both folders; `--check` compares the produced files with the committed seed and lists the six R5.4 files of the draft as pending (`shortcut:` comment, removed at R5.4); `--out <dir>` writes `<dir>/legacy-import` and `<dir>/draft` into a destination that is absent or an empty folder; it refuses an empty path, a path holding `..`, a missing parent folder, a destination inside the seed folder, a symbolic link (a trailing `/` or `/.` included), a path that is not a folder and a folder holding any entry; the parent's symbolic links are resolved and the canonical destination is printed before the first write; every folder under it is created with `create_dir` and every file with `create_new`, so an entry that appears after the claim (file, folder or symbolic link) is refused, never followed or truncated; a relative path is typed from `INIT_CWD` when absolute, else the current folder (the repository root when `scripts/import-equine.sh` is run directly, since it moves there; `pnpm r5:import-equine` is the reference); a non-UTF-8 argument is a usage error; nothing is ever deleted |
Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`, 13 tests):
Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`, 16 tests):
- the five R5.3 text files of the committed `draft/` byte for byte, the frozen `horse.svg`
described by its sha256, size and asset id; `pnpm r5:import-equine --check`: 12 files, 0
@@ -2916,7 +2916,7 @@ 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;
- 81 synthetic changesets on the mini sheet (`oracles/r5/curation-synthetic.json`,
- 82 synthetic changesets on the mini sheet (`oracles/r5/curation-synthetic.json`,
generator `packages/anatomy/tests/r5.curation-synthetic-oracles.test.ts`): 14 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
@@ -2927,8 +2927,8 @@ Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`,
family below included, 40 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;
four declared synthetic cases below (three refusals, one acceptance), each held by its own
test (14 compared + 63 refused alike + 4 declared = 81).
five declared synthetic cases below (four refusals, one acceptance), each held by its own
test (14 compared + 63 refused alike + 5 declared = 82).
Differences declared (none reachable by the committed files, since the folders are
reproduced byte for byte):
@@ -2940,12 +2940,12 @@ reproduced byte for byte):
| a lone surrogate escape (`"\ud800"`) in any string of the two files | `JSON.parse` kept it | refused (the core's L1 rule: no lone surrogate is ever read) |
| nesting deeper than 128 levels (an `add` of a 70-level finding chain) | accepted | refused at parse (serde_json's depth limit, kept as a resource bound) |
| a number beyond the double range (`1e400`) in a value a later op overwrites or removes | `JSON.parse` read Infinity, the value was discarded, the change accepted (a surviving value is refused by both at the gate) | refused at parse (serde_json's range check) |
| a `set` field path ending in an inherited `Object.prototype` member (`name.constructor`, `name.toString`, `name.valueOf`…) | `readField` returned the inherited function and the record's `structuredClone` threw (`… could not be cloned`): change refused at the op | the member is an ordinary missing key: written, `before` recorded as null. Kept alone, the shape gate refuses it (every object of the sheet contract is strict). Replaced by a later op of the run (a `set name` on the same item), the change is accepted: the document is byte for byte the one the later op alone gives, one extra record traces the overwritten write. Nothing is bypassed: the settable table checks the first segment on both sides (`constructor` as a field: `unknown field`), no value is read through a prototype, the integrity gate runs on the final document (test `an_inherited_member_name_is_a_plain_key_and_bypasses_nothing`, five member names). Accepted by the owner 2026-10-23 |
| a `set` field path ending in `__proto__` (`name.__proto__`) | the prototype setter swallowed the write: change accepted, one record, the document unchanged (or, when the holder was absent, `description: {}` added by `writeField`) | the key is written and the strict document gate refuses it (the R5.2 family: a name of `Object.prototype` is a plain key) |
| a `set` field path ending in an inherited `Object.prototype` member (`name.constructor`, `name.toString`, `name.valueOf`…) | `readField` returned the inherited function and the record's `structuredClone` threw (`… could not be cloned`): change refused at the op | the member is an ordinary missing key: written, `before` recorded as null. Kept alone, the shape gate refuses it (every object of the sheet contract is strict). Replaced by a later op of the run (a `set name` on the same item), the change is accepted: the document is byte for byte the one the later op alone gives, one extra record traces the overwritten write. Nothing is bypassed: the settable table checks the first segment on both sides (`constructor` as a field: `unknown field`), no value is read through a prototype, the integrity gate runs on the final document (test `an_inherited_member_name_is_a_plain_key_and_bypasses_nothing`, four member names; `__proto__` has its own row). Accepted by the owner 2026-10-23 |
| a `set` field path holding a `__proto__` segment (`name.__proto__`, `name.__proto__.x`) | no key was ever written: at the end of the path the setter ignored a primitive or set the holder's prototype (change accepted, records with `before: {}`); in the middle, `Object.prototype` itself was polluted and every later object failed the strict gate (change refused) | refused at the op (`reserved key "__proto__"`), with or without a later overwrite: no faithful reading exists (fifth final round; declared case `declared-proto-segment-overwritten`, test `a_proto_segment_is_refused_at_the_op`) |
| an authored key starting with NUL (`"\u0000touched"`) in a value, or a field path segment starting with NUL (`name.\u0000touched`) | refused at the strict document gate when the key reaches the document, accepted when a later op overwrites or removes it | refused (`reserved key`): at parse for a value, at the op for a field path; the prefix is reserved for the applier's transient touch marks, which the cleanup strips at every depth, so a written key would be lost while a record claims it (found by the final gates, test `a_reserved_or_unbounded_field_path_is_refused_without_writing`) |
| a null, a string, a number or a boolean among the `children` or `categories` of an added item | a TypeError where a walk met it (`descendants`, the review marking: refused), silently skipped by a rename's citation walk (accepted when a later op removed the item), refused by the gate when it stayed | refused at the add (`… entry that is not an object`), whatever follows (three cases frozen from the TypeScript, one declared: `declared-children-string-renamed-then-removed`) |
| a `children` or `categories` of an added item that is present but not a list (an object, a string, `null`) | replaced by `[]` when a later op added under the item (`childrenOf`): the author's value lost without a word | refused at the add (`… that is not a list`); `children_path` never replaces a present value (declared case `declared-children-object-then-added-to`) |
| a `set` whose path goes through a string (`name.fr.x`): `writeField` replaces the string by an object | `before` recorded as undefined (null), the replaced string in no record; refused by the gate unless a later op overwrites the field | the same (kept, recorded here) |
| a `children` or `categories` of an added item that is present but not a list (an object, a string, `null`) | replaced by `[]` when a later op added under the item (`childrenOf`): the author's value lost without a word; accepted as well when a later op removed the item | refused at the add (`… that is not a list`); `children_path` never replaces a present value (declared case `declared-children-object-then-added-to`) |
| a `set` whose path goes through a non-object (a string, a number, a boolean, an array, `null`: `name.fr.x`): `writeField` replaces it by an object | `before` recorded as undefined (null), the replaced string in no record; refused by the gate unless a later op overwrites the field | the same (kept, recorded here) |
| a field path of more than 8 segments (the deepest settable path has 2) | accepted, the gate refused the stray keys | refused at the op: a resource bound (20,000 segments overflowed the stack before it) |
| a document nested more than 64 levels after an op (the equine document has 10), by repeated `add` or `move`, or a deep value | accepted when valid | refused at the op: a resource bound checked after every op with an iterative walk (test `the_document_cannot_be_nested_past_the_bound_by_repeated_adds`) |
@@ -2990,7 +2990,7 @@ never matches; `String(x)` of a missing id is `"undefined"`; the error messages
(`unknown target "…" (no "…")`, `position N out of range`, …) are the TypeScript ones with
the change id and op index prefixed.
Tests: `cargo test -p faunosteo-core --features curation` (draft 13, importer 5, formatting
Tests: `cargo test -p faunosteo-core --features curation` (draft 16, importer 5, formatting
6, plus the crate's suites); anatomy 142 (the generator added); `pnpm rust:check` green.
Gates: security auditor PASS (semgrep 0 findings, 6 LOW; fixed: the head view box read with
@@ -3048,7 +3048,12 @@ silently replaced by `[]`) and LOWs (`--check` listing through a generated folde
link, a mount alias of the seed, the walk cost understated, the claim test fixture in the
shared temporary folder). Fixed: `js_normalize` and `js_insert`; non-list `children` and
`categories` refused at the add and never replaced; `--check` confined to the seed's folders;
the identity guard; a 200,000-value bound; the fixture under `target/`.
the identity guard; a 200,000-value bound; the fixture under `target/`. Fifth final round on
3ece1a6: verifier ECARTS(2) (C1, C2, C4 to C12 met; 120,000 random changesets, 40,494 accepted
identical, every other split a declared family but one: a `__proto__` segment, with the
inherited-member row wrong for it; the test count stale) and security PASS with LOWs (the
identity guard covering the seed folder only, quadratic id comparisons). Fixed: `__proto__`
segments refused at the op; the identity guard over every folder of the seed; hash sets.
### 11.13 Checkpoint R5.3
@@ -3070,8 +3075,11 @@ between a check and its use, never overwriting: every file is `create_new`); inv
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
seed guard of `--out` compares canonical paths and file identity (device, inode) of every
ancestor, so a second mount path of the seed is refused too; `--check` refuses a generated
seed guard of `--out` compares canonical paths, then the file identity (device, inode) of
every ancestor of the destination with that of the seed folder and of every folder under it,
so a second mount path of the seed or of any of its folders on the same device is refused
too (a share mounted twice on distinct devices is not told apart; every write is still
`create_new`); id comparisons use hash sets (cite, declared references, duplicate ids); `--check` refuses a generated
folder that is not itself a folder of the seed (a link there is never listed through); 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