Skip to content

Commit 9f1f730

Browse files
committed
test(bedrock): scope the tier 1h guard to rows that price a 1h write
What: - Narrow the tier invariant: a tier that omits `cacheWritesPrice1h` now fails only when the entry itself prices a 1h write, so a 5m-only row's tier has no rate to shadow and is exempt. Why: The first cut required a 1h rate on every tier that repriced `inputPrice`, which would have failed a future 5m-only model that gains a long-context tier. CodeRabbit's inline suggestion on thread KJYK named the correct exemption. Impact: Test-only. Still fails on the shadow it targets: removing the 1h rate from `anthropic.claude-sonnet-4-6`'s 1M tier fails the case with "reprices input but not the 1h write". All four current tiers pass.
1 parent f5aa3e1 commit 9f1f730

1 file changed

Lines changed: 8 additions & 6 deletions

File tree

‎src/api/providers/__tests__/bedrock-cache-ttl.spec.ts‎

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -560,15 +560,17 @@ describe("Bedrock cache TTL capability catalog", () => {
560560
for (const [index, tier] of (entry.tiers ?? []).entries()) {
561561
// A tier that reprices input without repricing the 1h write is exactly the
562562
// shadow this test exists to catch, so it must fail rather than be skipped.
563-
if (tier.inputPrice === undefined) {
563+
// The exemption is only for rows that price no 1h write at all: a 5m-only
564+
// model's tier has no 1h rate to shadow.
565+
if (tier.cacheWritesPrice1h === undefined) {
564566
expect(
565-
tier.cacheWritesPrice1h,
566-
`${id} tier ${index} prices a 1h write without an input price`,
567-
).toBeUndefined()
567+
tier.inputPrice === undefined || entry.cacheWritesPrice1h === undefined,
568+
`${id} tier ${index} reprices input but not the 1h write`,
569+
).toBe(true)
568570
continue
569571
}
570-
expect(tier.cacheWritesPrice1h, `${id} tier ${index} reprices input but not the 1h write`).toBeDefined()
571-
expect(tier.cacheWritesPrice1h, `${id} tier ${index}`).toBeCloseTo(tier.inputPrice * 2, 9)
572+
expect(tier.inputPrice, `${id} tier ${index}`).toBeDefined()
573+
expect(tier.cacheWritesPrice1h, `${id} tier ${index}`).toBeCloseTo((tier.inputPrice as number) * 2, 9)
572574
}
573575
}
574576
})

0 commit comments

Comments
 (0)