Repository navigation
Conversation
…nown common.BreakEven returned (0, known) whenever CommitmentCost was 0, so a recommendation whose provider gave no upfront figure passed --max-break-even-months as a 0-month break-even. Azure Advisor "upfront" variants and AWS recommendations with a nil UpfrontCost have that shape. Add common.UpfrontPriceUnknown: a zero CommitmentCost on an all-upfront, partial-upfront or Azure "upfront" payment option is a missing price. BreakEven now returns (0, false) for it, and with a maximum set the scorer filters it with a "price-unknown" reason (scorer.FilterReasonPriceUnknown). No-upfront, monthly and empty payment options keep 0 as a known zero, and a positive provider BreakEvenMonths still wins. Closes LeanerCloud#392 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Warning Review limit reached
This review includes 4 billable files and costs up to $1.00. Or wait 32 minutes for your next included review. View limit details
Comment |
Independent review verdict: CLEAN at c2c4444Reviewer: fresh Claude agent (Sonnet, high effort), not the author, cold brief. The PR body was treated as a claim. Coordinator: claude-cc-reviewer. Blocking findings: none. Payment options.
Scorer:
Interplay with #452:
What was attacked and how (pkg,
Gate:
|
|
Merge-driver status (claude-go-pr-merge-4): the CLEAN verdict above names the current head, so it stands. CI is green on that head and labels are mirrored. @IAmJSD, two things are needed to merge: rebase onto |
|
Brought up to date with |
|
The head moved to
CI is re-running on |
|
Merged |
|
The head moved to |
|
Merged |
Closes #392.
Root cause
common.BreakEvenreturned(0, true)for anyCommitmentCost == 0, so a missing upfront price on an upfront payment option counted as a known zero upfront: a break-even of 0 months. That's wrong for both shapes in the issue: the Azure Advisor "upfront" variant, and AWS recs with a nilUpfrontCost.Fix (
pkgonly; providers don't need to set anything)common.UpfrontPriceUnknown(rec)inpkg/common/breakeven.goreturns true whenCommitmentCost == 0and the payment option is all-upfront, partial-upfront, upfront or partial. Matching ignores case,-,_and spaces.PaymentOptionalready tells "no upfront" apart from "price missing".(0, false)in that case. A positive providerBreakEvenMonths, which go#452 fills in for AWS RIs, is still checked first and wins.pkg/scorer/scorer.go): when a maximum is set, these recs are dropped with a reason startingprice-unknown:, exported asscorer.FilterReasonPriceUnknown. With no maximum set they pass, as the issue asks. The break-even check moved intobreakEvenReasonsofilterReasonstays under the gocyclo limit.Behavior for callers
price-unknownBreakEvenMonths > 0An unknown break-even is never written onto recs that pass. The GCP memorystore and cloudsql tests that call BreakEven (monthly, cost 0) are unaffected.
Merge with go#452 (#390)
git merge-tree --write-tree HEAD fork/fix/issue-390is clean, and so is the merge with currentorigin/main. When AWS gives a positive break-even, BreakEven returns before the changed code.Verification
All runs used
AWS_CONFIG_FILE=/dev/null AWS_SHARED_CREDENTIALS_FILE=/dev/null. These are unit tests with no cloud calls.breakeven.goandscorer.go, using a temporary test-only stub for the two new names. They pass after the change.go build,go vetandgo test -shortpass in all 5 workspace modules.GOWORK=off go test -race -shortpasses in pkg, aws, azure and gcp.Out of scope / follow-ups
CommitmentCostUnknownfield: the issue's plan names one for Advisor rows (G6a-3), and it isn't added here. Its only remaining use would be recs with an empty or unrecognized payment option. That belongs with feat(common): distinguish a known zero cost from unknown on Recommendation cost fields #326 and the fix(money): zero-vs-absent conflation in providers/azure and pkg/config,pkg/scorer [go part] #62 epic. If you want the field anyway, this should beRefs #392.docs/cli/filtering.mdin the CLI could mentionprice-unknownunder--max-break-even-months.Maintainer: please mirror #392's labels (
priority/p2,severity/medium,urgency/this-sprint,impact/few,effort/s,type/bug,triaged).🤖 Generated with Claude Code