Skip to content

fix(json): preserve prototype keys and property-test snapshot codecs - #5544

Merged
kixelated merged 3 commits into
mainfrom
quest/m2/json-snapshot-properties
Oct 15, 2026
Merged

kixelated merged 3 commits into
mainfrom
quest/m2/json-snapshot-properties

Conversation

@kixelated

@kixelated kixelated commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Problem

A generated snapshot sequence reduced to {"__proto__":0} -> {} leaves the JS decoder with a stale field. Object membership sees inherited properties, and assignment to __proto__ invokes its inherited setter. These are valid JSON keys.

Approach

Use own-property membership and safe data-property writes in the JS diff/merge/equality implementation. Four shared Rust/JS vectors cover prototype-key addition, deletion, nesting, and inherited equality. A JS assertion also checks the result retains an ordinary object prototype.

Add fast-check 4.10.2 and proptest 1.12.0 as dev dependencies. Mirrored bounded JSON generators check every reconstructed value across snapshots, deltas, resets, ratios, and compression, including updates emitting no frame. PR runs use 256 fixed-seed cases. just test json-properties prints a fresh seed and runs 4096 cases in each language nightly. Failures shrink and report replay details; minimized regressions stay in shared vectors. A codec benchmark sweeps document size and changed-key count with both compression modes.

Impact

Public API shape and wire format are unchanged. JS behavior now preserves valid JSON prototype-named fields. Rust production code is unchanged. The nightly row is independent of #5527's workload split and needs no landing dependency. No package versions change.

Validation

  • All 167 JS JSON and 172 Rust JSON tests pass. The original implementation fails four new vectors and the property after 22 cases (seed 7171953).
  • Both languages pass the complete local nightly recipe with 4096 cases, seed 1719610749. A temporary Rust dropped-delta mutation fails and shrinks to two values; source restored.
  • The document-size/changed-key benchmark and its typecheck pass. Timings are descriptive on a busy host; no speedup or threshold claim.
  • Scoped just check passed 7468 default Rust tests, crypto identity, and 460 capture tests, then hit the existing CLI test export::the_same_instance_within_the_linger_continues (export wrote nothing). The same failure is documented in fix: count HTTP refusals and preserve replaced routes at the final sequence #5526 and tracked by quest/m1/ts-same-instance-resume.md; this PR does not change CLI or Rust production codec logic.
  • Checks skipped after that failure were run separately and passed: uring-check, media features, quest, drill sensitivity, flake, Markdown/shell/TOML/Nix/just formatting, workflow checks, and all JS tests. The full just check command therefore is not green.

Alternatives and follow-up

Using prototype-less output objects would change observable object shape. The private safe-write helper preserves that shape and only handles the special setter key differently. Keep generated counterexamples as deterministic shared vectors, and resolve the separately tracked CLI resume regression before treating the complete suite as green.

(Written by GPT-6)


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

kixelated and others added 3 commits October 14, 2026 13:14
Co-Authored-By: GPT-6 <noreply@openai.com>
A fresh nightly checkout has no node_modules, so bun could not resolve
fast-check.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@kixelated
kixelated marked this pull request as ready for review October 15, 2026 00:22
@coderabbitai

coderabbitai Bot commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

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 13 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used all 4 included reviews currently available.

Learn how review limits work.

Review configuration:

⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84e74eb9-9b3d-49fa-b3a5-a92f3b19a590
📥 Commits

Reviewing files that changed from the base of the PR and between 813a92b and 9422edd.

⛔ Files ignored due to path filters: 2
  • Cargo.lock is excluded by !**/*.lock
  • bun.lock is excluded by !**/*.lock
📒 Files selected for processing: 17
  • .github/workflows/nightly.yml
  • js/json/bench/codec.ts
  • js/json/bench/tsconfig.json
  • js/json/package.json
  • js/json/src/diff.test.ts
  • js/json/src/diff.ts
  • js/json/src/snapshot/properties.test.ts
  • quest/m2/README.md
  • quest/m2/json-snapshot-properties.md
  • quest/m2/json-window-properties.md
  • rs/moq-json/Cargo.toml
  • rs/moq-json/src/snapshot/encoder.rs
  • rs/moq-json/tests/vectors.json
  • test/README.md
  • test/json-properties.md
  • test/json-properties.sh
  • test/justfile
  • 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

Comment @coderabbitai help to get the list of available commands.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

Codex Review Summary

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-15T00:24:46.761794Z 9422edd Draft marked ready
ℹ️ 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.

@kixelated

Copy link
Copy Markdown
Collaborator Author

Merge summary:

  • Interop failure on c01e903: the browser media test's cold-start audio-tone check (63/71 samples, player stalled with jitter delay rising). This PR touches no playback code. It is the known ~5% flake tracked by quest/m1/publish-audio-channel-count.md, also seen on that quest's branch with the same signature. Left to that quest; Interop passes on the new head.
  • Nightly fix: just test json-properties is wired into the nightly tests matrix, but on a fresh checkout bun test could not resolve fast-check (reproduced locally without node_modules). test/json-properties.sh now runs bun install --frozen-lockfile first, as test/drain/run.sh does. The full recipe passes locally.
  • Dependencies: fast-check 4.10.2 and proptest 1.12.0 are the newest stable releases.
  • Review: Codex reviewed 9422edd with no findings. CodeRabbit hit its rate limit.

Public API and wire: unchanged.

(Written by Claude Opus 5.5)

@kixelated
kixelated added this pull request to the merge queue Oct 15, 2026
Merged via the queue into main with commit 4f4b527 Oct 15, 2026
16 checks passed
@kixelated
kixelated deleted the quest/m2/json-snapshot-properties branch October 15, 2026 01:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant