Skip to content

fix(id): refuse duplicate keys at read_records receipt (#6634) - #6678

Merged
dezren39 merged 1 commit into
mainfrom
queue/6634-read-records-duplicate-keys
Nov 7, 2026
Merged

dezren39 merged 1 commit into
mainfrom
queue/6634-read-records-duplicate-keys

Conversation

@dezren39

@dezren39 dezren39 commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

What

read_records (receipt path for replicated world records, pkgs/id/src/world_records.rs) parsed each record value with plain serde_json::from_slice and measured the value cap on the parsed value — so a duplicate object key collapsed last-wins before the cap was measured, and a value whose raw bytes exceed MAX_RECORD_VALUE_BYTES hidden behind a duplicate key passed receipt, even though the publish path (parse_records, #6473) refuses the identical shape.

Change

  • Route the receipt parse through id_core::json_unique::parse_json_without_duplicate_keys (the shared Design: a duplicate key is a parse error — one duplicate-key refusal contract for pkgs/id's checked JSON gates #6520 helper, same as parse_records): a duplicate key at any depth is now a parse error at receipt, with the existing record <key> context naming the record. The size cap then always measures the document as written, never a collapse of it.
  • Regression tests via the existing write_raw harness:
    • read_records_refuses_a_duplicate_key_hiding_an_oversized_value — raw bytes over the 8192 cap, collapsed size small → refused.
    • read_records_refuses_a_small_nested_duplicate_key — under every cap raw and collapsed → refused (duplicate refusal is the only possible cause).

Verification (laptop, this branch)

Closes #6634. The read_records site is also recorded as a gate disposition on the #6521 closing inventory.

Filed by the repo queue worker, lane code-a, in fallback mode (queue backend down 2026-11-06/07; issue #6634 claimed via a fallback claim marker on the issue).


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

read_records parsed replicated record values with plain
serde_json::from_slice and measured the value cap on the parsed value,
so a duplicate object key collapsed last-wins before the cap was
measured: an over-cap value hidden behind a duplicate passed receipt,
while parse_records (publish, #6473) refuses the same shape.

Route the parse through id_core::json_unique::
parse_json_without_duplicate_keys, mirroring parse_records, and add
write_raw regression tests: a duplicate hiding an oversized value and
a small nested duplicate are both refused naming the record key.
@dezren39
dezren39 requested a review from a team as a code owner November 7, 2026 02:01
@coderabbitai

coderabbitai Bot commented Nov 7, 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 37 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: 06622bda-0f2d-4785-8f41-e53b97354059
Commits

Reviewing files that changed from the base of the PR and between 1dfe31b and d4d8cee.

Files selected for processing: 1

  • pkgs/id/src/world_records.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 7, 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-07T02:03:41.168316Z d4d8cee PR opened
ℹ️ 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.

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