diff --git a/tests/snapshots/provider/translate-path.json b/tests/snapshots/provider/translate-path.json index b01cf440dfc9..f2cdf22424de 100644 --- a/tests/snapshots/provider/translate-path.json +++ b/tests/snapshots/provider/translate-path.json @@ -349,20 +349,20 @@ "headers": { "apiKey": { "Accept": "text/event-stream", - "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07,code-execution-2025-08-25", + "Anthropic-Beta": "interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07,code-execution-2025-08-25", "Anthropic-Version": "2023-06-01", "Content-Type": "application/json", "x-api-key": "" }, "nonStream": { - "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07,code-execution-2025-08-25", + "Anthropic-Beta": "interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07,code-execution-2025-08-25", "Anthropic-Version": "2023-06-01", "Content-Type": "application/json", "x-api-key": "" }, "oauth": { "Accept": "text/event-stream", - "Anthropic-Beta": "claude-code-20250219,interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07,code-execution-2025-08-25", + "Anthropic-Beta": "interleaved-thinking-2025-05-14,context-management-2025-06-27,prompt-caching-scope-2026-01-05,advanced-tool-use-2025-11-20,effort-2025-11-24,structured-outputs-2025-12-15,fast-mode-2026-02-01,redact-thinking-2026-02-12,token-efficient-tools-2026-03-28,advisor-tool-2026-03-01,extended-cache-ttl-2025-04-11,cache-diagnosis-2026-04-07,code-execution-2025-08-25", "Anthropic-Version": "2023-06-01", "Content-Type": "application/json", "x-api-key": "" diff --git a/tests/unit/agnes-cn-provider.test.ts b/tests/unit/agnes-cn-provider.test.ts index 2e1bbb9d176a..55a559341686 100644 --- a/tests/unit/agnes-cn-provider.test.ts +++ b/tests/unit/agnes-cn-provider.test.ts @@ -98,7 +98,9 @@ test("agnes-cn is a named OpenAI-style provider with openai-compat discovery", ( test("PROVIDER_SEARCH_PAIRS and CATALOG_SIBLING_IDS do not pair agnes with agnes-cn", () => { const pairs = extractNamedConstLiteral( - readRepo("src/sse/services/auth.ts"), + // #15927 moved PROVIDER_SEARCH_PAIRS (with getProviderSearchPool) out of + // src/sse/services/auth.ts into the shared pool module used by combo discovery. + readRepo("open-sse/services/providerConnectionPool.ts"), "PROVIDER_SEARCH_PAIRS" ); const siblings = extractNamedConstLiteral( diff --git a/tests/unit/flagship-0day-discovery.test.ts b/tests/unit/flagship-0day-discovery.test.ts index 198445ef6a00..3f8b7c330d52 100644 --- a/tests/unit/flagship-0day-discovery.test.ts +++ b/tests/unit/flagship-0day-discovery.test.ts @@ -53,10 +53,7 @@ test.after(() => { }); test("test 1: Claude models URL is exactly /v1/models?limit=1000", () => { - assert.equal( - PROVIDER_MODELS_CONFIG.claude.url, - "https://api.anthropic.com/v1/models?limit=1000" - ); + assert.equal(PROVIDER_MODELS_CONFIG.claude.url, "https://api.anthropic.com/v1/models?limit=1000"); }); test("test 2: Claude parseResponse keeps ids from data and defaults empty objects to []", () => { @@ -97,9 +94,7 @@ test("test 6: CATALOG_SIBLING_IDS stays agy/antigravity and never keys the xai f const src = readRepo("src/lib/db/models/activeSyncedCatalog.ts"); const literal = extractNamedConstLiteral(src, "CATALOG_SIBLING_IDS"); const uncommented = literal.replace(/\/\/.*$/gm, ""); - const keys = [ - ...uncommented.matchAll(/^\s*(?:"([^"]+)"|([A-Za-z_][\w-]*))\s*:/gm), - ] + const keys = [...uncommented.matchAll(/^\s*(?:"([^"]+)"|([A-Za-z_][\w-]*))\s*:/gm)] .map((match) => match[1] ?? match[2]) .sort(); assert.deepEqual(keys, ["agy", "antigravity"]); @@ -107,7 +102,9 @@ test("test 6: CATALOG_SIBLING_IDS stays agy/antigravity and never keys the xai f }); test("test 7: xai family stays out of PROVIDER_SEARCH_PAIRS and credential lookup", async () => { - const src = readRepo("src/sse/services/auth.ts"); + // #15927 moved PROVIDER_SEARCH_PAIRS (with getProviderSearchPool) out of + // src/sse/services/auth.ts into the shared pool module used by combo discovery. + const src = readRepo("open-sse/services/providerConnectionPool.ts"); const literal = extractNamedConstLiteral(src, "PROVIDER_SEARCH_PAIRS"); const uncommented = literal.replace(/\/\/.*$/gm, ""); assert.doesNotMatch(uncommented, /["']xai["']|["']xai-oauth["']|["']xao["']/); diff --git a/tests/unit/hard-session-lease-bypass-inventory.test.ts b/tests/unit/hard-session-lease-bypass-inventory.test.ts index d9a466815135..f8a8faf620ec 100644 --- a/tests/unit/hard-session-lease-bypass-inventory.test.ts +++ b/tests/unit/hard-session-lease-bypass-inventory.test.ts @@ -137,7 +137,11 @@ const EXPECTED: Record> = { // persisted-cooldown gate's connection read moved here byte-identically // (readConnectionForCooldownGate), so this is the same site, renamed. "open-sse/services/combo/executeTargetGates.ts": 1, - "open-sse/services/combo/providerWildcard.ts": 1, + // #15927: providerWildcard.ts no longer queries connections itself — the Alibaba + // free-tier drained-model filter now reads through getCachedProviderPoolConnections() + // (open-sse/services/providerConnectionPool.ts), which goes through the shared + // getCachedProviderConnections() read cache (its getProviderConnections site is the one + // already inventoried under src/lib/db/readCache.ts). Read-only state lookup, no dispatch, 1->0. "open-sse/services/tokenRefresh.ts": 1, // #15138: per-account test message config/send — reads the row for its stored test model // and active flag; dispatch goes through runSingleModelTest, which refuses managed-lease @@ -250,7 +254,10 @@ const EXPECTED: Record> = { // #11495: verify-only sweep queries oauth + cookie connections // #13874: the health check re-reads the row inside the refresh lane to see whether // a Layer 2 refresh already rotated the token before it POSTs a consumed one (2 -> 3). - "src/lib/tokenHealthCheck.ts": 3, + // #15891: after a successful refresh, getRefreshRecoveryUpdate() re-reads the row's + // rateLimitedUntil so it does not clear an active cooldown's diagnostics — a state + // read, not connection selection or dispatch, class C like its siblings (3 -> 4). + "src/lib/tokenHealthCheck.ts": 4, "src/lib/tokenHealthCheckCopilot.ts": 1, "src/lib/usage/callLogs.ts": 1, "src/lib/usage/codexResetCredits.ts": 1, @@ -304,7 +311,6 @@ const CLASSIFICATION: Record> = { "open-sse/services/alibabaFreeTier.ts", "open-sse/services/alibabaFreeTierQuotaFetcher.ts", "open-sse/services/combo/executeTargetGates.ts", - "open-sse/services/combo/providerWildcard.ts", "open-sse/services/tokenRefresh.ts", "src/app/api/translator/send/route.ts", "src/lib/credentialHealth/scheduler.ts",