Skip to content

build: generate app-runtime browser bundle instead of checking it in - #83

Merged
SawyerHood merged 1 commit into
mainfrom
app-runtime-bundle-build-step
Jun 10, 2026
Merged

SawyerHood merged 1 commit into
mainfrom
app-runtime-bundle-build-step

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Problem

packages/sdk/src/app-runtime-browser-bundle.generated.ts (the served window.bb runtime) was checked in and had to be manually regenerated whenever anything in its module graph changed — sdk, server-contract, domain, templates. The only enforcement was an after-the-fact CI sync check, so the failure mode was inevitable: f183840 changed projectWithThreadsResponseSchema without regenerating, breaking CI on main and every open PR (see #82 for the symptom-level fix).

Fix: make generation a build step

  • @bb/sdk#generate:app-runtime-browser-bundle is now a cached turbo task whose output is the generated module. The file is untracked and gitignored.
  • Dependency edges from every task that compiles the file: @bb/sdk build/typecheck/test, @bb/server build/typecheck/test/dev (the only importer of @bb/sdk/app-runtime), and @bb/integration-tests tasks (they compile server src). pnpm dev runs through turbo, so dev generates it automatically.
  • The --check mode, check: script, and the staleness test are deleted — staleness is structurally impossible now. The remaining tests (sha integrity, guide-templates-only) run against a freshly generated bundle.

This mirrors what @bb/templates already does (regenerate before its own tasks), taken one step further by untracking the artifact.

Verified

  • rm the generated file → turbo run build typecheck test --filter=@bb/sdk --filter=@bb/server: generate runs first, 7/7 tasks pass
  • Re-run after deleting the file again: cache hit, turbo restores the file from the task output cache
  • turbo run lint and @bb/integration-tests#typecheck pass
  • turbo run dev --filter=@bb/server --dry=json → ['@bb/sdk#generate:app-runtime-browser-bundle', '@bb/server#dev']

Notes

🤖 Generated with Claude Code

The committed bundle had to be manually regenerated whenever anything in
its module graph changed (sdk, server-contract, domain, templates, ...),
enforced only by an after-the-fact CI sync check. f183840 showed the
failure mode: a contract change without regeneration broke CI on main
and every open PR.

Make generation a turbo task instead:

- @bb/sdk#generate:app-runtime-browser-bundle is a cached task whose
  output is the generated module; the file is untracked and gitignored.
- Every task that compiles the file depends on it: sdk build/typecheck/
  test, server build/typecheck/test/dev (the only importer), and
  integration-tests (they compile server src). pnpm dev runs through
  turbo, so dev gets it for free.
- The --check mode, check: script, and staleness test are deleted —
  staleness is now structurally impossible.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@SawyerHood
SawyerHood merged commit 314c1f2 into main Jun 10, 2026
6 checks passed
@SawyerHood
SawyerHood deleted the app-runtime-bundle-build-step branch June 10, 2026 19:40
brsbl added a commit that referenced this pull request Jun 10, 2026
Brings the branch up to date with main (24 commits), which switched the
app-runtime browser bundle to build-time generation (#83) — removing the
checked-in generated file that was failing CI. Resolved conflicts in
PromptBoxInternal (deps: applyTrigger + canSubmitWithEnterKey), RootComposeView
(usePrimaryHost replaces useHostDaemon; keep useCommandSuggestions),
project-queries (keep requireProviderId + SidebarProject), and the
NewThreadPromptBox story (typeahead fixtures + makeHost).

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
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