docs(docs): R5.3 Object.prototype characterisation, migration-map debt kept (owner 2026-10-23); memory LRN-072, LRN-073, EVAL-028, TODO

This commit is contained in:
bchanot committed 2026-10-23 00:50:23 +02:00
1 parent 9901106a62
commit 865490512e
4 files changed
+45 -17

No files matched your search

+27 -17
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, refuses an empty path, a symbolic link, a path that is not a folder, a folder holding any file; an absent destination is created before any write (nothing can appear between the check and the writes) and the files go to its canonical path, which the success line prints (a symbolic link among the parent folders is visible there); a relative path is typed from `INIT_CWD` when absolute, else the current folder; nothing is ever deleted |
Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`, 8 tests):
Parity, every expectation written by the TypeScript (`tests/curation_draft.rs`, 10 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,15 +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;
- 58 synthetic changesets on the mini sheet (`oracles/r5/curation-synthetic.json`,
generator `packages/anatomy/tests/r5.curation-synthetic-oracles.test.ts`): 9 accepted
- 64 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) byte for byte on the formatted document, the
records, the stats, the migration map and the seed SQL; 48 refusals (19 schema, `null`
on `scope`, `position` and `field` included, 29 applier, integrity and shape gates
included) refused alike; 5 references files refused
alike; one declared difference below.
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
differences below (one refusal, one acceptance), each held by its own test.
Differences declared (none reachable by the committed files, since the folders are
reproduced byte for byte):
@@ -2936,17 +2938,25 @@ 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 through an inherited `Object.prototype` member (`name.constructor`) whose parent a later op replaces | `structuredClone` of the function read there threw, change refused | the member is a plain missing key: accepted (a surviving key is refused by both at the gate) |
| 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, document unchanged, one record | the key is written and the strict document gate refuses it (the R5.2 family: a name of `Object.prototype` is a plain key) |
| an authored key starting with NUL (`"\u0000touched"`) in a value | refused at the strict document gate when the value reaches the document, accepted when a later op overwrites or removes it | refused at parse (`reserved key`): the prefix is reserved for the applier's transient touch marks |
Observation, not a difference (reproduced as is): `applyRecord` of the migration map reads
`record.op` whatever `record.target` is, so a cascade record of a view, zone, category or
region rename whose target is an annotation of the legacy id map would be replayed as an
annotation rename, and a reference rename cascading into a finding's citations would be
replayed as a finding rename. The committed changeset renames findings only (33) and no
reference, so neither path runs; a fix would be a declared behaviour change of both
implementations, the owner's call.
Technical debt, kept during R5 (owner decision 2026-10-23, reproduced as is, never corrected
silently): `applyRecord` of the migration map reads `record.op` whatever `record.target` is.
A cascade record of a view, zone, category or region rename whose target is an annotation
of the legacy id map is replayed as a rename of that annotation; a reference rename's
cascade on a cited finding is replayed as a rename of the finding's path. Measured on the
mini sheet (TypeScript values, frozen; test
`the_migration_map_replays_cascade_records_by_their_op_as_the_typescript_does`): renaming
`view:main` sends `legacy-hip` and `legacy-neck` to `principal` and the legacy `head` view
to `principal`; renaming a cited reference sends `hip/hip-dysfunctions/mobility` away, and
re-homing brings it back, counted as 3 re-homed instead of 3 identical; combined with a
finding rename (`renames-cascade`), `hip/hip-dysfunctions/mobility` maps to null where
`hip-joint/hip-dysfunctions/motion` is the right target. The committed changeset renames
findings only (33) and no reference, so the equine map is untouched. A future changeset
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).
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
@@ -2956,7 +2966,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 8, importer 5, formatting
Tests: `cargo test -p faunosteo-core --features curation` (draft 10, 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