Refine MCP import reconciliation and validation#1620
Refine MCP import reconciliation and validation#1620idiotsj wants to merge 2 commits intofarion1231:mainfrom
Conversation
farion1231
left a comment
There was a problem hiding this comment.
Thanks a lot for your contribution — this is a solid improvement overall 👍
I’ve gone through the changes and would summarize my feedback as 2 blocking issues, 1 suggested fix, and 2 notes:
Blocking issues
-
Fail-fast aggregation without transaction rollback
The aggregated import is now fail-fast, but earlier sources may have already been partially persisted. This can lead to a mismatch between the reported failure and the actual state.
Relevant code:
services/mcp.rs#L246commands/mcp.rs#L199
Previously, the logic tolerated errors per source and continued importing. Now, a single source failure causes the whole process to return an error, but without any rollback. This should either be wrapped in a transaction or reverted to a tolerant strategy.
-
“All apps disabled” treated as unowned entry
Treating entries with all apps disabled as “unowned” can result in silently overwriting local specs when importing the same ID from external sources.
Relevant code:
importing.rs#L135
From a user perspective, disabling all apps does not mean giving up ownership of the configuration. This behavior may lead to unexpected data loss.
Suggested improvement
-
Swallowing normalization errors with
.ok()When normalizing existing servers, using
.ok()may hide invalid legacy data and treat it as a normal spec difference.Relevant code:
importing.rs#L153
This could lead to incorrect overwrite/conflict decisions. I’d consider handling this explicitly instead of silently ignoring errors.
Notes
-
Behavior change: missing
typenow errorsPreviously, missing
type(e.g. forurl) defaulted tostdio. Now it throws an error. This is a clear behavior change — it would be good to document it in the changelog or release notes. -
Import order affects conflict resolution
The current implementation makes conflict resolution dependent on import order across apps. It might be worth documenting the priority or making it explicit in tests.
One more note: the new tests look great and are all passing, but they don’t currently cover the two blocking regression scenarios above.
Let me know what you think — happy to discuss possible approaches 🙂
Summary
http_headers->headersnormalization and strict remotetypehandlingUnifiedSkillsPaneltest mock drift and clean up unrelated Prettier formatting so the documented frontend checks pass cleanlyValidation
pnpm typecheck✅pnpm format:check✅pnpm test:unit✅pnpm exec vitest run tests/hooks/useMcpValidation.test.tsx tests/utils/tomlUtils.test.ts tests/components/UnifiedMcpPanel.test.tsx✅cargo/rustfmtare unavailableNotes
pnpm typecheck,pnpm format:check, andpnpm test:unit