Skip to content

Commit 2b31cf1

Browse files
authored
fix(gateway): report unsupported node events (#123719)
Closes #123717
1 parent 2bc1699 commit 2b31cf1

2 files changed

Lines changed: 15 additions & 2 deletions

File tree

‎src/gateway/server-node-events.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,7 @@ export const handleNodeEvent = async (
12211221
}
12221222
}
12231223
default:
1224-
return undefined;
1224+
return { ok: true, event: evt.event, handled: false, reason: "unsupported_event" };
12251225
}
12261226
};
12271227
/* oxlint-disable max-lines -- TODO: split this grandfathered oversized file. */

‎src/gateway/server.roles-allowlist-update.test.ts‎

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -364,13 +364,26 @@ describe("gateway role enforcement", () => {
364364
expect(invokeRes.ok).toBe(false);
365365
expect(invokeRes.error?.message ?? "").toContain("unauthorized role");
366366

367-
nodeClient = await connectNodeClientWithPairing({
367+
nodeClient = await connectNodeClientWithNodePairing({
368368
port,
369369
commands: [],
370370
instanceId: "node-role-enforcement",
371371
displayName: "node-role-enforcement",
372372
});
373373

374+
const unsupportedEvent = await nodeClient.request<{
375+
ok: boolean;
376+
event?: string;
377+
handled?: boolean;
378+
reason?: string;
379+
}>("node.event", { event: "test.unsupported", payload: { ok: true } });
380+
expect(unsupportedEvent).toEqual({
381+
ok: true,
382+
event: "test.unsupported",
383+
handled: false,
384+
reason: "unsupported_event",
385+
});
386+
374387
const binsPayload = await nodeClient.request("skills.bins", {});
375388
expect(Array.isArray(binsPayload?.bins)).toBe(true);
376389

0 commit comments

Comments
 (0)