From ce18c1a9e2e868c3032a0bdffb8bbf13095c9f2d Mon Sep 17 00:00:00 2001 From: Paperclip Bot Date: Fri, 5 Jun 2026 10:42:01 +0000 Subject: [PATCH] Remove unsupported job company scope patch --- packages/plugins/sdk/src/worker-rpc-host.ts | 5 +- .../plugins/sdk/tests/worker-rpc-host.test.ts | 90 ------------------- 2 files changed, 1 insertion(+), 94 deletions(-) diff --git a/packages/plugins/sdk/src/worker-rpc-host.ts b/packages/plugins/sdk/src/worker-rpc-host.ts index 5bec10e2..28573112 100644 --- a/packages/plugins/sdk/src/worker-rpc-host.ts +++ b/packages/plugins/sdk/src/worker-rpc-host.ts @@ -1502,10 +1502,7 @@ export function startWorkerRpcHost(options: WorkerRpcHostOptions): WorkerRpcHost if (!handler) { throw new Error(`No handler registered for job "${params.job.jobKey}"`); } - await runtimeCompanyContext.run( - { companyId: params.job.companyId ?? null }, - () => handler(params.job), - ); + await handler(params.job); } async function handleWebhook(params: PluginWebhookInput): Promise { diff --git a/packages/plugins/sdk/tests/worker-rpc-host.test.ts b/packages/plugins/sdk/tests/worker-rpc-host.test.ts index fcbeb657..e4f0b2ce 100644 --- a/packages/plugins/sdk/tests/worker-rpc-host.test.ts +++ b/packages/plugins/sdk/tests/worker-rpc-host.test.ts @@ -515,94 +515,4 @@ describe("startWorkerRpcHost runtime company context", () => { } }); - it("passes runJob company context into config host calls", async () => { - const stdin = new PassThrough(); - const stdout = new PassThrough(); - const nextMessage = collectJsonLines(stdout); - - const plugin = definePlugin({ - async setup(ctx) { - ctx.jobs.register("check-job-context", async () => { - const config = await ctx.config.get(); - await ctx.state.set( - { - scopeKind: "instance", - namespace: "job-context", - stateKey: "mode", - }, - config.mode, - ); - }); - }, - }); - - const host = startWorkerRpcHost({ plugin, stdin, stdout }); - - try { - writeMessage(stdin, { - jsonrpc: "2.0", - id: 1, - method: "initialize", - params: { - manifest: { id: "test-plugin", name: "test-plugin", version: "1.0.0" }, - config: {}, - instanceInfo: { instanceId: "inst-1", hostVersion: "0.0.0-test" }, - apiVersion: 1, - }, - }); - await expect(nextMessage()).resolves.toMatchObject({ id: 1, result: { ok: true } }); - - writeMessage(stdin, { - jsonrpc: "2.0", - id: 2, - method: "runJob", - params: { - job: { - id: "job-1", - jobKey: "check-job-context", - companyId: "company-1", - payload: {}, - createdAt: new Date().toISOString(), - updatedAt: new Date().toISOString(), - }, - }, - }); - - const configRequest = await nextMessage(); - expect(configRequest).toMatchObject({ - method: "config.get", - params: { companyId: "company-1" }, - }); - writeMessage(stdin, { - jsonrpc: "2.0", - id: configRequest.id, - result: { mode: "company-config" }, - }); - - const stateRequest = await nextMessage(); - expect(stateRequest).toMatchObject({ - method: "state.set", - params: { - scopeKind: "instance", - namespace: "job-context", - stateKey: "mode", - value: "company-config", - }, - }); - writeMessage(stdin, { - jsonrpc: "2.0", - id: stateRequest.id, - result: null, - }); - - await expect(nextMessage()).resolves.toMatchObject({ - id: 2, - result: null, - }); - } finally { - host.stop(); - stdin.destroy(); - stdout.destroy(); - } - }); });