Skip to content

Load built host artifacts natively in tests - #2507

Merged
ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-keep-awake-builtin-host-artifact-ti-thr_b2bd5w6a77
Aug 27, 2026
Merged

Load built host artifacts natively in tests#2507
ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-keep-awake-builtin-host-artifact-ti-thr_b2bd5w6a77

Conversation

@ymichael

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

builtin-host-artifacts.test.ts builds final, self-contained host.js files and then dynamically imports them inside Vitest. The package left those generated artifacts inline in Vitest's module runner, so Vite parsed and transformed the already-built provider bundles again instead of handing them to Node's native loader as the daemon does. Under package-shard CPU oversubscription, that avoidable second pass stretched the Keep Awake case past its 20-second budget; Vitest timed the case out without cancelling its in-flight import, which then continued into later work. The independently verified merge base for this fix is 524b2fe4b0df74185bdd29a274fb77cd6765b2b3.

What changed

  • Externalize only .builtin-host-test-*/dist/host.js in @bb/plugin-build's Vitest configuration so the final ESM artifact is loaded natively.
  • Keep all five real artifact builds, dynamic imports, handler/bridge/contract assertions, and the existing timeout ceilings unchanged.
  • No production behavior, wire contract, CLI, guide, or daemon protocol changes.

How you verified

  • Same bounded contention harness before and after (two groups of 512 CPU workers, exact Keep Awake test): before timed out at 20.006s; after passed twice at 12.559s and 16.073s. Instrumentation isolated the changed phase: host build was effectively unchanged (11.277s before, 11.057s after), while artifact loading fell from 12.157s to 0.844s. The pre-fix import and handler logs arrived after Vitest had already reported the timeout, confirming the uncancelled overlap.
  • Unloaded full artifact file: 13.22s before to 2.64s after; aggregate Vitest transform time fell from 6.72s to 136ms. All five existing assertions passed.
  • TMPDIR=/private/tmp pnpm exec turbo run test --filter=@bb/plugin-build --force --env-mode=loose — 10 files passed, 134 tests passed, 1 skipped.
  • TMPDIR=/private/tmp pnpm exec turbo run test --filter=@bb/plugin-build --force --env-mode=loose -- --coverage — same tests passed with V8 coverage enabled.
  • pnpm exec turbo run typecheck --filter=@bb/plugin-build --force — 4/4 tasks passed.
  • pnpm exec turbo run build --filter=@get-bb/plugin-sdk --force — 2/2 tasks passed; 17 runtime entries built.
  • pnpm exec oxfmt packages/plugin-build/vitest.config.ts --check.

AGENT GENERATED: by GPT-5.6-Sol

@ymichael
ymichael merged commit 1d97c63 into main Aug 27, 2026
15 checks passed
@ymichael
ymichael deleted the bb/ci-flake-fix-keep-awake-builtin-host-artifact-ti-thr_b2bd5w6a77 branch August 27, 2026 16:06
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