Skip to content

CI typechecks neither lexicon tests nor examples #1388

Closed

Description

@lex00

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

  1. Typecheck lexicon tests. Drop **/*.test.ts from each lexicon's tsconfig.build.json exclude, or add a separate tsconfig.test.json per lexicon that check-lexicons also runs. Cheapest fix for the motivating gap; says nothing about examples.
  2. Fix the 56 example errors, then gate the root config. Highest coverage — one tsc -p tsconfig.json in 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.
  3. Gate the root config with lexicons/*/examples excluded, 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

  1. lex00 commented on Aug 3, 2026

    @lex00
    ContributorAuthor

    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, under moduleResolution: bundler (which is how vitest and tsx actually resolve, unlike the root config's node):

    Population Error lines Files Covered today
    packages/** (src and tests) 0 — yes, CI
    lexicons/*/src non-test 0 — yes, check-lexicons builds each tsconfig.build.json
    lexicons/*/src tests 405 — no
    lexicons/*/scripts 7 — no
    lexicons/*/examples and examples/ ~546 — no
    total 958 118

    So none of the three options as I wrote them is a config flip. Option 1 ("drop **/*.test.ts from 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_FAILURES in check-lexicons.ts:

    • tsconfig.typecheck.json covers packages, lexicons, scripts and examples, including tests
    • scripts/typecheck-baseline.json lists the 118 files failing today
    • scripts/typecheck.ts fails on a file not in the baseline, and also on a baselined file that now passes, with instructions to delete its line

    The 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:

    • moduleResolution is bundler in this config, deliberately. Tests and examples run under vitest and tsx, both of which resolve like a bundler; shipped code keeps its node-resolution build configs, so nothing about the published packages' resolution story changes. Under node the same run reports 763 lines, many of them resolution artifacts rather than real type errors.
    • The 118 are concentrated: github (118 lines), gcp (105), temporal (81), aws (51), k8s (37). Whoever takes one lexicon at a time will see the baseline drop in reviewable chunks.

    Working the 118 down is the remaining half of this issue, and is worth its own tracking once someone starts.

  2. added
    area:ci
    bug
    P2
    on Aug 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2area:cibug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions