Skip to content

Harden webhook migration concurrency#205

Merged
haasonsaas merged 1 commit intomainfrom
codex/webhook-helper-race-20260427
Apr 27, 2026
Merged

Harden webhook migration concurrency#205
haasonsaas merged 1 commit intomainfrom
codex/webhook-helper-race-20260427

Conversation

@haasonsaas
Copy link
Copy Markdown
Contributor

@haasonsaas haasonsaas commented Apr 27, 2026

Summary:

  • Catch concurrent constraint creation races in the webhook delivery reconciliation migration.
  • Guard concurrent index creation races observed in disposable Postgres.
  • Extend migration packaging assertions for concurrency handlers.

Internal source PR: evalops/maestro-internal#1515

Test plan:

  • npm run test -- test/web-health.test.ts test/db/migration-files.test.ts test/db/migrate-legacy-reconciliation.test.ts
  • bunx biome check test/db/migration-files.test.ts
  • git diff --check
  • Disposable Postgres 16: ran 0008 migration twice concurrently against a drifted legacy webhook_deliveries schema and verified helper, PK, FK, indexes, status normalization, and invalid payload wrapping.

@cursor
Copy link
Copy Markdown

cursor Bot commented Apr 27, 2026

PR Summary

Medium Risk
Touches a production database migration by adding exception-handling around constraint/index creation; behavior should be unchanged, but migration execution paths can vary across Postgres versions and drifted schemas.

Overview
Hardens the 0008_reconcile_legacy_webhook_deliveries migration against concurrent runs by wrapping primary key / foreign key constraint creation in BEGIN … EXCEPTION blocks to ignore duplicate/invalid-definition races.

Similarly guards index creation on webhook_deliveries to tolerate concurrent CREATE INDEX IF NOT EXISTS races (duplicate_table/unique_violation). Tests are updated to assert these new concurrency-handling clauses are present in the packaged migration SQL.

Reviewed by Cursor Bugbot for commit 0ffd0f7. Bugbot is set up for automated code reviews on this repo. Configure here.

@haasonsaas haasonsaas enabled auto-merge (squash) April 27, 2026 16:49
@github-actions
Copy link
Copy Markdown
Contributor

This PR changes mirrored Maestro source files in the public repo, but it does not link the matching private source-of-truth PR.

Add one of these to the PR body, then re-run the check:

  • https://github.com/evalops/maestro-internal/pull/<number>
  • evalops/maestro-internal#<number>
  • maestro-internal#<number>

Mirrored files touched:

  • src/db/migrations/0008_reconcile_legacy_webhook_deliveries.sql
  • test/db/migration-files.test.ts

@haasonsaas haasonsaas force-pushed the codex/webhook-helper-race-20260427 branch from 290dfad to 0ffd0f7 Compare April 27, 2026 16:53
@haasonsaas haasonsaas merged commit dcc0359 into main Apr 27, 2026
11 checks passed
@haasonsaas haasonsaas deleted the codex/webhook-helper-race-20260427 branch April 27, 2026 16:59
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