Skip to content

Stabilize large-event migration regression - #2502

Merged
ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-db-inline-large-value-migration-5s-thr_pxhahjff5h
Aug 27, 2026
Merged

Stabilize large-event migration regression#2502
ymichael merged 1 commit into
mainfrom
bb/ci-flake-fix-db-inline-large-value-migration-5s-thr_pxhahjff5h

Conversation

@ymichael

@ymichael ymichael commented Aug 26, 2026

Copy link
Copy Markdown
Collaborator

Human comments

What was wrong

The inline large-event migration regression constructed a current database with a full 100+ migration replay inside the case, rewound it to the legacy checkpoint, then ran the real forward migration under test. The first full migration was fixture setup rather than behavior under assertion, but it consumed the same 5 s test budget as the second migration. Stage measurements attributed 86% of the unloaded case and 83% under contention to those two full migrations, which made ordinary packages-shard CPU contention amplify the case past Vitest's unchanged ceiling in CI run 33006897846.

What changed

  • Reuse the existing serialized current-schema database image for the two large-event replay cases, then clone and rewind that image independently for each case.
  • Prepare the shared image in beforeAll, outside either case's timeout budget. Both cases still invoke the real production migrate() boundary after the rewind and retain their migration-ledger, removed-table, and inline-payload assertions.
  • Close the one-time template-building connection after serialization instead of retaining it for the worker lifetime.
  • No timeout, retry budget, polling deadline, or assertion changed. This is test-only and does not alter any host-daemon wire contract, so HOST_DAEMON_PROTOCOL_VERSION is unchanged.

How you verified

  • Exact red/green loop with 640 bounded CPU competitors and the unchanged 5 s timeout:
    • before: failed twice at 6.048 s and 6.534 s
    • after: passed twice at 4.115 s and 4.620 s
  • Unloaded exact case: 126 ms before, 64 ms after.
  • Focused skip + restore cases: 2/2 passed at 61 ms and 57 ms.
  • pnpm exec turbo run test --filter=@bb/db --force -- --reporter=verbose test/migrate.test.ts: 42/42 passed; 2.68 s file duration.
  • pnpm exec turbo run test --filter=@bb/db --force: 409/409 passed; 28/28 files.
  • pnpm exec turbo run typecheck --filter=@bb/db --force: passed.
  • pnpm exec turbo run build --filter=@bb/db --force: passed; Turbo reported that @bb/db defines no build task.
  • PR CI Tests (packages, ubuntu-latest, Node 22.x): passed; the exact case completed in 915 ms and the 42-case migration file in 26.764 s.

AGENT GENERATED

AGENT GENERATED: by GPT-5.6-Sol

@ymichael
ymichael merged commit 34756ab into main Aug 27, 2026
15 checks passed
@ymichael
ymichael deleted the bb/ci-flake-fix-db-inline-large-value-migration-5s-thr_pxhahjff5h branch August 27, 2026 16:28
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