Skip to content

fix: sync declarative schedules on deployment rollback#3468

Open
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777450352-fix-rollback-schedules
Open

fix: sync declarative schedules on deployment rollback#3468
devin-ai-integration[bot] wants to merge 2 commits intomainfrom
devin/1777450352-fix-rollback-schedules

Conversation

@devin-ai-integration
Copy link
Copy Markdown
Contributor

@devin-ai-integration devin-ai-integration Bot commented Apr 29, 2026

✅ Checklist

  • I have followed every step in the contributing guide
  • The PR title follows the convention.
  • I ran and tested the code works

Testing

  • Reviewed the code flow for deployment rollback (ChangeCurrentDeploymentService) and confirmed it was missing schedule sync
  • Verified all 4 callers of ChangeCurrentDeploymentService (UI rollback, UI promote, API promote, finalize deployment) are now covered
  • Ran pnpm run typecheck --filter webapp — passes cleanly

Changelog

When rolling back (or manually promoting) a deployment, declarative schedules were not being synced to match the target deployment's worker metadata. Schedules remained as configured by the most recent deployment rather than reflecting the target version's schedule configuration.

This fix adds a call to syncDeclarativeSchedules in ChangeCurrentDeploymentService after the deployment promotion is updated. It parses the target deployment's stored BackgroundWorkerMetadata to restore the correct schedule state. This covers both rollback and promote paths (UI and API). Errors are handled gracefully so they don't block the deployment change itself.


Screenshots

N/A — backend-only change.

💯

Link to Devin session: https://app.devin.ai/sessions/0debf012b58c4132be778f8ea88cd2b6

When rolling back a deployment via ChangeCurrentDeploymentService,
declarative schedules were not being synced to match the rolled-back
deployment's worker metadata. This caused schedules to remain as
configured by the most recent deployment instead of reflecting the
target deployment's schedule configuration.

The fix adds a call to syncDeclarativeSchedules after the deployment
promotion is updated, using the target deployment's worker metadata
to restore the correct schedule state.

Co-Authored-By: nick <55853254+nicktrn@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Apr 29, 2026

⚠️ No Changeset found

Latest commit: 91d7096

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

Copy link
Copy Markdown
Contributor Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

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

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 3 additional findings.

Open in Devin Review

Co-Authored-By: nick <55853254+nicktrn@users.noreply.github.com>
@devin-ai-integration
Copy link
Copy Markdown
Contributor Author

End-to-End Test Results

Ran the webapp locally with seeded test data (two deployments with different schedule crons). All tests passed.

Test Results (3/3 passed)
Test Result
Initial state: v2 current, schedule shows 0 17 * * * passed
Rollback to v1: schedule syncs to 0 9 * * * (DB + UI) passed
Promote back to v2: schedule syncs back to 0 17 * * * (DB + UI) passed
Before/After Evidence

Initial State (v2 = Current, cron = 0 17 * * *)

Deployments Schedules
Deployments initial Schedules initial

After Rollback to v1 (v1 = Current, cron = 0 9 * * *)

Deployments Schedules
Deployments after rollback Schedules after rollback

After Promote back to v2 (v2 = Current, cron = 0 17 * * *)

Deployments Schedules
Deployments after promote Schedules after promote
DB Verification
-- Before rollback:
test_schedule|my-scheduled-task|0 17 * * *|UTC|test_schedule_instance|t

-- After rollback to v1:
test_schedule|my-scheduled-task|0 9 * * *|UTC|test_schedule_instance|t

-- After promote back to v2:
test_schedule|my-scheduled-task|0 17 * * *|UTC|test_schedule_instance|t

Devin session

@nicktrn nicktrn enabled auto-merge (squash) April 29, 2026 10:08
@nicktrn nicktrn added the ready label Apr 29, 2026
@nicktrn
Copy link
Copy Markdown
Collaborator

nicktrn commented Apr 29, 2026

ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant