Repository navigation
Description
Found while adding compile-time assertions for #1344, where the natural place to put one — a test file — turned out to be checked by nothing.
What is typechecked today
| Scope | Covered by | Notes |
|---|---|---|
packages/core/src/** incl. 266 test files |
CI: tsc --noEmit -p packages/core/tsconfig.json |
The only config that typechecks tests |
packages/k8s-client |
CI: tsc --noEmit -p packages/k8s-client/tsconfig.build.json |
|
lexicons/*/src/** |
scripts/check-lexicons.ts builds each lexicon's tsconfig.build.json |
Runs in CI via the check job |
What is not
Lexicon test files. Every lexicon's tsconfig.build.json carries exclude: ["**/*.test.ts", …], and the root config excludes them too. npx tsc -p lexicons/forgejo/tsconfig.build.json --listFiles | grep -c '\.test\.ts' → 0.
That is the gap that motivated this issue. A compile-time assertion written in a lexicon test — the obvious home for one — is never evaluated. In #1344 I had to move the ChantConfig augmentation proofs into compiled source (NonNullable<ChantConfig["forgejo"]> in src/config.ts) so that check-lexicons' per-lexicon build would catch a regression. That works, but it is a workaround for the test file not being checked, and the next person will reach for the test file first.
packages/core typechecks its tests, so the asymmetry is between core and the lexicons rather than a repo-wide policy.
Lexicon examples. lexicons/*/examples/** is in no typechecked project. Running the root config surfaces 56 errors across 8 lexicons, all of them in examples/ and none in src/:
lexicons/aws/ 48
lexicons/k8s/ 26 (counts include multi-line context)
lexicons/gitlab/ 6
lexicons/temporal/ 3
lexicons/helm/ 2
lexicons/docker/ 2
lexicons/fountain/ 1
lexicons/fly/ 1
Mostly TS2339 (31), TS2322 (24), TS2345 (21) — the shapes you would expect from examples written against an older generated surface, e.g.:
lexicons/aws/examples/lambda-dynamodb/src/main.ts(6,3):
error TS2322: Type 'SubIntrinsic' is not assignable to type 'string'.
lexicons/aws/examples/fargate-alb/src/outputs.ts(4,42):
error TS2339: Property 'DNSName' does not exist on type 'Declarable'.
Tier 1's "Every shipped example builds" check does catch a broken example — but it discovers and serializes, which is a runtime path. An example can serialize correctly while its TypeScript is wrong about the types it is using, and these 56 are exactly that population. The examples are also documentation: they are what an author copies.
Why it matters beyond tidiness
The whole of #1340 was about closing gaps between what the contract claims and what is checked. Two of the resulting guards are type-level (#1344's augmentation proofs, the schema/interface agreement assertions in k8s and temporal), and their enforcement currently depends on a per-lexicon build config that excludes exactly the file kind where such assertions normally live.
Options
- Typecheck lexicon tests. Drop
**/*.test.tsfrom each lexicon'stsconfig.build.jsonexclude, or add a separatetsconfig.test.jsonper lexicon thatcheck-lexiconsalso runs. Cheapest fix for the motivating gap; says nothing about examples. - Fix the 56 example errors, then gate the root config. Highest coverage — one
tsc -p tsconfig.jsonin CI covers packages, lexicon source, lexicon tests and examples. Largest up-front cost, and some errors may reflect examples that are genuinely out of date rather than mistyped. - Gate the root config with
lexicons/*/examplesexcluded, and file the example errors separately. Gets tests and everything else under a single check now; leaves the examples where they are, but visibly rather than silently.
I lean toward 3 then 2: it closes the motivating gap immediately, makes the exclusion explicit rather than incidental, and turns the example backlog into its own tracked piece of work instead of a permanent blind spot.
Activity
lex00 commentedon Aug 3, 2026
Measured before building, and the scope is roughly ten times what I estimated when filing this. Correcting the numbers.
I counted only
examples/originally. Running a config that also covers lexicon tests and scripts, undermoduleResolution: bundler(which is how vitest and tsx actually resolve, unlike the root config'snode):packages/**(src and tests)lexicons/*/srcnon-testcheck-lexiconsbuilds eachtsconfig.build.jsonlexicons/*/srctestslexicons/*/scriptslexicons/*/examplesandexamples/So none of the three options as I wrote them is a config flip. Option 1 ("drop
**/*.test.tsfrom the excludes") lands 405 error lines; option 3 ("gate the root config with examples excluded") still lands 412.A check that cannot pass is a check nobody runs, so I have built the ratchet instead — the same shape as
KNOWN_FAILURESincheck-lexicons.ts:tsconfig.typecheck.jsoncovers packages, lexicons, scripts and examples, including testsscripts/typecheck-baseline.jsonlists the 118 files failing todayscripts/typecheck.tsfails on a file not in the baseline, and also on a baselined file that now passes, with instructions to delete its lineThe backlog can only shrink, and — the thing that motivated this issue — a lexicon test written tomorrow is typechecked from the moment it exists. Verified in both directions: a deliberately broken new test file is caught by name and line, and a baselined file that starts passing fails with "remove them from the baseline".
Two notes for whoever picks up the backlog:
moduleResolutionisbundlerin this config, deliberately. Tests and examples run under vitest and tsx, both of which resolve like a bundler; shipped code keeps itsnode-resolution build configs, so nothing about the published packages' resolution story changes. Undernodethe same run reports 763 lines, many of them resolution artifacts rather than real type errors.Working the 118 down is the remaining half of this issue, and is worth its own tracking once someone starts.
feat(ci): typecheck lexicon tests, scripts and examples, against a sh…
feat(ci): typecheck lexicon tests, scripts and examples, against a sh…
ci: typecheck lexicon tests and examples (#1388) (#1802)
fix(render): bring the lexicon up to the current plugin and docs cont…
feat(render): the render.com lexicon (#1730)