Skip to content

feat: exit 0 on --filter no-match, add --fail-if-no-match#393

Merged
branchseer merged 3 commits into
voidzero-dev:mainfrom
kazupon:feat/fail-if-no-match
May 24, 2026
Merged

feat: exit 0 on --filter no-match, add --fail-if-no-match#393
branchseer merged 3 commits into
voidzero-dev:mainfrom
kazupon:feat/fail-if-no-match

Conversation

@kazupon
Copy link
Copy Markdown
Contributor

@kazupon kazupon commented May 20, 2026

Summary

  • Match pnpm: vp run --filter <expr> now exits 0 with a warning when the expression matches no packages, instead of failing with Task "X" not found.
  • This also covers --filter {.}^... on a leaf package: the seed matches but the traversal collapses to zero, a legitimate no-op rather than a typo.
  • Add --fail-if-no-match for callers (CI scripts) that want the previous strict behaviour. In strict mode, any unmatched --filter aborts the run, even when other filters did match.

Implementation notes

  • unmatched_selectors now tracks filters whose expanded set is empty (was: whose core selector matched nothing), so traversal collapses are reported too.
  • TaskQueryResult exposes selected_package_count and plan_query returns a PlanResult { graph, no_packages_matched } so the CLI can distinguish "no packages matched filter" (succeed) from "packages matched but task missing" (still errors as NoTasksMatched).
  • Nested vp run --filter X build inside a task script gets the same default-success treatment.

Closes #380

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Could you also add tests validating behaviors of nested vt run --filter ...?

For example, with scripts:

  • "filter-nonexistent": "vt run --filter nonexistent build"
  • "filter-nonexistent-strict": "vt run --filter nonexistent --fail-if-no-match build"

vt run filter-nonexistent should not fail while vt run filter-nonexistent-strict should.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

sorry, lately my commits.
I've just added these!

kazupon and others added 2 commits May 24, 2026 14:17
Resolve conflict in crates/vite_task_plan/src/plan.rs by adopting
main's new command_item_index/and_item_index cache-key fields and
indentation while preserving this PR's nested_plan rename and
no_packages_matched short-circuit in the Query arm.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@branchseer branchseer merged commit 884df0c into voidzero-dev:main May 24, 2026
12 checks passed
@branchseer
Copy link
Copy Markdown
Member

Thanks!

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.

--filter no-match should not fail by default; add --fail-if-no-match for strict mode

2 participants