Skip to content

Sync staging database from production every three days - #727

Merged
cquil11 merged 1 commit into
masterfrom
agent/sync-staging-db
Aug 12, 2026
Merged

Sync staging database from production every three days#727
cquil11 merged 1 commit into
masterfrom
agent/sync-staging-db

Conversation

@cquil11

@cquil11 cquil11 commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add a scheduled GitHub Actions workflow that restores the Neon staging branch from the default production branch every three calendar days at 4:00 AM America/Chicago time
  • wait for Neon to report the restored branch ready, then invalidate the protected staging deployment cache
  • add a shared concurrency lock so scheduled restores cannot race the existing staged-results ingest workflow
  • support manual workflow runs for on-demand synchronization

Why

The staging database accumulates staged benchmark runs and can drift from production. Periodically replacing it from the production head gives staging a predictable, complete baseline while preserving the existing production branch and connection endpoints.

GitHub cron does not provide a true every-N-days interval: */3 in the day-of-month field resets at month boundaries. The workflow therefore triggers daily at 4:00 AM Central and uses an epoch-day modulo guard to perform the restore on an exact three-calendar-day cadence. timezone: America/Chicago keeps the wall-clock time at 4:00 AM across daylight-saving changes.

Validation

  • actionlint .github/workflows/stage-results.yml .github/workflows/sync-staging-database.yml
  • uvx --exclude-newer P1D zizmor@latest --strict-collection --pedantic --no-ignores .github/workflows/stage-results.yml .github/workflows/sync-staging-database.yml
  • pre-commit formatting, lint, and TypeScript checks
  • no live database restore was performed
  • full E2E tests were not run because the change is limited to GitHub Actions workflows

Note

Medium Risk
Periodically wipes and replaces the shared staging database via Neon restore APIs; production is guarded, but a bad restore or race would disrupt staging data and ingest.

Overview
Adds a scheduled workflow that restores the Neon staging branch from production every three calendar days (daily 4:00 AM Central trigger with an epoch-day guard), then invalidates the staging site cache. Manual workflow_dispatch runs bypass the cadence check.

Locks stage-results and the new sync workflow behind a shared staging-database-maintenance concurrency group so restores and staged-run ingest cannot overlap.

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

@vercel

vercel Bot commented Aug 12, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
inferencemax-app Building Building Preview Aug 12, 2026 1:43pm

Request Review

@cquil11
cquil11 marked this pull request as ready for review August 12, 2026 13:44
@cquil11
cquil11 requested a review from adibarra as a code owner August 12, 2026 13:44
@cquil11
cquil11 merged commit ebcd38d into master Aug 12, 2026
17 of 18 checks passed
@cquil11
cquil11 deleted the agent/sync-staging-db branch August 12, 2026 13:44

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit ea47d2d. Configure here.


concurrency:
group: staging-database-maintenance
cancel-in-progress: false

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Concurrency drops pending maintenance runs

High Severity

The shared staging-database-maintenance concurrency group omits queue: max, so GitHub keeps only one pending run and cancels any earlier waiter when another arrives. A pending scheduled sync can be dropped, and the epoch-day guard will not retry until three days later. Pending stage-results runs can also be cancelled with no completion dispatch back to the source repo.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit ea47d2d. Configure here.

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