Skip to content

typecheck convex/ under tsc -b; gitignore agent scratch dirs - #21

Merged
hibukki merged 2 commits into
mainfrom
typecheck-convex-under-tsc-build
Jul 27, 2026
Merged

hibukki merged 2 commits into
mainfrom
typecheck-convex-under-tsc-build

Conversation

@hibukki

@hibukki hibukki commented Jul 27, 2026

Copy link
Copy Markdown
Owner

👋 Claude here

Two small, independent DX fixes.

(A) tsc -b now typechecks convex/

Previously the root tsconfig.json referenced only tsconfig.app.json and tsconfig.node.json, so pnpm lint / pnpm build (both tsc -b) and CI never ran the backend through its own config. Convex files were only incidentally checked when reachable from the frontend's import graph via the generated api types — and then under the frontend's compiler settings (e.g. noUnusedLocals), not Convex's. Files not reachable from src (convex/auth.config.ts, the convex test files) were genuinely unchecked.

Change: added { "path": "./convex" } to the root tsconfig.json references.

Build-mode mechanics (the interesting part):

  • tsc --build normally requires referenced projects to be composite: true, but a project with noEmit: true is exempt in TS 5.9 — same as the existing app/node projects, which are also noEmit and not composite. So no composite needed, and Convex stays strictly typecheck-only (no JS emit).

  • Build mode still writes a .tsbuildinfo for incrementality. Left to default it landed at convex/tsconfig.tsbuildinfo, polluting the repo. Redirected it to the gitignored node_modules/.tmp/ (matching app/node):

    "tsBuildInfoFile": "../node_modules/.tmp/tsconfig.convex.tsbuildinfo"

    (../ because the path resolves relative to convex/tsconfig.json.)

Proof it works: temporarily added const _x: number = "..." to convex/auth.config.ts (a file not reachable from src, so a real before/after test):

  • Before the fix: pnpm lint passed (error missed).
  • After the fix: pnpm lint failed with convex/auth.config.ts(1,7): error TS2322: Type 'string' is not assignable to type 'number'.
  • Temp error then reverted.

(B) gitignore agent scratch dirs

Added .claude/worktrees/ and .tmp.gitignored/ (conventions already in use) so untracked agent worktrees stop polluting git status. No directories deleted — just ignored.

Verification (actual results)

  • pnpm lint — passes
  • pnpm build — passes (vite build OK)
  • pnpm test — passes (5/5)
  • Temp-error proof — confirmed as above

🤖 Generated with Claude Code

https://claude.ai/code/session_01VrVv49ZydmFUGUVbVTGWeN

hibukki and others added 2 commits July 27, 2026 14:24
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VrVv49ZydmFUGUVbVTGWeN
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VrVv49ZydmFUGUVbVTGWeN
@claude

claude Bot commented Jul 27, 2026

Copy link
Copy Markdown

Review

Overview

Two small, independent DX fixes:

  • (A) Adds { "path": "./convex" } to the root tsconfig.json references so tsc -b (and therefore pnpm lint / pnpm build / CI) actually typechecks convex/, plus redirects convex/tsconfig.json's tsBuildInfoFile to the gitignored node_modules/.tmp/ to avoid a stray convex/tsconfig.tsbuildinfo in the repo.
  • (B) Adds .claude/worktrees/ and .tmp.gitignored/ to .gitignore.

Correctness

  • Verified in .github/workflows/ci.yml: both pnpm lint and pnpm build run tsc -b, so this genuinely closes a CI gap — convex/auth.config.ts and the convex test files aren't reachable from src's import graph and were previously untyped by the compiler.
  • Confirmed eslint.config.js already references ./convex/tsconfig.json in parserOptions.project, so ESLint's type-aware rules were already parsing convex files under the right compiler settings — but ESLint's rule set (no-unsafe-*, etc.) doesn't surface plain compiler diagnostics like TS2322. So the PR's repro (a bad assignment in auth.config.ts slipping past pnpm lint pre-fix) is consistent with how these two tools actually divide responsibility, not a coincidence.
  • The "no composite needed because noEmit: true" claim checks out empirically against this repo: tsconfig.app.json and tsconfig.node.json are already referenced by the root config, already noEmit, and already not composite — so convex/tsconfig.json (also noEmit, also not composite) follows the exact same working pattern rather than relying on new/untested behavior.
  • The tsBuildInfoFile redirect (../node_modules/.tmp/tsconfig.convex.tsbuildinfo) mirrors the existing app/node convention exactly (path is relative to convex/tsconfig.json, correctly using ../).

Code quality / style

  • Minimal, surgical diff (net +7/-1 across 3 files) — no scope creep.
  • Matches existing conventions in the repo rather than introducing new patterns.

Potential issues / risks

  • Low risk overall — config-only change, no application logic touched.
  • Adding convex/ as a typechecked project could in theory surface pre-existing type errors elsewhere in convex/ that were silently passing before (since the whole point is that this project wasn't checked). The PR states pnpm lint/pnpm build/pnpm test all pass after the change, and CI will confirm this independently — worth a quick glance at the CI run for this PR before merging, but not a blocker given the stated verification.
  • The new .gitignore entries (.claude/worktrees/, .tmp.gitignored/) aren't documented anywhere else in the repo (README/CLAUDE.md) — a future reader might wonder where these directories come from. Very minor; not worth blocking on, just a possible one-line comment if you want extra clarity for humans unfamiliar with Claude Code's agent worktree conventions.

Test coverage

  • No automated test added, but none is really needed for a build-config change like this — the PR body documents a solid manual before/after repro (temporarily injecting a type error into a file unreachable from src, showing pnpm lint failed to catch it before the fix and does catch it after). That's the right kind of verification for this change; a unit test wouldn't meaningfully cover "does our tsconfig wiring work."

Security / performance

  • No security implications (build tooling only).
  • Performance impact is negligible — tsc -b now also typechecks one more (small) project on each lint/build invocation.

Overall: clean, well-justified, low-risk fix that closes a real and non-obvious gap in CI coverage. Nice write-up in the PR description too — the before/after repro is exactly the kind of evidence that makes this easy to trust.

@hibukki
hibukki merged commit 6fd358b into main Jul 27, 2026
2 checks passed
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