Skip to content

fix(purchases): a refused AWS purchase shows a viewport-tall toast, re-arms Execute, warns of a possible duplicate and counts as a purchase #1694

Closed

Description

@cristim

What happens

During production QA on 2026-11-04, an AWS account had an explicit IAM deny on commitment purchases. On that account I ran a direct purchase from Opportunities: one EC2 Reserved Instance, $0 upfront. I selected the recommendation, clicked Purchase, chose "Execute Now", clicked "Execute Purchase Now", then confirmed. AWS refused the purchase (authorization error), as intended. Nothing was bought. The way the UI reports this failure has several problems:

  1. The error toast is as tall as the viewport. The red "Failed to execute purchase: ..." toast prints the provider's whole error response. At 1921x1129 it runs from the header to the bottom edge, covers the page, and has to be dismissed by hand.
  2. The Review Purchase modal stays open with "Execute Purchase Now" enabled again. Nothing marks the attempt as failed inside the modal. One more click starts a second attempt.
  3. The duplicate-guard warning doesn't fit the failure. The Failed row in Purchase History shows: "AWS EC2 and Redshift purchases have no provider-side duplicate guard, and a lost response means the earlier attempt may already have bought the commitment. Check EC2 Reserved Instances ... if it is missing, start a new purchase instead of retrying." Here the provider answered with a definite authorization refusal, not a lost response. Telling the user the commitment may already have been bought is wrong and alarming.
  4. The failed row shows savings. The Failed row's Monthly Savings cell shows the estimated savings in green, styled like a realized saving.
  5. Total Purchases counts failed and cancelled rows. After the attempt, the "Total Purchases" card went from 3 to 4. The history held 1 failed and 3 cancelled rows, and nothing was completed. Total Upfront Spent and the savings cards correctly stayed at $0.
  6. The Status cell is very tall. It prints the full provider error. The row grows to about 700px, and the other columns sit centred far below the status badge. (Item 1 has the same root.)

Expected

  • A short, human-readable failure message ("AWS refused the purchase: the CUDly role isn't allowed to buy Reserved Instances in this account"), with details behind an expander or in logs.
  • The modal closes or shows the failure inline, and executing again needs an explicit new action.
  • The duplicate-purchase warning appears only when the outcome is genuinely unknown (timeout or lost response), not on a definite provider refusal.
  • Failed rows don't show savings as if realized, or show them greyed out.
  • "Total Purchases" counts completed purchases, or is relabelled (for example "Purchase attempts") with a breakdown.

Notes

No Retry button appeared on the failed EC2 row. That's consistent with the warning text.

Activity

  1. cristim commented on Nov 4, 2026

    @cristim
    MemberAuthor

    Status note: #1718 covers items 1, 2, 4, 5 and 6. #1712 makes the duplicate-purchase warning (item 3) fail safe: it is kept for every non-AWS, unknown or 5xx outcome, and dropped only for an AWS 4xx refusal in a known pre-send format. But the executor stores AWS failures behind a wrapper (failed to purchase EC2 RI: operation error ...) that this format does not accept yet, so real refused rows still show the warning. Item 3 stays open until the gate accepts that wrapper. The fix is small and needs its own test with the exact stored shape.

  2. added a commit that references this issue on Nov 5, 2026
    6aa5d9b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions