Plan work on roadmap item 2: Config patching is not RFC 7386 / RFC 7396 JSON Merge Patch…
- User
Plan work on roadmap item 2: Config patching is not RFC 7386 / RFC 7396 JSON Merge Patch
- README says config entries apply a JSON merge patch.
- The implementation only patches top-level keys by assignment or deletion (
src/core/deploy.ts:82). - Nested objects are replaced wholesale instead of recursively merged, and undo state is also captured only at the top level (
src/core/deploy.ts:71). - This is especially risky for MCP registration because the adapter writes
{ mcpServers: { [name]: config } }(src/core/adapters/mcp.ts:45), which can replace the entire existingmcpServersobject instead of adding one server.
Assistant
Now let me read the critical files directly to confirm key details before planning.
Assistant
Now I have everything I need. Let me write the plan.
Assistant
Now let me check if
isPlainObjectis available inrevert.ts:Assistant
isPlainObjectis private todeploy.ts. I'll inline it inrevert.tsas well:Assistant
Now let me read the existing config-patch tests in
deploy.test.tsto find where to insert the new tests:Assistant
Now let me read the MCP revert test that needs updating:
Assistant
The existing MCP revert test is actually correct for its scenario (no pre-existing
mcpServers). I'll add a new test for the sibling-preservation case. Let me find where to insert it:Assistant
Now let me also check the imports in revert.test.ts to make sure
ConfigPatchRevertActionis imported:Assistant
Good,
ConfigPatchRevertActionis already imported. Now let me update README and roadmap:Assistant
Now update the roadmap to cross out item 2:
Assistant
Also update the "Obvious Code Problems" and "Exit Criteria" sections that reference this item:
Assistant
All 215 tests pass, including the 3 new ones. Let me mark the final task complete:
Assistant
All done. Here's what changed:
src/core/deploy.ts—computeUndoPatchandapplyMergePatchare now recursive. When both the patch value and the existing target value are plain objects, they recurse into the nested structure instead of replacing it wholesale. The undo patch mirrors the same nesting, so it only captures the keys that were actually touched at each level.src/core/revert.ts—applyUndoPatchgot the same recursive treatment (andisPlainObjectinlined since it was private todeploy.ts). The undo patch is itself a valid RFC 7396 merge patch, so the same algorithm applies.Key correctness fix: Deploying
{ mcpServers: { "new-server": {...} } }onto a config that already has{ mcpServers: { "existing-server": {...} } }now merges the two servers together. The undo patch stored is{ mcpServers: { "new-server": null } }, so reverting removes only the new server and leaves the existing one untouched.Tests added (3 new, 215 passing total):
- User
commit your changes
Assistant
Committed as
b95d73b.