Skip to content

Commit 3446811

Browse files
committed
wip: onboard objectql test layer to check-test-typecheck
1 parent 2a18117 commit 3446811

5 files changed

Lines changed: 273 additions & 56 deletions

File tree

‎packages/objectql/package.json‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,9 @@
2020
"scripts": {
2121
"build": "tsup && node ../../scripts/check-dts-emitted.mjs",
2222
"test": "vitest run",
23-
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.scripts.json"
23+
"typecheck": "tsc --noEmit && tsc --noEmit -p tsconfig.scripts.json && pnpm check:test-typecheck",
24+
"check:test-typecheck": "tsx ../../scripts/check-test-typecheck.mts --self-test && tsx ../../scripts/check-test-typecheck.mts --package packages/objectql --project tsconfig.test.json",
25+
"gen:test-typecheck-debt": "tsx ../../scripts/check-test-typecheck.mts --update --package packages/objectql --project tsconfig.test.json"
2426
},
2527
"dependencies": {
2628
"@objectstack/core": "workspace:*",
@@ -35,6 +37,7 @@
3537
"zod": "^4.4.3"
3638
},
3739
"devDependencies": {
40+
"tsx": "^4.23.12",
3841
"typescript": "^6.0.3",
3942
"vitest": "^4.1.10"
4043
},
Lines changed: 163 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,163 @@
1+
{
2+
"_comment": "Per-file tsc error debt of the @objectstack/objectql TEST layer (#5286). `tsconfig.test.json` compiles `src/**/*.test.ts` — which `tsconfig.json` excludes and therefore no gate ever read — and every file below still carries errors from before that gate existed. THIS FIELD IS GENERATED: every regeneration rewrites it from scripts/check-test-typecheck.mts, and the EXACT ratchet below requires a regeneration on every repair — so an edit made here is gone by the next one. Anything true of THIS package goes in the sibling `_note` field, which is authored, is preserved verbatim, and is never written by the generator (#12624). This comment states NO cause for the errors, deliberately: the classes differ per package and per file, they move as the debt is paid down, and a cause written here is rewritten verbatim into every ledger by every regeneration — so it outlives its own repair and cannot be corrected in the file where it is read. Measure instead, before repairing anything: `tsc --noEmit --pretty false -p tsconfig.test.json` in the package prints the real classes with their TS codes. Each entry maps a file to its per-SIGNATURE error counts, never to a bare total (#13470): a signature is the TS code plus the diagnostic message with structural type blobs collapsed, and it carries NO line or column — so the pin survives edits that move code around, and only stops matching when the error itself becomes a different error. EXACT ratchet, judged by re-running tsc: a file that gains errors is red, a file that loses them is red until its number is re-recorded, a file that reaches zero is red until its entry is deleted, a signature that ARRIVES or VANISHES is red even when the file total is unchanged, and a file NOT listed here may have no errors at all. Regenerate with: pnpm --filter @objectstack/objectql gen:test-typecheck-debt",
3+
"_note": "SEEDED at 2a181174a6 by the PR that first put this layer in front of tsc (#13676), workspace closure built first. All 242 errors across 44 files are PRE-EXISTING: that PR edits no test file, and every one of these would have been reported on origin/main had this program ever existed. ⛔ Not one `any` and not one `@ts-expect-error` was added anywhere to open the gate — bulk-suppressing this residue is the exact shape the card was filed to prevent, and it would turn a real gate into a phantom one. The residue is NOT annotation debt to sweep: 14 of the 17 in src/datasource-mapping.test.ts and the bulk of the TS2345 population are one story — a driver double that does not satisfy IDataDriver — and src/engine.test.ts alone carries 102 of the 242, so read the classes before touching anything (`tsc --noEmit --pretty false -p tsconfig.test.json`). ⚠️ src/engine-filter-array-lowering.test.ts is DELIBERATELY ABSENT and must stay absent: it is the #13357 point-3 negative pin proving a refused filter shape cannot reach the reference matcher, it reports zero errors, and an unledgered file is red on its first error. ⚠️ But its zero is a weak guarantee today and must not be read as 'that pin is type-checked': the file holds `const driver: any` and `interface SeenRead { ast: any }` at the very seam the proof reads, so a drifted IDataDriver signature would not redden it. Repairing that is tracked separately and is not a licence to loosen tsconfig.test.json.",
4+
"entries": {
5+
"src/build-probes.test.ts": {
6+
"TS2493: Tuple type '…' of length '0' has no element at index '1'.": 1
7+
},
8+
"src/datasource-mapping.test.ts": {
9+
"TS2345: Argument of type '…' is not assignable to parameter of type 'IDataDriver'.": 14,
10+
"TS6133: 'obj' is declared but its value is never read.": 3
11+
},
12+
"src/engine-audit-anchor-write.test.ts": {
13+
"TS2532: Object is possibly 'undefined'.": 1
14+
},
15+
"src/engine-autonumber-default-format.test.ts": {
16+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 3
17+
},
18+
"src/engine-autonumber-defer.test.ts": {
19+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 4
20+
},
21+
"src/engine-autonumber-resync.test.ts": {
22+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 1
23+
},
24+
"src/engine-autonumber-seed-outage.test.ts": {
25+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 1
26+
},
27+
"src/engine-autonumber-seed-scan.test.ts": {
28+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 5
29+
},
30+
"src/engine-autonumber-seed-suffix.test.ts": {
31+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 1
32+
},
33+
"src/engine-cascade-delete.test.ts": {
34+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 1
35+
},
36+
"src/engine-data-events.test.ts": {
37+
"TS6133: 'warn' is declared but its value is never read.": 1
38+
},
39+
"src/engine-delete-prior-read-scope.test.ts": {
40+
"TS2749: 'ObjectSchema' refers to a value, but is being used as a type here. Did you mean 'typeof ObjectSchema'?": 3,
41+
"TS6196: 'ObjectSchema' is declared but never used.": 1
42+
},
43+
"src/engine-lifecycle-datasource.test.ts": {
44+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 1
45+
},
46+
"src/engine-update-prior-read-scope.test.ts": {
47+
"TS2345: Argument of type 'unknown' is not assignable to parameter of type '…'.": 1
48+
},
49+
"src/engine.test.ts": {
50+
"TS2339: Property 'getObject' does not exist on type 'typeof SchemaRegistry'.": 75,
51+
"TS2339: Property 'registerKind' does not exist on type 'typeof SchemaRegistry'.": 1,
52+
"TS2339: Property 'registerObject' does not exist on type 'typeof SchemaRegistry'.": 3,
53+
"TS2353: Object literal may only specify known properties, and 'filter' does not exist in type '…'.": 1,
54+
"TS7006: Parameter 'name' implicitly has an 'any' type.": 22
55+
},
56+
"src/function-registry-effect.test.ts": {
57+
"TS2352: Conversion of type '…' to type '…' may be a mistake because neither type sufficiently overlaps with the other. If this was intentional, convert the expression to 'unknown' first.": 1
58+
},
59+
"src/hook-binder.test.ts": {
60+
"TS2339: Property 'then' does not exist on type '…'.": 1,
61+
"TS7006: Parameter 'e' implicitly has an 'any' type.": 1
62+
},
63+
"src/hook-condition-bulk-previous.test.ts": {
64+
"TS2339: Property 'then' does not exist on type '…'.": 3,
65+
"TS7006: Parameter 'e' implicitly has an 'any' type.": 3
66+
},
67+
"src/hook-condition-fail-loud.test.ts": {
68+
"TS2339: Property 'catch' does not exist on type '…'.": 2,
69+
"TS2339: Property 'then' does not exist on type '…'.": 5,
70+
"TS7006: Parameter 'e' implicitly has an 'any' type.": 5
71+
},
72+
"src/hook-condition-merged-record.test.ts": {
73+
"TS2322: Type '…' is not assignable to type '…'.": 1,
74+
"TS2339: Property 'then' does not exist on type '…'.": 1,
75+
"TS7006: Parameter 'e' implicitly has an 'any' type.": 1
76+
},
77+
"src/hook-condition-previous-scope.test.ts": {
78+
"TS2322: Type '…' is not assignable to type '…'.": 1,
79+
"TS2339: Property 'then' does not exist on type '…'.": 1,
80+
"TS6133: 'reads' is declared but its value is never read.": 1,
81+
"TS7006: Parameter 'e' implicitly has an 'any' type.": 1
82+
},
83+
"src/in-memory-aggregation.test.ts": {
84+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 3
85+
},
86+
"src/layered-overlay-integration.test.ts": {
87+
"TS2322: Type '…' is not assignable to type 'SysMetadataEngine'.": 1,
88+
"TS2353: Object literal may only specify known properties, and 'org' does not exist in type 'InMemoryRepositoryOptions'.": 1
89+
},
90+
"src/metadata-service-roundtrip-conformance.test.ts": {
91+
"TS2322: Type 'WritableFixtureLoader' is not assignable to type 'MetadataLoader'.": 1,
92+
"TS2416: Property 'save' in type 'WritableFixtureLoader' is not assignable to the same property in base type 'MetadataLoader'.": 1
93+
},
94+
"src/plugin-authored-hooks.test.ts": {
95+
"TS6133: 'obj' is declared but its value is never read.": 1
96+
},
97+
"src/plugin.integration.test.ts": {
98+
"TS2749: 'ObjectSchema' refers to a value, but is being used as a type here. Did you mean 'typeof ObjectSchema'?": 11,
99+
"TS6133: 'ObjectSchema' is declared but its value is never read.": 1
100+
},
101+
"src/protocol-boot-hydration-scoped.test.ts": {
102+
"TS2322: Type '…' is not assignable to type 'string'.": 3
103+
},
104+
"src/protocol-boot-object-package-binding.test.ts": {
105+
"TS2345: Argument of type 'Row' is not assignable to parameter of type '…'.": 3
106+
},
107+
"src/protocol-discovery.test.ts": {
108+
"TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ data: string; metadata: string; discovery?: string | undefined; ui?: string | undefined; auth?: string | undefined; automation?: string | undefined; storage?: string | undefined; analytics?: string | undefined; ... 8 more ...; mcp?: string | undefined; }'.": 1
109+
},
110+
"src/protocol-lock-enforcement.test.ts": {
111+
"TS6133: 'beforeEach' is declared but its value is never read.": 1
112+
},
113+
"src/protocol-package-lifecycle.test.ts": {
114+
"TS2339: Property 'mock' does not exist on type 'never'.": 3,
115+
"TS2339: Property 'mockResolvedValue' does not exist on type 'never'.": 2,
116+
"TS7006: Parameter 'c' implicitly has an 'any' type.": 3
117+
},
118+
"src/protocol-publish-rollback.test.ts": {
119+
"TS6133: 'rows' is declared but its value is never read.": 1
120+
},
121+
"src/protocol-recorded-by-null.test.ts": {
122+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 2
123+
},
124+
"src/protocol-registry-shadow.test.ts": {
125+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 2
126+
},
127+
"src/protocol-save-meta-repo-path-real-engine.test.ts": {
128+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 3
129+
},
130+
"src/protocol-save-meta-repo-path.test.ts": {
131+
"TS18048: 'row.checksum' is possibly 'undefined'.": 1
132+
},
133+
"src/protocol-writepath-object-ownership.test.ts": {
134+
"TS2345: Argument of type 'Row' is not assignable to parameter of type '…'.": 2
135+
},
136+
"src/query-expression-conformance.test.ts": {
137+
"TS2322: Type '…' is not assignable to type 'QueryInput'.": 2
138+
},
139+
"src/registry-invalidate.test.ts": {
140+
"TS2459: Module '\"@objectstack/spec\"' declares 'ServiceObject' locally, but it is not exported.": 1
141+
},
142+
"src/registry.test.ts": {
143+
"TS18048: 'out.enable' is possibly 'undefined'.": 7,
144+
"TS2339: Property 'indexed' does not exist on type '…'.": 3
145+
},
146+
"src/sys-metadata-repository-list-drafts.test.ts": {
147+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 1
148+
},
149+
"src/sys-metadata-repository.test.ts": {
150+
"TS2322: Type '\"theme\"' is not assignable to type '…'.": 2,
151+
"TS2322: Type '\"trigger\"' is not assignable to type '…'.": 1,
152+
"TS2322: Type '\"webhook\"' is not assignable to type '…'.": 1,
153+
"TS2322: Type '…' is not assignable to type 'SysMetadataEngine'.": 1
154+
},
155+
"src/validation/record-validator.test.ts": {
156+
"TS2367: This comparison appears to be unintentional because the types 'number' and 'boolean' have no overlap.": 1
157+
},
158+
"src/validation/rule-fail-closed.test.ts": {
159+
"TS2345: Argument of type '…' is not assignable to parameter of type '…'.": 1,
160+
"TS2353: Object literal may only specify known properties, and 'name' does not exist in type 'ConditionalFieldDef'.": 2
161+
}
162+
}
163+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// The TEST-layer type-check program (#13676), adopting the mechanism #5286 set
2+
// for `packages/spec` and #5449 generalised. `tsconfig.json` above stays as it
3+
// is: it is the BUILD config, and its `**/*.test.ts` exclusion has a reason —
4+
// ci.yml gates that no test file reaches the published artifact. This sibling
5+
// puts the excluded layer back in front of tsc, and `package.json`'s
6+
// `typecheck` script NAMES it (via `check:test-typecheck --project`), because a
7+
// config no script invokes is exactly the phantom this whole change is about.
8+
//
9+
// BEFORE THIS FILE, NO tsc PROGRAM COMPILED A SINGLE TEST FILE HERE. Measured
10+
// at 2a181174a6 with the workspace closure built first: `tsc --listFiles`
11+
// against the build config puts 536 files in the program and **0** of the
12+
// package's 251 `*.test.ts` files among them, while 50 `src/**` non-test files
13+
// ARE there — so the zero is the `exclude` line, not a probe that sees nothing.
14+
// The directional control is `packages/drivers/driver-memory`, whose tsconfig
15+
// carries no test exclusion: the same probe puts **38 of its 38** test files in
16+
// the program. `pnpm --filter @objectstack/objectql typecheck` exiting 0 was a
17+
// true sentence carrying no information about any test file in this package.
18+
//
19+
// ⭐ WHY THIS PACKAGE, AND WHY NOW. `src/engine-filter-array-lowering.test.ts`
20+
// is the negative pin required by maintainer ruling #13357 execution point 3
21+
// (landed in #13673): it proves a refused filter shape CANNOT REACH the
22+
// reference matcher. A pin whose whole job is a security-relevant
23+
// unreachability guarantee was type-checked by nothing at all.
24+
//
25+
// What differs from the build config, and what deliberately does NOT:
26+
// - module semantics ONLY, plus `lib`. The tests are written and executed as
27+
// ESM by vitest (esbuild/vite), while `objectql` has no `"type": "module"`,
28+
// so the build config's NodeNext compiles them as CJS. Measured cost of
29+
// that mismatch here: 9 of 251 raw diagnostics — TS2550 x8 (all eight the
30+
// same `Array.prototype.at` message, against a `lib` older than es2022) and
31+
// TS1470 x1 (`import.meta` in a CJS program). Those 9 are about the CHECK,
32+
// never about the code. Notably SMALL next to the sibling packages
33+
// (`rest` paid 137, `spec` 108): this layer's relative imports already
34+
// carry their `.js` extensions, so there is no TS2835 pile here and hence
35+
// none of the TS7006 cascade an unresolved import drags behind it.
36+
// Matching vitest is fidelity, not laxity. No `DOM` in `lib`, unlike
37+
// `packages/client`: nothing in this layer touches a browser global.
38+
// - `rootDir` widens to the PACKAGE, from the build config's `src`. Under
39+
// `noEmit` that setting carries no output meaning; all it does is constrain
40+
// which files may enter the program. Measured: inherited as `src` it
41+
// reports a TS6059 for `src/dry-run-hash-compat.test.ts` importing
42+
// `scripts/dry-run-hash-compat.ts` — the SAME diagnostic #10779 retired
43+
// from the TEST_DEBT ledger as "measuring the tape measure", i.e. the
44+
// generated re-measure project billing this package for its own `rootDir`.
45+
// Re-introducing it here would re-import a defect this repo already fixed.
46+
// - ⛔ STRICTNESS IS UNTOUCHED. `strict`, `noUnusedLocals`,
47+
// `noUnusedParameters`, `noImplicitReturns`, `noFallthroughCasesInSwitch`
48+
// are inherited from the root config, and `types: ["node"]` restates
49+
// `tsconfig.json`'s. Nothing here may loosen a type rule; if a test does
50+
// not compile, that is the finding. ⛔ Not one `any` and not one
51+
// `@ts-expect-error` was added to any test file to open this gate — that
52+
// shape is what turns a real gate into a phantom one.
53+
//
54+
// `include` deliberately stops at `src`, matching the build config's root and
55+
// covering all 251 test files (239 in `src`, plus `src/integrity`,
56+
// `src/lifecycle`, `src/validation`). `scripts/` is the sibling
57+
// `tsconfig.scripts.json` (#10756) and stays a separate program: it carries no
58+
// ledger entries at all, so plain `tsc` is a stricter gate for it than this
59+
// file's shrink-only debt list.
60+
//
61+
// MEASURED at 2a181174a6, workspace closure built first (an error count taken
62+
// against an unbuilt closure is not a reading — unresolved-import cascades
63+
// inflate it): this program reports **242 errors across 44 files**, from a raw
64+
// 251 under the inherited NodeNext semantics. By code: TS2339 x115,
65+
// TS7006 x36, TS2345 x34, TS2749 x14, TS2322 x14, TS6133 x9, TS18048 x8,
66+
// TS2353 x4, plus 8 singletons (TS7053, TS6196, TS2532, TS2493, TS2459,
67+
// TS2416, TS2367, TS2352). `src/engine.test.ts` alone carries 102 of the 242;
68+
// the next five are `datasource-mapping` x17, `plugin.integration` x12,
69+
// `hook-condition-fail-loud` x12, `registry` x10, `protocol-package-lifecycle`
70+
// x8. Every one of the 242 is PRE-EXISTING: this change edits no test file, and
71+
// each would have been reported on `origin/main` had this program always
72+
// existed. They are ledgered per file in `test-typecheck-debt.json` beside this
73+
// config, EXACT and shrink-only — a file that gains an error is red, one that
74+
// loses one is red until re-recorded, one that reaches zero is red until its
75+
// entry is deleted, and a file NOT listed there may have no errors at all.
76+
//
77+
// ⚠️ THE NEGATIVE PIN CARRIES NO LEDGER ENTRY, and that is load-bearing:
78+
// `src/engine-filter-array-lowering.test.ts` reports ZERO errors under this
79+
// program, so any error it ever gains is red on arrival. ⚠️ Read that zero
80+
// correctly — it is NOT evidence the pin is well typed. The file holds 20 `:
81+
// any` annotations, and the two that matter are at its witness seam: the
82+
// recording driver is `const driver: any` and the recorded AST is `interface
83+
// SeenRead { ast: any }`, so `lastWhere()` — the expression the whole
84+
// unreachability proof reads — is typed by nothing, and a drifted
85+
// `IDataDriver` signature would not redden this file. Its own header rejects
86+
// "a bare `as any`" in favour of `as unknown as EngineQueryOptions`
87+
// (`asFilterArrayQuery`, used 14 times), yet 31 call sites use the bare form
88+
// anyway. Putting the file in a program is the precondition for fixing that,
89+
// not the fix; the repair is tracked separately (see the PR that added this
90+
// file) and ⛔ must not be smuggled in by loosening anything here.
91+
{
92+
"extends": "./tsconfig.json",
93+
"compilerOptions": {
94+
"noEmit": true,
95+
"rootDir": ".",
96+
"module": "esnext",
97+
"moduleResolution": "bundler",
98+
"lib": ["ES2022"],
99+
"types": ["node"]
100+
},
101+
"include": ["src/**/*"],
102+
"exclude": ["node_modules", "dist"]
103+
}

‎pnpm-lock.yaml‎

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)