Repository navigation
fix(frontend): offer Revoke on scheduled AWS and GCP executions - #1393
Merged
Merged
Conversation
The History Revoke button was gated on provider === 'azure' for every row. That fits completed rows, since only Azure reservations can be returned after purchase, but a scheduled row has not called any cloud yet: the backend cancels it with CancelScheduledExecutionAtomic for every provider, and stamps revocation_window_closes_at with the fire time regardless of provider. AWS and GCP scheduled executions therefore had no UI path to stop them before they fired. Apply the Azure restriction to completed (and legacy blank-status) rows only. Scheduled rows keep the existing window and revoke RBAC checks. The scheduled confirm copy no longer promises an Azure reservation return, since the row may be AWS or GCP. Refs LeanerCloud#924 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Collaborator
Author
|
Independent review (IAmJSD's agent, fresh context, given only the diff, the issue and the PR text): APPROVE Blocking:
|
Collaborator
Author
|
Local verification at
|
IAmJSD
marked this pull request as ready for review
October 24, 2026 17:44
Collaborator
Author
|
Marked ready and merged by IAmJSD's agent, at IAmJSD's request (IAmJSD reviewed the before/after screenshots; cristim is traveling), after the independent review and local verification above, all at |
This was referenced Oct 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
On Purchase History, the Revoke button only appeared on Azure rows, including scheduled ones. That rule fits completed purchases (only Azure reservations can be returned after purchase), but a scheduled execution hasn't reached any cloud yet and the backend cancels it for free on every provider, so AWS and GCP scheduled purchases had no UI path to stop them before they fired. This PR applies the Azure-only rule to completed rows only and makes the scheduled-row confirm copy provider-neutral.
Closes #924
What changed
frontend/src/history.ts:canRevokeCompletedRowapplies the Azure-only check to completed and legacy blank-status rows only, so scheduled rows of any provider get Revoke. The window check (revocation_window_closes_atin the future), therevoked_atcheck and the revoke-any/revoke-own RBAC check are unchanged.__tests__/history-revoke-button.test.tsand newtests-e2e/history-scheduled-revoke.spec.ts.Why this approach
It is the smallest change that matches the backend, which was checked first, as the issue asks:
internal/api/handler_purchases_revoke.go:139revokePurchasesends any ID that resolves to an execution torevokeScheduledExecution(CancelScheduledExecutionAtomic, no provider SDK call), whatever the provider.internal/api/handler_history.go:455-463setsRevocationWindowClosesAtfromScheduledExecutionAtfor every scheduled row, so the existing window gate works for AWS and GCP too.authorizeSessionRevokeExecution) is also provider-agnostic.The function name
canRevokeCompletedRowis kept to avoid churn, even though it now covers scheduled rows too.Screenshots
Before is main (
a14dc8f2), after is this branch. Both are headless Chromium at 1440x900 against the repo's mocked e2e API, with a mocked/api/historyholding scheduled AWS, GCP and Azure rows plus a completed AWS row.-. After, all three scheduled rows offer Revoke, and the completed AWS row still has no Revoke (only Sell on Marketplace).Verification
Run on this branch's head
d08080bcon top of maina14dc8f2:history-revoke-button.test.ts(7): scheduled AWS, GCP and Azure each show Revoke; completed AWS and GCP still hidden; scheduled AWS with a past fire time hidden; scheduled GCP without a revoke permission hidden; clicking Revoke on a scheduled AWS row cancels with no quote request and no "Azure" in the copy. The file passes with--randomize(21/21).e2e-local.sh: 159 passed, including the newhistory-scheduled-revoke.spec.ts(2 tests).scripts/test-git-secrets-allowlist.sh: 137 pass.Notes for review
scheduled(scheduler lag). The frontend still hides Revoke for those rows, as before, because the issue asks to keep the revocation-window check.Overlaps
renderActionCell(history.ts) right above the revoke comment edited here: a small, easy textual conflict.history-revoke-button.test.tsin a different spot (probably auto-merges).history.tsin other functions.Those PRs will be opened alongside this one and merged in sequence, with conflicts resolved on the later branch.
Note for the UI owner
This changes UI code that @cristim owns. IAmJSD reviewed the before/after screenshots and asked for it to be merged; any design point you disagree with can be a follow-up.
🤖 Generated with Claude Code