@beehexa/hexasync-template-validate 2611.8.3 → 2611.14.1
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/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/validate/answerAgentTool.d.ts +4 -2
- package/dist/validate/answerAgentTool.d.ts.map +1 -1
- package/dist/validate/answerAgentTool.js +26 -6
- package/dist/validate/answerAgentTool.js.map +1 -1
- package/dist/validate/boundedAgentTool.d.ts +1 -1
- package/dist/validate/boundedAgentTool.d.ts.map +1 -1
- package/dist/validate/boundedAgentTool.js +17 -1
- package/dist/validate/boundedAgentTool.js.map +1 -1
- package/dist/validate/buildValidationModel.d.ts +3 -2
- package/dist/validate/buildValidationModel.d.ts.map +1 -1
- package/dist/validate/buildValidationModel.js +2 -2
- package/dist/validate/buildValidationModel.js.map +1 -1
- package/dist/validate/frontendFailureReferences.d.ts +6 -0
- package/dist/validate/frontendFailureReferences.d.ts.map +1 -0
- package/dist/validate/frontendFailureReferences.js +456 -0
- package/dist/validate/frontendFailureReferences.js.map +1 -0
- package/dist/validate/frontendReferences.d.ts +12 -1
- package/dist/validate/frontendReferences.d.ts.map +1 -1
- package/dist/validate/frontendReferences.js +119 -22
- package/dist/validate/frontendReferences.js.map +1 -1
- package/dist/validate/frontendTypeKnowledge.d.ts +6 -2
- package/dist/validate/frontendTypeKnowledge.d.ts.map +1 -1
- package/dist/validate/frontendTypeKnowledge.js +37 -6
- package/dist/validate/frontendTypeKnowledge.js.map +1 -1
- package/dist/validate/model.d.ts.map +1 -1
- package/dist/validate/model.js +2 -1
- package/dist/validate/model.js.map +1 -1
- package/dist/validate/registry.d.ts +6 -6
- package/dist/validate/registry.d.ts.map +1 -1
- package/dist/validate/registry.js +10 -5
- package/dist/validate/registry.js.map +1 -1
- package/dist/validate/retrieve.d.ts +1 -1
- package/dist/validate/rule.d.ts +9 -1
- package/dist/validate/rule.d.ts.map +1 -1
- package/dist/validate/ruleCatalog.d.ts.map +1 -1
- package/dist/validate/ruleCatalog.js +21 -11
- package/dist/validate/ruleCatalog.js.map +1 -1
- package/dist/validate/rules/groupedFrontend.d.ts +2 -2
- package/dist/validate/rules/groupedFrontend.d.ts.map +1 -1
- package/dist/validate/rules/groupedFrontend.js +366 -91
- package/dist/validate/rules/groupedFrontend.js.map +1 -1
- package/dist/validate/sourceLocator.d.ts +5 -1
- package/dist/validate/sourceLocator.d.ts.map +1 -1
- package/dist/validate/sourceLocator.js +13 -0
- package/dist/validate/sourceLocator.js.map +1 -1
- package/package.json +10 -8
|
@@ -1,22 +1,29 @@
|
|
|
1
|
+
import { FRONTEND_SELECTED_METADATA_FIELDS, FRONTEND_UNPROCESSED_RESULT_TYPES } from '@beehexa/hexasync-template-context';
|
|
1
2
|
import { normalizeFrontendStepFlags } from '../frontendFlags.js';
|
|
2
3
|
import { CONNECTOR_WORKFLOW_KEYS, locateFrontendWorkflows } from '@beehexa/hexasync-template-frontend-flow';
|
|
3
4
|
import { frontendOutputReferences } from '../frontendReferences.js';
|
|
5
|
+
import { expressionOutputReferenceCandidates } from '../frontendFailureReferences.js';
|
|
4
6
|
const own = (value, key) => Object.prototype.hasOwnProperty.call(value, key);
|
|
5
7
|
const object = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
|
|
6
8
|
const text = (value) => typeof value === 'string' && value.length > 0;
|
|
9
|
+
const flowKey = (value) => text(value) && value.length <= 128 && /^[A-Z][A-Z0-9_]*$/.test(value);
|
|
7
10
|
const guidance = {
|
|
8
11
|
1: 'Use a key-only FrontendFlow envelope with title, action.label, string completionVersion and nonempty steps. Omission and [] are valid; null is not.',
|
|
9
12
|
2: 'Use only true, false, "true" or "false" for root/dryRun; omit an unset flag. Metadata expressions are not coerced.',
|
|
10
13
|
3: 'dependsOn must contain distinct existing keys in this group, without self-links or cycles. Array order does not imply a prerequisite.',
|
|
11
14
|
4: 'Use distinct flow-local step keys and exactly one root: true. Step syntax is type/root/metadata, not the worker dialect.',
|
|
12
|
-
5: 'Route only to a step in this flow. Correct the literal next/onCancelled/IF/SWITCH target; a prerequisite does not share steps.',
|
|
13
|
-
6: 'RETURN is terminal: SUCCESS needs object/jsonata:: outputs, FAILED needs error {code,message}, CANCELLED has neither. No next
|
|
14
|
-
7: 'PUBLISH_EVENT metadata is exactly {eventName:string,payload:object}. Map to a nonempty eventName at runtime; transport and identity are server-owned. HTTP 202 means router acceptance only, not delivery; no automatic retry.',
|
|
15
|
-
8: 'Every grouped
|
|
15
|
+
5: 'Route only to a step in this flow, by its exact key. Correct the literal next/onCancelled/IF/SWITCH target; a prerequisite does not share steps. Only {{ }}/{% %} Liquid or a jsonata:: prefix is dynamic; liquid:: and ${…} render literally.',
|
|
16
|
+
6: 'RETURN is terminal: SUCCESS needs object/jsonata:: outputs, FAILED needs error {code,message} with nonempty strings, CANCELLED has neither. No next or onCancelled; grouped RETURN forbids top-level outputs, direct RETURN tolerates only absent, null or []. FAIL is terminal too: metadata is exactly {code,message} with a literal ^[A-Z][A-Z0-9_]*$ code and a nonblank message; next/onCancelled only absent or null, outputs only absent, null or [].',
|
|
17
|
+
7: 'PUBLISH_EVENT metadata is exactly {eventName:string,payload:object}. Map to a nonempty eventName at runtime; transport and identity are server-owned. A grouped event step cannot be a dry run. HTTP 202 means router acceptance only, not delivery; no automatic retry.',
|
|
18
|
+
8: 'Every grouped step must route to an explicit RETURN or FAIL — a missing, null or blank next/arm/default or a blank onCancelled is rejected even on an unreachable step. Runtime exhaustion is MISSING_RETURN, never success.',
|
|
16
19
|
9: 'Static validation cannot certify a dynamic route or loop terminates or succeeds. Runtime exhaustion remains MISSING_RETURN.',
|
|
17
|
-
10: 'Frontend outputs belong only to nonterminal steps in the enclosing workflow. Prerequisites and sibling workflows do not inject data; worker _outputs is a different namespace.
|
|
18
|
-
11: 'Uncertain focus/root bindings, opaque or incomplete producer selectors, namespace predicates and duplicate local keys cannot establish one output owner statically. Keep ownership uncertain; runtime mapping still checks it.',
|
|
20
|
+
10: 'Frontend outputs belong only to nonterminal steps in the enclosing workflow. Prerequisites and sibling workflows do not inject data; worker _outputs is a different namespace.',
|
|
21
|
+
11: 'Uncertain focus/root bindings, opaque or incomplete producer selectors, whole-namespace reads, namespace predicates and duplicate local keys cannot establish one output owner statically; RECORDS_FORM search.items sees only the search response, so an outputs read there names a response member (read workflow values in search.request, label or fill). Keep ownership uncertain; runtime mapping still checks it.',
|
|
22
|
+
13: 'An API or GATEWAY_API step can fail in a controlled way and then follows its plain next, so a literal next straight into a SUCCESS RETURN would report success. Route through an IF step or a next branch object ({if, then, else}) that classifies the result, or to a FAILED RETURN, a FAIL step or an intermediate step.',
|
|
23
|
+
14: 'A failed API or GATEWAY_API needs a possible recovery route: a failed arm, an output read in its own next, or a reachable step that can read its result. This static advice does not prove that a branch executes. At runtime the failure stays unread until an actual workflow expression uses that run\'s output; comments, literals, unused branches and response-only projections do not handle it. Classify outputs.<KEY>.errorCode or _response.statusCode where you recover, or end the run failed.',
|
|
19
24
|
};
|
|
25
|
+
/** Profiles.api publication and dashboard admission: a FAIL code is a fixed literal, never templated. */
|
|
26
|
+
const FAIL_CODE = /^[A-Z][A-Z0-9_]*$/;
|
|
20
27
|
function closed(value, allowed, path, rule, emit) {
|
|
21
28
|
for (const key of Object.keys(value)) {
|
|
22
29
|
if (!allowed.includes(key))
|
|
@@ -55,17 +62,47 @@ function jsonValue(value) {
|
|
|
55
62
|
}
|
|
56
63
|
return true;
|
|
57
64
|
}
|
|
58
|
-
function specialStep(step, path, emit) {
|
|
59
|
-
if (step.type !== 'RETURN' && step.type !== 'PUBLISH_EVENT')
|
|
65
|
+
function specialStep(step, path, emit, grouped) {
|
|
66
|
+
if (step.type !== 'RETURN' && step.type !== 'FAIL' && step.type !== 'PUBLISH_EVENT')
|
|
60
67
|
return;
|
|
61
|
-
const rule = step.type === '
|
|
68
|
+
const rule = step.type === 'PUBLISH_EVENT' ? 7 : 6;
|
|
62
69
|
closed(step, ['key', 'type', 'root', 'dryRun', 'name', 'description', 'arguments', 'metadata', 'outputs', 'msg', 'repeatableCount', 'repeatableDetailCount', 'status', 'next', 'onCancelled'], path, rule, emit);
|
|
70
|
+
if (step.type === 'RETURN') {
|
|
71
|
+
for (const key of ['next', 'onCancelled']) {
|
|
72
|
+
if (own(step, key))
|
|
73
|
+
emit(rule, [...path, key], `RETURN forbids ${key}, even when empty or null.`);
|
|
74
|
+
}
|
|
75
|
+
if (own(step, 'outputs')) {
|
|
76
|
+
if (grouped)
|
|
77
|
+
emit(rule, [...path, 'outputs'], 'Grouped RETURN forbids outputs, even when empty or null.');
|
|
78
|
+
else if (step.outputs !== null && !(Array.isArray(step.outputs) && step.outputs.length === 0))
|
|
79
|
+
emit(rule, [...path, 'outputs'], 'RETURN forbids output processors; outputs must be absent, null or [].');
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (step.type === 'FAIL') {
|
|
83
|
+
// Same tolerance as profiles.api publication and dashboard admission: routes may be absent or null only,
|
|
84
|
+
// output processors absent, null or [] only.
|
|
85
|
+
for (const key of ['next', 'onCancelled']) {
|
|
86
|
+
if (own(step, key) && step[key] !== null)
|
|
87
|
+
emit(rule, [...path, key], `FAIL is terminal: ${key} must be absent or null.`);
|
|
88
|
+
}
|
|
89
|
+
if (own(step, 'outputs') && step.outputs !== null && !(Array.isArray(step.outputs) && step.outputs.length === 0))
|
|
90
|
+
emit(rule, [...path, 'outputs'], 'FAIL forbids output processors; outputs must be absent, null or [].');
|
|
91
|
+
}
|
|
63
92
|
if (!object(step.metadata)) {
|
|
64
93
|
emit(rule, [...path, 'metadata'], `${step.type} metadata must be an object.`);
|
|
65
94
|
return;
|
|
66
95
|
}
|
|
67
96
|
const metadata = step.metadata;
|
|
68
97
|
const at = [...path, 'metadata'];
|
|
98
|
+
if (step.type === 'FAIL') {
|
|
99
|
+
closed(metadata, ['code', 'message'], at, rule, emit);
|
|
100
|
+
if (typeof metadata.code !== 'string' || !FAIL_CODE.test(metadata.code))
|
|
101
|
+
emit(rule, [...at, 'code'], 'FAIL code must be a literal string matching ^[A-Z][A-Z0-9_]*$; a templated code is not accepted.');
|
|
102
|
+
if (typeof metadata.message !== 'string' || metadata.message.trim() === '')
|
|
103
|
+
emit(rule, [...at, 'message'], 'FAIL message must be a nonblank string.');
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
69
106
|
if (step.type === 'PUBLISH_EVENT') {
|
|
70
107
|
closed(metadata, ['eventName', 'payload'], at, rule, emit);
|
|
71
108
|
if (!text(metadata.eventName) || metadata.eventName.trim().length === 0)
|
|
@@ -75,10 +112,6 @@ function specialStep(step, path, emit) {
|
|
|
75
112
|
return;
|
|
76
113
|
}
|
|
77
114
|
closed(metadata, ['status', 'outputs', 'error'], at, rule, emit);
|
|
78
|
-
for (const key of ['next', 'onCancelled', 'outputs']) {
|
|
79
|
-
if (own(step, key))
|
|
80
|
-
emit(rule, [...path, key], `RETURN forbids ${key}, even when empty or null.`);
|
|
81
|
-
}
|
|
82
115
|
const status = metadata.status;
|
|
83
116
|
if (status !== 'SUCCESS' && status !== 'FAILED' && status !== 'CANCELLED')
|
|
84
117
|
emit(rule, [...at, 'status'], 'RETURN status must be exactly SUCCESS, FAILED or CANCELLED.');
|
|
@@ -96,9 +129,11 @@ function specialStep(step, path, emit) {
|
|
|
96
129
|
}
|
|
97
130
|
else {
|
|
98
131
|
closed(metadata.error, ['code', 'message'], [...at, 'error'], rule, emit);
|
|
132
|
+
// Dashboard grouped admission requires nonempty trimmed code and message strings.
|
|
99
133
|
for (const key of ['code', 'message']) {
|
|
100
|
-
|
|
101
|
-
|
|
134
|
+
const value = metadata.error[key];
|
|
135
|
+
if (typeof value !== 'string' || value.trim() === '')
|
|
136
|
+
emit(rule, [...at, 'error', key], `FAILED error.${key} must be a nonempty string.`);
|
|
102
137
|
}
|
|
103
138
|
}
|
|
104
139
|
}
|
|
@@ -106,9 +141,242 @@ function specialStep(step, path, emit) {
|
|
|
106
141
|
emit(rule, [...at, 'error'], 'Only FAILED may declare error.');
|
|
107
142
|
}
|
|
108
143
|
}
|
|
144
|
+
/**
|
|
145
|
+
* Mirrors the dashboard's grouped admission and `calculateNextProcessKey`: only a Liquid tag or an explicit
|
|
146
|
+
* `jsonata::` prefix makes a route dynamic. Any other text — `liquid::X`, `${X}`, ` X` — renders literally at runtime,
|
|
147
|
+
* so it is a literal key matched exactly.
|
|
148
|
+
*/
|
|
149
|
+
const dynamicRoute = (route) => route.includes('{{') || route.includes('{%') || route.startsWith('jsonata::');
|
|
150
|
+
/**
|
|
151
|
+
* Remote-action step types whose ordinary outcome includes a controlled failure — the dashboard's
|
|
152
|
+
* `FALLIBLE_STEP_TYPES` (`groupedWorkflowDefinition.ts`). PUBLISH_EVENT is not routed on failure at all; local
|
|
153
|
+
* transforms, storage, navigation, pass-through steps, WAIT, IF/SWITCH and terminals are not checked.
|
|
154
|
+
*/
|
|
155
|
+
const FALLIBLE_STEP_TYPES = { API: true, GATEWAY_API: true };
|
|
156
|
+
const outputProcessorTypes = {
|
|
157
|
+
jsonata: true, liquid: true, GET_LOCAL_STORAGE: true, SET_LOCAL_STORAGE: true,
|
|
158
|
+
};
|
|
159
|
+
function collectStrings(value, into, seen, metadataType = '', root = true, language, projection = false, transformedKeys = false, path) {
|
|
160
|
+
const selected = Object.hasOwn(FRONTEND_SELECTED_METADATA_FIELDS, metadataType)
|
|
161
|
+
? FRONTEND_SELECTED_METADATA_FIELDS[metadataType] : undefined;
|
|
162
|
+
if ((selected !== undefined || metadataType === 'RECORDS_FORM_SEARCH') && !object(value))
|
|
163
|
+
return;
|
|
164
|
+
if (['FORM_FIELD', 'FORM_VALIDATION'].includes(metadataType) && !Array.isArray(value) && !object(value))
|
|
165
|
+
return;
|
|
166
|
+
if (typeof value === 'string') {
|
|
167
|
+
const forcedLiquid = metadataType === 'OUTPUT_GET_LOCAL_STORAGE' || metadataType === 'OUTPUT_SET_LOCAL_STORAGE';
|
|
168
|
+
const expression = { text: value, language: language ?? (forcedLiquid || !value.startsWith('jsonata::') ? 'liquid' : 'jsonata') };
|
|
169
|
+
if (path !== undefined)
|
|
170
|
+
expression.path = path;
|
|
171
|
+
into.push(expression);
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (value === null || typeof value !== 'object' || seen.has(value))
|
|
175
|
+
return;
|
|
176
|
+
const type = (root || projection) && object(value) && typeof value.type === 'string' ? value.type.toUpperCase() : '';
|
|
177
|
+
if (root && type === 'RETURN' && object(value) && object(value.metadata) && value.metadata.status === 'CANCELLED')
|
|
178
|
+
return;
|
|
179
|
+
seen.add(value);
|
|
180
|
+
for (const [key, item] of Object.entries(value)) {
|
|
181
|
+
if (root && type && !['metadata', 'arguments', 'outputs', 'next', 'onCancelled', 'name', 'description'].includes(key))
|
|
182
|
+
continue;
|
|
183
|
+
if (root && ['RETURN', 'FAIL'].includes(type) && key !== 'metadata' && key !== 'arguments')
|
|
184
|
+
continue;
|
|
185
|
+
if (selected && !selected.includes(key))
|
|
186
|
+
continue;
|
|
187
|
+
if (['IF', 'SWITCH', 'JSONATA', 'LIQUID', 'SINGLE_CHOICE_FORM', 'MULTIPLE_CHOICE_FORM'].includes(metadataType) &&
|
|
188
|
+
typeof item !== 'string')
|
|
189
|
+
continue;
|
|
190
|
+
if (metadataType === 'RETURN' && key !== (object(value) && value.status === 'FAILED' ? 'error' : 'outputs'))
|
|
191
|
+
continue;
|
|
192
|
+
if (metadataType === 'FAIL' && key !== 'code' && key !== 'message')
|
|
193
|
+
continue;
|
|
194
|
+
if (metadataType === 'FORM' && ((key === 'notice' && typeof item !== 'string') ||
|
|
195
|
+
(key === 'fields' && !Array.isArray(item))))
|
|
196
|
+
continue;
|
|
197
|
+
if (metadataType === 'FORM_VALIDATION' && !Array.isArray(value) &&
|
|
198
|
+
(!object(value) || value.type !== 'API' || !['metadata', 'isOk', 'message'].includes(key)))
|
|
199
|
+
continue;
|
|
200
|
+
if ((metadataType === 'SHOW_INFO' || metadataType === 'INTEGRATION_APP_MANAGEMENT') && typeof item !== 'string')
|
|
201
|
+
continue;
|
|
202
|
+
if (metadataType === 'RECORDS_FORM' && key === 'search' && path === undefined &&
|
|
203
|
+
(!object(value) || !object(value.allow) || value.allow.add !== true))
|
|
204
|
+
continue;
|
|
205
|
+
if (metadataType === 'RECORDS_FORM_SEARCH' && key === 'items') {
|
|
206
|
+
// A located scope finding may name response-owned data; it can never be a recovery witness.
|
|
207
|
+
if (path !== undefined && typeof item === 'string')
|
|
208
|
+
into.push({ text: item, language: 'jsonata', path: [...path, key], responseFocused: true });
|
|
209
|
+
continue;
|
|
210
|
+
}
|
|
211
|
+
if (metadataType === 'RECORDS_FORM_SEARCH' && !['request', 'label', 'fill'].includes(key))
|
|
212
|
+
continue;
|
|
213
|
+
if (root && key === 'outputs' && FRONTEND_UNPROCESSED_RESULT_TYPES[type] === true)
|
|
214
|
+
continue;
|
|
215
|
+
if (projection && !Array.isArray(value) && (key !== 'metadata' || !object(value) ||
|
|
216
|
+
typeof value.type !== 'string' || !Object.hasOwn(outputProcessorTypes, value.type)))
|
|
217
|
+
continue;
|
|
218
|
+
if (['OUTPUT_JSONATA', 'OUTPUT_LIQUID'].includes(metadataType) && key !== 'expression')
|
|
219
|
+
continue;
|
|
220
|
+
const fieldPath = path === undefined ? undefined : [...path, key];
|
|
221
|
+
if (transformedKeys && (key.startsWith('jsonata::') || key.includes('{{') || key.includes('{%'))) {
|
|
222
|
+
collectStrings(key, into, seen, '', false, undefined, false, false, fieldPath);
|
|
223
|
+
}
|
|
224
|
+
let fieldLanguage;
|
|
225
|
+
let fieldValue = item;
|
|
226
|
+
if (typeof item === 'string') {
|
|
227
|
+
if ((metadataType === 'IF' && key === 'condition') || (metadataType === 'SWITCH' && key === 'expression')) {
|
|
228
|
+
const trimmed = item.trim();
|
|
229
|
+
fieldLanguage = 'liquid';
|
|
230
|
+
if (trimmed.startsWith('${') && trimmed.endsWith('}')) {
|
|
231
|
+
fieldLanguage = 'liquid-jsonata';
|
|
232
|
+
fieldValue = trimmed.slice(2, -1);
|
|
233
|
+
}
|
|
234
|
+
}
|
|
235
|
+
else if (key === 'expression' &&
|
|
236
|
+
['JSONATA', 'SINGLE_CHOICE_FORM', 'MULTIPLE_CHOICE_FORM'].includes(metadataType)) {
|
|
237
|
+
fieldLanguage = 'liquid-jsonata';
|
|
238
|
+
}
|
|
239
|
+
else if ((key === 'expression' && ['LIQUID', 'OUTPUT_LIQUID'].includes(metadataType)) ||
|
|
240
|
+
(metadataType === 'RECORDS_FORM_SEARCH' && key === 'label')) {
|
|
241
|
+
fieldLanguage = 'liquid';
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
// Only the step's own metadata fields use their handler grammar. Nested data and ordinary
|
|
245
|
+
// output processors use generic first-stage transforms; response-only second passes aren't root reads.
|
|
246
|
+
const childProjection = (projection && Array.isArray(value)) ||
|
|
247
|
+
(root && key === 'outputs' && Array.isArray(item) && type !== 'RETURN' && type !== 'FAIL');
|
|
248
|
+
const childMetadataType = (metadataType === 'FORM' && key === 'fields') ||
|
|
249
|
+
(metadataType === 'FORM_FIELD' && Array.isArray(value)) ? 'FORM_FIELD'
|
|
250
|
+
: (metadataType === 'FORM_FIELD' && key === 'validations') ||
|
|
251
|
+
(metadataType === 'FORM_VALIDATION' && Array.isArray(value)) ? 'FORM_VALIDATION'
|
|
252
|
+
: metadataType === 'RECORDS_FORM' && key === 'search' ? 'RECORDS_FORM_SEARCH'
|
|
253
|
+
: (root || projection) && key === 'metadata' ? `${projection ? 'OUTPUT_' : ''}${type}` : '';
|
|
254
|
+
const childKeys = metadataType === 'FORM_FIELD' && key === 'validations' ? false :
|
|
255
|
+
(metadataType === 'FORM_VALIDATION' && key === 'metadata') || transformedKeys || (root && key === 'arguments') ||
|
|
256
|
+
(metadataType === 'RECORDS_FORM' && key === 'initial') ||
|
|
257
|
+
(root && key === 'metadata' &&
|
|
258
|
+
!['IF', 'SWITCH', 'JSONATA', 'LIQUID', 'SINGLE_CHOICE_FORM', 'MULTIPLE_CHOICE_FORM', 'RETURN', 'FAIL', 'RECORDS_FORM'].includes(type)) ||
|
|
259
|
+
(['RETURN', 'FAIL'].includes(metadataType) && (key === 'outputs' || key === 'error'));
|
|
260
|
+
collectStrings(fieldValue, into, seen, childMetadataType, false, fieldLanguage, childProjection, childKeys, fieldPath);
|
|
261
|
+
}
|
|
262
|
+
// Active-path cycle detection must not suppress a shared value's different owning-field grammar.
|
|
263
|
+
seen.delete(value);
|
|
264
|
+
}
|
|
265
|
+
/** Every route target a step can take: `next` arms, `onCancelled`, IF then/else, SWITCH cases/default. */
|
|
266
|
+
function routeTargets(step) {
|
|
267
|
+
const into = [];
|
|
268
|
+
const visit = (route, seen) => {
|
|
269
|
+
if (typeof route === 'string') {
|
|
270
|
+
if (route)
|
|
271
|
+
into.push(route);
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
if (!object(route) || seen.has(route))
|
|
275
|
+
return;
|
|
276
|
+
seen.add(route);
|
|
277
|
+
for (const arm of ['then', 'else', 'success', 'failed'])
|
|
278
|
+
visit(route[arm], seen);
|
|
279
|
+
};
|
|
280
|
+
visit(step.next, new Set());
|
|
281
|
+
visit(step.onCancelled, new Set());
|
|
282
|
+
const metadata = step.metadata;
|
|
283
|
+
if (!object(metadata))
|
|
284
|
+
return into;
|
|
285
|
+
if (step.type === 'IF') {
|
|
286
|
+
visit(metadata.then, new Set());
|
|
287
|
+
visit(metadata.else, new Set());
|
|
288
|
+
}
|
|
289
|
+
if (step.type === 'SWITCH') {
|
|
290
|
+
if (object(metadata.cases))
|
|
291
|
+
for (const target of Object.values(metadata.cases))
|
|
292
|
+
visit(target, new Set());
|
|
293
|
+
visit(metadata.default, new Set());
|
|
294
|
+
}
|
|
295
|
+
return into;
|
|
296
|
+
}
|
|
297
|
+
/** One candidate at a time, including rejected syntax; an empty candidate still permits cancellation. */
|
|
298
|
+
function* failureConsumerWitnesses(nodes, key) {
|
|
299
|
+
const node = nodes.get(key);
|
|
300
|
+
if (!node?.fallible)
|
|
301
|
+
return;
|
|
302
|
+
if (node.explicitFailed) {
|
|
303
|
+
yield true;
|
|
304
|
+
return;
|
|
305
|
+
}
|
|
306
|
+
for (const { text, language } of node.ownNext) {
|
|
307
|
+
for (const candidate of expressionOutputReferenceCandidates(text, language))
|
|
308
|
+
yield candidate.has(key);
|
|
309
|
+
}
|
|
310
|
+
const visited = new Set(), pending = [...node.targets];
|
|
311
|
+
while (pending.length) {
|
|
312
|
+
const next = pending.pop();
|
|
313
|
+
if (visited.has(next))
|
|
314
|
+
continue;
|
|
315
|
+
const reader = nodes.get(next);
|
|
316
|
+
if (!reader)
|
|
317
|
+
continue;
|
|
318
|
+
visited.add(next);
|
|
319
|
+
for (const { text, language } of reader.readers) {
|
|
320
|
+
for (const candidate of expressionOutputReferenceCandidates(text, language))
|
|
321
|
+
yield candidate.has(key);
|
|
322
|
+
}
|
|
323
|
+
pending.push(...reader.targets);
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
/**
|
|
327
|
+
* Match the runtime's potential eligibility, never actual consumption. Snapshot primitive fields before
|
|
328
|
+
* yielding; complete structural choices can require exponential total work, so hosts may cancel the run.
|
|
329
|
+
*/
|
|
330
|
+
async function potentialRecoverySteps(steps, options) {
|
|
331
|
+
options.signal?.throwIfAborted();
|
|
332
|
+
const nodes = new Map();
|
|
333
|
+
for (const step of steps) {
|
|
334
|
+
if (!step || typeof step.key !== 'string' || nodes.has(step.key))
|
|
335
|
+
continue;
|
|
336
|
+
const ownNext = [], readers = [];
|
|
337
|
+
collectStrings(step.next, ownNext, new Set());
|
|
338
|
+
collectStrings(step, readers, new Set());
|
|
339
|
+
nodes.set(step.key, {
|
|
340
|
+
fallible: typeof step.type === 'string' && Object.hasOwn(FALLIBLE_STEP_TYPES, step.type),
|
|
341
|
+
ownNext, readers, targets: routeTargets(step),
|
|
342
|
+
explicitFailed: object(step.next) && own(step.next, 'failed'),
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
const keys = [...nodes.keys()];
|
|
346
|
+
for (const node of nodes.values())
|
|
347
|
+
if (node.targets.some(dynamicRoute))
|
|
348
|
+
node.targets = keys;
|
|
349
|
+
const consumed = new Set();
|
|
350
|
+
for (const [key, node] of nodes) {
|
|
351
|
+
if (!node.fallible)
|
|
352
|
+
continue;
|
|
353
|
+
const candidates = failureConsumerWitnesses(nodes, key);
|
|
354
|
+
try {
|
|
355
|
+
while (true) {
|
|
356
|
+
options.signal?.throwIfAborted();
|
|
357
|
+
const candidate = candidates.next();
|
|
358
|
+
options.signal?.throwIfAborted();
|
|
359
|
+
if (candidate.done)
|
|
360
|
+
break;
|
|
361
|
+
if (candidate.value) {
|
|
362
|
+
consumed.add(key);
|
|
363
|
+
break;
|
|
364
|
+
}
|
|
365
|
+
const { promise, resolve } = Promise.withResolvers();
|
|
366
|
+
setTimeout(resolve, 0);
|
|
367
|
+
await promise;
|
|
368
|
+
options.signal?.throwIfAborted();
|
|
369
|
+
}
|
|
370
|
+
}
|
|
371
|
+
finally {
|
|
372
|
+
candidates.return(undefined);
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
return consumed;
|
|
376
|
+
}
|
|
109
377
|
/** Inspect only routing fields; never walk user payloads looking for something that resembles a step. */
|
|
110
378
|
function routes(step, path, keys, emit) {
|
|
111
|
-
if (step.type === 'RETURN')
|
|
379
|
+
if (step.type === 'RETURN' || step.type === 'FAIL')
|
|
112
380
|
return { targets: [], exits: [], uncertain: [] };
|
|
113
381
|
const pending = [];
|
|
114
382
|
const exits = [];
|
|
@@ -116,10 +384,11 @@ function routes(step, path, keys, emit) {
|
|
|
116
384
|
const targets = [];
|
|
117
385
|
const metadata = object(step.metadata) ? step.metadata : {};
|
|
118
386
|
if (step.type === 'IF' || step.type === 'SWITCH') {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
387
|
+
if (own(step, 'next'))
|
|
388
|
+
emit(5, [...path, 'next'], `${step.type} routes through metadata and forbids next.`);
|
|
389
|
+
// Dashboard admission ignores an empty processor list here, so only a non-empty one is a defect.
|
|
390
|
+
if (own(step, 'outputs') && step.outputs !== null && !(Array.isArray(step.outputs) && step.outputs.length === 0))
|
|
391
|
+
emit(5, [...path, 'outputs'], `${step.type} routes through metadata and forbids output processors; outputs may only be absent, null or [].`);
|
|
123
392
|
closed(metadata, step.type === 'IF' ? ['condition', 'then', 'else'] : ['expression', 'cases', 'default'], [...path, 'metadata'], 5, emit);
|
|
124
393
|
const expression = step.type === 'IF' ? 'condition' : 'expression';
|
|
125
394
|
if (typeof metadata[expression] !== 'string')
|
|
@@ -152,10 +421,11 @@ function routes(step, path, keys, emit) {
|
|
|
152
421
|
else {
|
|
153
422
|
pending.push({ value: step.next, path: [...path, 'next'] });
|
|
154
423
|
}
|
|
155
|
-
|
|
424
|
+
// A declared string onCancelled is a route (blank → certain exit, as admission treats it); null/absent declares none.
|
|
425
|
+
if (typeof step.onCancelled === 'string') {
|
|
156
426
|
pending.push({ value: step.onCancelled, path: [...path, 'onCancelled'] });
|
|
157
427
|
}
|
|
158
|
-
else if (step.onCancelled != null
|
|
428
|
+
else if (step.onCancelled != null) {
|
|
159
429
|
emit(5, [...path, 'onCancelled'], 'onCancelled must be a string route when declared.');
|
|
160
430
|
}
|
|
161
431
|
const entered = new Set();
|
|
@@ -170,11 +440,11 @@ function routes(step, path, keys, emit) {
|
|
|
170
440
|
exits.push([...route.path]);
|
|
171
441
|
}
|
|
172
442
|
else if (typeof value === 'string') {
|
|
173
|
-
if (
|
|
443
|
+
if (dynamicRoute(value)) {
|
|
174
444
|
uncertain.push([...route.path]);
|
|
175
445
|
}
|
|
176
446
|
else {
|
|
177
|
-
const target = keys.get(value
|
|
447
|
+
const target = keys.get(value);
|
|
178
448
|
if (target === undefined)
|
|
179
449
|
emit(5, route.path, `Literal route ${JSON.stringify(value)} does not name a step in this flow.`);
|
|
180
450
|
else
|
|
@@ -202,7 +472,7 @@ function routes(step, path, keys, emit) {
|
|
|
202
472
|
}
|
|
203
473
|
return { targets, exits, uncertain };
|
|
204
474
|
}
|
|
205
|
-
function checkSteps(flow, path, emit) {
|
|
475
|
+
async function checkSteps(flow, path, emit, options) {
|
|
206
476
|
if (!Array.isArray(flow.steps) || flow.steps.length === 0)
|
|
207
477
|
return;
|
|
208
478
|
const keys = new Map();
|
|
@@ -234,7 +504,10 @@ function checkSteps(flow, path, emit) {
|
|
|
234
504
|
if (own(step, workerKey))
|
|
235
505
|
emit(4, [...at, workerKey], `Worker member ${workerKey} is not frontend syntax.`);
|
|
236
506
|
}
|
|
237
|
-
specialStep(step, at, emit);
|
|
507
|
+
specialStep(step, at, emit, true);
|
|
508
|
+
// Dashboard grouped admission: a dry run is never router acceptance, so such a step could never succeed.
|
|
509
|
+
if (step.type === 'PUBLISH_EVENT' && step.dryRun === true)
|
|
510
|
+
emit(7, [...at, 'dryRun'], 'PUBLISH_EVENT cannot run as a dry run: a dry run is never router acceptance, so the step could never succeed.');
|
|
238
511
|
}
|
|
239
512
|
if (roots.length === 0)
|
|
240
513
|
emit(4, [...path, 'steps'], 'Grouped flow has no true root.');
|
|
@@ -242,10 +515,44 @@ function checkSteps(flow, path, emit) {
|
|
|
242
515
|
for (const index of roots)
|
|
243
516
|
emit(4, [...path, 'steps', String(index), 'root'], 'Grouped flow has multiple true roots.');
|
|
244
517
|
}
|
|
245
|
-
if (!steps.some((step) => step?.type === 'RETURN'))
|
|
246
|
-
emit(8, [...path, 'steps'], 'Grouped flow is missing RETURN.');
|
|
518
|
+
if (!steps.some((step) => step?.type === 'RETURN' || step?.type === 'FAIL'))
|
|
519
|
+
emit(8, [...path, 'steps'], 'Grouped flow is missing RETURN or FAIL.');
|
|
520
|
+
// Mirrors the dashboard's grouped admission: a controlled API/GATEWAY_API failure follows its plain `next`, so a
|
|
521
|
+
// literal `next` straight into a SUCCESS RETURN would succeed the run. Classify the outcome first (IF or a next
|
|
522
|
+
// branch object). Templated routes, FAILED RETURNs, FAIL steps and intermediate steps stay allowed.
|
|
523
|
+
const straightToSuccess = new Set();
|
|
524
|
+
for (const [index, step] of steps.entries()) {
|
|
525
|
+
if (!step || typeof step.type !== 'string' || !Object.hasOwn(FALLIBLE_STEP_TYPES, step.type) || typeof step.next !== 'string')
|
|
526
|
+
continue;
|
|
527
|
+
const route = step.next;
|
|
528
|
+
if (!route.trim() || dynamicRoute(route))
|
|
529
|
+
continue;
|
|
530
|
+
const target = keys.has(route) ? steps[keys.get(route)] : undefined;
|
|
531
|
+
if (target?.type === 'RETURN' && object(target.metadata) && target.metadata.status === 'SUCCESS') {
|
|
532
|
+
straightToSuccess.add(index);
|
|
533
|
+
emit(13, [...path, 'steps', String(index), 'next'], `${step.type} step ${String(step.key)} must not lead straight to a SUCCESS RETURN (${route}); classify its outcome first.`);
|
|
534
|
+
}
|
|
535
|
+
}
|
|
536
|
+
// The dashboard routes a grouped step's failure only when it is consumed; any other failure ends the run failed.
|
|
537
|
+
// A step already reported by FFE-13 is not reported twice.
|
|
538
|
+
const consumed = await potentialRecoverySteps(steps, options);
|
|
539
|
+
const firstIndex = new Map();
|
|
540
|
+
for (const [index, step] of steps.entries())
|
|
541
|
+
if (step && typeof step.key === 'string' && !firstIndex.has(step.key))
|
|
542
|
+
firstIndex.set(step.key, index);
|
|
543
|
+
for (const [key, index] of firstIndex) {
|
|
544
|
+
const step = steps[index];
|
|
545
|
+
if (typeof step.type !== 'string' || !Object.hasOwn(FALLIBLE_STEP_TYPES, step.type) || straightToSuccess.has(index) || consumed.has(key))
|
|
546
|
+
continue;
|
|
547
|
+
emit(14, [...path, 'steps', String(index)], `Failed step ${key}'s failure is not read by any reachable step, so the run will fail. A ${String(step.type)} failure is handled only where a step reachable from ${key} reads outputs.${key}; read it where you recover, or leave it unread only to end the run failed on purpose.`);
|
|
548
|
+
}
|
|
247
549
|
const graph = steps.map((step, index) => step ? routes(step, [...path, 'steps', String(index)], keys, emit) : undefined);
|
|
248
|
-
//
|
|
550
|
+
// A certain exit is rejected on every step, reachable or not — the dashboard's grouped admission and the canonical
|
|
551
|
+
// graph both refuse it, so certifying only the reachable ones would pass a declaration the runtime rejects.
|
|
552
|
+
for (const edges of graph)
|
|
553
|
+
for (const exit of edges?.exits ?? [])
|
|
554
|
+
emit(8, exit, 'Statically certain implicit exit without RETURN (MISSING_RETURN).');
|
|
555
|
+
// Only known reachable paths establish uncertainty; unknown routing never proves success or reachability.
|
|
249
556
|
const reached = new Set();
|
|
250
557
|
const pending = roots.length === 1 ? [...roots] : [];
|
|
251
558
|
while (pending.length) {
|
|
@@ -256,8 +563,6 @@ function checkSteps(flow, path, emit) {
|
|
|
256
563
|
const edges = graph[index];
|
|
257
564
|
if (!edges)
|
|
258
565
|
continue;
|
|
259
|
-
for (const exit of edges.exits)
|
|
260
|
-
emit(8, exit, 'Statically certain implicit exit without RETURN (MISSING_RETURN).');
|
|
261
566
|
for (const at of edges.uncertain)
|
|
262
567
|
emit(9, at, 'Dynamic or cyclic route is statically uncertain; termination and success are not certified.');
|
|
263
568
|
pending.push(...edges.targets);
|
|
@@ -303,8 +608,8 @@ function checkDependencies(flows, emit) {
|
|
|
303
608
|
const seen = new Set();
|
|
304
609
|
for (const [dependencyIndex, dependency] of flow.dependsOn.entries()) {
|
|
305
610
|
const path = [...at, String(dependencyIndex)];
|
|
306
|
-
if (!
|
|
307
|
-
emit(3, path, 'Dependency must
|
|
611
|
+
if (!flowKey(dependency)) {
|
|
612
|
+
emit(3, path, 'Dependency must match ^[A-Z][A-Z0-9_]*$ with at most 128 characters.');
|
|
308
613
|
continue;
|
|
309
614
|
}
|
|
310
615
|
if (seen.has(dependency))
|
|
@@ -344,75 +649,45 @@ function checkDependencies(flows, emit) {
|
|
|
344
649
|
}
|
|
345
650
|
}
|
|
346
651
|
}
|
|
347
|
-
/** Scope
|
|
652
|
+
/** Scope and possible recovery share one owning-field walk; literal configuration is never code. */
|
|
348
653
|
function checkOutputScope(steps, base, emit) {
|
|
349
654
|
const local = new Map();
|
|
350
655
|
for (const step of steps) {
|
|
351
|
-
if (!object(step) || !text(step.key) || step.type === 'RETURN')
|
|
656
|
+
if (!object(step) || !text(step.key) || step.type === 'RETURN' || step.type === 'FAIL')
|
|
352
657
|
continue;
|
|
353
658
|
local.set(step.key, (local.get(step.key) ?? 0) + 1);
|
|
354
659
|
}
|
|
355
660
|
for (const [index, step] of steps.entries()) {
|
|
356
661
|
if (!object(step))
|
|
357
662
|
continue;
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
const
|
|
364
|
-
if (
|
|
365
|
-
|
|
663
|
+
const fields = [];
|
|
664
|
+
collectStrings(step, fields, new Set(), '', true, undefined, false, false, [...base, String(index)]);
|
|
665
|
+
for (const field of fields) {
|
|
666
|
+
// Passing a root path above makes every collected field located, including transformed keys.
|
|
667
|
+
const path = field.path;
|
|
668
|
+
const references = frontendOutputReferences(field.text, field.language);
|
|
669
|
+
if (field.responseFocused) {
|
|
670
|
+
if (references.length)
|
|
671
|
+
emit(11, path, 'search.items is evaluated against the search response, not this workflow: an outputs/_outputs read here names a response member, valid only if the response has one. Read workflow values in search.request, label or fill instead.');
|
|
366
672
|
continue;
|
|
367
673
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
// member, so a same-flow read is no more valid than a sibling one and must not certify.
|
|
378
|
-
const rawJsonata = frame.path.length === base.length + 3 &&
|
|
379
|
-
frame.path[base.length + 1] === 'metadata' &&
|
|
380
|
-
frame.path[base.length + 2] === 'expression' &&
|
|
381
|
-
(step.type === 'JSONATA' || step.type === 'SINGLE_CHOICE_FORM' || step.type === 'MULTIPLE_CHOICE_FORM');
|
|
382
|
-
const responseFocused = step.type === 'RECORDS_FORM' && frame.path.length === base.length + 4 &&
|
|
383
|
-
frame.path[base.length + 1] === 'metadata' && frame.path[base.length + 2] === 'search' &&
|
|
384
|
-
frame.path[base.length + 3] === 'items';
|
|
385
|
-
const references = frontendOutputReferences(frame.value, rawJsonata);
|
|
386
|
-
if (responseFocused) {
|
|
387
|
-
if (references.length)
|
|
388
|
-
emit(10, frame.path, 'search.items is evaluated against the search response, not this workflow: an outputs/_outputs read here names a response member. Read workflow values in search.request, label or fill instead.');
|
|
389
|
-
continue;
|
|
390
|
-
}
|
|
391
|
-
for (const reference of references) {
|
|
392
|
-
if (reference.rootCertainty === 'uncertain')
|
|
393
|
-
emit(11, frame.path, 'Output ownership is statically uncertain; lexical focus, root rebinding or opaque template output prevents establishing the workflow root.');
|
|
394
|
-
else if (reference.namespace === '_outputs')
|
|
395
|
-
emit(10, frame.path, 'Worker _outputs is not a frontend output namespace.');
|
|
396
|
-
else if (reference.key === undefined || (local.get(reference.key) ?? 0) > 1)
|
|
397
|
-
emit(11, frame.path, 'Output ownership is statically uncertain; a predicate, computed or incomplete producer selector, or duplicate local key cannot establish one producer.');
|
|
398
|
-
else if (!local.has(reference.key))
|
|
399
|
-
emit(10, frame.path, `Output ${reference.key} is not produced by a nonterminal step in this workflow.`);
|
|
400
|
-
}
|
|
401
|
-
continue;
|
|
674
|
+
for (const reference of references) {
|
|
675
|
+
if (reference.rootCertainty === 'uncertain')
|
|
676
|
+
emit(11, path, 'Output ownership is statically uncertain; lexical focus, root rebinding or opaque template output prevents establishing the workflow root.');
|
|
677
|
+
else if (reference.namespace === '_outputs')
|
|
678
|
+
emit(10, path, 'Worker _outputs is not a frontend output namespace.');
|
|
679
|
+
else if (reference.key === undefined || (local.get(reference.key) ?? 0) > 1)
|
|
680
|
+
emit(11, path, 'Output ownership is statically uncertain; a predicate, computed or incomplete producer selector, or duplicate local key cannot establish one producer.');
|
|
681
|
+
else if (!local.has(reference.key))
|
|
682
|
+
emit(10, path, `Output ${reference.key} is not produced by a nonterminal step in this workflow.`);
|
|
402
683
|
}
|
|
403
|
-
if ((!object(frame.value) && !Array.isArray(frame.value)) || active.has(frame.value))
|
|
404
|
-
continue;
|
|
405
|
-
active.add(frame.value);
|
|
406
|
-
pending.push({ leave: frame.value });
|
|
407
|
-
for (const [key, value] of Object.entries(frame.value))
|
|
408
|
-
pending.push({ value, path: [...frame.path, key] });
|
|
409
684
|
}
|
|
410
685
|
}
|
|
411
686
|
}
|
|
412
687
|
export const groupedFrontendRule = {
|
|
413
688
|
id: 'FFE',
|
|
414
689
|
family: 'FFE',
|
|
415
|
-
run(ctx) {
|
|
690
|
+
async run(ctx, options = {}) {
|
|
416
691
|
const document = ctx.tokenForm;
|
|
417
692
|
if (!object(document))
|
|
418
693
|
return [];
|
|
@@ -421,7 +696,7 @@ export const groupedFrontendRule = {
|
|
|
421
696
|
const emit = (rule, path, message) => {
|
|
422
697
|
const flow = Array.isArray(group) ? group[Number(path[0])] : undefined;
|
|
423
698
|
issues.push({
|
|
424
|
-
ruleId: `FFE-${rule}`, family: 'FFE', severity: rule === 9 ? 'low' : 'high',
|
|
699
|
+
ruleId: `FFE-${rule}`, family: 'FFE', severity: rule === 9 ? 'low' : rule === 14 ? 'medium' : 'high',
|
|
425
700
|
parentKey: 'getReadyFlows', idOrKey: object(flow) && text(flow.key) ? flow.key : undefined,
|
|
426
701
|
componentPath: path,
|
|
427
702
|
message: `getReadyFlows${path.map((part) => `[${JSON.stringify(part)}]`).join('')}: ${message}`,
|
|
@@ -439,8 +714,8 @@ export const groupedFrontendRule = {
|
|
|
439
714
|
continue;
|
|
440
715
|
}
|
|
441
716
|
closed(flow, ['key', 'title', 'description', 'action', 'completionVersion', 'dependsOn', 'steps'], at, 1, emit);
|
|
442
|
-
if (!
|
|
443
|
-
emit(1, [...at, 'key'], 'Flow key must match ^[A-Z][A-Z0-9_]
|
|
717
|
+
if (!flowKey(flow.key))
|
|
718
|
+
emit(1, [...at, 'key'], 'Flow key must match ^[A-Z][A-Z0-9_]*$ with at most 128 characters.');
|
|
444
719
|
if (typeof flow.title !== 'string')
|
|
445
720
|
emit(1, [...at, 'title'], 'title must be a string.');
|
|
446
721
|
if (!text(flow.completionVersion))
|
|
@@ -458,7 +733,7 @@ export const groupedFrontendRule = {
|
|
|
458
733
|
}
|
|
459
734
|
if (!Array.isArray(flow.steps) || flow.steps.length === 0)
|
|
460
735
|
emit(1, [...at, 'steps'], 'steps must be a nonempty array.');
|
|
461
|
-
checkSteps(flow, at, emit);
|
|
736
|
+
await checkSteps(flow, at, emit, options);
|
|
462
737
|
}
|
|
463
738
|
checkDependencies(group, emit);
|
|
464
739
|
}
|
|
@@ -470,8 +745,8 @@ export const groupedFrontendRule = {
|
|
|
470
745
|
continue;
|
|
471
746
|
specialStep(step, [...base, String(index)], (rule, path, message) => issues.push({
|
|
472
747
|
ruleId: `FFE-${rule}`, family: 'FFE', severity: 'high', parentKey, idOrKey,
|
|
473
|
-
componentPath: path, message: `${parentKey}
|
|
474
|
-
}));
|
|
748
|
+
componentPath: path, message: `${parentKey ? `${parentKey}.` : ''}${path.join('.')}: ${message}`, why: `${guidance[rule]} See hexasync://docs/frontend/FRONTEND-FLOWS.`,
|
|
749
|
+
}), false);
|
|
475
750
|
}
|
|
476
751
|
};
|
|
477
752
|
const locations = locateFrontendWorkflows(document);
|
|
@@ -481,7 +756,7 @@ export const groupedFrontendRule = {
|
|
|
481
756
|
checkOutputScope(location.steps, path, (rule, componentPath, message) => issues.push({
|
|
482
757
|
ruleId: `FFE-${rule}`, family: 'FFE', severity: rule === 11 ? 'low' : 'high',
|
|
483
758
|
parentKey, idOrKey: location.flowKey ?? location.ownerKey, componentPath,
|
|
484
|
-
message: `${parentKey}
|
|
759
|
+
message: `${parentKey ? `${parentKey}.` : ''}${componentPath.join('.')}: ${message}`,
|
|
485
760
|
why: `${guidance[rule]} See hexasync://docs/frontend/FRONTEND-FLOWS.`,
|
|
486
761
|
}));
|
|
487
762
|
if (location.groupKey)
|