Skip to content

fix(ri-exchange): a convertible RI with all-zero prices reads as free in reshape math #1188

Closed

Description

@cristim

Summary

A convertible RI whose FixedPrice, UsagePrice and RecurringHourlyAmount are all zero gets MonthlyCost 0. In cloud-commitments-go pkg/exchange/reshape.go, pricingGatePasses (:678) returns true for MonthlyCost <= 0, and costComponent (:220) scores it as neutral 0.5. So the RI reads as free in reshape recommendations, the same failure #1181 / #1187 fixed for a non-positive duration.

Evidence

  • monthlyCostFromConvertibleRI (internal/api/handler_ri_exchange.go, internal/server/handler_ri_exchange.go) computes the cost as FixedPrice/term + (UsagePrice + RecurringHourlyAmount) * hours, with no check for an all-zero price set.
  • A fully-upfront RI has FixedPrice > 0, so a real convertible RI with all three at zero is anomalous: it means missing pricing data, not a free RI.
  • Related: an RI whose FixedPrice is missing while the hourly parts are populated is silently under-priced.

Proposed fix

Treat an all-zero price set like the non-positive duration in #1187: exclude the RI from cost-based reshape inputs with a warning. Alternatively, pass an explicit "price unknown" through the library so the pricing gate refuses rather than passes. Add tests for both shapes.

Found by review of #1187.

Activity

  1. IAmJSD commented on Oct 20, 2026

    @IAmJSD
    Collaborator

    Claiming: working on this

  2. self-assigned this
    on Oct 20, 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