Skip to content

fix(mcp): keep dry-run config loads side-effect free - #898

Closed
ydflow wants to merge 1 commit into
Tencent:mainfrom
ydflow:fix/mcp-inject-dry-run-no-migration
Closed

ydflow wants to merge 1 commit into
Tencent:mainfrom
ydflow:fix/mcp-inject-dry-run-no-migration

Conversation

@ydflow

@ydflow ydflow commented Sep 29, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Forward --dry-run to autoDetectInit from mcp inject, keeping legacy-role migration and legacy project-partition adoption in memory.
  • Load mcp list with dryRun: true because it is read-only.

Fixes #893.

Verification

  • npx vitest run src/__tests__/dry-run-load-path.test.ts src/__tests__/mcp-cmd.test.ts — 30 tests passed.
  • npx tsc --noEmit — passed.
  • npm run lint — passed.
  • npm run build — passed.
  • Real CLI: node dist/index.js mcp inject --dry-run with a legacy role-less user config printed the migration preview and left config.yaml unchanged.

The full Vitest suite was attempted on Windows but did not complete cleanly because unrelated tests hit platform-specific permission/shell expectations and temporary-path EPERM/timeouts. The targeted MCP and dry-run suites pass.

@SaulMoro

Copy link
Copy Markdown
Collaborator

Thanks for picking this up. #901 also fixes #893, and it includes both changes here: mcp inject forwards { dryRun } and mcp list loads with dryRun: true, each with a row in LOAD_ONLY_COMMANDS.

While sweeping for #893 we found the same bare load in about 40 more places, and #901 fixes them too:

  • the other commands that honour --dry-run: roles, projects, tags, source, remove, uninstall, packages install, import --from-*, codebase --reconcile/--deep-enrich and models switch
  • the pre-command auto-migration, which renamed a pre-feat(partition): encode the full project path into the data-home slug #546 partition on pull --dry-run and push --dry-run
  • the read-only commands, such as the list subcommands, doctor, skill, webhook list and digest

Each case has a test that fails on main. The other --dry-run gaps it turned up are tracked in #900.

Both PRs change the same lines in src/mcp-cmd.ts and the same test table, so only one can merge without a conflict. If #901 goes in, this one is covered by it.

@jeff-r2026 jeff-r2026 self-assigned this Sep 29, 2026
@github-actions

Copy link
Copy Markdown

No findings.

The PR description documents sufficient testing, including a representative real-CLI mcp inject --dry-run verification for this runtime behavior change.

@jeff-r2026 jeff-r2026 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please resolve the conflicts

@ydflow

ydflow commented Sep 29, 2026

Copy link
Copy Markdown
Contributor Author

Thanks for the review. #901 has now merged and includes both changes in this PR: mcp inject --dry-run forwards { dryRun }, and mcp list loads with dryRun: true. It also covers the broader loader migration cases. This PR is superseded, so I'm closing it rather than resolving conflicts against code already on main.

@ydflow ydflow closed this Sep 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[bug] mcp inject --dry-run can still save a config migration

3 participants