GeezerVison is showing github.com — id(world_session): first-frame and joined-frame parsers collapse duplicate JSON keys before their checks — a hidden first type/world/capability value is never seen, and the sibling session paths reject the same bytes · Issue #6501 · developing-today/code
id(world_session): first-frame and joined-frame parsers collapse duplicate JSON keys before their checks — a hidden first type/world/capability value is never seen, and the sibling session paths reject the same bytes #6501DescriptionProblem
Two of the four world-session frame parsers in pkgs/id parse the raw frame text into a serde_json::Value first and only then convert to ClientFrame, so duplicate JSON keys collapse (last value wins) before any check sees the frame. The other two parsers in the same module parse the same frame type directly from text, where serde refuses duplicate fields — so the identical bytes are accepted in one session phase and refused in another.
Evidence (origin/main 4f29a12; pkgs/id/src/world_session/mod.rs is identical between the laptop primary HEAD and origin/main):
- First frame —
run_session_with, mod.rs:901: serde_json::from_str::<serde_json::Value>(&first), then the world routing field is removed from the collapsed map (mod.rs:909–921), then serde_json::from_value::<ClientFrame>(value) (mod.rs:922). Every later check — admin-token length/admin_ok, capability handling, the signed-request path — sees only the collapsed frame.
- Joined frames —
handle_client_frame, mod.rs:2536: same Value-first parse; the delegation uses guard delegation_names_uses (mod.rs:2545) tests value.get("type") on the collapsed map, then from_value::<ClientFrame> (mod.rs:2549).
- Sibling strict paths in the same module:
query_session parses serde_json::from_str::<ClientFrame>(&text) directly (mod.rs:1596), and the install path does the same for chunk/end frames (mod.rs:2062, mod.rs:2081). Serde's derived decoding refuses a duplicate field there.
Verified this run on the laptop with a probe driving the real id crate's public run_session_with (probe ~/git/fleet/probe-session-dup, fake WorldOpener/SessionIo, Directory needs no world):
- Control
{"type":"directory"} → worlds reply (accepted).
- Control
{"type":"bogus"} → refused at parse ("first frame must be a valid join or invite request").
{"type":"directory","type":"directory"} → accepted, worlds reply.
{"type":"bogus","type":"directory"} → accepted, worlds reply: the invalid first type is hidden behind the duplicate.
{"world":123,"world":null,"type":"directory"} → accepted: the non-string first world value is hidden. Reversed (null then 123) → refused with "world must be a string", proving last-value-wins routing.
{"type":"join","capability":123,"capability":"some-capability"} → passes the parse stage (fails later at world resolution, not with the parse refusal): the non-string first capability is hidden.
Why it matters
Session frames carry the credentials and routing of the world protocol: the world name that leases a world, admin tokens, capabilities, and signed moderator requests (signed objects nested inside frames collapse the same way). A parser that silently drops all but the last spelling of a field lets two readers of the same bytes disagree about what was sent — the strict sibling paths in this very module refuse such frames outright — and it hides forbidden first values (a wrong frame type, a non-string routing field, a mistyped capability) from every check that runs on the collapsed value. This is the same duplicate-key class as #6473 (parse_records), #6474 (world_fixture) and #6491 (parse_surface), in the session layer those fixes did not cover.
Acceptance criteria
- The first-frame and joined-frame entry points refuse any frame containing duplicate keys — at minimum at the top level and inside nested objects such as
signed — before routing, the uses guard, or ClientFrame conversion run; or they parse directly from the frame text like the query/install paths, with the world extraction and the delegation-uses guard re-implemented so their current semantics (including refusing uses at any depth) are preserved.
- Tests pin the refusal of: duplicate
type (identical and conflicting), duplicate world in both orders, duplicate capability, duplicate admin_token, and a duplicate field inside a nested signed object — in both the first-frame and joined phases.
- Controls keep working: a plain
directory frame lists worlds, a plain join/invite/chat/delegation flow is unchanged, a delegation frame carrying uses is still refused, and the query/install paths are unchanged.
Activitydeveloping-today commented on Nov 6, 2026 dezren39 commented on Nov 6, 2026 🤖 Agent note · filed
- Agent: new-issue-creator-code-b (new-issue-creator job, Lane B)
- Session / ID: new-issue-creator-code-b run 2026-11-06 04:20 CST
- Found via: filed this run
- Task: Triage the world_session duplicate-key collapse: first-frame (mod.rs:901) and joined-frame (mod.rs:2536) parsers go through serde_json::Value before every check, while the query/install paths in the same module parse ClientFrame directly and refuse duplicate fields.
- Expectation: effort/m — done when both entry points refuse duplicate keys (top level and nested, e.g.
signed) with raw-string regression tests, and directory/join/delegation controls (including the uses refusal) are unchanged.
- Links: evidence and probe details in the issue body; probe
~/git/fleet/probe-session-dup on the laptop (real id crate, foreground rerun EXIT:0, all 7 cases as described).
dezren39 commented on Nov 6, 2026 dezren39 commented on Nov 6, 2026 dezren39 commented on Nov 6, 2026 agent-note:v1 — picked up (resume) by queue worker lane code-c, task 10998. Prior progress verified fresh: PR #6508 at 9e2a4de, branch queue/10998-6501-duplicate-json-keys, cargo test -p id --lib world_session 62 passed on laptop (prior lane), CodeRabbit finding 4492089683 fixed in 9e2a4de and acknowledged by the bot, Codex gate dispositioned on PR #6508 (review failed on Codex usage limits, no findings produced). scripts-test checks on PR #6508 have been QUEUED since 2026-11-06T12:16Z (fleet-wide GitHub-hosted runner stall; that Python workflow is unrelated to this Rust-only change). Merging under the standing merge authority. dezren39 commented on Nov 6, 2026 agent-note:v1 — done (task 10998, queue worker lane code-c). PR #6508 merged at 2026-11-06T13:28:03Z, merge commit 6046e1d; this issue auto-closed by the merge. Evidence: branch queue/10998-6501-duplicate-json-keys at 9e2a4de; cargo test -p id --lib world_session 62 passed on laptop (prior lane checkpoint, re-verified on resume); CodeRabbit finding fixed + bot-acknowledged; Codex gate dispositioned on the PR (usage-limit failure, no findings). Caveat: scripts-test checks sat QUEUED since 12:16Z (fleet-wide runner stall, unrelated Python workflow); merged under the standing merge authority — if main CI surfaces a regression, fix forward.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|