Skip to content

The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.

test(webhooks): update rpc response structure in webhook ingress tests

Steven Enamakel41b978864ba6
diff --git a/app/test/playwright/specs/webhooks-ingress-flow.spec.ts b/app/test/playwright/specs/webhooks-ingress-flow.spec.ts
index fd1c0003f0..cc8ceed6be 100644
--- a/app/test/playwright/specs/webhooks-ingress-flow.spec.ts
+++ b/app/test/playwright/specs/webhooks-ingress-flow.spec.ts
@@ -19,42 +19,53 @@ test.describe('Webhooks ingress surface (stub-level)', () => {
const tunnelUuid = 'e2e-webhooks-ingress-tunnel';
const registrations = await callCoreRpc<{
- result?: { registrations?: unknown[] };
- logs?: string[];
+ result: { registrations: unknown[] };
+ logs: string[];
}>('openhuman.webhooks_list_registrations', {});
- expect(registrations.result?.registrations ?? []).toEqual([]);
+ expect(registrations.result.registrations).toEqual([]);
+ expect(registrations.logs[0]).toContain('webhooks.list_registrations returned 0');
- const logs = await callCoreRpc<{ result?: { logs?: unknown[] }; logs?: string[] }>(
+ const logs = await callCoreRpc<{ result: { logs: unknown[] }; logs: string[] }>(
'openhuman.webhooks_list_logs',
{ limit: 5 }
);
- expect(logs.result?.logs ?? []).toEqual([]);
+ expect(logs.result.logs).toEqual([]);
+ expect(logs.logs[0]).toContain('webhooks.list_logs returned 0');
+ let register: {
+ result: { registrations: unknown[] };
+ logs: string[];
+ };
try {
- const register = await callCoreRpc<{
- result?: { registrations?: unknown[] };
- logs?: string[];
- }>('openhuman.webhooks_register_echo', {
+ register = await callCoreRpc('openhuman.webhooks_register_echo', {
tunnel_uuid: tunnelUuid,
tunnel_name: 'E2E Tunnel',
backend_tunnel_id: 'backend-e2e-webhooks-ingress',
});
- expect(Array.isArray(register.result?.registrations ?? [])).toBe(true);
-
- const clear = await callCoreRpc<{ result?: { cleared?: number }; logs?: string[] }>(
- 'openhuman.webhooks_clear_logs',
- {}
- );
- expect(typeof clear.result?.cleared).toBe('number');
-
- const unregister = await callCoreRpc<{
- result?: { registrations?: unknown[] };
- logs?: string[];
- }>('openhuman.webhooks_unregister_echo', { tunnel_uuid: tunnelUuid });
- expect(unregister.result?.registrations ?? []).toEqual([]);
- } catch {
- // Router initialization is socket-backed and can be absent in this lane.
- // The load-bearing part is that the read-only surface above remains stable.
+ } catch (error) {
+ if (!(error instanceof Error) || !error.message.includes('webhook router not initialized')) {
+ throw error;
+ }
+ return;
}
+
+ expect(register.result.registrations.length).toBeGreaterThanOrEqual(1);
+ expect(register.logs[0]).toContain(`webhooks.register_echo registered tunnel ${tunnelUuid}`);
+
+ const clear = await callCoreRpc<{ result: { cleared: number }; logs: string[] }>(
+ 'openhuman.webhooks_clear_logs',
+ {}
+ );
+ expect(clear.result.cleared).toBe(0);
+ expect(clear.logs[0]).toContain('webhooks.clear_logs removed 0');
+
+ const unregister = await callCoreRpc<{
+ result: { registrations: unknown[] };
+ logs: string[];
+ }>('openhuman.webhooks_unregister_echo', { tunnel_uuid: tunnelUuid });
+ expect(unregister.result.registrations).toEqual([]);
+ expect(unregister.logs[0]).toContain(
+ `webhooks.unregister_echo removed tunnel ${tunnelUuid}`
+ );
});
});