Conversation
Implement first-class JSON Delta support as an adapter layer over the existing v4 internals. New APIs produce, consume, apply, and revert spec-conformant JSON Delta documents while preserving all v4 APIs unchanged. New public functions: diffDelta, applyDelta, revertDelta, invertDelta, toDelta, fromDelta, validateDelta. New files: src/jsonDelta.ts, src/deltaPath.ts, CLAUDE.md, conformance fixtures, and comprehensive tests (143 new tests, all 245 pass). README rewritten to position JSON Delta as the primary API with practical examples for audit logging, undo/redo, and state sync.
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
Add 19 new tests covering error paths, edge cases, and validation branches in deltaPath.ts and jsonDelta.ts. Add istanbul ignore comments to unreachable defensive branches (exhaustive switch defaults, function-key paths that diff() never produces). Coverage: deltaPath.ts 100%, jsonDelta.ts 97.8%, overall 96.96%.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR introduces a first-class JSON Delta (v1) API surface as an adapter over the existing v4 jsonDiff internals, plus path parsing/canonicalization helpers and extensive conformance + integration tests.
Changes:
- Added
src/jsonDelta.tsimplementingdiffDelta,applyDelta,revertDelta,invertDelta,toDelta,fromDelta,validateDelta. - Added
src/deltaPath.tsfor JSON Delta path parsing/building and v4 atomic-path conversion utilities. - Reworked README to position JSON Delta as the primary API; added fixtures and a large new test suite.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 10 comments.
Show a summary per file
| File | Description |
|---|---|
src/jsonDelta.ts |
New JSON Delta API adapter layer over v4 diff/apply/atomize/unatomize. |
src/deltaPath.ts |
JSON Delta path parsing + canonicalization + v4 path interop helpers. |
src/index.ts |
Exports JSON Delta module from the package entrypoint. |
tests/jsonDelta.test.ts |
New test coverage for validate/diff/apply/revert/invert/bridge operations + fixtures. |
tests/deltaPath.test.ts |
Unit tests for delta path parsing/building and conversion helpers. |
tests/__fixtures__/json-delta/basic-replace.json |
Conformance fixture for basic replace semantics. |
tests/__fixtures__/json-delta/keyed-array-update.json |
Conformance fixture for keyed-array update/add/remove semantics. |
README.md |
Documentation rewrite focusing on JSON Delta API and migration/bridge guidance. |
package.json |
Version bump to 5.0.0-alpha.0. |
CLAUDE.md |
Added contributor/AI-assistance architecture notes and conventions. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Fix applyRootOp Array↔Object root replace bug (only mutate plain obj→obj) - Reject NaN/Infinity in formatFilterLiteral - Fix )] in quoted strings breaking filter parsing (new findFilterClose helper) - Change applyDelta/revertDelta return type from T to any (root ops change type) - Reject non-JSON numeric formats in parseFilterLiteral (hex, octal, etc.) - Fix CLAUDE.md spec path reference to GitHub URL - Add prototype pollution warning to README Data Sync example - Add 8 new tests covering all fixes (272 total)
|
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.



Summary
diffDelta,applyDelta,revertDelta,invertDelta,toDelta,fromDelta,validateDeltasrc/jsonDelta.ts,src/deltaPath.ts, conformance fixtures,CLAUDE.md5.0.0-alpha.0Key design decisions
IChange[]tree and JSON Delta format without modifyingsrc/jsonDiff.tsdiffDeltaproduces[?(@.id==42)](number), not[?(@.id=='42')](string)fromDeltareturnsIAtomicChange[]: 1:1 mapping with delta operations for transparencyapplyDeltaprocesses operations one-at-a-time with dedicated root handlingreplaceoperations in delta outputTest plan