Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions packages/formula/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"@objectstack/spec": "workspace:*"
},
"devDependencies": {
"@types/node": "^26.2.0",
"typescript": "^6.0.3",
"vitest": "^4.1.10"
},
Expand Down
13 changes: 1 addition & 12 deletions packages/formula/test-typecheck-debt.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"_comment": "Per-file tsc error debt of the @objectstack/formula 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/formula gen:test-typecheck-debt",
"_note": "#16297 paid down 8 of the 15 errors this ledger held, with NO test file edited: `@types/node` became a devDependency of this package and `tsconfig.test.json` gained `\"types\": [\"node\"]`, so the node typings finally reach the TEST program. `tsconfig.json` — the BUILD config — was deliberately not touched, and `packages/formula/dist` was measured byte-identical across the change. The 8 were the entire content of `src/rls-predicate.test.ts` and `src/skill-catalog-sync.test.ts`: TS2591 x6 naming `node:fs` / `node:path` / `node:url` as bare specifiers, and TS2339 x2 reading `import.meta.url`. Both files GRADUATED, so their entries are gone from `entries` and any error either of them gains is now red on arrival. WHAT THAT CARD GOT WRONG, recorded here because the number will outlive the card: it was titled \"15 of its test-typecheck ledger errors have one cause\", and measured, the cause was 8 of the 15 — exactly the set `tsconfig.test.json`'s header had named all along, before the card generalised it to the file total. The entries that remain are three unrelated classes in three other files (TS2739 in cel-to-filter, TS2345 in matches-filter-temporal-conformance, TS2352 in normalize); none of them is the node-typings cause and none was expected to move. The separating measurement is cheap and repeatable: `tsc --noEmit --pretty false -p tsconfig.test.json --types node`, run on the pre-repair tree with no package-local devDependency at all, already reported exactly these same 7.",
"entries": {
"src/cel-to-filter.test.ts": {
"TS2739: Type '…' is missing the following properties from type '…': id, organization_id, team_member_ids, department": 1
Expand All @@ -10,18 +11,6 @@
},
"src/normalize.test.ts": {
"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.": 3
},
"src/rls-predicate.test.ts": {
"TS2339: Property 'url' does not exist on type 'ImportMeta'.": 1,
"TS2591: Cannot find name 'node:fs'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.": 1,
"TS2591: Cannot find name 'node:path'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.": 1,
"TS2591: Cannot find name 'node:url'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.": 1
},
"src/skill-catalog-sync.test.ts": {
"TS2339: Property 'url' does not exist on type 'ImportMeta'.": 1,
"TS2591: Cannot find name 'node:fs'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.": 1,
"TS2591: Cannot find name 'node:path'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.": 1,
"TS2591: Cannot find name 'node:url'. Do you need to install type definitions for node? Try `npm i --save-dev @types/node` and then add 'node' to the types field in your tsconfig.": 1
}
}
}
51 changes: 46 additions & 5 deletions packages/formula/tsconfig.test.json
Original file line number Diff line number Diff line change
Expand Up @@ -73,17 +73,58 @@
// one that loses one is red until re-recorded, one that reaches zero is red
// until its entry is deleted, a signature that ARRIVES or VANISHES is red even
// at an unchanged file total, and a file NOT listed there may have no errors at
// all. 24 of the 29 files carry no entry, so any error any of them gains is red
// on arrival. This layer holds ZERO `@ts-expect-error` directives (grepped with
// a positive control — the same grep hits `packages/spec/src`), so no pin here
// was silently dead.
// all. At 6a1e38244, 24 of the 29 files carried no entry, so any error any of
// them gains is red on arrival. This layer holds ZERO `@ts-expect-error`
// directives (grepped with a positive control — the same grep hits
// `packages/spec/src`), so no pin here was silently dead.
//
// ⭐ REPAIRED (#16297) — the repair the paragraph above described as real and
// deliberately deferred. `@types/node` is now a devDependency of this package
// and this file names `"types": ["node"]`. It goes HERE and not in
// `tsconfig.json` for the reason this header opens with: that file is the BUILD
// config and stays exactly as it is. Measured, not assumed: `packages/formula/
// dist` is byte-identical across the change (6 files, sha256 per file, built
// before and after on the same tree), so nothing published moves and the test
// program alone gains the typings its two fixture-loading tests already assumed.
// Ledger effect, with NO test file edited: 15 -> 7 errors, 5 -> 3 files,
// 12 -> 4 signatures. 26 of the 29 files now carry no entry.
//
// ⚠️ A COUNT CORRECTION that repair earned in its turn. #16297 is titled
// "15 of its test-typecheck ledger errors have one cause". Measured here, the
// node-typings cause is **8 of the 15** — precisely the TS2591 x6 + TS2339 x2
// named in the paragraph above, confined to `src/rls-predicate.test.ts` and
// `src/skill-catalog-sync.test.ts`. That paragraph always said 8; the card
// generalised it to the file total. The 7 that SURVIVE are three unrelated
// classes in three OTHER files — TS2739 x1 (`src/cel-to-filter.test.ts`),
// TS2345 x3 (`src/matches-filter-temporal-conformance.test.ts`), TS2352 x3
// (`src/normalize.test.ts`) — and none of them is this cause.
//
// ⚠️ `types` REPLACES rather than merges, exactly like the `paths` note above,
// so naming `["node"]` also ENDS whatever automatic `@types/*` inclusion this
// program had. Measured before naming it: the only package in the reachable
// `node_modules/@types` is `node` itself, and the ledger reading above is the
// proof that the replacement subtracted nothing.
//
// ⚠️ OF THE TWO LINES, THIS ONE IS THE LOAD-BEARING ONE, and the pair was
// measured in both directions on a fully built closure rather than reasoned
// about. `tsc -p tsconfig.test.json --types node` with NO package-local
// devDependency at all already reports 7 — the entry alone does the whole job,
// resolving `@types/node` from the root hoist. The complementary leg is the one
// worth knowing: the devDependency WITHOUT this entry reports 15, unchanged,
// so ⛔ adding `@types/node` to `package.json` on its own would have been a
// no-op that looked like a repair. The devDependency earns its line by making
// the dependency declared instead of borrowed, and it is the pairing
// `packages/spec` (#5286), `packages/verify`, `packages/cli` and
// `packages/drivers/driver-mongodb` all use.

{
"extends": "./tsconfig.json",
"compilerOptions": {
"noEmit": true,
"module": "esnext",
"moduleResolution": "bundler",
"lib": ["ES2022"]
"lib": ["ES2022"],
"types": ["node"]
},
"include": ["src/**/*"],
"exclude": ["node_modules", "dist"]
Expand Down
3 changes: 3 additions & 0 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading