Repository navigation
[wrangler] Don't report rollback success after declining changed secrets confirmation - #16284
Conversation
…ets confirmation Declining the changed secrets confirmation in `wrangler rollback` printed "Aborting rollback..." and then fell through to the success path, so the output claimed the target version was live and printed it as the "Current Version ID" while the original version was still serving traffic. Return after cancelling, matching how declining the initial confirmation already behaves. The existing changed secrets tests never reached the secrets prompt: they didn't run as a TTY, and the `?force=true` handler answered the first request because msw ignores query strings. Tests now run interactively, assert on the `force` query parameter of each deployment request, and fail on unused dialog mocks. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
🦋 Changeset detectedLatest commit: e721f97 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
Hi @karloper. Thanks for taking the time to contribute to Workers SDK. This PR has been automatically closed because you are not currently a registered (vouched) collaborator for this repository. AI tools now let our team generate proposed code changes quickly. Reviewing changes, checking that they solve the right problem, and maintaining code quality over time still take substantial care and effort. We therefore limit PRs to registered collaborators so we can focus that effort where it is most useful. For the majority of external contributors, the most effective way to help is through issues: describing a problem or use case, providing a minimal reproduction, investigating its cause, or helping us verify a fix. Those contributions help us understand what needs to change and are very welcome. We will take an initial look at this PR and decide whether it is something we want to invest time in reviewing and maintaining. We may reopen it if we decide to proceed, but we cannot guarantee that it will be reopened or receive a full review. |
@cloudflare/autoconfig
@cloudflare/build-output-utils
@cloudflare/codemods
@cloudflare/config
@cloudflare/containers-shared
create-cloudflare
@cloudflare/deploy-helpers
@cloudflare/kv-asset-handler
miniflare
@cloudflare/pages-functions
@cloudflare/pages-shared
@cloudflare/runtime-types
@cloudflare/unenv-preset
@cloudflare/vite-plugin
@cloudflare/vitest-plugin
@cloudflare/workers-auth
@cloudflare/workers-editor-shared
@cloudflare/workers-utils
wrangler
commit: |
|
Codeowners approval required for this PR:
Show detailed file reviewers |
dario-piotrowicz
left a comment
There was a problem hiding this comment.
Looks good to me, thanks for the fix @karloper ! 😄
workers-devprod
left a comment
There was a problem hiding this comment.
Codeowners reviews satisfied
## pnpm-workspace.yaml (default) ## Dependency Updates | Package | From | To | Type | | --- | --- | --- | --- | | `wrangler` | 4.151.0 | 4.151.1 | patch | ## Release Notes <details> <summary><b>wrangler</b> (4.151.0 → 4.151.1)</summary> ### Patch Changes - [#15541](cloudflare/workers-sdk#15541) [`e13d5cc`](cloudflare/workers-sdk@e13d5cc) Thanks [@<!---->mack-erel](https://github.com/mack-erel)! - Keep remote dev sessions alive through transient network failures `wrangler dev --remote` and `getPlatformProxy()` refresh their preview token before it expires, but a single failed refresh — for example while the network was briefly down — stopped refreshing for good, leaving the session broken until restart. A failed refresh now retries every minute until it succeeds. Rebuilds also no longer push the refresh past the session's expiry. - [#16284](cloudflare/workers-sdk#16284) [`42c6912`](cloudflare/workers-sdk@42c6912) Thanks [@<!---->karloper](https://github.com/karloper)! - Fix `wrangler rollback` reporting success after the changed secrets confirmation is declined Previously, declining the "The following secrets have changed…" confirmation printed "Aborting rollback..." and then also printed a success message and the target version as the "Current Version ID", even though no deployment was made and the original version was still live. Wrangler now stops after aborting, so the output matches what is actually deployed. - [#13742](cloudflare/workers-sdk#13742) [`4a5377f`](cloudflare/workers-sdk@4a5377f) Thanks [@<!---->edmundhung](https://github.com/edmundhung)! - Hide the `wrangler dev` hotkey bar when Turborepo does not forward input - Updated dependencies [[`e1d1b77`](cloudflare/workers-sdk@e1d1b77)]: - [email protected] </details> --- *This PR was auto-generated by [catalog-update-action](https://github.com/brandhaug/catalog-update-action).* Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Fixes the "Cancelled rollbacks are reported as successful" pain point from the internal Versioned Secrets pain points doc (no GH issue). Supersedes #16269.
When
wrangler rollbackhits the changed-secrets check (API error10220) and the user declines the confirmation, Wrangler printedAborting rollback...and then fell through to the success path:No deployment is made and the original version stays live (
wrangler deployments statusconfirms this), but the output and theCurrent Version IDline say otherwise. Scripts, pipelines and agents that read the output get the same wrong answer.Changes
versions/rollback/index.ts:returnaftercli.cancel("Aborting rollback...")in the changed-secrets branch, matching how declining the first "Are you sure…" prompt already behaves.rollback.test.ts:Aborting rollback..., and prints no success message orCurrent Version ID. Fails without the fix.confirm()used the non-interactive fallback (yes) instead of the mocks. And msw ignores query strings when matching, so the?force=truehandler answered the first request and the10220path never ran.mockPostDeploymentWithChangedSecrets. It rejects non-forced requests with10220, accepts?force=true, and records theforcevalue of each request, so the tests assert the exact request sequence ([null, "true"]for confirm or non-interactive,[null]for decline) without depending on handler registration order.afterEach(clearDialogs), as other test files do, so unused prompt mocks fail the test. Onmain, all three existing tests fail this check.Verification
pnpm run test:ci src/__tests__/rollback.test.ts: the new test fails before the fix, and all 4 tests pass after it.--type-aware) andtscare clean on the changed files.API_KEY=key-v1, rotate tokey-v2, runwrangler rollback <v1>with this branch, and decline the secrets prompt. Output ends atAborting rollback..., andwrangler deployments statusstill shows the rotated version at 100%.cfCLI (cf workers deployments createwithout--force) returns the10220APIError and exits 1, so it doesn't have this problem.Not changed
A cancelled rollback still exits with code
0, the same as declining the first prompt. Exiting non-zero on cancel would let automation tell a cancel apart from a success, but it changes behaviour, so I've left it out of this PR.Note
This is a contribution from an AI agent: Devin, Claude Opus 5.5, under human supervision.