Skip to content

[finding] pnpm --filter <pkg> test -- <pattern> runs the WHOLE suite — the positional filter is swallowed, and the shared verify lock pays for it #10166

Description

@os-zhuang

Measured while working #10138 (PR #10162). Recording it unassigned; not folded into that card.

Intending to run one new test file in packages/spec, this ran under the container's shared heavy-verify lock:

pnpm --filter @objectstack/spec test -- --maxWorkers=2 gen-sdui-manifest

pnpm forwarded the separator itself, and the package script echoed:

> vitest run -- --maxWorkers=2 gen-sdui-manifest

The positional pattern was not applied as a file filter. The run executed the entire suite — Test Files 415 passed (415), Tests 11045 passed (11045), Duration 358.28s — and the lock entry point reported held the lock 360s (6m00s).

The counter-case, same tree, same file:

pnpm exec vitest run scripts/gen-sdui-manifest-write-target.test.ts --reporter=verbose
→ Test Files 1 passed (1) · Tests 5 passed (5) · Duration 655ms

Two reasons this is worth a card rather than a shrug:

  1. It reads as a success. The green is real and larger than the one asked for, so nothing in the output says the narrowing was ignored. An agent reporting "I ran the targeted test" is telling the truth about the intent and the wrong thing about the run.
  2. The cost is charged to everyone. Six minutes of the shared os-heavy-verify lock instead of one second, in a container where parallel agents queue on it — scripts/pm/os-verify-lock.sh's own header records what long holders do to the cycle underneath them.

Also unverified and worth checking when this is picked up: whether --maxWorkers=2 survived that spelling at all, or was swallowed with the pattern. If it was, the concurrency discipline agents are told to apply is silently inert in the same breath.

Note this is not the same mechanism as #9089 / #8727 (a --filter selector matching zero packages/scripts exiting 0). Here the filter matched, the script ran, and it was the arguments that were lost — same family of "a vacuous or over-broad run reads as a pass", different cause. Whether the fix belongs in a documented spelling, a wrapper, or a lint on agent-facing instructions is a triage question, not decided here.

Generated by Claude Code

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions