Skip to content

[finding] driver-mongodb's own typecheck is blind to its 30 test files — the only program compiling them is the TEST_DEBT ratchet, which reports a number rather than a pass #14917

Description

@os-musk

Recording + measurement only — no severity asserted, no fix chosen. Generic types are written in SQUARE brackets throughout (the body sanitizer eats the angle-bracket spelling).

Found while implementing #14428 (PR #14914), which needed a declared-return-type pin on MongoDBDriver.update(). I hit this, measured it, and moved the pin out rather than land a check that cannot fail.

The measurement

packages/drivers/driver-mongodb/tsconfig.json:

"include": ["src/**/*"],
"exclude": ["node_modules", "dist", "**\/*.test.ts"]

(the **\/ is escaped for this comment only.)

So the package's only tsc --noEmit compiles no test file at all. Measured with --listFiles, both packages, same tree, same commit:

Package tsconfig exclude Files ending .test.ts in the tsc program
driver-mongodb node_modules, dist, **\/*.test.ts 0
driver-turso node_modules, dist 43

driver-mongodb has 30 test files (25 passing + 5 opt-in skipped, per its own suite summary). None is type-checked.

Why that makes a pin a phantom rather than merely uncovered

Nothing else picks these files up:

  • vitest does not typecheck — it transpiles through oxc/esbuild, so a type error is not an error, it is erased.
  • the root tsconfig.json excludes packages entirely ("exclude": ["node_modules", "packages", "apps", "examples"]), so no repo-wide program covers them either.
  • the root typecheck script is turbo run typecheck, i.e. the per-package tsc --noEmit above.

So a type-level assertion in a driver-mongodb test file — the Equals / IsAny const idiom that #13878's packages/drivers/driver-memory/src/memory-update-declared-null.test.ts established and that sibling driver suites copy — is green forever and unable to fail. It appears in the file list, it reads as coverage in review, and it is checked by nothing. That is worse than absent coverage, because absent coverage does not claim to be there.

The concrete near-miss: #14428 called for "a per-driver pin of the same shape as driver-memory's". Copying that shape into driver-mongodb produces a file whose type half is inert. PR #14914 therefore carries the type pin only in driver-turso's twin file and states the measurement in the mongo file instead, pinning the mongo declaration through mongodb-driver.ts itself (which IS in the program — narrowing the declaration there is a real tsc error, verified by ablation).

Scope of the claim

  • ⛔ No fix chosen. Removing the exclude line would put 30 test files into the program for the first time and is very likely to surface pre-existing errors — that is a measurement nobody has taken, and the cost is unknown until someone does.
  • ⛔ No claim that any existing driver-mongodb test contains a phantom pin. The claim is about the instrument: the package cannot hold one that works.
  • ⛔ Nothing about the behavioural coverage — the 552 runtime assertions run and pass normally. Only the compile-time layer is affected.

Dedup

MCP search_issues, one targeted query → 30 results. This genre is well known and has been filed repeatedly, but no open or closed card names driver-mongodb:

The channel answered on-topic and non-empty, so the absence of a driver-mongodb card is a reading rather than a silent zero.

Related

#14428 / PR #14914 (where this was hit) · #13878 + PR #14434 (the pin idiom being copied) · #14504 (nearest prior instance, closed) · #14438 (a different driver-mongodb-adjacent published-type finding, open)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions