Skip to content

Commit ccc28ff

Browse files
committed
ci(typecheck): the ratchet judges the test layer too — 27 "covered" packages were hiding their tests (#4311)
#4324 counted a package covered the moment it declared a `typecheck` script. But `tsc --noEmit` reads the package's own tsconfig.json, and 27 of the 48 packages that gate waved through `exclude` `**/*.test.ts` from exactly that file — so COVERED and REAL both passed while nothing read the test layer, which is the source #4311 is actually about. Measured by lifting each exclusion and re-running the package's own config: 568 test files, 1451 errors, behind a green check. `spec` alone hid 902 across 272 files; `plugin-approvals` hid 467, more than driver-sql's 241, with a clean src. What changed: 1. New TESTS_COVERED invariant + TEST_DEBT ledger in scripts/check-type-check-coverage.mjs. A package that excludes its own tests must carry a measured entry; RECONCILED runs both ways, so dropping the exclusion without deleting the entry fails, and so does the reverse. Test files are counted under the tsconfig's `include` roots — `exclude` only subtracts from what `include` selected, and several packages keep a sibling `test/` tree that `include` never mentions. Six new self-test cases (18 total). The summary line now prints both layers: reporting only the src figure is how 48/77 read as green over 568 unchecked files. 2. Nine packages that were already clean with tests included had the exclusion deleted outright: sdui-parser, plugin-audit, plugin-email, plugin-hono-server, plugin-pinyin-search, plugin-reports, trigger-api, trigger-schedule, connector-slack. 3. 44 relative imports repaired to carry the `.js` extension NodeNext requires. This was filed as config-tier noise and is not: an unresolved import degrades every symbol it names to `any`, and the callbacks over those symbols then report TS7006 "implicitly any". The 44 fixes closed 110 errors across eight packages — and exposed 12 real defects in service-settings (manifest action handlers called without `namespace`/`actionId`) that the broken imports had been masking. Its ledger entry said "no code-tier finding"; it was wrong in both directions, and now says so. 4. Nine packages graduate out of DEBT (types, create-objectstack, service-cache, service-i18n, service-job, service-messaging, service-queue, service-realtime, plugin-approvals). Three tsconfig repairs: `types:["node"]` for types (107 errors, one line), `exclude: src/templates` for create-objectstack (scaffolding copied verbatim by tsup, whose imports resolve in the generated project, not this one), `lib: ES2021` for plugin-approvals (String.replaceAll). plugin-approvals graduates on src only and carries a TEST_DEBT entry — its 13 test files are still excluded. Coverage: 48/77 -> 57/77 src-covered; DEBT 29 -> 20 entries (679 raw errors); TEST_DEBT 21 entries (652 files, 2243 raw errors) newly visible. No non-test source file changes. Verified: self-test 18/18, coverage gate, `turbo run typecheck` 119/119, `pnpm test` 132/132, eslint, check:published-files. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_011m13wbaZziPveBdtQthrXd
1 parent b07d829 commit ccc28ff

52 files changed

Lines changed: 316 additions & 106 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
---
3+
4+
ci(dx): the type-check coverage ratchet now judges the test layer too (#4311). #4324 counted a package covered the moment it declared a `typecheck` script — but 27 of the 48 it waved through `exclude` `**/*.test.ts` from the very `tsconfig.json` that `tsc --noEmit` reads, hiding 568 test files and 1451 errors behind a green check (`@objectstack/spec` alone: 272 files, 902 errors). A new `TESTS_COVERED` invariant fails any package that excludes its own tests without a measured `TEST_DEBT` entry, and the gate now prints both layers so the src figure can never again stand in for the whole. Nine packages that were already clean with tests included had the exclusion dropped outright; nine more graduate out of DEBT after repairing 44 NodeNext imports missing their `.js` extension — a repair that closed 110 errors (most of the "noise" tier was one unresolved import degrading symbols to `any`) and exposed 12 real defects in `service-settings` that those broken imports had been masking. Dev scripts, tests and CI only; releases nothing.

AGENTS.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,19 @@ workspace package declares a `typecheck` script or carries a measured DEBT/EXEMP
2929
in `scripts/check-type-check-coverage.mjs`. New packages must arrive covered; a package
3030
that graduates deletes its ledger entry in the same PR.
3131

32+
**Do not `exclude` `*.test.ts` / `*.spec.ts` from a package's `tsconfig.json`.** `tsc
33+
--noEmit` reads that config, so an exclusion there hides the tests from the check the
34+
`typecheck` script advertises — a green gate over source nothing read, which is the
35+
#4311 defect itself. The ratchet's `TESTS_COVERED` invariant fails on any new exclusion;
36+
the packages that already had one carry a measured `TEST_DEBT` entry and graduate by
37+
dropping the exclusion.
38+
39+
One trap worth knowing before you read any of these counts: under `moduleResolution:
40+
NodeNext` a relative import missing its `.js` extension does not resolve, every symbol it
41+
names becomes `any`, and the callbacks over those symbols then report TS7006 "implicitly
42+
any". A pile of TS7006 is usually one broken import upstream, not a package that needs
43+
type annotations — fix the extension first and re-measure.
44+
3245
### Running the dev server
3346

3447
| Scenario | Command | Notes |

packages/connectors/connector-slack/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"types": ["node"]
77
},
88
"include": ["src/**/*"],
9-
"exclude": ["dist", "node_modules", "**/*.test.ts"]
9+
"exclude": ["dist", "node_modules"]
1010
}

packages/create-objectstack/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
},
88
"scripts": {
99
"build": "tsup",
10+
"typecheck": "tsc --noEmit",
1011
"dev": "tsup --watch",
1112
"test": "vitest run"
1213
},

packages/create-objectstack/tsconfig.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,8 @@
1919
},
2020
"include": [
2121
"src"
22+
],
23+
"exclude": [
24+
"src/templates"
2225
]
2326
}

packages/plugins/plugin-approvals/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
},
1515
"scripts": {
1616
"build": "tsup --config ../../../tsup.config.ts",
17+
"typecheck": "tsc --noEmit",
1718
"test": "vitest run --passWithNoTests"
1819
},
1920
"dependencies": {

packages/plugins/plugin-approvals/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33
"compilerOptions": {
44
"outDir": "./dist",
55
"rootDir": "./src",
6-
"types": ["node"]
6+
"types": ["node"],
7+
"lib": ["ES2021"]
78
},
89
"include": ["src/**/*"],
910
"exclude": ["dist", "node_modules", "**/*.test.ts"]

packages/plugins/plugin-audit/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
],
1313
"exclude": [
1414
"dist",
15-
"node_modules",
16-
"**/*.test.ts"
15+
"node_modules"
1716
]
1817
}

packages/plugins/plugin-email/tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@
66
"types": ["node"]
77
},
88
"include": ["src/**/*"],
9-
"exclude": ["dist", "node_modules", "**/*.test.ts"]
9+
"exclude": ["dist", "node_modules"]
1010
}

packages/plugins/plugin-hono-server/tsconfig.json

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@
1818
],
1919
"exclude": [
2020
"node_modules",
21-
"dist",
22-
"**/*.test.ts"
21+
"dist"
2322
]
2423
}

0 commit comments

Comments
 (0)