Skip to content

chore: typecheck incrementally and cache Knip results - #232

Merged
neoromantic merged 1 commit into
mainfrom
ci/caches
Nov 19, 2026
Merged

neoromantic merged 1 commit into
mainfrom
ci/caches

Conversation

@neoromantic

Copy link
Copy Markdown
Owner

What and why

Sergey asked for caches wherever simply turning one on helps. I measured every candidate on real CI runs. The only one that pays today is local, so this PR turns on just that one:

  • tsconfig.json: incremental with the build info in node_modules/.cache/tsc.
  • check:knip: knip --cache (state in node_modules/.cache/knip).

A repeat run checks only what changed. Locally, best of 3 at load ~30:

first run repeat run
bun run typecheck 3.4 s (5.8 s CPU) 0.7 s (1.7 s CPU)
bun run check:knip 1.8 s 0.6 s

The pre-commit hook runs the typecheck on every commit. With warm state, an added type error still fails typecheck, and an added unused file still fails check:knip.

CI doesn't change. Fresh runners start empty, and filling the state costs nothing measurable. These were measured and rejected:

  • actions/cache on GitHub-hosted runners: a restore costs 1.0–1.5 s even for 52 KB, more than the steps it would shorten.
    • Install: 0.5 s of bun install.
    • Check: 3–4 s in total, of which tsc is about 1 s and Knip 0.6 s.
    • Probe runs 44569277729, 44569396146, 44569542194 show the miss, the restore-key hit and the exact hit for the tsc state.
  • Bun's install and transpiler caches: on main the self-hosted runner already keeps both between runs. On PRs the transpiler cache warms within the run, so carrying it over saves nothing measurable.
  • The self-hosted runner would gain about 5 s per main run (tsc 3–4 s, Knip 2 s) if devkit's ci-bun kept these two dirs between runs. That is proposed to devkit separately.

How I checked it

  • bun run check, and the error checks above.

  • Tests pass locally and use made-up data only

  • README, docs and affected demos follow the product content standard

  • Title follows the repo's commit style: Conventional Commits (feat: …, fix: …) unless AGENTS.md says otherwise

🤖 Generated with Claude Code

tsc keeps its build info in node_modules/.cache/tsc and Knip runs with
--cache (node_modules/.cache/knip). A repeat run checks only what
changed: locally, `bun run typecheck` takes 0.7 s instead of 3.4 s and
`bun run check:knip` 0.6 s instead of 1.8 s. The pre-commit hook runs the
typecheck on every commit. With a warm state, a type error and an unused
file still fail the checks.

CI doesn't change. Fresh runners start empty, and filling the state costs
nothing measurable. On GitHub-hosted runners an actions/cache restore
(1.0-1.5 s) costs more than these steps take, so none is added. The
self-hosted runner would gain about 5 s per main run if devkit's ci-bun
kept these two dirs between runs; that is proposed to devkit.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant