Repository navigation
fix(mcp): preserve TOML multiline strings during removal - #564
Frankie-Xu wants to merge 5 commits into
Conversation
stripTomlSection stopped at the next '[' header, orphaning [mcp_servers.graft.*] subtables (e.g. .env) and breaking Codex CLI config loads after uninstall. Dotted children of the graft table are now consumed with it; foreign tables are untouched. Fixes trailhq#546
Extend stripTomlSection to whole-file family removal: every [mcp_servers.graft] and [mcp_servers.graft.*] table is dropped whether contiguous or not, including orphaned subtables without a parent. Foreign tables are preserved.
🌱 graft blast radius1 area changed → 1 area can be affected. 1 dependent symbol, depth 2. flowchart TB
A0(("Configuration Retraction<br/>1 symbol"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0 reached;
Who knows this code — 2 people across 2 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 1 dependent symbol, grouped by areaConfiguration Retraction — 1 symbol in 1 file
Test signal per changed area — 1 ✗Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
Removing or rewriting a Graft TOML entry can mistake
[mcp_servers.graft.env]inside another server's multiline string for an owned table. It then deletes the string's closing delimiter and following foreign settings, leaving invalid TOML. The removal scanner now tracks basic/literal string context, including comments, escapes and four/five-quote endings, and preserves foreign string content and newline delimiters.This is a focused follow-up to #547. That PR is currently unmerged, so this branch retains its canonical parent/subtable cleanup commits; the additional commit
e36ba64b8bdb7daa49fc7bd897fdcb770dc0a42chandles multiline-string preservation. It preserves orphan and noncontiguous canonical Graft-subtable cleanup and adds no runtime dependency or TOML reserialization.A separate CI-only commit reuses the shared fix from
e9649a4cda39f9bae7264e4f6d642e466dd46d0cto align CodeQL init with the existing analyze pin at v4.38.1. It changes one workflow line; functional source remains the independently reviewed commit above.Validation:
tomlliboracle passes 19 fixtures with valid output and preserved foreign values. Independent review adds 168 valid string-boundary probes, all passing.npm run buildpasses locally. On exact published head9e8878a, official clean-install prepare/build and full Ubuntu/Windows CI pass: 1,376 / 1,371 passed; 1 / 6 expected skips; zero failures. Node 24 WASM and CodeQL pass. The still-unstarted duplicate local host suite was canceled after these official substitutes passed.git diff --checkpasses; independent code/spec review found no actionable issues.Existing noncanonical-header/array-table matching and nested-array boundary limitations are outside this string-focused follow-up. The nested-array behavior was reproduced on upstream main and #547 as well as this branch. New Codex registration/retract fixtures use temporary synthetic homes; existing repo-only retraction fixtures disable global writes. Native dependency compilation encountered a local missing C++ header; the affected tests ran using an exact-version, verified read-only N-API cache copied into this isolated checkout.
AI-assisted implementation and review.