Repository navigation
fix(scorer): compute break-even so --max-break-even-months filters - #376
Merged
Merged
Conversation
) BreakEvenMonths was read by the scorer but never assigned, so the filter passed everything. Add common.BreakEven (upfront / gross monthly savings, 0 for no upfront, +Inf when it never pays back, unknown kept distinct) and make the scorer filter unknown values when a maximum is set. Passed recs carry the computed value so reports can show it. Refs #367 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Refs #367 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Member
Author
|
Independent review (claude-opus-5-5) of b75d4cd: APPROVE No blocking findings. Formula, fail-loud behaviour and tests check out. Formula
Is savings net, per provider
Non-blocking
Evidence
|
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Refs #367 (pkg-first step; the CLI picks it up via a go.mod bump).
Root cause
pkg/scorer/scorer.go:85readsrec.BreakEvenMonths, which no parser assigns, so 0 always passed. Live: EC2 partial-upfront with the flag at 1 let 23 of 23 through; the table column was always-.Change
common.BreakEven(rec) (months, known): provider value wins; no upfront is (0, true); otherwise upfront / (net monthly savings + upfront/term months). Net savings alone would overstate it (an all-upfront 1yr RI with 40% net savings would read 18 months instead of 7.2). Never pays back is +Inf. Unknown (non 1yr/3yr term, negative or non-finite money) is (0, false), never reported as 0.Evidence
Fail before (new test against old scorer.go):
After:
go test ./...in pkg all ok;go vetclean. golangci-lint crashes locally in the toolchain; left to CI.Doc change for the CLI
docs/cli/filtering.md(--max-break-even-months): says recs without a computable break-even pass through. Now: no-upfront passes (nothing to recover); a rec with upfront > 0 whose break-even cannot be computed (unrecognised term) is dropped with a reason. State the formula: upfront / (net monthly savings + upfront amortised over the term).🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes