Skip to content

fix(bb-app): keep installed package repackable - #2373

Merged
ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-installed-bb-app-repacki-thr_bheyykdij3
Aug 25, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-installed-bb-app-repacki-thr_bheyykdij3

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

What was wrong

Published bb-app packages retained prepack: node scripts/prune-bb-chunks.mjs, but the npm files allowlist omitted that script. The server deliberately runs npm pack from 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

  • Red: at the introducing commit, pnpm start:worktree produced the source tarball; a server launched from that installed tarball returned HTTP 500 from /install/bb-app.tgz. Its artifact-service npm pack failed with MODULE_NOT_FOUND for the omitted prune script.
  • Green: 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.
  • Prettier and git diff --check passed.

Fixes the packaging regression introduced by #2349.

AGENT GENERATED

@ymichael
ymichael merged commit b3d38e2 into main Aug 25, 2026
15 checks passed
@ymichael
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
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