GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

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

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 #6473

New issue
Copy link
New issue
Copy link
Closed
#6561
Closed
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#6473
#6561
Copy link
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

Description

@dezren39
dezren39
opened on Nov 6, 2026
Issue body actions

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

Summary

parse_records (pkgs/id/src/world/mod.rs:1946) is the validation gate for a world program's published records: it bounds the record count (MAX_RECORDS = 4096), key length and control characters, and each value's serialized size (MAX_RECORD_VALUE_BYTES = 8 KiB). It parses with a bare serde_json::from_str::<Records> (:1947), where Records is a BTreeMap<String, Value>. serde_json's map deserialization is last-wins for duplicate keys, and every check in parse_records runs on the post-collapse map. A program output (or a fixture header's records, which reaches the same function via world_fixture.rs:1170) that repeats a key is therefore silently rewritten before it is checked:

# 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.

Evidence

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):

  • Control: {"a":1,"b":2} parses, 2 records.
  • Control: a single 9000-byte value is refused (size cap works when the value survives).
  • Case 1: {"a":1,"a":2} → Ok(Some(2)) — duplicate accepted, last wins.
  • Case 2: oversized-first / small-duplicate → Ok — size cap bypassed.
  • Case 3: 4096 distinct keys plus one repeat (4097 raw entries) → 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).

Why it matters

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.

Acceptance criteria

  • 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).
  • The oversized-hidden-value shape (case 2) and the over-count raw shape (case 3) are refused; the caps apply to the input as written.
  • Valid inputs are unchanged: the existing world/tests.rs records tests and the fixture round-trip tests still pass, and a records object with distinct keys parses exactly as before.
  • New tests pin all three shapes above at 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).
  • Sibling site checked in the same pass: 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.

Activity

Next
  1. dezren39
    added
    kind/bugSomething isn't working (prefixed form of the classic bug label)
    task/triageQueue packet kind: verify, reproduce, and route this item
    status/needs-triageNot yet triaged; needs a first look
    source/creatorFiled by the new-issue-creator job
    on Nov 6, 2026
  2. developing-today commented on Nov 6, 2026

    @developing-today
    developing-todayBot
    on Nov 6, 2026 – with developing.today
    Contributor
    More actions

    CODE-1950

  3. dezren39
    added
    priority/normalOrdinary priority (the default)
    queue/queuedHas a queued queue task
    app/idPackage/app: id (pkgs/ or apps/ in this repo)
    on Nov 6, 2026
  4. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · filed

    • Agent: new-issue-creator (new-issue-creator-code-b)
    • Session / ID: cron new-issue-creator-code-b, run 2026-11-06 02:50 CST (2026-11-06T08:50Z)
    • Found via: filed this run
    • Task: Filed after verifying on the laptop (probe ~/git/fleet/probe-records-dup, real id crate, 1 passed): parse_records collapses duplicate JSON keys before its caps run — dup last-wins, a 9000-byte value hidden behind a small duplicate passes MAX_RECORD_VALUE_BYTES, and 4097 raw entries collapse under MAX_RECORDS; controls (distinct keys, single oversized value) behave.
    • Expectation: effort s–m — triage routes the fix: duplicate-key refusal at parse_records naming the repeated key, caps applied to the input as written; companion fixture-decode issue filed the same run covers the earlier collapse on that path.
    • Links: probe worktree ~/git/fleet/probe-records-dup @252d430853; body evidence in the issue.
  5. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    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.

  6. dezren39
    added
    work/assignedQueue worker lifecycle state
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/needs-triageNot yet triaged; needs a first look
    queue/queuedHas a queued queue task
    on Nov 6, 2026
  7. 23 remaining items

  8. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · picked up

    • Agent: queue worker (repo-worker-code), lane code-a
    • Session / ID: task 11202
    • Found via: queue claim (assigned_lane=direct)
    • Task: Resuming task 11202 for issue 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 #6473 from the prior checkpoint (branch queue/11202-6473-parse-records-dup-keys, laptop worktree ~/git/fleet/11202): verify the in-progress implementation fresh, finish parse_records duplicate-key refusal with regression tests, open the PR.
    • Expectation: PR opened for issue 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 #6473 with duplicate-key refusal at every depth and caps applied to input as written; task completed or parked with the PR recorded.
    • Links: issue 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 #6473
  9. developing-today
    added
    status:in-review
    on Nov 6, 2026
  10. dezren39 commented on Nov 6, 2026

    @dezren39
    dezren39
    on Nov 6, 2026
    MemberAuthor
    More actions

    🤖 Agent note · parked

    • Agent: queue worker (repo-worker-code), lane code-a
    • Session / ID: task 11202
    • Found via: queue claim (assigned_lane=direct)
    • Task: Implemented task 11202 for issue 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 #6473: promoted 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).
    • Expectation: On resume: read PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561 checks + Codex findings fresh; merge when green. Note the pre-existing 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.
    • Links: PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561 — id(world): parse_records refuses duplicate JSON keys (#6473) #6561 · branch queue/11202-6473-parse-records-dup-keys
  11. dezren39
    added
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    status/parkedDeliberately paused with a recorded resume condition
    and removed
    status/in-progressQueue worker lifecycle state
    queue/claimedQueue worker lifecycle state
    on Nov 6, 2026
  12. developing-today
    added a commit that references this issue on Nov 6, 2026

    Merge pull request #6561 from developing-today/queue/11202-6473-parse…

    16ffcf5
  13. developing-today
    closed this as completedin #6561on Nov 6, 2026
  14. developing-today
    added
    status:done
    and removed
    status:in-review
    on Nov 6, 2026
  15. developing-today commented on Nov 6, 2026

    @developing-today
    developing-todayBot
    on Nov 6, 2026 – with developing.today
    Contributor
    More actions

    🤖 Agent note · done

    • Agent: queue worker (repo-worker-code), lane code-e (implementation by lane code-a's session; verification + merge by lane code-e)
    • Session / ID: task 11202
    • Found via: queue claim
    • Task: task 11202 complete — PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561 merged (merge commit 16ffcf5). parse_records now parses through id-core's shared json_unique helper (promoted from world_session per design Design: a duplicate key is a parse error — one duplicate-key refusal contract for pkgs/id's checked JSON gates #6520), so duplicate keys are refused at every depth before the MAX_RECORDS / MAX_RECORD_VALUE_BYTES caps run.
    • Expectation: met — id-core json_unique tests pass 2/2 (independently re-run); Codex review completed with zero findings; the id-crate lib-test build block is the pre-existing world_net.rs E0277 break on clean main, tracked as issue id(world_net): str vs String comparisons (E0277) break cargo check -p id on main #6567.
    • Links: PR id(world): parse_records refuses duplicate JSON keys (#6473) #6561 · issue id(world_net): str vs String comparisons (E0277) break cargo check -p id on main #6567 (pre-existing break) · design issue Design: a duplicate key is a parse error — one duplicate-key refusal contract for pkgs/id's checked JSON gates #6520
  16. developing-today
    removed
    status/parkedDeliberately paused with a recorded resume condition
    queue/parkedQueue task is parked (waiting on CI, time, or an event)
    work/assignedQueue worker lifecycle state
    on Nov 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      You are visitor 01402775 — GeezerVison does not store the pages you look up.
      Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.