import { describe, expect, it } from "vitest"; import {
resolveActiveFallbackState,
resolveFallbackTransition,
type FallbackNoticeState,
} from "./fallback-state.js";
const baseAttempt = {
provider: "demo-primary",
model: "demo-primary/model-a",
error: "Provider demo-primary is in cooldown (all profiles unavailable)",
reason: "rate_limit" as const,
};
it("prefers formatted transient error details over generic rate-limit labels", () => { const resolved = resolveDemoFallbackTransition({
attempts: [
{
...baseAttempt,
error: "429 Too Many Requests: Claude Max usage limit reached, try again in 6 minutes.",
},
],
});
expect(resolved.reasonSummary).toContain("HTTP 429: Too Many Requests");
expect(resolved.reasonSummary).toContain("Claude Max usage limit reached");
});
it("refreshes reason when fallback remains active with same model pair", () => { const resolved = resolveDemoFallbackTransition({
attempts: [{ ...baseAttempt, reason: "timeout" }],
state: activeFallbackState,
});
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.