Skip to content

test(void): run PGlite initdb once for the wrapper migration tests - #432

Merged
cpojer merged 1 commit into
mainfrom
fix/flaky-wrapper-pg-bundle
Oct 14, 2026
Merged

cpojer merged 1 commit into
mainfrom
fix/flaky-wrapper-pg-bundle

Conversation

@Brooooooklyn

Copy link
Copy Markdown
Member

Problem

wrapper.test.ts > generateWrapper with migrations > bundles the pg dependencies that sit in the app node_modules timed out on Linux CI (job): 5108 ms against the 5 s test deadline of the unit-pglite project.

Each new PGlite() runs initdb. That is about 0.7 s locally and 4–5× that on CI, and every PostgreSQL test in this block paid it inside its own deadline:

CI (ubuntu, unit-pglite)               time
pg bundle test (first PGlite)          5108 ms  ✗
PostgreSQL cron tests                  2206–3638 ms
MySQL tests (Miniflare, no PGlite)     582–606 ms

Fix

Same pattern as #431: pay the one-time cost in a hook with its own budget.

before:  test ─▶ new PGlite() ─▶ initdb (seconds on CI) ─▶ query
after:   beforeAll ─▶ initdb once ─▶ dumpDataDir()  (10 s hook budget, 30 s on Windows)
         test ─▶ new PGlite({ loadDataDir }) ─▶ query   (~0.1 s, fresh empty database)

Each test still gets its own fresh PGlite instance, so isolation does not change. No test deadline changes.

Result (local, --project unit-pglite, same file)

                    before        after
pg bundle test      912–984 ms    185–326 ms
PostgreSQL crons    697–981 ms    188–401 ms
file total          5.7–6.6 s     3.2–4.7 s

Under heavy local load (load average 40–88), the pg bundle test went from 1656–2891 ms to 511–635 ms.

🤖 Generated with Claude Code

https://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufH

Each new PGlite runs initdb. On Linux CI that took most of the 5s test
deadline, and the pg bundle test timed out at 5108ms. Run initdb once in a
hook with its own budget, and load each test's fresh database from the
saved data directory.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0123r5HnanmW2VUrZ7VWDufH
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-14T18:40:01.319557Z 53669b0 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://fix-flaky-wrapper-pg-bundle-void-cloud.voidzero-docs.workers.dev (commit 53669b0)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://86aa9f28-void-cloud.voidzero-docs.workers.dev 53669b0 2026-10-14T18:38:38.940Z Visit the dashboard ↗

@cpojer
cpojer merged commit 2c731b5 into main Oct 14, 2026
34 checks passed
@cpojer
cpojer deleted the fix/flaky-wrapper-pg-bundle branch October 14, 2026 21:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants