Skip to content

fix: resolve vp run crash when task script contains global CLI subcommands#766

Merged
fengmk2 merged 2 commits intomainfrom
fix-vp-run-prepare
Mar 10, 2026
Merged

fix: resolve vp run crash when task script contains global CLI subcommands#766
fengmk2 merged 2 commits intomainfrom
fix-vp-run-prepare

Conversation

@fengmk2
Copy link
Copy Markdown
Member

@fengmk2 fengmk2 commented Mar 10, 2026

Summary

  • vp run crashed when a task script contained global-only commands like vp config because CLIArgs::try_parse_from failed on unrecognized subcommands with ErrorKind::InvalidSubcommand
  • Now InvalidSubcommand errors return HandledCommand::Synthesized with UserCacheConfig::disabled(), letting the global CLI binary handle them as regular subprocesses without caching
  • Also disabled cache for vp exec and vp check in task scripts, since they run arbitrary/composite commands with side effects

Test plan

  • Added unit test global_subcommands_produce_invalid_subcommand_error confirming config, create, env, migrate produce InvalidSubcommand
  • Added snap test command-run-with-vp-config verifying vp run foo with "foo": "vp config" no longer crashes
  • All existing snap tests pass

@netlify
Copy link
Copy Markdown

netlify Bot commented Mar 10, 2026

Deploy Preview for viteplus-staging canceled.

Name Link
🔨 Latest commit df46871
🔍 Latest deploy log https://app.netlify.com/projects/viteplus-staging/deploys/69b01fdab7bb2e00082310e8

Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 10, 2026

This stack of pull requests is managed by Graphite. Learn more about stacking.

@fengmk2 fengmk2 force-pushed the fix-vp-run-prepare branch from dc02933 to e7f3e05 Compare March 10, 2026 13:13
@fengmk2 fengmk2 self-assigned this Mar 10, 2026
@fengmk2 fengmk2 marked this pull request as ready for review March 10, 2026 13:13
Comment thread packages/cli/binding/src/cli.rs Outdated
fengmk2 added 2 commits March 10, 2026 21:42
`vp run` crashed when a task script contained global-only commands like
`vp config` because CLIArgs parsing failed on unrecognized subcommands.
Now InvalidSubcommand errors return HandledCommand::Verbatim, letting
the global CLI binary handle them as regular subprocesses.
…cripts

Per review feedback, use Synthesized with UserCacheConfig::disabled()
instead of Verbatim for commands that should not be cached: global
subcommands (vp config, etc.), vp exec, and vp check.
@fengmk2 fengmk2 force-pushed the fix-vp-run-prepare branch from e7f3e05 to df46871 Compare March 10, 2026 13:42
Comment thread packages/cli/binding/src/cli.rs
@fengmk2 fengmk2 changed the title fix: let global subcommands in task scripts fall through as Verbatim fix: resolve vp run crash when task script contains global CLI subcommands Mar 10, 2026
@fengmk2 fengmk2 merged commit 58b2307 into main Mar 10, 2026
22 checks passed
Copy link
Copy Markdown
Member Author

fengmk2 commented Mar 10, 2026

Merge activity

@fengmk2 fengmk2 deleted the fix-vp-run-prepare branch March 10, 2026 14:03
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.

2 participants