Skip to content

Add prepare-worktree-types script for worktree lint#4382

Open
habdelra wants to merge 3 commits intomainfrom
worktree-agent-a56a86cd
Open

Add prepare-worktree-types script for worktree lint#4382
habdelra wants to merge 3 commits intomainfrom
worktree-agent-a56a86cd

Conversation

@habdelra
Copy link
Copy Markdown
Contributor

@habdelra habdelra commented Apr 10, 2026

Problem

When running pnpm lint in a git worktree (e.g. .claude/worktrees/), TypeScript type checks fail with hundreds of TS2307: Cannot find module '@cardstack/boxel-icons/*' errors and similar failures for @cardstack/boxel-ui imports.

This happens because boxel-icons and boxel-ui/addon have their declarations/ and dist/ directories in .gitignore — they're build artifacts that exist in the main repo from prior builds but are missing in fresh worktrees. Other packages depend on these for type resolution via the exports and typesVersions fields in package.json.

Affected packages:

Package Missing artifacts
packages/boxel-icons declarations/, dist/
packages/boxel-ui/addon declarations/

Solution

Added two ways to build just the type declarations needed before running lint in a worktree:

  • pnpm script: pnpm prepare-worktree-types
  • mise task: mise run build:worktree-types

Both run:

  1. Full build of @cardstack/boxel-icons (types + JS, since the exports field references both dist/ and declarations/)
  2. Type-only build of @cardstack/boxel-ui (build:types)

Usage

After pnpm install in a fresh worktree:

pnpm prepare-worktree-types
# or
mise run build:worktree-types

Then pnpm lint passes.

Also fixed: prerender handleFatal exit code

While investigating a flaky CI failure in factory-bootstrap.spec.ts (prerender server exited before it became ready (code: 0, signal: null)), we found that handleFatal in prerender-app.ts used setTimeout(() => process.exit(1), 100).unref(). The .unref() allowed the event loop to drain before the timer fired, so when the prerender server hit a fatal error like EADDRINUSE (port conflict), it exited with code 0 instead of 1 — masking the real error. Removed .unref() so process.exit(1) actually fires.

Test plan

  • Created a fresh worktree, confirmed pnpm lint fails without build artifacts
  • Ran pnpm prepare-worktree-types, confirmed it completes successfully
  • Ran pnpm lint after, confirmed all type checks pass (only pre-existing openrouter-realm failure remains, which is broken on main too)
  • Verified handleFatal fix by tracing the CI log showing EADDRINUSE → code 0 exit path

🤖 Generated with Claude Code

habdelra and others added 2 commits April 10, 2026 14:06
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Host Test Results

2 194 tests  ±0   2 179 ✅ ±0   2h 5m 32s ⏱️ - 17m 5s
    1 suites ±0      15 💤 ±0 
    1 files   ±0       0 ❌ ±0 

Results for commit 3d900bc. ± Comparison against base commit 2a8cb5f.

♻️ This comment has been updated with latest results.

@habdelra habdelra requested a review from a team April 10, 2026 18:10
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 10, 2026

Realm Server Test Results

  1 files  ±0    1 suites  ±0   13m 48s ⏱️ -45s
844 tests ±0  844 ✅ ±0  0 💤 ±0  0 ❌ ±0 
915 runs  ±0  915 ✅ ±0  0 💤 ±0  0 ❌ ±0 

Results for commit 3d900bc. ± Comparison against base commit 2a8cb5f.

♻️ This comment has been updated with latest results.

The .unref() on the exit timer allowed the event loop to drain
before process.exit(1) fired, causing the process to exit with
code 0 on fatal errors like EADDRINUSE port conflicts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@backspace backspace left a comment

Choose a reason for hiding this comment

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

How long does this build take for you? I found it faster to just copy the built icons from the existing worktree, since they almost never change.

This is a bigger question but I’m wondering whether we can build some tooling around repository/branch management, to automate checking out a branch for review and running things, etc

@habdelra
Copy link
Copy Markdown
Contributor Author

How long does this build take for you? I found it faster to just copy the built icons from the existing worktree, since they almost never change.

This is a bigger question but I’m wondering whether we can build some tooling around repository/branch management, to automate checking out a branch for review and running things, etc

it’s about 3 minutes on my machine. but yeah better branch management tooling would be nice,

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