Skip to content

fix(build): stop the declaration build from losing its own output - #374

Merged
omridevk merged 2 commits into
mainfrom
fix/build-tsbuildinfo-outputs
Aug 9, 2026
Merged

fix(build): stop the declaration build from losing its own output#374
omridevk merged 2 commits into
mainfrom
fix/build-tsbuildinfo-outputs

Conversation

@omridevk

@omridevk omridevk commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Fixes a regression from #372 that is currently on main and breaks local builds and the packed-tgz e2e.

Mechanism

Every package builds with vite build && tsc -p tsconfig.build.json.

  1. vite build empties dist/, deleting the .d.ts files tsc emitted on the previous run.
  2. tsc then reads the .build.tsbuildinfo chore(build): make typecheck cacheable and incremental #372 introduced, sees an unchanged source graph, and correctly concludes it has already emitted — so it writes nothing. TypeScript never checks whether its outputs still exist on disk.

Every second build silently loses all declarations. No turbo cache is involved; it happens inside a single pnpm run build.

Consumers then fail with TS7016: Could not find a declaration file for module '@conciv/…', which is what broke ui-kit-terminal, ui-kit-chat, extension-terminal and embed, and why the packed-tgz Next.js e2e went red on main at 9397c6e0 (that test installs real packed artifacts).

Measured

@conciv/protocol, same sources, two consecutive builds, before the fix:

build 1 (no buildinfo):                      17 d.ts
build 2 (buildinfo present, sources same):    0 d.ts

After the fix, the whole @conciv/embed dependency chain built twice:

PASS1  protocol=17  ui-kit-system=30
PASS2  protocol=17  ui-kit-system=30

The change

Incremental state is only safe when a single tool owns the outDir. So it stays on for typecheck (tsc --noEmit, nothing else writes there — that is the caching #372 wanted, and it works) and comes off for the declaration build: 18 tsconfig.build.json files get "incremental": false and drop tsBuildInfoFile.

turbo.json is unchanged from main — an earlier revision of this PR added .build.tsbuildinfo to the build task's outputs, which only made cache restores consistent and did not fix the underlying loss. That is reverted.

Gates: format:check clean, typecheck green, fallow audit --changed-since main verdict pass.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores
    • Standardized TypeScript build settings across packages by disabling incremental compilation.
    • Removed custom build-info file configuration.
    • Preserved declaration-only output and existing source/output directory settings.

@coderabbitai

coderabbitai Bot commented Aug 9, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The package TypeScript build configurations now disable incremental compilation and remove explicit tsBuildInfoFile paths. Declaration-only output and existing source/output directory settings remain unchanged.

Changes

TypeScript build configuration

Layer / File(s) Summary
Disable incremental builds
packages/embed/tsconfig.build.json, packages/extensions/*/tsconfig.build.json, packages/protocol/tsconfig.build.json, packages/solid-diffs/tsconfig.build.json, packages/solid-streamdown/tsconfig.build.json, packages/ui-kit-*/tsconfig.build.json, packages/uno-preset/tsconfig.build.json
The build configurations remove tsBuildInfoFile and set incremental to false. Declaration-only emission and existing output settings remain configured.

Estimated code review effort: 1 (Trivial) | ~5 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title describes the main build fix: preserving declaration build outputs and preventing them from becoming inconsistent with cached build information.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/build-tsbuildinfo-outputs

Comment @coderabbitai help to get the list of available commands.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Fixes local incremental declaration builds by caching TypeScript build metadata alongside generated declarations.

Changes:

  • Adds .build.tsbuildinfo files to Turbo’s build outputs.
  • Ensures cached declarations and their incremental state are restored together.

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@omridevk
omridevk force-pushed the fix/build-tsbuildinfo-outputs branch from be268d1 to abf4b5a Compare August 9, 2026 16:58
@omridevk omridevk changed the title fix(build): cache the declaration buildinfo with the outputs it describes fix(build): stop the declaration build from losing its own output Aug 9, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/extensions/tanstack/tsconfig.build.json`:
- Around line 8-9: Remove the inherited tsBuildInfoFile setting from all nine
build configurations while retaining incremental: false and the existing dist/**
output: packages/extensions/tanstack/tsconfig.build.json (lines 8-9),
packages/extensions/terminal/tsconfig.build.json (lines 8-9),
packages/extensions/test-runner/tsconfig.build.json (lines 8-9),
packages/extensions/try-it/tsconfig.build.json (lines 8-9),
packages/extensions/whiteboard/tsconfig.build.json (lines 8-9),
packages/protocol/tsconfig.build.json (lines 9-10),
packages/solid-diffs/tsconfig.build.json (lines 8-9),
packages/solid-streamdown/tsconfig.build.json (lines 8-9), and
packages/ui-kit-chat-tools/tsconfig.build.json (lines 8-9).
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 7654dcd1-d270-4c80-b59e-459ef5258bfb

📥 Commits

Reviewing files that changed from the base of the PR and between be268d1 and abf4b5a.

📒 Files selected for processing (18)
  • packages/embed/tsconfig.build.json
  • packages/extensions/ios/tsconfig.build.json
  • packages/extensions/page/tsconfig.build.json
  • packages/extensions/recorder/tsconfig.build.json
  • packages/extensions/tanstack/tsconfig.build.json
  • packages/extensions/terminal/tsconfig.build.json
  • packages/extensions/test-runner/tsconfig.build.json
  • packages/extensions/try-it/tsconfig.build.json
  • packages/extensions/whiteboard/tsconfig.build.json
  • packages/protocol/tsconfig.build.json
  • packages/solid-diffs/tsconfig.build.json
  • packages/solid-streamdown/tsconfig.build.json
  • packages/ui-kit-chat-tools/tsconfig.build.json
  • packages/ui-kit-chat/tsconfig.build.json
  • packages/ui-kit-system/tsconfig.build.json
  • packages/ui-kit-tap/tsconfig.build.json
  • packages/ui-kit-terminal/tsconfig.build.json
  • packages/uno-preset/tsconfig.build.json

Comment thread packages/extensions/tanstack/tsconfig.build.json
omridevk and others added 2 commits August 9, 2026 20:26
…ibes

tsc --incremental trusts .build.tsbuildinfo and never checks whether its
outputs still exist, so once the buildinfo and dist disagree it exits 0 and
emits no .d.ts. The build task declared only dist/** as output, leaving
.build.tsbuildinfo outside turbo's knowledge while dist was cached, restored
and cleaned independently. Every consumer then failed with TS7016.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Every package builds with `vite build && tsc -p tsconfig.build.json`. vite
empties dist, deleting the .d.ts tsc emitted last time; tsc then reads the
buildinfo, sees an unchanged source graph, and skips emit without checking
whether its outputs still exist. Every second build dropped all declarations
and consumers failed with TS7016.

Incremental state is only safe when one tool owns the outDir, so it stays on
for typecheck (tsc --noEmit, nothing else writes there) and comes off for the
declaration build.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@omridevk
omridevk force-pushed the fix/build-tsbuildinfo-outputs branch from abf4b5a to 620af69 Compare August 9, 2026 17:26
@omridevk
omridevk merged commit e7529b8 into main Aug 9, 2026
24 checks passed
@omridevk
omridevk deleted the fix/build-tsbuildinfo-outputs branch August 9, 2026 17:41
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.

2 participants