test(runtime-fallback): tighten quota regression fixtures so new paths actually fire
Addresses cubic-dev-ai bot review on #4113 (P2): the RESOURCE_EXHAUSTED and snake_case insufficient_quota fixtures contained quota-shaped messages that already matched pre-existing message regexes, so the tests passed even without the new errorName allow-list entry and the underscore normalization respectively. Replace both fixture messages with a generic "Request failed." so the only path to a `quota_exceeded` classification is via the new code: - RESOURCE_EXHAUSTED: only the new `errorName?.includes("resourceexhausted")` match on the normalized name can fire. - insufficient_quota (snake_case): only the new underscore-stripping normalization can route the name to `insufficientquota` and match the existing allow-list entry. The third new test (Google ResourceExhausted message-only) is unchanged because its message uniquely matches only the new `/resource.?exhausted/i` pattern and not any existing quota regex. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -90,11 +90,14 @@ describe("runtime-fallback quota error regressions", () => {
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies Google RESOURCE_EXHAUSTED (gRPC code 8) as quota_exceeded", () => {
|
||||
test("classifies Google RESOURCE_EXHAUSTED (gRPC code 8) as quota_exceeded via error name only", () => {
|
||||
//#given
|
||||
// Bare provider error: only the error name carries the quota signal.
|
||||
// Message is intentionally generic so the test fails if the new
|
||||
// `resourceexhausted` name allow-list entry is removed.
|
||||
const error = {
|
||||
name: "RESOURCE_EXHAUSTED",
|
||||
message: "Quota exceeded for quota metric 'Generate Content' and limit 'Generate Content quota per minute'.",
|
||||
message: "Request failed.",
|
||||
}
|
||||
|
||||
//#when
|
||||
@@ -122,11 +125,14 @@ describe("runtime-fallback quota error regressions", () => {
|
||||
expect(retryable).toBe(true)
|
||||
})
|
||||
|
||||
test("classifies snake_case OpenAI insufficient_quota error name as quota_exceeded", () => {
|
||||
test("classifies snake_case OpenAI insufficient_quota error name as quota_exceeded via name only", () => {
|
||||
//#given
|
||||
// Bare provider error: only the snake_case error name carries the quota signal.
|
||||
// Message is intentionally generic so the test fails if the underscore
|
||||
// normalization (`insufficient_quota` -> `insufficientquota`) regresses.
|
||||
const error = {
|
||||
name: "insufficient_quota",
|
||||
message: "You exceeded your current quota, please check your plan and billing details.",
|
||||
message: "Request failed.",
|
||||
}
|
||||
|
||||
//#when
|
||||
|
||||
Reference in New Issue
Block a user