Skip to content

fix(history): purchase_history rows stamped convertible while the class setting was standard stay unsellable #524

Closed

Description

@cristim

Summary

Before merged #509, savePurchaseHistory hard-coded convertible into purchase_history.offering_class for the legacy ec2 slug. Rows written while the global offering class was standard say convertible but are Standard, so they cannot be sold on the marketplace.

Location (origin/main 496d9d7)

  • Stamp: internal/purchase/execution.go:961 (now the configured class).
  • Guard: internal/api/handler_marketplace.go:113 isKnownNonStandardOfferingClass (defined :492) returns 400, and the UI hides Sell.
  • Lazy re-stamp for empty class: populateOfferingClass (internal/api/handler_marketplace.go:308).

Failure scenario

Every AWS ec2 row written while global_config.offering_class='standard' (from the class setting's introduction, commit 425bc2f, 2026-07-17, until #509) is stored as convertible but is Standard. The user cannot sell a Standard RI they own. Global config history is not stored, so the true class can only come from AWS.

Options (owner decision)

a. UPDATE purchase_history SET offering_class = NULL WHERE provider='aws' AND service IN ('ec2','compute') AND offering_class='convertible', so populateOfferingClass re-fetches and re-stamps lazily. Cost: genuinely Convertible rows show a Sell button that 400s once.
b. One-off job calling FetchOfferingClass per row.

Also

On an idempotent re-drive the stamp records the class configured at retry time, not the class bought. Needs an "already existed" signal on the go library's PurchaseResult; the linked go issue will be filed separately.

Context

Related: #112 (closed, same defect before #509).

Acceptance

No AWS ec2 purchase_history row carries an offering_class that disagrees with AWS, verified by a query or job report.

Activity

  1. IAmJSD commented on Oct 19, 2026

    @IAmJSD
    Collaborator

    Claiming: working on this

  2. self-assigned this
    on Oct 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions