Repository navigation
fix(jsonc): preserve strict JSON after removing adjacent hook entries - #1078
Merged
1 commit merged intoOct 15, 2026
Merged
1 commit merged into
1 commit merged into
Conversation
code-review-graph reviewOverall risk: 0.65 (MEDIUM) — 5 changed function(s)/class(es), 1 affected flow(s), 0 test gap(s) Risk-scored changes
Affected execution flows
Powered by code-review-graph — local-first analysis; no code leaves the CI runner. |
azizur100389
marked this pull request as ready for review
October 1, 2026 16:46
03a5c7d
Owner
|
Thank you! I added tests for nested JSONC removals with comments, top-level arrays, and Gemini and Claude settings after uninstall. The tests and your change are merged into staging in #1115. |
azizur100389
pushed a commit
to azizur100389/code-review-graph
that referenced
this pull request
Oct 15, 2026
- every removal subset of object members and array elements (sizes 1-5, compact and indented), adjacent or not, parses as strict JSON - commented JSONC: all comments survive and no new trailing comma appears - empty path list returns the document unchanged - a surviving member keeps its own JSONC trailing comma; a removed tail that carried one still leaves strict JSON - duplicate paths, parent+child overlapping paths, removals in several containers at once, nested hook groups emptied at the end - unicode, escaped quotes and Windows paths before the edit point; CRLF - large documents (300 members/elements) - unresolvable paths still raise KeyError/IndexError/ValueError - install -> uninstall leaves strict JSON with user hooks for Claude, Qoder, CodeBuddy, Codex, Gemini (own and shared events) and Cursor - Continue duplicate registrations at the end of mcpServers - hooks written by an earlier release, owned hooks inside a user group - second uninstall is byte-stable; install/uninstall cycles; dry run - the issue tirth8205#1068 reproduction through the CLI Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
azizur100389
pushed a commit
to azizur100389/code-review-graph
that referenced
this pull request
Oct 15, 2026
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Linked issue
Closes #1068.
What & why
Uninstalling CRG from Claude settings with user-owned hooks can remove adjacent final members and leave the preceding separator behind. Fix the shared token-preserving removal helper to remove newly exposed trailing commas, while retaining pre-existing JSONC commas, comments, formatting, and literal commas inside strings. Includes an actual install/uninstall cycle that strictly parses the resulting settings and verifies that user permissions and hooks survive.
How it was tested
Following the same staged regression/baseline methodology used in my earlier PRs (#274, #276, #279, #353 and #354), against the current contribution target
stagingat6b12d11625cbec3b6773e076cb3d136464fa90e5.ruff check code_review_graph tests/test_jsonc_removals.py: clean.bandit -r code_review_graph/ -c pyproject.toml: zero findings.mypy code_review_graph/ --ignore-missing-imports --no-strict-optional: the same three existing Windowsfcntl.LOCK_EX/LOCK_NB/flockerrors indaemon.pyas unchanged staging; no new errors.Exact test commands (using a local virtual environment with
.[dev], asuvis not installed):Full local Windows suite completed: 4,151 passed, 110 failed, 819 skipped, 46 deselected, 2 xfailed, 2 xpassed; 86% coverage. Unchanged staging: 4,143 passed, 110 failed, with identical skip/xfail/xpass counts. Failure identities match unchanged staging exactly; no new failures. The Git ceiling isolates temporary test repositories from an unrelated enclosing home-directory Git repository; PATH/PYTHONPATH point to each checkout under test. Browser tests passed in CI; browser and opt-in upgrade suites were excluded locally.