Skip to content

check-type-check-coverage.mjs reports green when a "type-check" script chains a tsconfig project that does not exist #4347

Description

@yinlianghui

Observation-class finding, hit while doing #4291. Unassigned, not queued — filing so it is not lost.

Fact

scripts/check-type-check-coverage.mjs decides whether a package's chained tsconfig projects are honest by asking two independent questions:

  • does the file exist? — hasTypeTestsConfig / hasTestConfig, from a readFileSync in collect()
  • does type-check run it? — chainsTypeTestsConfig / chainsTestConfig, a regex over the script string

Section 5½ opens with if (!pkg.hasTypeTestsConfig) continue;, so the combination chained but missing is never examined. A package whose type-check reads

tsc --noEmit && tsc -p tsconfig.typetests.json && tsc -p tsconfig.test.json

with no tsconfig.typetests.json on disk passes this gate at exit 0.

How it was observed

During #4291, a git checkout -- packages/auth/package.json restored the original script while the narrow project stayed deleted. node scripts/check-type-check-coverage.mjs printed both green lines, including 4 with a narrow type-assertion project — the dangling chain entry is invisible to it. pnpm --filter @object-ui/auth type-check fails immediately with TS5058 (The specified path does not exist).

Why it is observation-class, not a defect anyone hits today

The failure is loud, not silent: the chained tsc exits non-zero, so CI's Type Check job goes red on the very next run. Nothing can ship in this state. The gap is that the coverage gate — whose whole purpose is catching mismatches between what is declared and what CI actually runs — is the one check that cannot see this particular mismatch, so its green line reads as a broader assurance than it is.

The direction that IS silent is the mirror image, and is already covered: a project that exists but is never chained (#3009 / #3181, reported by the same section).

The fix, if it is ever worth doing

In collect(), keep the two facts separate (they already are), then in section 5½ and section 5b report chains* && !has* before the early continue:

@object-ui/x (packages/x): "type-check" chains tsconfig.typetests.json, which does not exist.
Delete the chain entry, or restore the project.

Cheap, and it closes the last "declared vs actually runs" combination the gate does not ask about.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions