GeezerVison is showing github.com — id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted · Issue #6491 · developing-today/code
id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491Descriptionid(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted
Summary
parse_surface (pkgs/id/crates/id-core/src/world_presentation.rs:419) is the gate that decides whether a world program's view output is a valid text/1 or screen/1 presentation — the module's contract is that guests never supply terminal escapes, control characters, or unsupported versions, and every presenter (web/world_ws.rs:182, world/actor.rs:1473, world_session/mod.rs:2404, the native shell) trusts its verdict.
It parses the guest document into a serde_json::Value first (world_presentation.rs:420), dispatches on value.get("kind"), and only then converts the already-collapsed value into TextPayload / ScreenPayload (:428, :445). Duplicate JSON keys therefore collapse last-wins before any check runs: the version gate (:431, :448), the width validation in TextSurface::with_width, the control-character rejection, and the screen row/shape checks only ever see the surviving value. A document whose raw form carries a forbidden value is accepted as long as a benign duplicate follows it.
This is the same defect class as #6473 (world::parse_records) and #6474 (world_fixture::decode) in sibling guest-facing parsers; parse_surface is the remaining presentation-path instance. The in-tree tests cannot express it: they build documents via serde_json::json! values (world_presentation.rs tests, fn screen(value: Value)), which cannot represent duplicate keys.
Verified (laptop, origin/main 49797df, probe ~/git/fleet/probe-surface-dup, real id crate, 1 test passed)
Controls — each single-key invalid form is rejected:
{"kind":"text","version":99,"lines":["hi"]} → Err (unsupported version)
{"kind":"text","version":1,"width":0,"lines":["hi"]} → Err (zero width)
{"kind":"text","version":1,"lines":["<ESC>[31mred"]} → Err (control character)
{"kind":"screen","version":99,"width":2,"height":1,"rows":["hi"]} → Err
{"kind":"screen","version":1,"width":2,"height":1,"rows":["toolong"]} → Err
Duplicate-key forms — every one is accepted (Ok(Some(..))):
{"kind":"text","version":99,"version":1,"lines":["hi"]} → Text
{"kind":"text","version":1,"width":0,"width":80,"lines":["hi"]} → Text
{"kind":"text","version":1,"lines":["<ESC>[31mred"],"lines":["clean"]} → Text
{"kind":"screen","version":99,"version":1,"width":2,"height":1,"rows":["hi"]} → Screen
{"kind":"screen","version":1,"width":2,"height":1,"rows":["toolong"],"rows":["hi"]} → Screen
{"kind":"screen","kind":"text","version":1,"lines":["hi"]} → Text (the kind dispatch itself is last-wins)
Why it matters
Acceptance criteria
parse_surface rejects any kind: text / kind: screen document containing a duplicate key at any level it inspects (top level at minimum), instead of collapsing last-wins.
- Regression tests use raw string literals (not
serde_json::json!) covering at least: duplicate version (text and screen), duplicate width, duplicate lines carrying a control character, duplicate rows, and duplicate kind.
- All previously valid documents still parse identically (existing world_presentation, world_session, sandbox, and native-shell tests green).
- Related: 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, id(world_fixture): decode accepts duplicate JSON fields in header and event lines — check_keys and the window check only ever see the collapsed last value #6474 (same class, sibling parsers), id: text/1 presentation contract — text-only as the main mode, with a text projection for every surface (#2027) #2339 (text/1 presentation contract).
Activitydeveloping-today commented on Nov 6, 2026 added kind/bugSomething isn't working (prefixed form of the classic bug label) task/triageQueue packet kind: verify, reproduce, and route this item app/idPackage/app: id (pkgs/ or apps/ in this repo) on Nov 6, 2026dezren39 commented on Nov 6, 2026 dezren39 commented on Nov 6, 2026 🤖 Agent note · handed off
- Agent: queue worker (repo-worker-code), lane code-e
- Session / ID: task 10977
- Found via: queue claim
- Task: Handed off task 10977 (triage) for issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491 to the opencode claimant — execution lane assigned opencode. Fresh check: issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491 OPEN, no hard-stop labels.
- Expectation: claimant launches the bound opencode session and drives task 10977 to a terminal state
- Links: issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491
dezren39 commented on Nov 6, 2026 🤖 Agent note · picked up
- Agent: queue worker (repo-worker-code), lane code-r
- Session / ID: task 10977
- Found via: queue claim
- Task: task 10977 (triage for issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491) claimed by lane code-r; issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491 verified OPEN with no hard-stop labels; execution-lane assignment returned
opencode, so task 10977 is handed off to the opencode claimant per the worker instruction §1b.
- Expectation: claimant launches the bound opencode session and drives task 10977 to its terminal state
- Links: issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491
dezren39 commented on Nov 11, 2026
🤖 Agent note · done — fixed and merged (task 10977, lane code-d)
- Outcome: PR fix(id-core): reject duplicate JSON keys in parse_surface (#6491) #8424 MERGED (merge commit 0e71307) — issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491 CLOSED.
parse_surface rejects duplicate JSON keys in text/screen documents instead of collapsing them last-wins.
- Resume work this shift: PR fix(id-core): reject duplicate JSON keys in parse_surface (#6491) #8424 had gone CONFLICTING against main (new
TokenSpan struct landed at the insertion point). Rebased onto current main (head aa60487); the conflict resolution initially dropped the top_level_kind_is_duplicated(data) call from the parse_surface condition — Codex's re-review caught exactly that as a new P2 (4540059438); restored in aa60487 with the reviewer's example ({"x":1,"x":2,"kind":"screen","kind":"other"}) added to the regression list.
- Codex gate: all three findings dispositioned — 4533093004 (fixed d1fdabc, reply 4538206911), 4538239737 (fixed 258ef8a; corrected disposition reply 4540036205 — the earlier reply 4539019448 had posted a file path instead of its text), 4540059438 (fixed aa60487, reply 4540102756). No new findings on the final head.
- Tests:
cargo test -p id-core world_presentation on the laptop — 34 passed, 0 failed (rebased head, including main's new semantic-token tests).
dezren39 commented on Nov 11, 2026
🤖 Agent note · done — already done (task 14983, lane code-d)
- Task 14983 is the small_fix follow-on packet for issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491, duplicating triage task 10977, which this same shift resumed and finished: PR fix(id-core): reject duplicate JSON keys in parse_surface (#6491) #8424 MERGED at 2026-11-11T15:59:18Z (merge commit 0e71307), issue id(world_presentation): parse_surface collapses duplicate JSON keys before its checks — a forbidden version, width, lines, or rows hidden behind a duplicate is accepted #6491 CLOSED (verified fresh just now; PR state MERGED re-read in the same pass).
- No second fix and no competing PR: the acceptance criteria are met by the merged PR —
parse_surface rejects duplicate keys in text/screen documents, with raw-string regression tests including the duplicate-kind shapes.
- Completing task 14983 as
already_done naming task 10977 / PR fix(id-core): reject duplicate JSON keys in parse_surface (#6491) #8424 as the canonical work.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|