(owner: "not_found" | "terminated" = "not_found")
| 45 | }); |
| 46 | |
| 47 | const makeHarness = (owner: "not_found" | "terminated" = "not_found") => { |
| 48 | const ownerChecks = { count: 0 }; |
| 49 | const traces = { count: 0 }; |
| 50 | const stub = { |
| 51 | validateMcpSessionOwner: async () => { |
| 52 | ownerChecks.count += 1; |
| 53 | return owner; |
| 54 | }, |
| 55 | }; |
| 56 | const namespace = { |
| 57 | idFromString: (sessionId: string) => sessionId, |
| 58 | get: () => stub, |
| 59 | }; |
| 60 | // oxlint-disable-next-line executor/no-double-cast -- test boundary: the handler only reads the MCP_SESSION namespace in these legacy dead-session cases |
| 61 | const env = { MCP_SESSION: namespace } as unknown as Env; |
| 62 | // oxlint-disable-next-line executor/no-double-cast -- test boundary: no ExecutionContext capability is used before the dead-session response |
| 63 | const ctx = {} as unknown as ExecutionContext; |
| 64 | const handler = makeCloudMcpAgentHandler({ |
| 65 | authProvider: AuthProviderLive, |
| 66 | makeModernServerBuilder: () => ({ build: () => Effect.die("unused modern builder") }), |
| 67 | traceRequest: async (request, _env, _ctx, handle) => { |
| 68 | traces.count += 1; |
| 69 | return handle(request); |
| 70 | }, |
| 71 | }); |
| 72 | return { ctx, env, handler, ownerChecks, traces }; |
| 73 | }; |
| 74 | |
| 75 | describe("cloud MCP dead-session negative cache", () => { |
| 76 | beforeEach(() => { |
no test coverage detected