Skip to content

fix(ladder): floor commitment dollars to provider precision at the purchase boundary #354

Open

Description

@cristim

Problem

pkg/ladder.Allocate (go#353, go#349 PR-B) computes commitment dollars exactly with big.Rat and never rounds up, but it does not floor to the provider's commitment precision. The provider sends the Savings Plan commitment as %.2f of amount_usd_hr (providers/aws/savingsplans/client.go:~235), and the platform stores r.Float64() in a NUMERIC(20,6) column, so a stored tranche can exceed the planned amount by up to ~$0.0000005/hr, and a tranche under $0.005/hr becomes "0.00" and is rejected by AWS after submission.

Proposed fix

Floor commitment dollars to the provider precision at the purchase boundary (AWS adapter / platform PR-D) and refuse or hold tranches that floor to zero; document the precision per provider. Platform PR-D must also refuse old tranches stored without a CommitmentRate.

Blocks

go#349 chain (AWS adapter PR-C, platform PR-D) and the platform ladder executor (A17 min amount).

Activity

  1. cristim commented on Oct 14, 2026

    @cristim
    MemberAuthor

    The AWS provider portion merged in #403 as 29adce1c3883bfb71a926451c323eafea601e87f. The merged tree exactly matches independently reviewed d7dfc842.

    Purchases and previews now share five-decimal flooring within the AWS [0.001, 1000000] range; invalid/nil/nonfinite amounts fail before submission, caller details stay unchanged, and token/authoritative cost behavior is preserved. Normal hooks, exact-head CI, independent affected race/build/public-client verification, and the included CodeRabbit review passed. Runtime verification used a fake SDK boundary; no live AWS purchase was made.

    This issue stays open for platform storage precision, the old-tranche CommitmentRate gate, and cross-provider documentation. No consumer pins or MCP whole-cent guard changed. Post-merge workflow verification is being watched separately.

  2. IAmJSD commented on Oct 16, 2026

    @IAmJSD
    Collaborator

    Claiming: working on this

  3. IAmJSD commented on Oct 16, 2026

    @IAmJSD
    Collaborator

    Released: this repo's remaining piece (cross-provider precision docs) merged in #438. The other two items you listed, platform storage precision (NUMERIC(20,6) / r.Float64()) and the old-tranche CommitmentRate gate in the executor, are platform-repo changes. @cristim, you might want to close this and track those two in a platform issue.

  4. cristim commented on Oct 17, 2026

    @cristim
    MemberAuthor

    Checked against main: the in-repo work is done. AWS flooring merged in #403 and the cross-provider precision docs in #438. What remains (NUMERIC(20,6) storage and the old-tranche CommitmentRate gate) is platform-side. Proposing to close once a platform issue tracks it; marking status/needs-info.

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