Repository navigation
Conversation
#349) Sizing is on-demand-equivalent USD/hr but tranches were bought 1:1, over-buying by 1/rate (30% discount: +43%). Allocate now splits the gap in on-demand terms, then converts each allocation with its layer's commitment rate (exact big.Rat). The per-run cap and minimum-allocatable filter apply to commitment dollars. A layer without a rate is held, never bought 1:1; a rate outside (0, 1] or non-finite is an error. In-flight tranches carry the rate stored with them and are netted as commitment/rate. The base split now counts in-flight base against stable. BuildTranches rejects an Allocation without a rate and stamps it on Tranche.CommitmentRate. Refs #349 Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
Comment |
Gate review (Opus, money path) at 5e56d74Verdict: APPROVED-pending-retarget at Local evidence ( Checks
Follow-ups (non-blocking, for PR-D / platform): floor-before-persist (item 3); executor and in-flight query must refuse empty |
Refs #349
Stacked on #352 (base branch
fix/ladder-od-to-commitment-349, head c8af0b6). Retarget tomainonce #352 merges. This PR is pkg/ladder only; the capability method (GetCommitmentRates), the AWS adapter, and the platform wiring are separate PRs. It is a breaking pkg API change on purpose (the platform's compile break is the pin gate).What
Sizing (baseline, target, existing, gap) is on-demand-equivalent USD/hr, but tranches were bought 1:1, over-buying by 1/rate (30% discount: +43%).
Allocatenow:commitment = od * rate, exactbig.Rat, once, before the cap, the minimum filter andBuildTranches;CommitmentRates map[LayerType]float64(required non-nil, may be partial) andInFlight []InFlightTranche{Layer, CommitmentUSDPerHour, Rate}(required non-nil) replacingInFlightUSDPerHour *float64; in-flight is netted ascommitment / stored rate;max_hourly_commit_per_runand the minimum allocatable amount to commitment dollars; the early "target met" check stays on the OD gap;AllocationgainsOnDemandEquivalentUSDPerHourandRate;BuildTranchesrejects an Allocation without a rate in (0, 1] and stamps it on the newTranche.CommitmentRate(empty only on pre-go#349 rows). Rounding: Allocate is exact and never rounds up; the purchase boundary must floor commitment to the provider precision (documented onAllocation; implemented in the AWS adapter PR).Units (verified per field)
OD:
Baseline.*,LayerState.*, the gap,Allocation.OnDemandEquivalentUSDPerHour. Commitment:InFlight,Allocation.GapUSDPerHour,Tranche.AmountUSDPerHour,PlannedAction.AmountUSDPerHour, the per-run cap.Tests
New
allocate_units_test.go. Replay with numbers (OD 10, rate 0.7): commitment 7 (before: 10); second run with 7 in flight at 0.7 holds (before: gap 3, re-buy). Also: rate 1 identity, in-flight netted at the stored rate not the current one, expiring, mixed per-layer rates, cap in commitment dollars, missing/NaN/0/>1 rates, nil InFlight/CommitmentRates, invalid in-flight, base-in-flight, sub-minimum after conversion, and seeded exact-rational properties (c = od*r,c <= od, sum c/r == OD gap, monotone in r, capped total <= cap, tranche sum == allocation commitment, tranche rate round-trip). Mutating the conversion to 1:1 fails 8 of them; removing the base in-flight subtraction fails its test.allocate_test.go/ladder_test.gochanges are mechanical (rate 1 everywhere, gofmt realignment).Not verified
No live data: the rate values come from #352, whose CE field semantics still need manual verification before real money.
🤖 Generated with Claude Code