| @@ -9,14 +9,13 @@ import { · 8 unmodified lines |
| 9 | OpenApi, | 9 | OpenApi, |
| 10 | } from "@effect/platform"; | 10 | } from "@effect/platform"; |
| 11 | import { describe, expect, it } from "@effect/vitest"; | 11 | import { describe, expect, it } from "@effect/vitest"; |
| 12 | import { assertInstanceOf, assertTrue } from "@effect/vitest/utils"; | 12 | import { assertTrue } from "@effect/vitest/utils"; |
| 13 | import * as Effect from "effect/Effect"; | 13 | import * as Effect from "effect/Effect"; |
| 14 | import * as Schema from "effect/Schema"; | 14 | import * as Schema from "effect/Schema"; |
| 15 | | 15 | |
| 16 | import { startMcpElicitationDemoServer } from "@executor-v3/mcp-elicitation-demo"; | 16 | import { startMcpElicitationDemoServer } from "@executor-v3/mcp-elicitation-demo"; |
| 17 | import { makeToolInvokerFromTools, toTool } from "@executor-v3/codemode-core"; | 17 | import { makeToolInvokerFromTools, toTool } from "@executor-v3/codemode-core"; |
| 18 | import { | 18 | import { |
| 19 | ControlPlaneStorageError, | | |
| 20 | createControlPlaneClient, | 19 | createControlPlaneClient, |
| 21 | type ControlPlaneClient, | 20 | type ControlPlaneClient, |
| 22 | type ResolveExecutionEnvironment, | 21 | type ResolveExecutionEnvironment, |
| @@ -898,7 +897,7 @@ describe("local-executor-server", () => { · 875 unmodified lines |
| 898 | 15_000, | 897 | 15_000, |
| 899 | ); | 898 | ); |
| 900 | | 899 | |
| 901 | it.scoped("updates an existing demo MCP source instead of creating a duplicate", () => | 900 | it.scoped("does not create a duplicate when the demo MCP source already exists", () => |
| 902 | Effect.gen(function* () { | 901 | Effect.gen(function* () { |
| 903 | const demoServer = yield* Effect.acquireRelease( | 902 | const demoServer = yield* Effect.acquireRelease( |
| 904 | Effect.promise(() => startMcpElicitationDemoServer()), | 903 | Effect.promise(() => startMcpElicitationDemoServer()), |
| @@ -926,7 +925,7 @@ describe("local-executor-server", () => { · 21 unmodified lines |
| 926 | payload: { | 925 | payload: { |
| 927 | name: "Demo", | 926 | name: "Demo", |
| 928 | kind: "mcp", | 927 | kind: "mcp", |
| 929 | endpoint: "http://127.0.0.1:58005/mcp", | 928 | endpoint: demoServer.endpoint, |
| 930 | status: "connected", | 929 | status: "connected", |
| 931 | enabled: true, | 930 | enabled: true, |
| 932 | namespace: "demo", | 931 | namespace: "demo", |
| @@ -945,7 +944,7 @@ describe("local-executor-server", () => { · 12 unmodified lines |
| 945 | namespace: "demo", | 944 | namespace: "demo", |
| 946 | }); | 945 | }); |
| 947 | | 946 | |
| 948 | expect(seeded.action).toBe("updated"); | 947 | expect(seeded.action).toBe("noop"); |
| 949 | expect(seeded.sourceId).toBe(existing.id); | 948 | expect(seeded.sourceId).toBe(existing.id); |
| 950 | | 949 | |
| 951 | const sources = yield* client.sources.list({ | 950 | const sources = yield* client.sources.list({ |
| @@ -957,6 +956,7 @@ describe("local-executor-server", () => { · 5 unmodified lines |
| 957 | expect(sources).toHaveLength(1); | 956 | expect(sources).toHaveLength(1); |
| 958 | expect(sources[0]?.endpoint).toBe(demoServer.endpoint); | 957 | expect(sources[0]?.endpoint).toBe(demoServer.endpoint); |
| 959 | }), | 958 | }), |
| | 959 | 15_000, |
| 960 | ); | 960 | ); |
| 961 | | 961 | |
| 962 | it.scoped("loads OpenAPI sources from control-plane state and calls them", () => | 962 | it.scoped("loads OpenAPI sources from control-plane state and calls them", () => |
| @@ -1286,7 +1286,7 @@ describe("local-executor-server", () => { · 323 unmodified lines |
| 1286 | }), | 1286 | }), |
| 1287 | ); | 1287 | ); |
| 1288 | | 1288 | |
| 1289 | it.scoped("returns a typed storage error when a configured MCP endpoint is invalid", () => | 1289 | it.scoped("marks execution failed when a configured MCP endpoint is invalid", () => |
| 1290 | Effect.gen(function* () { | 1290 | Effect.gen(function* () { |
| 1291 | const server = yield* createLocalExecutorServer({ | 1291 | const server = yield* createLocalExecutorServer({ |
| 1292 | port: 0, | 1292 | port: 0, |
| @@ -1363,20 +1363,18 @@ describe("local-executor-server", () => { · 70 unmodified lines |
| 1363 | }], | 1363 | }], |
| 1364 | }); | 1364 | }); |
| 1365 | | 1365 | |
| 1366 | const failure = yield* client.executions | 1366 | const execution = yield* client.executions.create({ |
| 1367 | .create({ | 1367 | path: { |
| 1368 | path: { | 1368 | workspaceId: installation.workspaceId, |
| 1369 | workspaceId: installation.workspaceId, | 1369 | }, |
| 1370 | }, | 1370 | payload: { |
| 1371 | payload: { | 1371 | code: 'return await tools.demo.gated_echo({ value: "broken" });', |
| 1372 | code: 'return await tools.demo.gated_echo({ value: "broken" });', | 1372 | }, |
| 1373 | }, | 1373 | }); |
| 1374 | }) | | |
| 1375 | .pipe(Effect.flip); | | |
| 1376 | | 1374 | |
| 1377 | assertInstanceOf(failure, ControlPlaneStorageError); | 1375 | expect(execution.execution.status).toBe("failed"); |
| 1378 | expect(failure.operation).toBe("executions.create.environment"); | 1376 | expect(execution.pendingInteraction).toBeNull(); |
| 1379 | expect(failure.message).toContain("Failed creating MCP connector"); | 1377 | expect(execution.execution.errorText).toContain("Invalid URL"); |
| 1380 | }), | 1378 | }), |
| 1381 | ); | 1379 | ); |
| 1382 | }); | 1380 | }); |