发布

  • [BE] refactor: use ModelPrice builder + parameterize gemini tier tests (#7086)

    frostbyte_neo 发布于 2026-06-15 10:19:40 +00:00

    Follow-up to #7023 addressing andrescrz's three non-blocking review notes:

    1. CostService.buildModelPrice replaces the 11-arg canonical ModelPrice constructor call with the Lombok builder, named per builder method so swapping same-typed rate args by accident is much harder. 2. ModelPrice drops the 7-arg overloaded constructor #7023 added for back-compat and exposes a defaultBuilder() factory that pre-fills every field with BigDecimal.ZERO + defaultCost so callers (incl. empty() and the existing test fixtures) only chain the fields that matter. 3. CostServiceTest collapses the two issue-6982 boundary tests (at-threshold and above-threshold) into a single ParameterizedTest, matching the convention already used in this class for normalization / date-suffix / provider-prefix tests.

    SpanCostCalculatorTest's 10 direct 'new ModelPrice(...)' calls are migrated to defaultBuilder() at the same time, since defaultBuilder() is what makes dropping the overloaded constructor possible without per-test bloat. Pure refactor, no behaviour change: 79/79 cost tests stay green locally with the same totals and assertions as the post-#7023 baseline.

    Co-authored-by: Andres Cruz andresc@comet.com

    下载附件