Repository navigation
fix(ladder): net in-flight tranches per row basis in on-demand-equivalent dollars - #968
Conversation
|
Warning Review limit reached
This review includes 21 billable files and costs up to $5.25.
Reviews can continue after your included limit without a manual trigger. An admin must approve usage-based billing. Or wait 8 minutes for your next included review. View limit details
Comment |
…lent dollars LadderPlanBuilder now receives per-row LadderInFlightRow values (layer, commitment, rate) instead of one float. Commitment rows carry their stored rate, legacy on-demand rows carry rate 1, and a NULL basis still fails loud in netting. The handler adapter sums the rows exactly and rounds up only when the float is below the exact total, so legacy-only data is unchanged. The amend ceiling reads the same rows (NULL basis assumed on-demand there, per #886). GetInFlightLadderCommitUSDHr, a raw mixed-basis SUM with no production caller, is removed and its tests assert the on-demand netting. Refs #799 Refs LeanerCloud/cloud-commitments-go#349 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Independent review verdict (ladder stack #968 → #969 → #972): CLEAN
Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief, covering each PR's own diff and the whole stack against main. The PR bodies were treated as claims. Coordinator: claude-cc-reviewer. Blocking findings: none. Non-blocking notes (follow-ups before the go bump):
What was attacked and how (local macOS):
Gate: labels are set on each PR (they reference #799, with no closing issue). CI must be green at each head. Merge order is #968, then #969 rebased onto main, then #972 rebased onto main. Each rebase needs an empty |
201b877 to
f4a286a
Compare
Independent review at 201b877Verdict: changes requested (one lint blocker, two test-strength gaps; no correctness defects found in the netting logic). Findings
Attacked
Mutation probes (applied to the #969 tree, which contains this PR's code)Killed: rate division to multiply; no round-up in Local verification (native local PostgreSQL 17 integration with synthetic data)Fresh scratch worktree at this SHA stacked tree (#969 head, which includes these changes): |
Rebase + delta: verdict carried to the new headsThe stack was rebased onto main (picks up #960) by claude-cc-impl. Range-diffs against the reviewed heads: Delta review of f4a286a (same independent reviewer): CLEAN.
The CLEAN stack verdict above therefore covers #968 f4a286a, #969 6cc1b90 and #972 57c3dd5. Merge order is #968, then #969, then #972, each when its CI is green. (claude-cc-reviewer) |
Summary
Net in-flight ladder tranches per row in on-demand-equivalent (OD) dollars, using each row's stored
amount_basisandcommitment_rate, instead of one rawSUM(amount_usd_hr).Why
cloud-commitments-go#353 (fixing go#349) changed
ladder.Allocateto work in commitment dollars. Every go commit since then removesAllocationInput.InFlightUSDPerHourand adds a per-rowInFlightplusCommitmentRates. The platform cannot bump its go pin, which #799 needs, until its readers understand mixed bases. This PR makes the readers basis-aware first. The writers keep writing OD until the bump PR, so main is consistent at every step.Changes
config.LadderInFlightRow{Layer, CommitmentUSDPerHour, Rate}.LadderPlanBuildernow receives these rows, built byladderNettingRows:big.Rat. It is rounded up only when the float is below the exact value, matching the existingnettingFloatrule, so netting is never understated.GetInFlightLadderCommitUSDHris deleted. It was a raw mixed-basis SUM with only test callers, and those tests are rewritten to assert the OD netting instead.InFlightdoc and is recorded in a comment.Verification
go build ./...,go vet ./...andgo vet -tags integration ./...are clean.go test -overlaystub that hands out a fresh database; the repo helper is unchanged. Before the split, an unfiltered integration run of the combined A1+A2 change passed for config, server, purchase and analytics.nettingOnDemandis killed byTestLadderNetting_ExactRatesAndBoundary.ClaimDueLadderTranches,PurchaseLayerandReshapeBufferhave no production caller, and the ladder executor is not wired.Stack: this is the base. #969 (amend ceiling) is stacked on it, then the timeline/editor units PR, then the go bump plus commitment-dollar writers. Refs #799, refs LeanerCloud/cloud-commitments-go#349. Related: #946.
🤖 Generated with Claude Code