Skip to content

fix(id): reject duplicate JSON fields in world_fixture headers and events (#6474) - #7702

Merged
dezren39 merged 3 commits into
mainfrom
queue/12995-6474-world-fixture-dup-keys
Nov 10, 2026
Merged

dezren39 merged 3 commits into
mainfrom
queue/12995-6474-world-fixture-dup-keys

Conversation

@dezren39

@dezren39 dezren39 commented Nov 8, 2026 •

Copy link
Copy Markdown
Member

What

Fixes #6474. world_fixture::decode_header and decode_event parsed each JSON Lines record into serde_json::Value with plain serde_json::from_str, which collapses duplicate keys last-wins before check_keys, the fixture version gate, nested records parsing, or check_window can look at the text. A fixture line could therefore name two worlds, hide an unsupported fixture version behind a supported one, repeat a nested records key, or hide an out-of-window sequence — and every check would validate only the surviving value.

Queue task: repo-health-code-pilot task 12995 (issue #6474).

Changes

  • pkgs/id/src/world_fixture.rs
    • decode_header and decode_event now parse through the shared rejecting parser crate::world_session::parse_json_without_duplicate_keys (landed in fix(id): refuse duplicate JSON keys in world_session first/joined frames (#6501) #6508), so a duplicate key is a parse error at any nesting depth.
    • Error context is unchanged: header failures still read the fixture header is not JSON, event failures the event is not JSON, and both still carry the fixture line N context added by the caller.
  • pkgs/id/src/world_fixture.rs tests
    • New decode_refuses_duplicate_fields_in_the_header_and_events covers: duplicate world, an unsupported fixture version hidden behind a supported one, a nested duplicate records key, an out-of-window duplicate event sequence (asserting the fixture line 2 context), and a valid control that still decodes.

No wire, journal, or shell-contract change: this only makes an already-invalid input fail at parse time instead of being silently collapsed.

Tests

  • cd pkgs/id && cargo test --lib world_fixture::tests::decode_refuses — 4 passed (includes the new duplicate-key case and the existing malformed/version/window suites).
  • Formatting is auto-fixed on main per .github/ci-policy.md; no treefmt gate.

Autofix with [code]smith
Open in [code]smith · Need help on this PR? Tag @codesmith-bot with what you need.

…ents (#6474)

decode_header and decode_event parsed into serde_json::Value with plain
from_str, so a duplicate key collapsed last-wins before check_keys, the
fixture version gate, nested records parsing, or check_window could see
what the line actually said. Both now parse through the shared rejecting
parser (parse_json_without_duplicate_keys), so a duplicate key is a parse
error at any nesting depth, with the existing header/event-line context
preserved.

Regression test covers duplicate world, a hidden unsupported fixture
version, a nested duplicate records key, an out-of-window duplicate event
sequence, and a valid control that still decodes.
@dezren39
dezren39 requested a review from a team as a code owner November 8, 2026 13:24
@coderabbitai

coderabbitai Bot commented Nov 8, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

Next included review available in 59 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0fe02dc7-c1af-4f32-82e3-77848c679554
Commits

Reviewing files that changed from the base of the PR and between bd9cbc1 and 30d8516.

Files selected for processing: 1

  • pkgs/id/src/world_fixture.rs
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 8, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-10T23:19:44.162144Z 30d8516 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@developing-today

Copy link
Copy Markdown
Contributor

Targeted tests verified locally on this branch (3dc2ca8ece, worktree ~/git/fleet/12995):

$ cd pkgs/id && cargo test --lib world_fixture
test world_fixture::tests::decode_refuses_duplicate_fields_in_the_header_and_events ... ok
test result: ok. 29 passed; 0 failed; 0 ignored; 0 measured; 2394 filtered out; finished in 21.06s

All 29 world_fixture tests pass, including the new duplicate-field regression test and the existing encode/decode round-trip, window-check and key-check suites — so valid fixtures are unchanged.

The PR is merge-ready except for checks: its four workflows have been QUEUED since 2026-11-08T13:24:48Z while the repo has 0 in_progress runs and 100+ queued (runner fleet not draining). Merge as soon as runners return and checks go green.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · picked up — lane code-u, task 12995 (small_fix, issue #6474). Fresh check: the packet's "no open PR" evidence (2026-11-08) is stale — this PR is the task's own fix, committed as 3dc2ca8 on the draft branch. I merged current origin/main into the branch (clean; the diff vs main is only pkgs/id/src/world_fixture.rs, +46/-2) and pushed new head 966e3c9. No hard-stop labels on issue #6474 or this PR; no unresolved review threads. The fix routes decode_header/decode_event through the shared parse_json_without_duplicate_keys, so duplicate keys are parse errors at any nesting depth. Next: fresh CI on 966e3c9, then merge under the standing criteria and complete task 12995.

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · parked (CI wait) — lane code-u, task 12995 (small_fix, issue #6474). Parked as a broker CI wait (wait_kind=ci, ready-condition: CI on PR #7702), head 966e3c9. Resume: when CI completes, merge under the standing criteria (id checks green, or any failure proven pre-existing on main) and complete task 12995 with outcome fixed_merged; issue #6474 closes via the PR.

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · duplicate-PR salvage check (task 12995, lane code-o)

PR #8320 (opened 2026-11-10T22:07Z from the predecessor task's branch queue/12529-6474-world-fixture-dup-keys) duplicates this PR. Salvage check, per the fleet duplicate protocol — a full diff comparison, not a file-list comparison:

Salvage result: nothing unique in PR #8320. This PR is canonical — its branch is the live task 12995 branch and its body names task 12995 — so PR #8320 is being closed as a duplicate pointing here. No work is lost: every line of PR #8320 is already in this PR.

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · picked up (resume) — lane code-b, task 12995 (small_fix, issue #6474).

Resuming from the verified draft: PR #7702 already carries the fix (decode_header/decode_event in pkgs/id/src/world_fixture.rs now parse via parse_json_without_duplicate_keys, with the decode_refuses_duplicate_fields_in_the_header_and_events reproducer test). Fresh checks this shift: issue #6474 is OPEN with no hard-stop labels; the fix is NOT on current origin/main (both decoders still use plain serde_json::from_str there); PR #7702's diff vs main is exactly the one-file fix. I merged current origin/main into the PR branch and pushed — new head 30d8516. Next: targeted world_fixture tests on the laptop, then merge under the standing criteria once verified (no Codex findings exist on the PR to disposition).

@dezren39

Copy link
Copy Markdown
Member Author

🤖 Agent note · shepherd status for PR #7702 (task 12995, lane code-o)

  • Review findings disposition: Codex's review on head 966e3c9 failed on usage limits (chatgpt-codex-connector[bot]: "You have reached your Codex usage limits for code reviews") and posted zero inline findings; CodeRabbit hit its review rate limit and posted no findings. There are no bot findings to fix or rebut on this PR. The change was reviewed by hand against issue 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's acceptance: both decode paths (decode_header, decode_event) now parse through crate::world_session::parse_json_without_duplicate_keys, so duplicates are refused at any nesting depth before check_keys, the version gate, nested records parsing, or check_window can see a collapsed value, with the existing header/event-line context retained in the error.
  • Regression coverage: decode_refuses_duplicate_fields_in_the_header_and_events covers a duplicated world, an unsupported fixture version hidden behind a duplicate key, a repeated nested records key, and an out-of-window event sequence hidden behind a duplicate (asserting the "fixture line 2" context), plus a clean control fixture that still decodes.
  • Duplicate PR: PR fix(id): reject duplicate JSON fields in world_fixture headers and events (#6474) #8320 was byte-identical (same head SHA, same diff hash) and has been closed as a duplicate; the salvage note is on this PR (6781530680).
  • Targeted tests (fresh, this shift): cargo test -p id world_fixture --lib on this head's tree — 29 passed, 0 failed (2,519 filtered out), including decode_refuses_duplicate_fields_in_the_header_and_events.

@dezren39
dezren39 merged commit c2420df into main Nov 10, 2026
1 of 7 checks passed
@dezren39
dezren39 deleted the queue/12995-6474-world-fixture-dup-keys branch November 10, 2026 23:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant