GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | ||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | ||||||||||||||||
GeezerVison is showing github.com — id(world): parse_records silently collapses duplicate JSON keys — an oversized value hidden behind a duplicate passes MAX_RECORD_VALUE_BYTES, and the record-count cap is checked after collapse · Issue #6473 · developing-today/code Closed Labels app/idPackage/app: id (pkgs/ or apps/ in this repo)kind/bugSomething isn't working (prefixed form of the classic bug label)priority/normalOrdinary priority (the default)source/creatorFiled by the new-issue-creator jobsource/design-architectFiled by the repo design architect jobstatus:donetask/triageQueue packet kind: verify, reproduce, and route this item Descriptionid(world):
|
| # | Input shape | Result today | What the checks were supposed to do |
|---|---|---|---|
| 1 | {"a":1,"a":2} |
Ok, a = 2 |
one key, one value — the output is ambiguous and should be refused, not silently resolved |
| 2 | {"k":"<9000 bytes>","k":"small"} |
Ok |
the 9000-byte value exceeds MAX_RECORD_VALUE_BYTES (8192); a single oversized value on its own is refused (control in the probe), but hiding it behind a small duplicate passes the size cap |
| 3 | 4097 raw entries where one key repeats (4096 distinct) | Ok |
MAX_RECORDS is a bound on what a program may publish; the raw object lists 4097 entries and is only under the cap after collapse |
This is the same silent-discard class already filed and fixed for other parsers in this repo — atlas-eval's duplicate results key (#6390) and deploy.py's duplicate registry keys (#6384) — and the house stance in those was that a duplicate key in a validated document is an error, never a silent last-wins. parse_records is the one remaining JSON-object gate in pkgs/id that still collapses first and validates second: its own doc comment says it exists to "parse and bound a program's records output", so the bounds must apply to the output as written.
Verified this run on the laptop at origin/main 252d430853 with a probe integration test against the real id crate (~/git/fleet/probe-records-dup/pkgs/id/tests/probe_records_dup.rs, worktree ~/git/fleet/probe-records-dup @252d430853):
{"a":1,"b":2} parses, 2 records.{"a":1,"a":2} → Ok(Some(2)) — duplicate accepted, last wins.Ok — size cap bypassed.Ok — count cap checked post-collapse.Probe result: 1 passed (all three bug cases reproduce; both controls behave).
Code read @252d430853: parse_records at world/mod.rs:1946-1970 — serde_json::from_str into Records (BTreeMap, :1856), then records.len(), per-key, and per-value size checks over the collapsed map. No duplicate detection anywhere in the function. Existing tests (world/tests.rs:5108-5113) pin the non-object, empty-key, control-char, and long-key refusals but never a duplicate key. Callers: program_records (:1973, every program records() output) and world_fixture::decode_header (records field, via re-serialization — see the companion fixture issue for the collapse that happens even earlier on that path).
Records are a world's published, replicated state: they are mirrored into the iroh-docs records doc (world_records::reconcile) and compared byte-for-value in fixture verification. A validation gate that silently rewrites the input before checking it means (a) the size bound — the control that keeps one record from bloating every replica — can be evaded by any program (buggy or hostile) that emits a repeated key, and (b) two readers can legitimately disagree about what a program published, because JSON duplicate keys are undefined behavior across parsers (some refuse, some first-win). The gate should refuse, loudly, like its sibling parsers now do.
parse_records refuses any input whose top-level object contains a duplicate key, with an error that names the repeated key (or otherwise makes the duplication the stated reason).world/tests.rs records tests and the fixture round-trip tests still pass, and a records object with distinct keys parses exactly as before.parse_records (duplicates in nested objects are serde_json Value semantics and are out of scope unless triage decides otherwise — the gate's own checks are top-level).world_fixture::decode_header's records path (companion issue) — fixing only the fixture's re-serialization call is not sufficient, since program_records reaches parse_records directly.🤖 Agent note · filed
Companion filed the same run: #6474 — the fixture decoder collapses duplicate fields even earlier (at its serde_json::Value parse), so a repeated record key in a fixture header's records object is collapsed before parse_records ever sees it. The two fixes should agree on which layer refuses nested duplicates.
🤖 Agent note · picked up
🤖 Agent note · parked
parse_json_without_duplicate_keys to id-core (json_unique) and routed parse_records through it; PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561 opened. Parked pending PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561 CI (still pending at the 5-minute poll cap).world_net.rs E0277 build break on clean main (evidence on PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561) may block the id test build in CI.Merge pull request #6561 from developing-today/queue/11202-6473-parse…
🤖 Agent note · done