Skip to content

chore: drop NODE_COMPILE_CACHE + harden .env allowlist + ignore .cache/#1279

Open
John-David Dalton (jdalton) wants to merge 3 commits intomainfrom
chore/remove-node-compile-cache
Open

chore: drop NODE_COMPILE_CACHE + harden .env allowlist + ignore .cache/#1279
John-David Dalton (jdalton) wants to merge 3 commits intomainfrom
chore/remove-node-compile-cache

Conversation

@jdalton
Copy link
Copy Markdown
Contributor

@jdalton John-David Dalton (jdalton) commented Apr 25, 2026

Summary

  • Drops the project-level NODE_COMPILE_CACHE="./.cache" pin from every place it was set (.env.example, .env.precommit, packages/cli/.env.test). Nothing in the codebase consumed the on-disk cache it produced — the vX.Y.Z-arch-hash-uid directories at repo root were pure noise from per-developer Node invocations.
  • Hardens the commit-msg .env allowlist: switches the file-name check from full-path-anchored regex to basename matching so nested .env.test files (e.g. packages/cli/.env.test) are not erroneously blocked, and adds .env.precommit to the allowlist alongside .env.example and .env.test. The previous regex wouldn't have allowed any of the templates this repo actually tracks except the root .env.example.
  • Re-includes the templates in .gitignore so the existing .env.* blanket-ignore pattern doesn't shadow them: adds !.env.precommit and !.env.test.
  • Adds **/.cache/ as a defensive .gitignore entry so stray writers (corepack, pnpm RC, ambient Node compile-cache) stay untracked.
  • Restores .cache/** excludes in tsconfig.json + packages/cli/tsconfig.json, and adds them to the two tsconfig.check.json files that did not previously list them. The **/.cache/ gitignore is defense-in-depth, not prevention; tsc would still try to type-check anything that leaked through.

The clean:cache pnpm script (del-cli '**/.cache') is unchanged — it still functions as the explicit cleanup path.

Test plan

  • Confirm pnpm test still passes locally (config-only — no source changes).
  • Confirm vitest still writes to node_modules/.cache/vitest (already configured in .config/vitest.config.base.mts:34).
  • Confirm CI passes.
  • Confirm a fresh checkout no longer accumulates .cache/ at repo root after running unit tests.

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON. A cloud agent has been kicked off to fix the reported issue.

Comment @cursor review or bugbot run to trigger another review on this PR

Reviewed by Cursor Bugbot for commit 633bb68. Configure here.

Comment thread .env.example
Removes the project-level NODE_COMPILE_CACHE="./.cache" pin from
.env.example and the now-redundant ".cache/**" excludes from both
tsconfigs. The compile-cache pollution at repo root is noise that
has no consumer in the codebase — vitest already writes its own
cache under node_modules/.cache/.
…ommit-msg env allowlist, add **/.cache/ ignore

Cursor Bugbot flagged that .env.precommit and packages/cli/.env.test still
set NODE_COMPILE_CACHE="./.cache", so pre-commit hooks and test runs were
still creating .cache/ at repo root. Removed both.

The commit-msg hook's .env allowlist regex was anchored to the repo root
(^.env.test$) and missing .env.precommit entirely, so committing the
above edits was blocked. Switched to basename-based matching and added
.env.precommit. Also added !.env.precommit and !.env.test to .gitignore
so the templates stay re-traceable if re-added.

Added **/.cache/ as a defensive gitignore so any tool dropping cache
there (corepack, pnpm RC, external Node compile-cache invocations)
stays untracked.
@jdalton John-David Dalton (jdalton) force-pushed the chore/remove-node-compile-cache branch from 633bb68 to a4f3ca0 Compare April 25, 2026 06:59
Adds .cache/** back to every tsconfig with an exclude array — the
previous commit dropped it from tsconfig.json and packages/cli/tsconfig.json
on the assumption that .cache/ would not be created, but the new
**/.cache/ gitignore is defense-in-depth, not prevention. Stray
writers (Node compile-cache, corepack, pnpm RC) will still drop
files there, and tsc would otherwise try to type-check them.

Also adds the entry to the two tsconfig.check.json configs that did
not previously list it. Sorted alphabetically for consistency.
@jdalton
Copy link
Copy Markdown
Contributor Author

Addressed in 499aeb2 + a4f3ca0:

  • NODE_COMPILE_CACHE removed from .env.precommit and packages/cli/.env.test (the two files this thread flagged).
  • .cache/** exclude restored in both tsconfig.json and packages/cli/tsconfig.json, plus newly added to the two tsconfig.check.json configs that did not previously list it.
  • Defensive **/.cache/ added to .gitignore so any stray writer (corepack, pnpm RC, ambient Node compile-cache) stays untracked.

@jdalton John-David Dalton (jdalton) changed the title chore: drop NODE_COMPILE_CACHE convention chore: drop NODE_COMPILE_CACHE + harden .env allowlist + ignore .cache/ Apr 25, 2026
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