Add JSON Pointer, Patch and Merge Patch#271
Merged
Merged
Conversation
jsonpath is read-only and approval compares whole artifacts, so nothing could address one location, compute a structured delta, or apply a partial update to a JSON document. Add the three IETF primitives: RFC 6901 JSON Pointer, RFC 6902 JSON Patch (all six ops, atomic apply, plus make_patch diffing), and RFC 7386 JSON Merge Patch. Pure stdlib, validated against the RFC test vectors. Wired through the facade, four AC_* executor commands, MCP tools and the Script Builder.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 122 |
| Duplication | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
|
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
jsonpathis read-only andapprovalcompares whole artifacts by equality — nothing could address a single location, compute a structured delta, or apply a partial update to a JSON document. This adds the three IETF primitives that fill that gap.resolve_pointer/set_pointer/remove_pointer(with~0/~1escaping,-end-of-array token).apply_patch(all six ops add/remove/replace/move/copy/test, atomic — failure leaves the input untouched) andmake_patch(diff two docs).merge_patch(anullvalue deletes a key) andmake_merge_patch.testdoes deep equality keepingtruedistinct from1;moverejects moving a value into its own child. Pure stdlib (json+copy), fully deterministic, validated against the RFC test vectors. Useful for config-drift detection, partial updates in flows, HTTP PATCH bodies, and golden-master deltas.Five-layer wiring
je_auto_control/utils/json_patch/__init__.py+__all__AC_resolve_pointer,AC_apply_json_patch,AC_make_json_patch,AC_merge_patchac_resolve_pointer,ac_apply_json_patch,ac_make_json_patch,ac_merge_patchTests & docs
test/unit_test/headless/test_json_patch_batch.py(14 tests: RFC vectors, atomicity, move-into-child, bool≠int, round-trips)Lint clean: ruff / pylint / bandit / radon (no function CC > 10).