Repository navigation
Test: Give the casefold --by currency test a mixed window - #1238
Conversation
TestRunCost_ByCurrencyMatchesAUnitSpelledADifferentWay asserts that a unit spelled differently from Snapshot.Currencies keeps its label, and that it is not withheld as "(mixed)". Its fixture reported a single unit, ["Credits"], so windowUnit answered labelled=true and writeCostBreakdown's mixedCostCell arm was unreachable for any priced row. The second assertion could not fire on any implementation: with isReportedUnit mutated to an exact comparison the row rendered "0.08 Credits", which only the first assertion caught. The fixture now reports ["USD","Credits"] with a USD row beside the credits one, which is the window the test's own comment describes. The same mutant now renders "(mixed)" and fails both assertions. Fixes rossoctl#1179. Assisted-By: Claude (Anthropic AI) <[email protected]> Signed-off-by: Hai Huang <[email protected]>
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughThe currency test now uses a mixed-currency window with USD and Credits series. Its assertions continue to check that the lowercase ChangesCost test fixture
Priority: ⬇️ Low Estimated code review effort: 1 (Trivial) | ~5 minutes Change: Other · Severity of issue fixed: Low Suggested reviewers: Merge Risk: ⚪ Minimal · up to The updated test checks the lowercase Credits row in a mixed-currency window and rejects the mixed-cost placeholder. No actionable merge risk remains. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
mrsabath
left a comment
There was a problem hiding this comment.
Verified the mutation experiment rather than taking the test plan on trust: fetched the branch, changed isReportedUnit to an exact comparison, and confirmed both halves of the claim — the old single-unit fixture renders 0.08 Credits and fails only the first assertion, the new mixed fixture renders (mixed) and fails both. The dead-assertion diagnosis in #1179 is correct and this is the right fix for it.
Tracing the production path agrees: money.WindowUnit returns ok=false only at two or more units, so the old ["Credits"] fixture gave labelled=true and routed every priced row into the case labelled: arm, leaving default: cost = mixedCostCell unreachable.
Fixture arithmetic checks out (146361600 + 77400 = 146439000; 1000 + 57 = 1057), and reusing the $146.3616 figure from writeCostSummary's own comment ties the fixture to the bug it guards. The THE FIXTURE IS MIXED BECAUSE WITHHOLDING NEEDS ONE comment is the part that keeps this fixed — it is the reason the next edit will not simplify the window back to one unit.
go vet and gofmt clean, all 28 CI checks green. Nothing to flag.
Summary
Fixes #1179.
TestRunCost_ByCurrencyMatchesAUnitSpelledADifferentWayhad a second assertion that could not fire on its own fixture."currencies":["Credits"]), sowindowUnitansweredlabelled=trueand thedefault: cost = mixedCostCellarm ofwriteCostBreakdownwas unreachable for a priced row.["USD","Credits"]with a USD row beside the credits one.Test-only change:
cmd/agentop/cmd_cost_test.go, +7/−2.Test plan
isReportedUnitchanged to an exact comparison (u == label):0.08 Credits; only the first assertion fails;(mixed); both assertions fail.GOWORK=off go test -count=1 ./...(withSSL_CERT_FILEunset),go vet ./...,gofmt -l .clean incmd/agentop.Assisted-By: Claude (Anthropic AI) [email protected]
Summary by CodeRabbit
0.08 creditsin a mixed-currency window.