Repository navigation
Conversation
ymichael
deleted the
bb/post-merge-fix-preserve-installed-bb-app-repacki-thr_bheyykdij3
branch
August 25, 2026 03:37
ymichael
added a commit
that referenced
this pull request
Aug 25, 2026
## What was wrong Removing bb-app's source-only `prepack` cleanup in #2373 made an installed package self-repackable, but also removed the cleanup that ran immediately before source packaging. When Turbo restores bb-app output from cache, unreachable CLI chunks from an older generation can remain on disk and enter the next tarball as dead package weight. ## What changed The bb-app build now bundles the existing chunk-pruning implementation into a self-contained script that ships in `dist`, and the restored `prepack` command runs that script before npm creates an archive. This preserves both source cleanup after a cache hit and ordinary `npm pack` from an installed copy. The tarball smoke now injects a stale chunk immediately before real packaging and rejects an archive that contains it; the publish workflow comment now describes the restored behavior. No host-daemon wire contract, CLI/config surface, SDK API, database, migration, or generated committed file changed. `HOST_DAEMON_PROTOCOL_VERSION` is unchanged. ## How you verified - Red: with 11/11 Turbo tasks cached, an injected stale CLI chunk survived and appeared in `npm pack --dry-run --json`. - Green: with the same 11/11 cached build, normal npm packaging ran the bundled cleanup, removed one stale chunk, and excluded it from the archive. - Extracted the real tarball and repacked the installed-package shape with ordinary `npm pack`; it succeeded and ran the included cleanup. - `pnpm exec turbo run build --filter=bb-app --output-logs=new-only` - `pnpm exec turbo run test --filter=bb-app -- test/index.test.ts` — 67 tests passed. - `pnpm exec turbo run test --filter=@bb/server -- test/app/bb-app-artifact.test.ts` — 12 tests passed. - `pnpm exec turbo run typecheck --filter=bb-app --filter=@bb/server --output-logs=new-only` - `pnpm exec turbo run smoke:tarball --filter=bb-app --force --output-logs=new-only` — 12/12 tasks passed. - `git diff --check` Fixes: no issue filed; follow-up to #2373. > AGENT GENERATED
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was wrong
Published
bb-apppackages retainedprepack: node scripts/prune-bb-chunks.mjs, but the npmfilesallowlist omitted that script. The server deliberately runsnpm packfrom the installed package root to serve/install/bb-app.tgz, so installed servers returned HTTP 500 instead of an artifact. Shipping the script alone would still leave its workspace-relative helper import outside the package.What changed
Removed the source-only prepack hook from the published manifest and kept stale-chunk cleanup in the existing release build, immediately after build output is copied.
Extended the real tarball smoke to source-pack and install
bb-app, repack that installed layout with npm, and verify that every live CLI chunk survives. The focused cleanup unit now invokes the build cleanup directly instead of starting another npm process, avoiding the existing timing-sensitive Vitest signature without increasing its timeout.No server/daemon wire contract, CLI surface, documentation, lockfile, or protocol version changed.
How you verified
pnpm start:worktreeproduced the source tarball; a server launched from that installed tarball returned HTTP 500 from/install/bb-app.tgz. Its artifact-servicenpm packfailed withMODULE_NOT_FOUNDfor the omitted prune script.BB_PI_BRIDGE_COMMAND=/tmp/bb-pr-deliberately-missing-pi BB_PI_BRIDGE_ARGS=[] pnpm exec turbo run smoke:tarball --filter=bb-app --force --env-mode=loose— 12/12 tasks passed, including real installed-layout repacking.pnpm exec turbo run test typecheck build --filter=bb-app --filter=@bb/scripts --force— 17/17 tasks passed; bb-app 72/72 tests and scripts 120/120 tests.pnpm exec turbo run test --filter=@bb/server --force -- test/app/bb-app-artifact.test.ts— 12/12 artifact-service tests passed.git diff --checkpassed.Fixes the packaging regression introduced by #2349.