Skip to content

Commit 51e6536

Browse files
claude[bot]claude
andcommitted
fix(devx): refuse a pnpm --filter that matches nothing, instead of exiting 0 (#10853)
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DdCnBGcHeufjrq7drTD3wt
1 parent 9faa9bc commit 51e6536

5 files changed

Lines changed: 1363 additions & 0 deletions

File tree

‎.github/workflows/lint.yml‎

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,37 @@ jobs:
19711971
- name: Read-side tenant chokepoint gate
19721972
run: pnpm check:tenant-chokepoint
19731973

1974+
# Every committed `pnpm --filter <name>` must name a real workspace
1975+
# package (#10853).
1976+
#
1977+
# ⛔ `pnpm --filter <name>` EXITS 0 when the filter matches nothing:
1978+
#
1979+
# $ pnpm --filter @objectstack/definitely-not-a-package test; echo $?
1980+
# No projects matched the filters in "..."
1981+
# 0
1982+
#
1983+
# So a step here, a package.json script or a `scripts/**` helper can name
1984+
# a package that does not exist and stay GREEN forever, measuring nothing
1985+
# and reporting success. `cmd > log 2>&1; ec=$?` captures the 0 perfectly;
1986+
# the log even says what happened and nothing reads it. Same family as the
1987+
# `--`-before-vitest-args trap: exit 0, nothing measured, output that reads
1988+
# like success — #4690, sitting underneath the command used to PROVE
1989+
# results.
1990+
#
1991+
# This gate reads SPELLINGS THAT ARE CHECKED IN, and that is the whole of
1992+
# its claim. It cannot see a filter an agent types at a prompt, which is
1993+
# the population that actually bit; that half is covered, only for callers
1994+
# of the shared verify lock, by `scripts/pm/os-verify-lock.sh`'s filter
1995+
# preflight. Disjoint populations, neither a substitute for the other.
1996+
#
1997+
# Reads package.json, pnpm-workspace.yaml and text under `scripts/**` and
1998+
# `.github/workflows/**`. No build, no pnpm invocation, no network,
1999+
# sub-second. The `check:` key runs the shared resolver's --self-test
2000+
# first, then the gate's, then the gate: a checker whose resolver is
2001+
# broken has no verdict worth printing.
2002+
- name: Every committed pnpm --filter names a real package
2003+
run: pnpm check:pnpm-filter-targets
2004+
19742005
# Lane 1 of 4 behind the required `TypeScript Type Check` context. The
19752006
# aggregator job at the bottom of this file explains the split, holds the
19762007
# contract, and is the thing the merge queue actually requires — read it

‎package.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@
6161
"check:pm-governed-prose": "node scripts/pm/check-governed-prose.mjs --self-test && node scripts/pm/check-governed-prose.mjs",
6262
"check:partof-closing-keyword": "node scripts/check-partof-closing-keyword.mjs --self-test",
6363
"check:single-claim-paths": "node scripts/check-single-claim-paths.mjs --self-test",
64+
"check:pnpm-filter-targets": "node scripts/pnpm-filter-targets.mjs --self-test && node scripts/check-pnpm-filter-targets.mjs --self-test && node scripts/check-pnpm-filter-targets.mjs",
6465
"check:adr-anchors": "node scripts/check-adr-anchors.mjs --self-test && node scripts/check-adr-anchors.mjs",
6566
"check:adr-links": "node scripts/check-adr-links.mjs --self-test && node scripts/check-adr-links.mjs",
6667
"check:platform-checklist": "node scripts/checklist-select.mjs --self-test && node scripts/check-platform-checklist.mjs",

0 commit comments

Comments
 (0)