Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions tests/snapshots/provider/translate-path.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<CRED>"
},
"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": "<CRED>"
},
"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": "<CRED>"
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/agnes-cn-provider.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
13 changes: 5 additions & 8 deletions tests/unit/flagship-0day-discovery.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 []", () => {
Expand Down Expand Up @@ -97,17 +94,17 @@ 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"]);
assert.doesNotMatch(literal, /["']xai["']|["']xai-oauth["']|["']xao["']/);
});

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["']/);
Expand Down
12 changes: 9 additions & 3 deletions tests/unit/hard-session-lease-bypass-inventory.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,11 @@ const EXPECTED: Record<InventoryKind, Record<string, number>> = {
// 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
Expand Down Expand Up @@ -250,7 +254,10 @@ const EXPECTED: Record<InventoryKind, Record<string, number>> = {
// #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,
Expand Down Expand Up @@ -304,7 +311,6 @@ const CLASSIFICATION: Record<InventoryKind, Record<string, BypassClass>> = {
"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",
Expand Down
Loading