Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion packages/sdk/tests/authored-use-loader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,14 @@ function fixture(files: Record<string, string[]>): string {
writeFileSync(join(directory, `${name}.flow.ts`), `
import { flow } from '@relayflows/surface';
export default flow(${JSON.stringify(name)}, { use: ${JSON.stringify(use)} }, async f => {
throw new Error('loader must never execute authored bodies');
// The authored body must NEVER run during use: resolution — the loader
// only walks the header. If you see this thrown by a test in
// packages/sdk/tests/authored-use-loader.test.ts, some loader code path
// is invoking the body when it should be inspecting the header only.
// Track the invocation site and gate it on the same signal that
// execute-authored-flow uses (see 'preflightHelpers' or the compile
// pass, not the body).
throw new Error('loader-invoked-body: use: resolution must not execute authored bodies (see authored-use-loader.test.ts)');
});
`);
}
Expand Down
13 changes: 12 additions & 1 deletion packages/sdk/tests/webhook.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,18 @@ async function receiver(dir: string): Promise<string> {
const server = await startWebhookServer(dir, 0);
servers.push(server);
const address = server.address();
if (!address || typeof address === 'string') throw new Error('missing HTTP address');
if (!address || typeof address === 'string') {
// startWebhookServer returned before the TCP socket bound (address()===null)
// or bound to a UNIX socket path (typeof 'string'). Neither shape is usable
// for the http:// URL these tests hand to the receiver. If you hit this:
// - Verify startWebhookServer is awaited before receiver() returns.
// - Confirm the second arg (port) is a number, not a socket path.
// - Check that a prior test didn't hold onto port 0 or exhaust ephemeral ports.
throw new Error(
'webhook receiver: server.address() returned a non-TCP address; '
+ `see packages/sdk/tests/webhook.test.ts:${28}`,
);
}
return `http://127.0.0.1:${address.port}`;
}

Expand Down
12 changes: 11 additions & 1 deletion scripts/schema-metaschemas.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,17 @@ export function outputMetaschemas(require) {
const fragment = target.hash;
target.hash = '';
const name = ids.get(target.href);
if (!name) throw new Error(`Unbundled meta-schema reference ${target.href}`);
if (!name) {
throw new Error(
`Unbundled meta-schema reference ${target.href}.\n`
+ `Add the referenced schema's $id to the bundled roots list in\n`
+ `scripts/schema-metaschemas.mjs so this generator can inline it under\n`
+ `#/$defs/<name>. Bundled roots are the entries fed to \`ids\`. This pin\n`
+ `exists so a new schema can't silently produce a JSON Schema file with\n`
+ `an unresolvable external $ref — Ajv would then throw at load time and\n`
+ `every consumer would see a runtime failure with no context.`,
);
}
result.$ref = `#/$defs/${name}${fragment.startsWith('#/') ? fragment.slice(1) : ''}`;
} else if (key === 'dependencies') {
result.dependentRequired = child;
Expand Down
Loading