Skip to content

check:type-check-debt --re-measure trusts stale dist/: phantom upward drift for ledgered packages whose deps resolve to build artifacts, unless the caller builds the closure first #8271

Description

@hotlong

Split out of #8235 (closed: its "red on main" premise measured false) per the services seat's referral (comment 5274624869 on #6015). The measurement establishing the mechanism is the services seat's stale-premise check, comment 5274598357 on #8235 — read it before re-deriving anything here.

The defect

KNOWN_UNALIASED_TEST_IMPORTS packages (e.g. @objectstack/service-analytics, listed at scripts/check-test-source-alias.mjs:279) resolve workspace deps through exportsdist/ — no vitest.config.ts, no paths in tsconfig.json.

  • In CI (lint.yml), step 31 "Build the ledgered packages' dependencies" runs immediately before step 32's re-measure, so tsc always sees a dist/ matching current source.
  • Locally, pnpm check:type-check-debt --re-measure performs no closure build. Against a dist/ predating a sibling package's change, it reports upward ledger drift that does not exist in source.

Measured consequence: #8235 was filed in good faith as a priority:p0 "main-red stanch" off exactly this — four phantom errors (TS2614/TS2339/TS7006 against pre-#8198 @objectstack/driver-sql artifacts) while main CI's step 32 was green on two consecutive runs.

Why it matters

The gate lies in the direction that manufactures false alarms: a careful reporter following the gate's own output escalates a queue-jumping p0 against a green gate. The mirror direction also holds — a stale dist/ can hide real drift locally until CI catches it, which defeats the point of running the gate before pushing.

Suggested directions (not prescriptive)

  1. Make --re-measure build the ledgered packages' dep closure first (what CI step 31 does), or
  2. Staleness detection: warn/refuse loudly when a resolved dep's dist/ is older than its src/, naming the un-built packages, or
  3. Resolve through source — heavier; that is the Type-axis remediation worklist: 51 packages resolve a workspace dep's declarations through dist, per check:type-source-resolution's landing registry #8249 worklist's axis, not this card's.

Acceptance shape

A local --re-measure against a deliberately stale dist/ must either build the closure or name the staleness — it must not report phantom ledger drift. A regression fixture can stage this deterministically (touch a src/ file in a dep of any ledgered package, skip the build, run the gate).

Related (checked for duplicates before filing)

Metadata

Metadata

Assignees

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions