Skip to content

fix(edge-worker): await worker startup in integration tests - #680

Open
jumski wants to merge 1 commit into
mainfrom
650-await-worker-startup
Open

fix(edge-worker): await worker startup in integration tests#680
jumski wants to merge 1 commit into
mainfrom
650-await-worker-startup

Conversation

@jumski

@jumski jumski commented Sep 13, 2026

Copy link
Copy Markdown
Contributor

Summary

Make the integration-test harness await worker startup. startWorker() in pkgs/edge-worker/tests/integration/_helpers.ts fired worker.startOnlyOnce() fire-and-forget, so the startup transaction (ensure_flow_compiled: create_flow/add_step, or destructive local recompile via delete_flow_and_data) could race the test body and commit across test boundaries, interleaving with the next test's reset_db. A stray commit then left a listed PGMQ queue with no owning flow row, and a later create_flow rejected it (queue "X" is already in use by another owner). Startup errors now fail at the call site instead of surfacing via a later worker.stop().

Test-only change: _helpers.ts, 31 call sites across 9 integration test files, and performanceMapFlow's startWorkers. No product code, SQL, or migrations.

Base of the #679 stack (queue identity feature); that PR's CI originally failed on this race.

Checks

  • mapFlow.test.ts focused runs pass twice consecutively (no orphan-queue leak across runs); queueIdentity.test.ts likewise
  • Full pnpm nx test:integration edge-worker: 63 passed, 0 failed
  • nx affected --target=prepush: 32/32 successful

Part of #650

startWorker() fired worker.startOnlyOnce() fire-and-forget, so the startup transaction (ensure_flow_compiled: create_flow/add_step, or destructive local recompile via delete_flow_and_data) raced the test body and could commit across test boundaries, interleaving with the next test's reset_db. A stray commit then left a listed PGMQ queue with no owning flow row, and the next create_flow correctly rejected it: cannot create flow "X": queue "X" is already in use by another owner.

Fix: make startWorker() async and await startup; await all 31 call sites and performanceMapFlow's startWorkers. Startup errors now fail at the call site instead of surfacing via a later worker.stop(). Product code, SQL, and migrations are untouched; the ownership guard stays as approved in #650.

mapFlow.test.ts focused runs pass twice consecutively; full integration suite 63 passed, 0 failed.

Refs #650. CI: edge-worker-integration on PR #679.
@changeset-bot

changeset-bot Bot commented Sep 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: cae4772

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

jumski commented Sep 13, 2026

Copy link
Copy Markdown
Contributor Author

@nx-cloud

nx-cloud Bot commented Sep 13, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cae4772

Command Status Duration Result
nx run edge-worker:smoke:bun ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-13 06:53:23 UTC

@nx-cloud

nx-cloud Bot commented Sep 13, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit cae4772

Command Status Duration Result
nx run-many -t build --projects=dsl,core,cli ✅ Succeeded 4s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-09-13 06:53:41 UTC

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