@powerhousedao/switchboard 6.2.3-dev.7 → 6.2.3-dev.71
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.tsbuild/test/attachments/byte-grants.test.d.ts +2 -0
- package/.tsbuild/test/attachments/byte-grants.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts +2 -0
- package/.tsbuild/test/attachments/byte-routes-read-gate.integration.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts +2 -0
- package/.tsbuild/test/attachments/reserve-metadata-parity.test.d.ts.map +1 -0
- package/.tsbuild/test/attachments/url-signer.test.d.ts +2 -0
- package/.tsbuild/test/attachments/url-signer.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-create-signature-policy.test.d.ts +2 -0
- package/.tsbuild/test/boot-create-signature-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-inspection-enabled.test.d.ts +2 -0
- package/.tsbuild/test/boot-inspection-enabled.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-mcp-enabled.test.d.ts +2 -0
- package/.tsbuild/test/boot-mcp-enabled.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-privacy.test.d.ts +2 -0
- package/.tsbuild/test/boot-privacy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts +2 -0
- package/.tsbuild/test/boot-unsupported-stored-documents.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-without-renown.test.d.ts +2 -0
- package/.tsbuild/test/boot-without-renown.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-without-require-signatures.test.d.ts +2 -0
- package/.tsbuild/test/boot-without-require-signatures.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-worker-trust-policy.test.d.ts +2 -0
- package/.tsbuild/test/boot-worker-trust-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts +2 -0
- package/.tsbuild/test/boot-workflow-singleton-conflict.test.d.ts.map +1 -0
- package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts +2 -0
- package/.tsbuild/test/boot-workflow-singleton-retry.test.d.ts.map +1 -0
- package/.tsbuild/test/builder-defaults.test.d.ts +2 -0
- package/.tsbuild/test/builder-defaults.test.d.ts.map +1 -0
- package/.tsbuild/test/create-signature-policy.test.d.ts +2 -0
- package/.tsbuild/test/create-signature-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/default-drive-slug.test.d.ts +2 -0
- package/.tsbuild/test/default-drive-slug.test.d.ts.map +1 -0
- package/.tsbuild/test/durable-node-fs-pg16.test.d.ts +2 -0
- package/.tsbuild/test/durable-node-fs-pg16.test.d.ts.map +1 -0
- package/.tsbuild/test/fatal-shutdown.test.d.ts +2 -0
- package/.tsbuild/test/fatal-shutdown.test.d.ts.map +1 -0
- package/.tsbuild/test/inspection-flag.test.d.ts +2 -0
- package/.tsbuild/test/inspection-flag.test.d.ts.map +1 -0
- package/.tsbuild/test/inspection-throttle.test.d.ts +2 -0
- package/.tsbuild/test/inspection-throttle.test.d.ts.map +1 -0
- package/.tsbuild/test/mcp-flag.test.d.ts +2 -0
- package/.tsbuild/test/mcp-flag.test.d.ts.map +1 -0
- package/.tsbuild/test/observability-signals.test.d.ts +2 -0
- package/.tsbuild/test/observability-signals.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-preflight.test.d.ts +2 -0
- package/.tsbuild/test/pglite-preflight.test.d.ts.map +1 -0
- package/.tsbuild/test/pglite-storage-dirs.test.d.ts +2 -0
- package/.tsbuild/test/pglite-storage-dirs.test.d.ts.map +1 -0
- package/.tsbuild/test/plugin-config-schemas.test.d.ts +2 -0
- package/.tsbuild/test/plugin-config-schemas.test.d.ts.map +1 -0
- package/.tsbuild/test/plugin-presence.test.d.ts +2 -0
- package/.tsbuild/test/plugin-presence.test.d.ts.map +1 -0
- package/.tsbuild/test/port-probe.test.d.ts +2 -0
- package/.tsbuild/test/port-probe.test.d.ts.map +1 -0
- package/.tsbuild/test/renown-trust-policy.test.d.ts +2 -0
- package/.tsbuild/test/renown-trust-policy.test.d.ts.map +1 -0
- package/.tsbuild/test/shutdown.test.d.ts +2 -0
- package/.tsbuild/test/shutdown.test.d.ts.map +1 -0
- package/.tsbuild/test/snapshot-writer.d.ts +18 -0
- package/.tsbuild/test/snapshot-writer.d.ts.map +1 -0
- package/.tsbuild/test/unsupported-stored-documents.test.d.ts +2 -0
- package/.tsbuild/test/unsupported-stored-documents.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/harness.d.ts +56 -0
- package/.tsbuild/test/workflow/harness.d.ts.map +1 -0
- package/.tsbuild/test/workflow/oauth.test.d.ts +2 -0
- package/.tsbuild/test/workflow/oauth.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/resolvers.test.d.ts +2 -0
- package/.tsbuild/test/workflow/resolvers.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-dedupe.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-signed.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-signed.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-trigger-test.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts +2 -0
- package/.tsbuild/test/workflow/webhook-unsigned.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-reactor-access.test.d.ts +2 -0
- package/.tsbuild/test/workflow-reactor-access.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts +2 -0
- package/.tsbuild/test/workflow-reactor-enforcement.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-read-gate.test.d.ts +2 -0
- package/.tsbuild/test/workflow-read-gate.test.d.ts.map +1 -0
- package/.tsbuild/test/workflow-runtime.test.d.ts +2 -0
- package/.tsbuild/test/workflow-runtime.test.d.ts.map +1 -0
- package/.tsbuild/test/workflows-plugin-config.test.d.ts +2 -0
- package/.tsbuild/test/workflows-plugin-config.test.d.ts.map +1 -0
- package/.tsbuild/tsconfig.tsbuildinfo +1 -1
- package/.tsbuild/tsdown.config.d.ts.map +1 -1
- package/.tsbuild/vitest.config.d.ts.map +1 -1
- package/Auth.md +144 -2
- package/CHANGELOG.md +869 -0
- package/README.md +47 -10
- package/dist/index.d.mts +2 -1
- package/dist/index.mjs +50 -50
- package/dist/index.mjs.map +1 -1
- package/dist/install-packages.d.mts +2 -1
- package/dist/install-packages.mjs +2 -2
- package/dist/install-packages.mjs.map +1 -1
- package/dist/mcp-SsBK14Jm.mjs +32 -0
- package/dist/mcp-SsBK14Jm.mjs.map +1 -0
- package/dist/migrate.d.mts +2 -1
- package/dist/migrate.mjs +4 -3
- package/dist/migrate.mjs.map +1 -1
- package/dist/plugin-host-CGO4XZzK.d.mts +38 -0
- package/dist/plugin-host-CGO4XZzK.d.mts.map +1 -0
- package/dist/plugins/attachments.d.mts +33 -0
- package/dist/plugins/attachments.d.mts.map +1 -0
- package/dist/plugins/attachments.mjs +4 -0
- package/dist/plugins/mcp.d.mts +31 -0
- package/dist/plugins/mcp.d.mts.map +1 -0
- package/dist/plugins/mcp.mjs +4 -0
- package/dist/plugins/privacy.d.mts +22 -0
- package/dist/plugins/privacy.d.mts.map +1 -0
- package/dist/plugins/privacy.mjs +4 -0
- package/dist/plugins/workflows.d.mts +79 -0
- package/dist/plugins/workflows.d.mts.map +1 -0
- package/dist/plugins/workflows.mjs +4 -0
- package/dist/privacy-BsFl7GzK.mjs +118 -0
- package/dist/privacy-BsFl7GzK.mjs.map +1 -0
- package/dist/{server-CiKkVE6g.mjs → server-Be1vmpxu.mjs} +1213 -244
- package/dist/server-Be1vmpxu.mjs.map +1 -0
- package/dist/server.d.mts +208 -45
- package/dist/server.d.mts.map +1 -1
- package/dist/server.mjs +4 -5
- package/dist/{utils-Baw7rThP.mjs → utils-Dh845exv.mjs} +48 -9
- package/dist/utils-Dh845exv.mjs.map +1 -0
- package/dist/utils.d.mts +10 -5
- package/dist/utils.d.mts.map +1 -1
- package/dist/utils.mjs +3 -3
- package/dist/workflow-runtime-7GaJ13c9.d.mts +30 -0
- package/dist/workflow-runtime-7GaJ13c9.d.mts.map +1 -0
- package/dist/workflows-fsBcElEi.mjs +1382 -0
- package/dist/workflows-fsBcElEi.mjs.map +1 -0
- package/package.json +50 -20
- package/scripts/install-packages.sh +0 -0
- package/test/attachment-reference-read-model.test.ts +6 -1
- package/test/attachments/auth.test.ts +85 -0
- package/test/attachments/byte-grants.test.ts +290 -0
- package/test/attachments/byte-routes-read-gate.integration.test.ts +314 -0
- package/test/attachments/download-target.test.ts +201 -32
- package/test/attachments/index.test.ts +47 -4
- package/test/attachments/reserve-metadata-parity.test.ts +96 -0
- package/test/attachments/routes-integration.test.ts +60 -4
- package/test/attachments/routes.test.ts +271 -24
- package/test/attachments/service-config.test.ts +13 -3
- package/test/attachments/url-signer.test.ts +105 -0
- package/test/boot-create-signature-policy.test.ts +108 -0
- package/test/boot-inspection-enabled.test.ts +150 -0
- package/test/boot-mcp-enabled.test.ts +130 -0
- package/test/boot-privacy.test.ts +243 -0
- package/test/boot-unsupported-stored-documents.test.ts +213 -0
- package/test/boot-without-renown.test.ts +81 -0
- package/test/boot-without-require-signatures.test.ts +74 -0
- package/test/boot-worker-trust-policy.test.ts +90 -0
- package/test/boot-workflow-singleton-conflict.test.ts +107 -0
- package/test/boot-workflow-singleton-retry.test.ts +133 -0
- package/test/builder-defaults.test.ts +80 -0
- package/test/create-signature-policy.test.ts +69 -0
- package/test/default-drive-slug.test.ts +97 -0
- package/test/durable-node-fs-pg16.test.ts +80 -0
- package/test/fatal-shutdown.test.ts +165 -0
- package/test/inspection-flag.test.ts +62 -0
- package/test/inspection-throttle.test.ts +23 -0
- package/test/mcp-flag.test.ts +56 -0
- package/test/observability-signals.test.ts +131 -0
- package/test/pglite-dialect.test.ts +217 -2
- package/test/pglite-preflight.test.ts +313 -0
- package/test/pglite-storage-dirs.test.ts +103 -0
- package/test/pglite-version.test.ts +9 -1
- package/test/plugin-config-schemas.test.ts +83 -0
- package/test/plugin-presence.test.ts +269 -0
- package/test/port-probe.test.ts +45 -0
- package/test/renown-trust-policy.test.ts +315 -0
- package/test/shutdown.test.ts +278 -0
- package/test/snapshot-writer.ts +94 -0
- package/test/unsupported-stored-documents.test.ts +72 -0
- package/test/worker-pool.test.ts +27 -1
- package/test/workflow/harness.ts +289 -0
- package/test/workflow/oauth.test.ts +214 -0
- package/test/workflow/resolvers.test.ts +357 -0
- package/test/workflow/webhook-dedupe.test.ts +295 -0
- package/test/workflow/webhook-signed.test.ts +509 -0
- package/test/workflow/webhook-trigger-test.test.ts +82 -0
- package/test/workflow/webhook-unsigned.test.ts +345 -0
- package/test/workflow-reactor-access.test.ts +384 -0
- package/test/workflow-reactor-enforcement.test.ts +808 -0
- package/test/workflow-read-gate.test.ts +213 -0
- package/test/workflow-runtime.test.ts +1122 -0
- package/test/workflows-plugin-config.test.ts +77 -0
- package/tsconfig.json +11 -2
- package/tsdown.config.ts +9 -1
- package/dist/server-CiKkVE6g.mjs.map +0 -1
- package/dist/utils-Baw7rThP.mjs.map +0 -1
|
@@ -0,0 +1,269 @@
|
|
|
1
|
+
import { mkdtemp, rm } from "node:fs/promises";
|
|
2
|
+
import { createServer } from "node:net";
|
|
3
|
+
import { tmpdir } from "node:os";
|
|
4
|
+
import { join } from "node:path";
|
|
5
|
+
import type { HostPlugin, ResolvedPlugin } from "@powerhousedao/host-core";
|
|
6
|
+
import type { ILogger } from "document-model";
|
|
7
|
+
import { describe, expect, it, vi } from "vitest";
|
|
8
|
+
import {
|
|
9
|
+
builtinSwitchboardPlugins,
|
|
10
|
+
createSwitchboardPluginHost,
|
|
11
|
+
} from "../src/plugin-host.mjs";
|
|
12
|
+
import { startSwitchboard, type StartServerOptions } from "../src/server.mjs";
|
|
13
|
+
|
|
14
|
+
// `port: 0` would bind a random port the switchboard does not report back, so
|
|
15
|
+
// the test picks a free one and pins it.
|
|
16
|
+
async function freePort(): Promise<number> {
|
|
17
|
+
const server = createServer();
|
|
18
|
+
await new Promise<void>((resolve) => server.listen(0, "127.0.0.1", resolve));
|
|
19
|
+
const address = server.address();
|
|
20
|
+
await new Promise<void>((resolve) => server.close(() => resolve()));
|
|
21
|
+
if (!address || typeof address === "string") throw new Error("no port");
|
|
22
|
+
return address.port;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function stubLogger(): ILogger {
|
|
26
|
+
const logger = {
|
|
27
|
+
verbose: vi.fn(),
|
|
28
|
+
debug: vi.fn(),
|
|
29
|
+
info: vi.fn(),
|
|
30
|
+
warn: vi.fn(),
|
|
31
|
+
error: vi.fn(),
|
|
32
|
+
child: vi.fn(),
|
|
33
|
+
};
|
|
34
|
+
logger.child.mockReturnValue(logger);
|
|
35
|
+
return logger as unknown as ILogger;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Boots with FEATURE_PLUGIN_HOST_ENABLED=1, sandboxing the env exactly like
|
|
40
|
+
* boot-mcp-enabled.test.ts: temp PH_REACTOR_DATABASE_URL, MCP_ENABLED cleared
|
|
41
|
+
* so it never leaks into the plugin-host composition under test, and every
|
|
42
|
+
* touched env var restored in `finally`. Workflows stay off by default here
|
|
43
|
+
* — case 5 below covers workflow presence on its own, lighter path.
|
|
44
|
+
*/
|
|
45
|
+
async function withPluginHostSwitchboard(
|
|
46
|
+
optionsOverride: Partial<StartServerOptions>,
|
|
47
|
+
run: (
|
|
48
|
+
switchboard: Awaited<ReturnType<typeof startSwitchboard>>,
|
|
49
|
+
) => Promise<void>,
|
|
50
|
+
): Promise<void> {
|
|
51
|
+
const tempRoot = await mkdtemp(
|
|
52
|
+
join(tmpdir(), "switchboard-plugin-presence-"),
|
|
53
|
+
);
|
|
54
|
+
const names = [
|
|
55
|
+
"PH_REACTOR_DATABASE_URL",
|
|
56
|
+
"MCP_ENABLED",
|
|
57
|
+
"FEATURE_PLUGIN_HOST_ENABLED",
|
|
58
|
+
];
|
|
59
|
+
const previous = names.map((name) => [name, process.env[name]] as const);
|
|
60
|
+
process.env.PH_REACTOR_DATABASE_URL = join(tempRoot, "reactor-storage");
|
|
61
|
+
delete process.env.MCP_ENABLED;
|
|
62
|
+
process.env.FEATURE_PLUGIN_HOST_ENABLED = "1";
|
|
63
|
+
let switchboard: Awaited<ReturnType<typeof startSwitchboard>> | undefined;
|
|
64
|
+
|
|
65
|
+
try {
|
|
66
|
+
switchboard = await startSwitchboard({
|
|
67
|
+
workflows: { enabled: false },
|
|
68
|
+
dbPath: join(tempRoot, "read-model"),
|
|
69
|
+
port: await freePort(),
|
|
70
|
+
strictPort: true,
|
|
71
|
+
disableLocalPackages: true,
|
|
72
|
+
identity: { keypairPath: join(tempRoot, "identity.json") },
|
|
73
|
+
drive: {
|
|
74
|
+
slug: "default-drive",
|
|
75
|
+
global: { name: "Default Drive" },
|
|
76
|
+
},
|
|
77
|
+
logger: stubLogger(),
|
|
78
|
+
...optionsOverride,
|
|
79
|
+
});
|
|
80
|
+
await run(switchboard);
|
|
81
|
+
await switchboard.shutdown();
|
|
82
|
+
switchboard = undefined;
|
|
83
|
+
} finally {
|
|
84
|
+
await switchboard?.shutdown();
|
|
85
|
+
for (const [name, value] of previous) {
|
|
86
|
+
if (value === undefined) {
|
|
87
|
+
delete process.env[name];
|
|
88
|
+
} else {
|
|
89
|
+
process.env[name] = value;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
await rm(tempRoot, { recursive: true, force: true });
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
async function postMcp(port: number): Promise<number> {
|
|
97
|
+
const response = await fetch(`http://127.0.0.1:${port}/mcp`, {
|
|
98
|
+
method: "POST",
|
|
99
|
+
headers: {
|
|
100
|
+
"content-type": "application/json",
|
|
101
|
+
accept: "application/json, text/event-stream",
|
|
102
|
+
},
|
|
103
|
+
body: JSON.stringify({ jsonrpc: "2.0", id: 1, method: "ping" }),
|
|
104
|
+
});
|
|
105
|
+
await response.body?.cancel();
|
|
106
|
+
return response.status;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
async function getReservation(port: number): Promise<number> {
|
|
110
|
+
const response = await fetch(
|
|
111
|
+
`http://127.0.0.1:${port}/attachments/reservations/does-not-matter`,
|
|
112
|
+
);
|
|
113
|
+
await response.body?.cancel();
|
|
114
|
+
return response.status;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
describe("plugin-host composition presence (FEATURE_PLUGIN_HOST_ENABLED)", () => {
|
|
118
|
+
it("DEFAULT composition: mcp mounted, attachments present", async () => {
|
|
119
|
+
await withPluginHostSwitchboard({}, async (switchboard) => {
|
|
120
|
+
expect(switchboard.mcpEnabled).toBe(true);
|
|
121
|
+
expect(await postMcp(switchboard.port)).not.toBe(404);
|
|
122
|
+
expect(switchboard.attachmentService).toBeDefined();
|
|
123
|
+
});
|
|
124
|
+
}, 60_000);
|
|
125
|
+
|
|
126
|
+
it("EMPTY composition ([]): attachments absent", async () => {
|
|
127
|
+
await withPluginHostSwitchboard(
|
|
128
|
+
{ pluginComposition: [] },
|
|
129
|
+
async (switchboard) => {
|
|
130
|
+
expect(switchboard.attachmentService).toBeUndefined();
|
|
131
|
+
expect(await getReservation(switchboard.port)).toBe(404);
|
|
132
|
+
},
|
|
133
|
+
);
|
|
134
|
+
}, 60_000);
|
|
135
|
+
|
|
136
|
+
// Presence is activation (R2.6c fix): flag-on, startSwitchboard skips the
|
|
137
|
+
// classic mcp/workflows resolvers and initServer normalizes unset values to
|
|
138
|
+
// OFF after transformServerOptions — an absent plugin actually deactivates
|
|
139
|
+
// its subsystem.
|
|
140
|
+
it("EMPTY composition ([]): /mcp does not mount — presence is activation", async () => {
|
|
141
|
+
await withPluginHostSwitchboard(
|
|
142
|
+
{ pluginComposition: [] },
|
|
143
|
+
async (switchboard) => {
|
|
144
|
+
expect(switchboard.mcpEnabled).toBe(false);
|
|
145
|
+
expect(await postMcp(switchboard.port)).toBe(404);
|
|
146
|
+
},
|
|
147
|
+
);
|
|
148
|
+
}, 60_000);
|
|
149
|
+
|
|
150
|
+
it("SUBSET composition (mcp only): mcp mounted, attachments absent", async () => {
|
|
151
|
+
const mcpOnly = builtinSwitchboardPlugins().filter((resolved) =>
|
|
152
|
+
resolved.entry.module.includes("/plugins/mcp"),
|
|
153
|
+
);
|
|
154
|
+
expect(mcpOnly).toHaveLength(1);
|
|
155
|
+
await withPluginHostSwitchboard(
|
|
156
|
+
{ pluginComposition: mcpOnly },
|
|
157
|
+
async (switchboard) => {
|
|
158
|
+
expect(switchboard.mcpEnabled).toBe(true);
|
|
159
|
+
expect(await postMcp(switchboard.port)).not.toBe(404);
|
|
160
|
+
expect(switchboard.attachmentService).toBeUndefined();
|
|
161
|
+
expect(await getReservation(switchboard.port)).toBe(404);
|
|
162
|
+
},
|
|
163
|
+
);
|
|
164
|
+
}, 60_000);
|
|
165
|
+
|
|
166
|
+
it("an explicit mcp: false option still wins over the default composition", async () => {
|
|
167
|
+
await withPluginHostSwitchboard({ mcp: false }, async (switchboard) => {
|
|
168
|
+
expect(switchboard.mcpEnabled).toBe(false);
|
|
169
|
+
expect(await postMcp(switchboard.port)).toBe(404);
|
|
170
|
+
});
|
|
171
|
+
}, 60_000);
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
describe("plugin-host workflows presence (transformServerOptions)", () => {
|
|
175
|
+
// A real boot's workflows.enabled is resolved classically (env/config,
|
|
176
|
+
// default OFF) in startSwitchboard BEFORE the plugin host is even
|
|
177
|
+
// constructed (server.mts resolveWorkflowsEnabled ~line 1545, pluginHost
|
|
178
|
+
// gate at ~line 407) — by the time the workflows plugin's
|
|
179
|
+
// transformServerOptions hook runs, options.workflows.enabled is already a
|
|
180
|
+
// definite boolean, so its "unless explicit false" short-circuit can never
|
|
181
|
+
// observe an "unset" value through that path. Exercising the hook directly
|
|
182
|
+
// against createSwitchboardPluginHost, as suggested as a fallback, is the
|
|
183
|
+
// only way to observe the plugin's own force-true behavior in isolation —
|
|
184
|
+
// see the suspected-bug note in the final report.
|
|
185
|
+
it("forces workflows.enabled true when the plugin is present, leaves it alone when absent", async () => {
|
|
186
|
+
const withWorkflowsPlugin = createSwitchboardPluginHost(
|
|
187
|
+
{ logger: stubLogger(), options: {}, renown: null },
|
|
188
|
+
builtinSwitchboardPlugins(),
|
|
189
|
+
);
|
|
190
|
+
const resolvedWith = await withWorkflowsPlugin.transformOptions<
|
|
191
|
+
Record<string, unknown>
|
|
192
|
+
>({});
|
|
193
|
+
expect(
|
|
194
|
+
(resolvedWith.workflows as { enabled?: boolean } | undefined)?.enabled,
|
|
195
|
+
).toBe(true);
|
|
196
|
+
|
|
197
|
+
const withoutAnyPlugin = createSwitchboardPluginHost(
|
|
198
|
+
{ logger: stubLogger(), options: {}, renown: null },
|
|
199
|
+
[],
|
|
200
|
+
);
|
|
201
|
+
const resolvedWithout = await withoutAnyPlugin.transformOptions<
|
|
202
|
+
Record<string, unknown>
|
|
203
|
+
>({});
|
|
204
|
+
expect(resolvedWithout.workflows).toBeUndefined();
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
it("still honors an explicit workflows.enabled: false even with the plugin present", async () => {
|
|
208
|
+
const host = createSwitchboardPluginHost(
|
|
209
|
+
{ logger: stubLogger(), options: {}, renown: null },
|
|
210
|
+
builtinSwitchboardPlugins(),
|
|
211
|
+
);
|
|
212
|
+
const resolved = await host.transformOptions<Record<string, unknown>>({
|
|
213
|
+
workflows: { enabled: false },
|
|
214
|
+
});
|
|
215
|
+
expect(
|
|
216
|
+
(resolved.workflows as { enabled?: boolean } | undefined)?.enabled,
|
|
217
|
+
).toBe(false);
|
|
218
|
+
});
|
|
219
|
+
});
|
|
220
|
+
|
|
221
|
+
describe("plugin-host onShutdown ordering (runObserveHookSequential)", () => {
|
|
222
|
+
it("runs onShutdown sequentially, in registration order — not by whichever finishes first", async () => {
|
|
223
|
+
const order: string[] = [];
|
|
224
|
+
|
|
225
|
+
function fakePlugin(name: string, delayMs: number): HostPlugin {
|
|
226
|
+
return {
|
|
227
|
+
name,
|
|
228
|
+
appliesTo: "switchboard",
|
|
229
|
+
hooks: {
|
|
230
|
+
onShutdown: async () => {
|
|
231
|
+
if (delayMs > 0) {
|
|
232
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
233
|
+
}
|
|
234
|
+
order.push(name);
|
|
235
|
+
},
|
|
236
|
+
},
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
function resolvedFake(plugin: HostPlugin): ResolvedPlugin {
|
|
241
|
+
return {
|
|
242
|
+
plugin,
|
|
243
|
+
provenance: "local",
|
|
244
|
+
entry: {
|
|
245
|
+
module: `fake:${plugin.name}`,
|
|
246
|
+
enabled: true,
|
|
247
|
+
verbs: "*",
|
|
248
|
+
config: {},
|
|
249
|
+
},
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
// Registered first but slower: if onShutdown ran in parallel (the way
|
|
254
|
+
// the other hook moments do, via Promise.all in runObserveHook), "b"
|
|
255
|
+
// would resolve first and the recorded order would be ["b", "a"].
|
|
256
|
+
// Sequential execution must still record registration order, ["a", "b"].
|
|
257
|
+
const first = fakePlugin("a", 50);
|
|
258
|
+
const second = fakePlugin("b", 0);
|
|
259
|
+
|
|
260
|
+
const host = createSwitchboardPluginHost(
|
|
261
|
+
{ logger: stubLogger(), options: {}, renown: null },
|
|
262
|
+
[resolvedFake(first), resolvedFake(second)],
|
|
263
|
+
);
|
|
264
|
+
|
|
265
|
+
await host.observe("onShutdown");
|
|
266
|
+
|
|
267
|
+
expect(order).toEqual(["a", "b"]);
|
|
268
|
+
});
|
|
269
|
+
});
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import net from "node:net";
|
|
2
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
3
|
+
import { isPortAvailable } from "../src/server.mjs";
|
|
4
|
+
|
|
5
|
+
// A host without IPv6, e.g. a container: binding `::` fails before the port is tried.
|
|
6
|
+
function withoutIpv6() {
|
|
7
|
+
const { listen } = net.Server.prototype as unknown as {
|
|
8
|
+
listen: (this: net.Server, ...args: unknown[]) => net.Server;
|
|
9
|
+
};
|
|
10
|
+
return vi.spyOn(net.Server.prototype, "listen").mockImplementation(function (
|
|
11
|
+
this: net.Server,
|
|
12
|
+
...args: unknown[]
|
|
13
|
+
) {
|
|
14
|
+
const [options] = args as [{ host?: string } | undefined];
|
|
15
|
+
if (options?.host === "::") {
|
|
16
|
+
const error = Object.assign(new Error("address family not supported"), {
|
|
17
|
+
code: "EAFNOSUPPORT",
|
|
18
|
+
});
|
|
19
|
+
queueMicrotask(() => this.emit("error", error));
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
return listen.apply(this, args);
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
afterEach(() => {
|
|
27
|
+
vi.restoreAllMocks();
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
describe("isPortAvailable", () => {
|
|
31
|
+
it("probes IPv4 on a host without IPv6", async () => {
|
|
32
|
+
withoutIpv6();
|
|
33
|
+
const busy = net.createServer();
|
|
34
|
+
await new Promise<void>((resolve) =>
|
|
35
|
+
busy.listen({ port: 0, host: "0.0.0.0" }, resolve),
|
|
36
|
+
);
|
|
37
|
+
const { port } = busy.address() as net.AddressInfo;
|
|
38
|
+
try {
|
|
39
|
+
await expect(isPortAvailable(port)).resolves.toBe(false);
|
|
40
|
+
} finally {
|
|
41
|
+
await new Promise((resolve) => busy.close(resolve));
|
|
42
|
+
}
|
|
43
|
+
await expect(isPortAvailable(port)).resolves.toBe(true);
|
|
44
|
+
});
|
|
45
|
+
});
|
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
import type {
|
|
2
|
+
ActionSigner,
|
|
3
|
+
ISigner,
|
|
4
|
+
} from "@powerhousedao/shared/document-model";
|
|
5
|
+
import {
|
|
6
|
+
ReactorBuilder,
|
|
7
|
+
ReactorClientBuilder,
|
|
8
|
+
type SignatureTrustPolicy,
|
|
9
|
+
} from "@powerhousedao/reactor";
|
|
10
|
+
import type { IRenown } from "@renown/sdk/node";
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { pathToFileURL } from "node:url";
|
|
13
|
+
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
14
|
+
import { applySwitchboardReactorDefaults } from "../src/builder-defaults.mjs";
|
|
15
|
+
import {
|
|
16
|
+
assertWorkerTrustPolicy,
|
|
17
|
+
getRenownTrustPolicyConfig,
|
|
18
|
+
} from "../src/renown.js";
|
|
19
|
+
|
|
20
|
+
const WALLET = "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266";
|
|
21
|
+
const CONNECT_KEY = "did:key:zDnaeConnectKey";
|
|
22
|
+
const SWITCHBOARD_KEY = "did:key:zDnaeSwitchboardKey";
|
|
23
|
+
const SWITCHBOARD_USER = {
|
|
24
|
+
address: "0x70997970C51812dc3A010C7d01b50e0d17dc79C8",
|
|
25
|
+
networkId: "eip155",
|
|
26
|
+
chainId: 1,
|
|
27
|
+
};
|
|
28
|
+
const GRAPHQL = "http://renown.test/graphql";
|
|
29
|
+
|
|
30
|
+
// Signed by WALLET's Anvil dev key; its expiry is ignored by the policy.
|
|
31
|
+
const CREDENTIAL_ROW = {
|
|
32
|
+
documentId: "doc-cred",
|
|
33
|
+
credentialId: "urn:uuid:c7882913-68ef-48e5-9e89-f2948d2ca22c",
|
|
34
|
+
context: ["https://www.w3.org/2018/credentials/v1"],
|
|
35
|
+
type: ["VerifiableCredential", "RenownCredential"],
|
|
36
|
+
issuerId: "did:pkh:eip155:1:0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
|
|
37
|
+
issuerEthereumAddress: WALLET,
|
|
38
|
+
issuanceDate: "2026-09-24T00:48:25.566Z",
|
|
39
|
+
expirationDate: "2026-10-01T00:48:25.566Z",
|
|
40
|
+
credentialSubjectId: CONNECT_KEY,
|
|
41
|
+
credentialSubjectApp: "connect",
|
|
42
|
+
credentialStatusId: null,
|
|
43
|
+
credentialStatusType: null,
|
|
44
|
+
credentialSchemaId: "https://renown.id/schemas/renown-credential/v1",
|
|
45
|
+
credentialSchemaType: "JsonSchemaValidator2018",
|
|
46
|
+
proofVerificationMethod:
|
|
47
|
+
"did:pkh:eip155:1:0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266",
|
|
48
|
+
proofEthereumAddress: WALLET,
|
|
49
|
+
proofCreated: "2026-09-24T00:48:25.566Z",
|
|
50
|
+
proofPurpose: "assertionMethod",
|
|
51
|
+
proofType: "EthereumEip712Signature2021",
|
|
52
|
+
proofValue:
|
|
53
|
+
"0xe8d7a2468b9eb21286483fd88601d350ac7a8ed908506e51a34c6b119f93a7d75c6284a3f231698f6fcc8a3ad0ec5096a34811c7b6adef2d1e4146ddb22826a91c",
|
|
54
|
+
proofEip712Domain: JSON.stringify({ version: "1", chainId: 1 }),
|
|
55
|
+
proofEip712PrimaryType: "VerifiableCredential",
|
|
56
|
+
revoked: false,
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
function stubRenown(user: ActionSigner["user"] = SWITCHBOARD_USER): IRenown {
|
|
60
|
+
const signer = {
|
|
61
|
+
user,
|
|
62
|
+
app: { name: "switchboard", key: SWITCHBOARD_KEY },
|
|
63
|
+
} as unknown as ISigner;
|
|
64
|
+
return { signer } as unknown as IRenown;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
function claim(address: string, key: string): ActionSigner {
|
|
68
|
+
return {
|
|
69
|
+
user: { address, networkId: "eip155", chainId: 1 },
|
|
70
|
+
app: { name: "connect", key },
|
|
71
|
+
signatures: [],
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/** Answers the renown read model with `rows`; counts the requests. */
|
|
76
|
+
function mockReadModel(rows: unknown[] = [CREDENTIAL_ROW]) {
|
|
77
|
+
return vi.spyOn(globalThis, "fetch").mockImplementation(() =>
|
|
78
|
+
Promise.resolve(
|
|
79
|
+
new Response(JSON.stringify({ data: { renownCredentials: rows } }), {
|
|
80
|
+
status: 200,
|
|
81
|
+
}),
|
|
82
|
+
),
|
|
83
|
+
);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function remotePolicy(
|
|
87
|
+
renown = stubRenown(),
|
|
88
|
+
): Promise<SignatureTrustPolicy> {
|
|
89
|
+
const { trustPolicy } = await getRenownTrustPolicyConfig(
|
|
90
|
+
{ source: "remote", switchboardUrl: GRAPHQL },
|
|
91
|
+
renown,
|
|
92
|
+
);
|
|
93
|
+
return trustPolicy!;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
describe("getRenownTrustPolicyConfig", () => {
|
|
97
|
+
afterEach(() => vi.restoreAllMocks());
|
|
98
|
+
|
|
99
|
+
it("accepts a key a credential binds to the claimed wallet", async () => {
|
|
100
|
+
const fetchMock = mockReadModel();
|
|
101
|
+
const policy = await remotePolicy();
|
|
102
|
+
|
|
103
|
+
await expect(
|
|
104
|
+
policy.authorizeSigner(claim(WALLET, CONNECT_KEY), CONNECT_KEY, "doc"),
|
|
105
|
+
).resolves.toBe(true);
|
|
106
|
+
expect(fetchMock.mock.calls[0][0]).toBe(GRAPHQL);
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
it("refuses a mismatched address or key", async () => {
|
|
110
|
+
mockReadModel();
|
|
111
|
+
const policy = await remotePolicy();
|
|
112
|
+
|
|
113
|
+
await expect(
|
|
114
|
+
policy.authorizeSigner(
|
|
115
|
+
claim(SWITCHBOARD_USER.address, CONNECT_KEY),
|
|
116
|
+
CONNECT_KEY,
|
|
117
|
+
"doc",
|
|
118
|
+
),
|
|
119
|
+
).resolves.toBe(false);
|
|
120
|
+
await expect(
|
|
121
|
+
policy.authorizeSigner(
|
|
122
|
+
claim(WALLET, "did:key:zDnaeOther"),
|
|
123
|
+
"did:key:zDnaeOther",
|
|
124
|
+
"doc",
|
|
125
|
+
),
|
|
126
|
+
).resolves.toBe(false);
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
it("refuses a key no credential binds yet", async () => {
|
|
130
|
+
const fetchMock = mockReadModel([]);
|
|
131
|
+
const policy = await remotePolicy();
|
|
132
|
+
|
|
133
|
+
await expect(
|
|
134
|
+
policy.authorizeSigner(claim(WALLET, CONNECT_KEY), CONNECT_KEY, "doc"),
|
|
135
|
+
).resolves.toBe(false);
|
|
136
|
+
await expect(
|
|
137
|
+
policy.authorizeSigner(claim(WALLET, CONNECT_KEY), CONNECT_KEY, "doc"),
|
|
138
|
+
).resolves.toBe(false);
|
|
139
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
it("caches an acceptance per (address, key)", async () => {
|
|
143
|
+
const fetchMock = mockReadModel();
|
|
144
|
+
const policy = await remotePolicy();
|
|
145
|
+
const signer = claim(WALLET, CONNECT_KEY);
|
|
146
|
+
|
|
147
|
+
await policy.authorizeSigner(signer, CONNECT_KEY, "doc-1");
|
|
148
|
+
fetchMock.mockRejectedValue(new TypeError("offline"));
|
|
149
|
+
|
|
150
|
+
await expect(
|
|
151
|
+
policy.authorizeSigner(signer, CONNECT_KEY, "doc-2"),
|
|
152
|
+
).resolves.toBe(true);
|
|
153
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
it("throws on a network failure rather than refusing", async () => {
|
|
157
|
+
vi.spyOn(globalThis, "fetch").mockRejectedValue(new TypeError("offline"));
|
|
158
|
+
const policy = await remotePolicy();
|
|
159
|
+
|
|
160
|
+
await expect(
|
|
161
|
+
policy.authorizeSigner(claim(WALLET, CONNECT_KEY), CONNECT_KEY, "doc"),
|
|
162
|
+
).rejects.toThrow("offline");
|
|
163
|
+
});
|
|
164
|
+
|
|
165
|
+
it("accepts the switchboard's own key for its own user without a lookup", async () => {
|
|
166
|
+
const fetchMock = mockReadModel([]);
|
|
167
|
+
const policy = await remotePolicy();
|
|
168
|
+
|
|
169
|
+
await expect(
|
|
170
|
+
policy.authorizeSigner(
|
|
171
|
+
claim(SWITCHBOARD_USER.address, SWITCHBOARD_KEY),
|
|
172
|
+
SWITCHBOARD_KEY,
|
|
173
|
+
"doc",
|
|
174
|
+
),
|
|
175
|
+
).resolves.toBe(true);
|
|
176
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
it("matches the switchboard's own key against its current user", async () => {
|
|
180
|
+
const fetchMock = mockReadModel([]);
|
|
181
|
+
const renown = stubRenown();
|
|
182
|
+
const policy = await remotePolicy(renown);
|
|
183
|
+
|
|
184
|
+
renown.signer.user = { address: WALLET, networkId: "eip155", chainId: 1 };
|
|
185
|
+
|
|
186
|
+
await expect(
|
|
187
|
+
policy.authorizeSigner(
|
|
188
|
+
claim(WALLET, SWITCHBOARD_KEY),
|
|
189
|
+
SWITCHBOARD_KEY,
|
|
190
|
+
"doc",
|
|
191
|
+
),
|
|
192
|
+
).resolves.toBe(true);
|
|
193
|
+
expect(fetchMock).not.toHaveBeenCalled();
|
|
194
|
+
await expect(
|
|
195
|
+
policy.authorizeSigner(
|
|
196
|
+
claim(SWITCHBOARD_USER.address, SWITCHBOARD_KEY),
|
|
197
|
+
SWITCHBOARD_KEY,
|
|
198
|
+
"doc",
|
|
199
|
+
),
|
|
200
|
+
).resolves.toBe(false);
|
|
201
|
+
});
|
|
202
|
+
|
|
203
|
+
it("gives pooled workers a spec that builds the same policy", async () => {
|
|
204
|
+
const fetchMock = mockReadModel();
|
|
205
|
+
const { workerTrustPolicy } = await getRenownTrustPolicyConfig(
|
|
206
|
+
{ source: "remote", switchboardUrl: GRAPHQL },
|
|
207
|
+
stubRenown(),
|
|
208
|
+
);
|
|
209
|
+
|
|
210
|
+
const module = workerTrustPolicy!.module;
|
|
211
|
+
expect(module.exportName).toBe("createRenownTrustPolicy");
|
|
212
|
+
const filePath = "filePath" in module ? module.filePath : "";
|
|
213
|
+
expect(existsSync(filePath)).toBe(true);
|
|
214
|
+
expect(workerTrustPolicy!.initArgs).toEqual({
|
|
215
|
+
switchboard: GRAPHQL,
|
|
216
|
+
self: { key: SWITCHBOARD_KEY, user: SWITCHBOARD_USER },
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
const imported = (await import(pathToFileURL(filePath).href)) as Record<
|
|
220
|
+
string,
|
|
221
|
+
(args: unknown) => SignatureTrustPolicy
|
|
222
|
+
>;
|
|
223
|
+
const policy = imported[module.exportName](workerTrustPolicy!.initArgs);
|
|
224
|
+
await expect(
|
|
225
|
+
policy.authorizeSigner(claim(WALLET, CONNECT_KEY), CONNECT_KEY, "doc"),
|
|
226
|
+
).resolves.toBe(true);
|
|
227
|
+
expect(fetchMock).toHaveBeenCalledTimes(1);
|
|
228
|
+
});
|
|
229
|
+
|
|
230
|
+
it("reads a self source in process and gives workers no spec", async () => {
|
|
231
|
+
const request = vi.fn(() =>
|
|
232
|
+
Promise.resolve({ renownCredentials: [CREDENTIAL_ROW] }),
|
|
233
|
+
);
|
|
234
|
+
const config = await getRenownTrustPolicyConfig(
|
|
235
|
+
{ source: "self", request },
|
|
236
|
+
null,
|
|
237
|
+
);
|
|
238
|
+
|
|
239
|
+
expect(config.workerTrustPolicy).toBeUndefined();
|
|
240
|
+
await expect(
|
|
241
|
+
config.trustPolicy!.authorizeSigner(
|
|
242
|
+
claim(WALLET, CONNECT_KEY),
|
|
243
|
+
CONNECT_KEY,
|
|
244
|
+
"doc",
|
|
245
|
+
),
|
|
246
|
+
).resolves.toBe(true);
|
|
247
|
+
expect(request).toHaveBeenCalledTimes(1);
|
|
248
|
+
});
|
|
249
|
+
});
|
|
250
|
+
|
|
251
|
+
describe("assertWorkerTrustPolicy", () => {
|
|
252
|
+
it("fails with workers, authEnforcement and a self source", () => {
|
|
253
|
+
expect(() =>
|
|
254
|
+
assertWorkerTrustPolicy({
|
|
255
|
+
workers: 2,
|
|
256
|
+
authEnforcement: true,
|
|
257
|
+
renownSource: "self",
|
|
258
|
+
}),
|
|
259
|
+
).toThrow(
|
|
260
|
+
/REACTOR_WORKERS[\s\S]*REACTOR_AUTH_ENFORCEMENT[\s\S]*RENOWN_SOURCE/,
|
|
261
|
+
);
|
|
262
|
+
});
|
|
263
|
+
|
|
264
|
+
it.each([
|
|
265
|
+
{ workers: 0, authEnforcement: true, renownSource: "self" as const },
|
|
266
|
+
{ workers: 2, authEnforcement: false, renownSource: "self" as const },
|
|
267
|
+
{ workers: 2, authEnforcement: true, renownSource: "remote" as const },
|
|
268
|
+
])("passes %o", (config) => {
|
|
269
|
+
expect(() => assertWorkerTrustPolicy(config)).not.toThrow();
|
|
270
|
+
});
|
|
271
|
+
});
|
|
272
|
+
|
|
273
|
+
describe("applySwitchboardReactorDefaults with a trust policy", () => {
|
|
274
|
+
it("gives the reactor the policy and its worker spec", () => {
|
|
275
|
+
const reactorBuilder = new ReactorBuilder();
|
|
276
|
+
const withTrustPolicy = vi.spyOn(reactorBuilder, "withTrustPolicy");
|
|
277
|
+
const trustPolicy: SignatureTrustPolicy = {
|
|
278
|
+
authorizeSigner: () => Promise.resolve(true),
|
|
279
|
+
};
|
|
280
|
+
const workerTrustPolicy = {
|
|
281
|
+
module: { filePath: "/trust.js", exportName: "createTrustPolicy" },
|
|
282
|
+
};
|
|
283
|
+
|
|
284
|
+
applySwitchboardReactorDefaults(
|
|
285
|
+
reactorBuilder,
|
|
286
|
+
new ReactorClientBuilder(),
|
|
287
|
+
{
|
|
288
|
+
includeBaseModels: false,
|
|
289
|
+
signalHandlers: false,
|
|
290
|
+
trustPolicy: { trustPolicy, workerTrustPolicy },
|
|
291
|
+
},
|
|
292
|
+
);
|
|
293
|
+
|
|
294
|
+
expect(withTrustPolicy).toHaveBeenCalledWith(
|
|
295
|
+
trustPolicy,
|
|
296
|
+
workerTrustPolicy,
|
|
297
|
+
);
|
|
298
|
+
expect(reactorBuilder.hasTrustPolicy()).toBe(true);
|
|
299
|
+
});
|
|
300
|
+
|
|
301
|
+
it("leaves the reactor on the default without one", () => {
|
|
302
|
+
const reactorBuilder = new ReactorBuilder();
|
|
303
|
+
|
|
304
|
+
applySwitchboardReactorDefaults(
|
|
305
|
+
reactorBuilder,
|
|
306
|
+
new ReactorClientBuilder(),
|
|
307
|
+
{
|
|
308
|
+
includeBaseModels: false,
|
|
309
|
+
signalHandlers: false,
|
|
310
|
+
},
|
|
311
|
+
);
|
|
312
|
+
|
|
313
|
+
expect(reactorBuilder.hasTrustPolicy()).toBe(false);
|
|
314
|
+
});
|
|
315
|
+
});
|