Skip to content

yarn typecheck reports phantom and stale errors because of the incremental tsbuildinfo cache #187

Description

@pat-lewczuk

Hit by two independent agent runs adding route-handler tests. It produces false results in both
directions
, which makes it worse than a plain slow build.

What happens

yarn typecheck is tsc --noEmit with incremental caching into tsconfig.tsbuildinfo (untracked,
at the repo root). Across branch switches and file moves/renames the cache goes stale, and then:

  • it reports phantom errors on a clean tree — observed as TS2451 duplicate-identifier errors for
    files that no longer exist at the paths the cache remembers;
  • and it keeps reporting an error after the fix has landed, so a correct tree looks broken.

Both were observed in the same session, on different branches.

Why it matters more than a normal caching wrinkle

yarn typecheck is one of five validation.commands in .ai/agentic.config.json — it is the gate
every change is measured against, and the one that substitutes for yarn lint (which cannot run at
all, see #179). A gate that intermittently fabricates failures trains everyone, human and agent, to
distrust it or to work around it with reruns.

Reproduction is branch-history dependent rather than a fixed recipe: switch between two branches whose
test files differ in name or location, then run yarn typecheck. The workaround is:

rm -f tsconfig.tsbuildinfo && yarn typecheck

Options

  1. Clean in the script"typecheck": "rm -f tsconfig.tsbuildinfo && tsc --noEmit". Costs a few
    seconds per run, removes the whole class of problem. Probably right for a gate command.
  2. Drop incremental: true from tsconfig.json — same effect, but also affects editors and any
    other tsc consumer.
  3. Keep incremental, move the buildinfo per-branch — more machinery than this is worth.

Option 1 is the smallest change that makes the gate trustworthy. Also worth confirming
tsconfig.tsbuildinfo is gitignored (it is currently untracked but should be explicit), the same
hygiene question as #131's next-env.d.ts.

Activity

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

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions