From dff836ae2651b7c449278368e897cced4dfb50ea Mon Sep 17 00:00:00 2001 From: diegosouzapw Date: Wed, 3 Jun 2026 22:12:17 -0300 Subject: [PATCH] fix(ci): resolve remaining CI failures (typecheck + build-reorg test drift + #3100 dedup) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Full CI surfaced real failures that local subsets missed (gh-merged PRs bypass the hooks that run these gates): - typecheck:core (Lint job): 3 now-unused @ts-expect-error in mcp-server/server.ts (#3077 dynamic tool loops) → @ts-ignore (lenient, no TS2578). - pack-artifact-policy.test.ts: build-reorg (#3124) renamed app/->dist/; the test still asserted app/ paths + REQUIRED order (it sorts alphabetically). - electron-packaging.test.ts: extraResources from .next/electron-standalone -> .build/electron-standalone (#3124). - glm-provider-model-import-route.test.ts: two GLM connections shared one apiKey, so #3100 (#3023) dedup collapsed them → only one discovery fetch. Distinct keys. Remaining CI flakes (batch expiration, ModelSync self-fetch) pass in isolation — concurrency/port flakiness under --test-concurrency=4, not real failures. --- open-sse/mcp-server/server.ts | 6 ++--- tests/unit/electron-packaging.test.ts | 4 +-- .../glm-provider-model-import-route.test.ts | 10 +++++-- tests/unit/pack-artifact-policy.test.ts | 27 ++++++++++--------- 4 files changed, 28 insertions(+), 19 deletions(-) diff --git a/open-sse/mcp-server/server.ts b/open-sse/mcp-server/server.ts index 6f5ed6b7e5..ba2ee2b976 100644 --- a/open-sse/mcp-server/server.ts +++ b/open-sse/mcp-server/server.ts @@ -998,7 +998,7 @@ export function createMcpServer(): McpServer { async (args) => { try { const parsedArgs = toolDef.inputSchema.parse(args ?? {}); - // @ts-expect-error - handler type lost through dynamic Object.values() access + // @ts-ignore - handler type lost through dynamic Object.values() access const result = await toolDef.handler(parsedArgs); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } catch (err) { @@ -1025,7 +1025,7 @@ export function createMcpServer(): McpServer { async (args) => { try { const parsedArgs = toolDef.inputSchema.parse(args ?? {}); - // @ts-expect-error - handler type lost through dynamic Object.values() access + // @ts-ignore - handler type lost through dynamic Object.values() access const result = await toolDef.handler(parsedArgs); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } catch (err) { @@ -1102,7 +1102,7 @@ export function createMcpServer(): McpServer { async (args) => { try { const parsedArgs = toolDef.inputSchema.parse(args ?? {}); - // @ts-expect-error - handler type lost through dynamic Object.values() access + // @ts-ignore - handler type lost through dynamic Object.values() access const result = await toolDef.handler(parsedArgs); return { content: [{ type: "text" as const, text: JSON.stringify(result, null, 2) }] }; } catch (err) { diff --git a/tests/unit/electron-packaging.test.ts b/tests/unit/electron-packaging.test.ts index 057095119d..7d801cda8c 100644 --- a/tests/unit/electron-packaging.test.ts +++ b/tests/unit/electron-packaging.test.ts @@ -14,11 +14,11 @@ test("electron build copies standalone runtime dependencies into resources/app/n assert.deepEqual( extraResources.find( (resource) => - resource?.from === "../.next/electron-standalone/node_modules" && + resource?.from === "../.build/electron-standalone/node_modules" && resource?.to === "app/node_modules" ), { - from: "../.next/electron-standalone/node_modules", + from: "../.build/electron-standalone/node_modules", to: "app/node_modules", filter: ["**/*"], } diff --git a/tests/unit/glm-provider-model-import-route.test.ts b/tests/unit/glm-provider-model-import-route.test.ts index 02d6eef6f1..dd174c93c6 100644 --- a/tests/unit/glm-provider-model-import-route.test.ts +++ b/tests/unit/glm-provider-model-import-route.test.ts @@ -60,14 +60,20 @@ test("GLM import uses international coding endpoint when apiRegion is internatio test("GLM import normalizes custom coding models URLs without duplicating endpoints", async () => { await resetStorage(); + // Distinct apiKeys per connection: createProviderConnection dedups by decrypted + // key value (#3023), so a shared key would collapse these two custom-endpoint + // connections into one and the second would serve from the first's cached + // catalog (only one discovery fetch instead of two). const cases = [ { baseUrl: "https://api.z.ai/api/coding/paas/v4", expectedUrl: "https://api.z.ai/api/coding/paas/v4/models", + apiKey: "glm-key-0", }, { baseUrl: "https://api.z.ai/api/coding/paas/v4/models", expectedUrl: "https://api.z.ai/api/coding/paas/v4/models", + apiKey: "glm-key-1", }, ]; @@ -81,7 +87,7 @@ test("GLM import normalizes custom coding models URLs without duplicating endpoi provider: "glm", authType: "apikey", name: `glm-custom-${index}`, - apiKey: "glm-key", + apiKey: testCase.apiKey, providerSpecificData: { baseUrl: testCase.baseUrl }, }) ); @@ -91,7 +97,7 @@ test("GLM import normalizes custom coding models URLs without duplicating endpoi const expected = cases[seenUrls.length]; assert.ok(expected, `unexpected GLM discovery call to ${String(url)}`); assert.equal(String(url), expected.expectedUrl); - assert.equal(init.headers.Authorization, "Bearer glm-key"); + assert.equal(init.headers.Authorization, `Bearer ${expected.apiKey}`); assert.equal(init.headers["x-api-key"], undefined); assert.equal(init.headers["anthropic-version"], undefined); seenUrls.push(String(url)); diff --git a/tests/unit/pack-artifact-policy.test.ts b/tests/unit/pack-artifact-policy.test.ts index 26b7b28536..71534eeb11 100644 --- a/tests/unit/pack-artifact-policy.test.ts +++ b/tests/unit/pack-artifact-policy.test.ts @@ -40,11 +40,11 @@ test("findUnexpectedArtifactPaths flags staged app files outside the allowlist", test("findUnexpectedArtifactPaths flags app pack files outside the allowlist", () => { const unexpectedPaths = findUnexpectedArtifactPaths( [ - "app/open-sse/services/compression/engines/rtk/filters/generic-output.json", - "app/open-sse/services/compression/rules/en/filler.json", - "app/server.js", - "app/scripts/dev/sync-env.mjs", - "app/scripts/build/prepublish.mjs", + "dist/open-sse/services/compression/engines/rtk/filters/generic-output.json", + "dist/open-sse/services/compression/rules/en/filler.json", + "dist/server.js", + "dist/scripts/dev/sync-env.mjs", + "dist/scripts/build/prepublish.mjs", "docs/extra.md", ], { @@ -53,7 +53,7 @@ test("findUnexpectedArtifactPaths flags app pack files outside the allowlist", ( } ); - assert.deepEqual(unexpectedPaths, ["app/scripts/build/prepublish.mjs", "docs/extra.md"]); + assert.deepEqual(unexpectedPaths, ["dist/scripts/build/prepublish.mjs", "docs/extra.md"]); }); test("setupPolyfill.ts is allowed in the tarball (bin/omniroute.mjs imports it at startup)", () => { @@ -68,7 +68,7 @@ test("setupPolyfill.ts is allowed in the tarball (bin/omniroute.mjs imports it a test("findMissingArtifactPaths flags missing root runtime files in the tarball", () => { const missingPaths = findMissingArtifactPaths( [ - "app/server.js", + "dist/server.js", "bin/omniroute.mjs", "package.json", "scripts/build/postinstall.mjs", @@ -77,15 +77,18 @@ test("findMissingArtifactPaths flags missing root runtime files in the tarball", PACK_ARTIFACT_REQUIRED_PATHS ); + // findMissingArtifactPaths returns the missing required paths sorted + // alphabetically (bin/ < dist/ < scripts/ < src/), minus the paths present + // above (dist/server.js, bin/omniroute.mjs, package.json, the postinstall scripts). assert.deepEqual(missingPaths, [ - "app/open-sse/services/compression/engines/rtk/filters/generic-output.json", - "app/open-sse/services/compression/rules/en/filler.json", - "app/peer-stamp.mjs", - "app/responses-ws-proxy.mjs", - "app/server-ws.mjs", "bin/cli/program.mjs", "bin/mcp-server.mjs", "bin/nodeRuntimeSupport.mjs", + "dist/open-sse/services/compression/engines/rtk/filters/generic-output.json", + "dist/open-sse/services/compression/rules/en/filler.json", + "dist/peer-stamp.mjs", + "dist/responses-ws-proxy.mjs", + "dist/server-ws.mjs", "scripts/build/native-binary-compat.mjs", "src/shared/utils/nodeRuntimeSupport.ts", ]);