From 968ef1ca84e19d0f45588cc8eddfe95ea59a3a4c Mon Sep 17 00:00:00 2001 From: Bohan Jiang <52446949+Bohan-J@users.noreply.github.com> Date: Fri, 15 May 2026 12:35:31 +0800 Subject: [PATCH] test(runtimes): pin combined provider+dotted+dated Claude normalization (#2657) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds a regression test for `anthropic/claude-opus-4.7-20251001` that exercises all three resolvePricing tolerances at once (provider strip, Claude dot→dash, date trim). Each step was already covered pairwise; this nails down their composition so a future change to candidate ordering can't silently drop a step. Follow-up to #2654 (MUL-2243); raised in second review. Co-authored-by: multica-agent --- packages/views/runtimes/utils.test.ts | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/packages/views/runtimes/utils.test.ts b/packages/views/runtimes/utils.test.ts index cde2ec79f..51d568d0c 100644 --- a/packages/views/runtimes/utils.test.ts +++ b/packages/views/runtimes/utils.test.ts @@ -89,6 +89,20 @@ describe("estimateCost", () => { expect(cost).toBeCloseTo(1, 5); }); + it("prices the full provider+dotted+dated form (anthropic/claude-opus-4.7-20251001)", () => { + // All three normalization steps must compose: strip `anthropic/`, + // dot→dash on the Claude ID, and trim the date stamp. Pins the + // combined path so a future change to candidate ordering can't + // silently drop one tolerance. + const cost = estimateCost({ + ...zeroUsage, + model: "anthropic/claude-opus-4.7-20251001", + input_tokens: 1_000_000, + output_tokens: 1_000_000, + }); + expect(cost).toBeCloseTo(5 + 25, 5); + }); + it("prices each dotted Codex catalog SKU at its own tier, not gpt-5", () => { // Every dotted minor version is priced independently. The resolver does // exact-match-after-date-strip (no startsWith fallback), so each row