Found while implementing #10969 (adding packages/client-react/packages/client as a second
resolution surface for check:skill-examples). Filing rather than fixing inline — see below.
The bug
packages/spec/scripts/lib/dist-freshness.ts's inspectDistFreshness(pkgDir, mode, rerun)
already takes an arbitrary pkgDir and is designed to be reusable (its own docblock: "the
caller names ITSELF" for the rerun command). But the refusal message's cause strings are
hardcoded literals, not derived from pkgDir:
constcause=state==='missing'
? `packages/spec/dist holds no .d.ts declarations — the package is not built …`
: `packages/spec/dist/**/*.d.ts is OLDER than packages/spec/src — the declarations …`;
Same shape in inspectBundleFreshness(). Until #10969, every real caller (check:api-surface,
check:exported-any, check:dual-source-exports, check:skill-examples) only ever passed
SPEC_DIR, so the hardcoded text happened to always be correct. #10969 is the first caller to
pass a differentpkgDir (packages/client-react, packages/client) — on a stale-dist
refusal for that surface, the printed message would say "packages/spec/dist … OLDER than
packages/spec/src", misnaming the actually-stale package. The refusal itself (exit 1, correct
verdict) is unaffected; only the diagnostic text is wrong.
Why filed instead of fixed in the same PR
dist-freshness.test.ts pins the exact hardcoded strings (.toContain('OLDER than packages/spec/src'), .toContain('no .d.ts declarations')) against a throwaway sandbox dir
that is NOT shaped like packages/spec — the test's own design assumes the wording is a fixed
literal, not derived from pkgDir. A correct fix has to also update those pinned assertions
(and ideally add a case with a non-spec-shaped pkgDir to prove the label is genuinely
dynamic), which is a second verification surface beyond #10969's own diff — outside the
"mechanical, no new verification surface" bar for a same-PR fix.
Suggested direction
Derive a packages/<name> display label from pkgDir (e.g. find the packages path segment
and take the next one, falling back to the raw path if the shape doesn't match) and interpolate
it into both cause strings in inspectDistFreshness and inspectBundleFreshness. Update
dist-freshness.test.ts's pinned assertions to match, and add a case that passes a
non-spec-shaped sandbox to prove the label is dynamic rather than coincidentally correct.
Refs: #10969, #7181, #7122 (which landed this primitive).
Found while implementing #10969 (adding
packages/client-react/packages/clientas a secondresolution surface for
check:skill-examples). Filing rather than fixing inline — see below.The bug
packages/spec/scripts/lib/dist-freshness.ts'sinspectDistFreshness(pkgDir, mode, rerun)already takes an arbitrary
pkgDirand is designed to be reusable (its own docblock: "thecaller names ITSELF" for the
reruncommand). But the refusal message'scausestrings arehardcoded literals, not derived from
pkgDir:Same shape in
inspectBundleFreshness(). Until #10969, every real caller (check:api-surface,check:exported-any,check:dual-source-exports,check:skill-examples) only ever passedSPEC_DIR, so the hardcoded text happened to always be correct. #10969 is the first caller topass a different
pkgDir(packages/client-react,packages/client) — on a stale-distrefusal for that surface, the printed message would say "packages/spec/dist … OLDER than
packages/spec/src", misnaming the actually-stale package. The refusal itself (exit 1, correct
verdict) is unaffected; only the diagnostic text is wrong.
Why filed instead of fixed in the same PR
dist-freshness.test.tspins the exact hardcoded strings (.toContain('OLDER than packages/spec/src'),.toContain('no .d.ts declarations')) against a throwawaysandboxdirthat is NOT shaped like
packages/spec— the test's own design assumes the wording is a fixedliteral, not derived from
pkgDir. A correct fix has to also update those pinned assertions(and ideally add a case with a non-spec-shaped
pkgDirto prove the label is genuinelydynamic), which is a second verification surface beyond #10969's own diff — outside the
"mechanical, no new verification surface" bar for a same-PR fix.
Suggested direction
Derive a
packages/<name>display label frompkgDir(e.g. find thepackagespath segmentand take the next one, falling back to the raw path if the shape doesn't match) and interpolate
it into both cause strings in
inspectDistFreshnessandinspectBundleFreshness. Updatedist-freshness.test.ts's pinned assertions to match, and add a case that passes anon-spec-shaped sandbox to prove the label is dynamic rather than coincidentally correct.
Refs: #10969, #7181, #7122 (which landed this primitive).