Add prepare-worktree-types script for worktree lint#4382
Add prepare-worktree-types script for worktree lint#4382
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
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>
backspace
left a comment
There was a problem hiding this comment.
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, |
Problem
When running
pnpm lintin a git worktree (e.g..claude/worktrees/), TypeScript type checks fail with hundreds ofTS2307: Cannot find module '@cardstack/boxel-icons/*'errors and similar failures for@cardstack/boxel-uiimports.This happens because
boxel-iconsandboxel-ui/addonhave theirdeclarations/anddist/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 theexportsandtypesVersionsfields inpackage.json.Affected packages:
packages/boxel-iconsdeclarations/,dist/packages/boxel-ui/addondeclarations/Solution
Added two ways to build just the type declarations needed before running lint in a worktree:
pnpm prepare-worktree-typesmise run build:worktree-typesBoth run:
@cardstack/boxel-icons(types + JS, since theexportsfield references bothdist/anddeclarations/)@cardstack/boxel-ui(build:types)Usage
After
pnpm installin a fresh worktree:pnpm prepare-worktree-types # or mise run build:worktree-typesThen
pnpm lintpasses.Also fixed: prerender
handleFatalexit codeWhile investigating a flaky CI failure in
factory-bootstrap.spec.ts(prerender server exited before it became ready (code: 0, signal: null)), we found thathandleFatalinprerender-app.tsusedsetTimeout(() => 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 likeEADDRINUSE(port conflict), it exited with code 0 instead of 1 — masking the real error. Removed.unref()soprocess.exit(1)actually fires.Test plan
pnpm lintfails without build artifactspnpm prepare-worktree-types, confirmed it completes successfullypnpm lintafter, confirmed all type checks pass (only pre-existingopenrouter-realmfailure remains, which is broken on main too)handleFatalfix by tracing the CI log showing EADDRINUSE → code 0 exit path🤖 Generated with Claude Code