Skip to content

Commit 1a0e8db

Browse files
committed
test: wire the fixtures that held a node no edge reaches
Claude-Session: https://claude.ai/code/session_01FEkQ5oEQNYg7j3ueo5t6pV Co-Authored-By: Claude <noreply@anthropic.com>
1 parent ee32adf commit 1a0e8db

6 files changed

Lines changed: 25 additions & 10 deletions

File tree

‎packages/services/service-automation/src/builtin/notify-currency-read-fault.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,10 @@ describe('notify — a currency hole refused after a FAILED tenant-settings read
131131

132132
it('under errorHandling retry the run succeeds once the read does, and the title formats in the default', async () => {
133133
const flow = flowWith({ errorHandling: { strategy: 'retry', maxRetries: 2, backoffMs: 1 } });
134-
flow.edges = flow.edges.filter((e) => e.type !== 'fault');
134+
// Without its fault edge the handler is reached by nothing, which the
135+
// parse refuses, so it goes with the edge.
136+
flow.edges = flow.edges.filter((e) => e.type !== 'fault' && e.source !== 'handled');
137+
flow.nodes = flow.nodes.filter((n) => n.id !== 'handled');
135138
const { engine, messaging } = engineWith(flow);
136139
let reads = 0;
137140
engine.setTenantCurrencyResolver(() => {

‎packages/services/service-automation/src/canonicalize-stored-flow.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,13 +246,16 @@ describe('canonicalizeStoredFlow — every site registerFlow refuses after the p
246246
engine.registerNodeExecutor(stampExecutor);
247247
return engine;
248248
};
249+
// The nodes are chained `start → … → end`: a top-level node no edge reaches
250+
// is refused at parse, and that is not the check these cases judge.
251+
const chain = (ids: string[]) => ids.slice(1).map((target, i) => ({ id: `e${i}`, source: ids[i], target }));
249252
const flowOf = (nodes: unknown[], extra: Record<string, unknown> = {}) => ({
250253
name: 'fd_stored',
251254
label: 'Stored',
252255
type: 'autolaunched',
253256
status: 'active',
254257
nodes: [{ id: 'start', type: 'start', label: 'Start' }, ...nodes, { id: 'end', type: 'end', label: 'End' }],
255-
edges: [],
258+
edges: chain(['start', ...nodes.map((n) => (n as { id: string }).id), 'end']),
256259
...extra,
257260
});
258261
const notify = (title: string) => ({

‎packages/services/service-automation/src/fault-edge-guard-containment.test.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -280,7 +280,10 @@ describe('#3863 — a fault edge must not swallow a guard refusal', () => {
280280
it('a guard refusal without any fault edge is fatal, as before', async () => {
281281
const flow = guardedDeleteWithHandler();
282282
flow.name = 'no_handler';
283-
flow.edges = flow.edges.filter((e) => e.type !== 'fault');
283+
// Without its fault edge the handler is reached by nothing, which the
284+
// parse refuses, so it goes with the edge.
285+
flow.edges = flow.edges.filter((e) => e.type !== 'fault' && e.source !== 'handler');
286+
flow.nodes = flow.nodes.filter((n) => n.id !== 'handler');
284287
engine.registerFlow('no_handler', flow);
285288

286289
const result = await engine.execute('no_handler', {

‎packages/spec/src/automation/flow-region-pause-and-end.test.ts‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,13 @@ const pausingNode = (type: string, id = 'pauser'): FlowNode => ({
5757

5858
const step = (id: string): FlowNode => ({ id, type: 'assignment', label: id });
5959

60-
const flowWith = (nodes: FlowNode[], edges: FlowEdge[] = []): Flow => ({
60+
// Unless a test passes its own edges, the nodes are chained from `start` in
61+
// order: a top-level node no edge reaches is refused at parse, and that rule is
62+
// not the one these tests judge.
63+
const chainFromStart = (nodes: FlowNode[]): FlowEdge[] =>
64+
nodes.map((node, i) => ({ id: `chain_${i}`, source: i === 0 ? 'start' : nodes[i - 1].id, target: node.id }));
65+
66+
const flowWith = (nodes: FlowNode[], edges: FlowEdge[] = chainFromStart(nodes)): Flow => ({
6167
name: 'region_contents',
6268
label: 'Region contents',
6369
type: 'autolaunched',

‎packages/spec/src/conversions/conversions.test.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -456,7 +456,7 @@ describe('conversion layer (ADR-0087 D2)', () => {
456456
{ id: 's', type: 'start', label: 'S' },
457457
{ id: 'g', type: 'get_record', label: 'G', config: { objectName: 'lead', object: 'lead' } },
458458
],
459-
edges: [],
459+
edges: [{ id: 'e1', source: 's', target: 'g' }],
460460
}],
461461
};
462462
let refusal: unknown;
@@ -482,7 +482,7 @@ describe('conversion layer (ADR-0087 D2)', () => {
482482
{ id: 's', type: 'start', label: 'S' },
483483
{ id: 'h', type: 'http_request', label: 'H', config: { url: 'https://example.com' } },
484484
],
485-
edges: [],
485+
edges: [{ id: 'e1', source: 's', target: 'h' }],
486486
}],
487487
};
488488
let refusal: unknown;
@@ -723,7 +723,7 @@ describe('conversion layer (ADR-0087 D2)', () => {
723723
name: 'settle',
724724
label: 'Settle',
725725
type: 'autolaunched',
726-
edges: [],
726+
edges: [{ id: 'e1', source: 'n1', target: 'w' }],
727727
nodes: [
728728
{ id: 'n1', type: 'start', label: 'Start' },
729729
{ id: 'w', type: 'wait', label: 'Wait', ...node },
@@ -839,7 +839,7 @@ describe('conversion layer (ADR-0087 D2)', () => {
839839
name: 'notify_slack',
840840
label: 'Notify Slack',
841841
type: 'autolaunched',
842-
edges: [],
842+
edges: [{ id: 'e1', source: 'n1', target: 'c' }],
843843
nodes: [
844844
{ id: 'n1', type: 'start', label: 'Start' },
845845
{ id: 'c', type: 'connector_action', label: 'Call', ...node },
@@ -892,7 +892,7 @@ describe('conversion layer (ADR-0087 D2)', () => {
892892
name: 'settle',
893893
label: 'Settle',
894894
type: 'autolaunched',
895-
edges: [],
895+
edges: [{ id: 'e1', source: 'n1', target: String(node.id) }],
896896
nodes: [
897897
{ id: 'n1', type: 'start', label: 'Start' },
898898
{ label: 'Step', ...node },

‎packages/spec/src/shared/retired-key-removal-version.pin.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ const flowWithNode = (node: Record<string, unknown>) => ({
247247
name: 'settle',
248248
label: 'Settle',
249249
type: 'autolaunched',
250-
edges: [],
250+
edges: [{ id: 'e1', source: 'n1', target: 'n2' }],
251251
nodes: [{ id: 'n1', type: 'start', label: 'Start' }, { id: 'n2', label: 'Step', ...node }],
252252
});
253253

0 commit comments

Comments
 (0)