Skip to content

Preserve bb-app chunk cleanup on cached builds - #2413

Merged
ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-source-tarball-chunk-cle-thr_i8e66i688a
Aug 25, 2026
Merged

ymichael merged 1 commit into
mainfrom
bb/post-merge-fix-preserve-source-tarball-chunk-cle-thr_i8e66i688a

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

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

@ymichael
ymichael merged commit 2231436 into main Aug 25, 2026
15 checks passed
@ymichael
ymichael deleted the bb/post-merge-fix-preserve-source-tarball-chunk-cle-thr_i8e66i688a branch August 25, 2026 17:51
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