Repository navigation
fix(id): refuse duplicate keys at read_records receipt (#6634) - #6678
Merged
Merged
Conversation
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.
|
Warning Review limit reachedYou'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. View limit details
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. |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This was referenced Nov 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
read_records(receipt path for replicated world records,pkgs/id/src/world_records.rs) parsed each record value with plainserde_json::from_sliceand 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 exceedMAX_RECORD_VALUE_BYTEShidden behind a duplicate key passed receipt, even though the publish path (parse_records, #6473) refuses the identical shape.Change
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 asparse_records): a duplicate key at any depth is now a parse error at receipt, with the existingrecord <key>context naming the record. The size cap then always measures the document as written, never a collapse of it.write_rawharness: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)
cargo test -p id --lib world_records -- --test-threads=1: 15 passed, 0 failed — both new tests plus every pre-existing receipt test.Node-harness tests intermittently fail atwrite_rawwith iroh-docs "author not found" — reproduced identically on a clean-main control worktree (6 failed there too), so it is a pre-existing harness race, not this change; the serial run is green on both trees' passing subsets. (Observation recorded on issue id(world_records): read_records collapses duplicate keys inside a replicated value — the #6483 receipt caps measure the collapsed value, so an oversized value hidden behind a duplicate passes, unlike parse_records (#6473) #6634.)Closes #6634. The
read_recordssite 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).
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.