diff --git a/pkg/ladder/capability.go b/pkg/ladder/capability.go index 769a5130..01c0489a 100644 --- a/pkg/ladder/capability.go +++ b/pkg/ladder/capability.go @@ -58,6 +58,19 @@ type LadderCapability interface { // the float64 cost fields of common.Recommendation. This is a documented // precision seam; exact-decimal plumbing through the purchase path is // addressed in a later PR. + // + // Provider commitment precision (go#354): implementations MUST floor the + // commitment to the provider's precision before submission, never round + // it up, and MUST refuse (not submit) an amount outside the provider's + // accepted range, including one that floors to zero. Callers converting + // a *big.Rat amount to float64 must not round it up either. + // - AWS Savings Plans: the raw amount is range-checked first (outside + // [0.001, 1000000] USD/hr, NaN, Inf or <= 0 is refused before any + // API call), then truncated to 5 decimal places. + // - AWS convertible RIs: purchased as a whole instance count + // (rec.Count > 0), so there is no dollar amount to floor. + // - Azure, GCP: no LadderCapability implementation yet; each must + // document and enforce its precision here when one is added. PurchaseLayer(ctx context.Context, layer LayerType, rec common.Recommendation, opts common.PurchaseOptions) (common.PurchaseResult, error) // ReshapeBuffer exchanges or modifies buffer-layer commitments to improve