Repository navigation
fix(clients): remove a sole JSONC registration with a trailing comma - #4284
alfredo1491 wants to merge 1 commit into
Conversation
When REA's entry is the only member of a JSONC server table and is
followed by a trailing comma, jsonc-parser's removal edit drops the
property but keeps the comma, producing `{ , }`. Uninstall then fails
validation, restores the original file, and leaves REA registered
(Cursor reports `failed`).
`deleteJsonPropertyPreservingComments` now handles that sole-member case:
it drops the trailing comma before applying the stock removal edit. The
whitespace/comment scan that locates the comma is shared with the
existing next-sibling path, and the JSONC edit formatting options are
named once.
Fixes morluto#4244
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR appears safe to merge; no actionable defects were found. SummaryFixes uninstall when REA is the only JSONC registration and has a trailing comma.
No actionable issues were found. Tests were not run during this review. Whether this PR was superseded could not be checked because GitHub access required authentication. Reviews (1) · Last reviewed commit: "fix(clients): remove a sole JSONC regist..." · Reviewed by Greptile |
Remove properties and their separators using parsed JSONC token spans. Preserve unrelated comments, BOM, CRLF, backups, and repeated removal behavior. Refs: #4244, #4284 Co-authored-by: alfredo1491 <[email protected]>
|
Closing as superseded: the trailing-comma fix and its test were integrated into |
Fixes #4244
Problem
When REA's registration is the only member of a JSONC server table and is followed by a trailing comma,
rea uninstallfails: Cursor reportsfailed, the original file is restored, and REA stays registered. Removing the comma by hand makes the same uninstall succeed.Root cause: for a sole property,
deleteJsonPropertyPreservingCommentsreturnsundefinedand the stock jsonc-parser removal edit runs. That edit (jsonc-parser 3.3.1) drops the property but keeps its trailing comma:The serialized document then fails validation, so the uninstall transaction rolls back. Tables with another sibling are unaffected (the existing path or the stock edit leaves valid JSONC).
Change
deleteJsonPropertyPreservingCommentshandles the sole-member case: it drops the trailing comma, then applies the same stock removal edit, so the result matches the comma-less file.nextJsoncTokenOffsetand shared with the existing next-sibling path; the JSONC edit formatting options are named once (JSONC_EDIT_FORMATTING). No other behavior changes.Verification
uninstalls a sole Cursor registration that has a trailing commaintests/boundary/filesystem/clientConfigurationDialects.test.ts: realconfigureClientConfigurationregistration, a trailing comma added after REA's entry, thensystemUninstallHost(...).removeClient(...). It fails onmainwithexpected 'failed' to be 'removed'and passes with this change; the result parses without errors and leavesmcpServersempty.tests/boundary/filesystem/client*.test.ts,*ClientConfiguration.test.ts,src/application/{Setup,Uninstall,Client,Doctor}*.test.ts) compared before/after on the same Windows host: identical failure set (46 pre-existing Windows-host failures), 500 → 501 passing, no new failures.tsc --noEmitandoxlinton the changed files: passed.Unavailable coverage: run on Windows 11 x64 / Node 22.23.1 only; the 46 pre-existing failures in those suites on this host were not investigated, and the full CI suite was not run locally.
🤖 Generated with Claude Code