Skip to content

Add JSON Pointer, Patch and Merge Patch#271

Merged
JE-Chen merged 3 commits into
devfrom
feat/json-patch
Jun 20, 2026
Merged

Add JSON Pointer, Patch and Merge Patch#271
JE-Chen merged 3 commits into
devfrom
feat/json-patch

Conversation

@JE-Chen

@JE-Chen JE-Chen commented Jun 20, 2026

Copy link
Copy Markdown
Member

Summary

jsonpath is read-only and approval compares 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.

  • RFC 6901 JSON Pointerresolve_pointer / set_pointer / remove_pointer (with ~0/~1 escaping, - end-of-array token).
  • RFC 6902 JSON Patchapply_patch (all six ops add/remove/replace/move/copy/test, atomic — failure leaves the input untouched) and make_patch (diff two docs).
  • RFC 7386 JSON Merge Patchmerge_patch (a null value deletes a key) and make_merge_patch.

test does deep equality keeping true distinct from 1; move rejects 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

  • Headless core: je_auto_control/utils/json_patch/
  • Facade: re-exported from __init__.py + __all__
  • Executor: AC_resolve_pointer, AC_apply_json_patch, AC_make_json_patch, AC_merge_patch
  • MCP: ac_resolve_pointer, ac_apply_json_patch, ac_make_json_patch, ac_merge_patch
  • Script Builder: four commands under Data

Tests & docs

  • test/unit_test/headless/test_json_patch_batch.py (14 tests: RFC vectors, atomicity, move-into-child, bool≠int, round-trips)
  • v63 feature docs (EN + Zh) + toctree registration
  • What's-new sections in all three READMEs

Lint clean: ruff / pylint / bandit / radon (no function CC > 10).

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.
@codacy-production

codacy-production Bot commented Jun 20, 2026

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 122 complexity · 0 duplication

Metric Results
Complexity 122
Duplication 0

View in Codacy

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.

@JE-Chen
JE-Chen merged commit 76207e0 into dev Jun 20, 2026
2 checks passed
@JE-Chen
JE-Chen deleted the feat/json-patch branch June 20, 2026 21:57
@sonarqubecloud

Copy link
Copy Markdown

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