@stalfh233/omc-cli 0.6.74 → 0.6.75
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/coverage/m1-coverage-manifest-v1.json +4 -0
- package/dist/capability-overview.js +1 -1
- package/dist/cli-output.js +91 -3
- package/dist/cli.js +212 -30
- package/dist/discovery.js +48 -2
- package/dist/graph.js +124 -1
- package/dist/lanes/b2-registration-contract.js +8 -0
- package/dist/lanes/b2-registration-coverage.js +1 -0
- package/dist/lanes/b2-registration.js +99 -0
- package/dist/lanes/businessrule-contract.js +4 -4
- package/dist/lanes/businessrule.js +251 -60
- package/dist/lanes/form-contract.js +7 -2
- package/dist/lanes/form-coverage.js +1 -0
- package/dist/lanes/form.js +248 -5
- package/dist/lanes/model.js +102 -15
- package/dist/lanes/rule-graph.js +25 -2
- package/dist/lanes/workflow-contract.js +1 -1
- package/dist/lanes/workflow.js +48 -8
- package/dist/mcp-graph.js +43 -4
- package/dist/path-projection.js +53 -0
- package/dist/read-shapes.js +21 -6
- package/dist/recipes/businessrule.js +2 -1
- package/package.json +3 -3
- package/skills/omc-capabilities.md +2 -2
- package/skills/omc-write-hazards.md +3 -1
|
@@ -110,6 +110,213 @@ export function ruleCompactProjection(result) {
|
|
|
110
110
|
...(Array.isArray(result.routes) ? { routes: strip(result.routes, RULE_ROUTE_LAYOUT_KEYS) } : {}),
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
+
/**
|
|
114
|
+
* r79-w2b(issue 06):摘要面的开关注释。enabled 是分发真相,ruleStatus 只是
|
|
115
|
+
* 同一 get 面的 status 列(可能滞后)——两个词都要在(r53 双面断言),但只留
|
|
116
|
+
* 判定所需的一句(258B → ~95B)。
|
|
117
|
+
*/
|
|
118
|
+
const RULE_EXECUTABLE_BASIS = "依据 app/businessrule/get.enabled 判开关(enabled 是分发真相);ruleStatus 列可能滞后,不据此否决运行(开关推断,运行成功未证)";
|
|
119
|
+
const RULE_STATUS_LAG_NOTE = "平台 status 列滞后:enabled=true 才是分发真相(列表面/日志可复核);不要据 ruleStatus=DISABLED 判定未启用";
|
|
120
|
+
/** 规则图体检(写面同源 dry-lint):返回语义隐患与整图回存判定。失败不破坏读回。 */
|
|
121
|
+
async function lintRuleGraphFace(record, graph) {
|
|
122
|
+
try {
|
|
123
|
+
const { validateRuleNodeGraph } = await import("./rule-graph.js");
|
|
124
|
+
// r45 I5 误报根因:体检重建图只带 nodes/routes,把行级 schedulerSetting
|
|
125
|
+
// 丢了——定时规则读回恒报 scheduler-setting-missing(实际已持久化)。
|
|
126
|
+
const findings = validateRuleNodeGraph(graph, record.code === undefined ? undefined : String(record.code), record.schemaCode === undefined ? undefined : String(record.schemaCode)).filter(
|
|
127
|
+
// r45 I5:读回体检只看「平台持久化后仍有害」的形状——UI 坐标类
|
|
128
|
+
// (route points)平台自己会归一化/补全,读回图缺失属正常,不是隐患。
|
|
129
|
+
(finding) => finding.code !== "rule-graph-route-points");
|
|
130
|
+
const semanticFindings = findings.length > 0
|
|
131
|
+
? findings.map((finding) => ({
|
|
132
|
+
code: finding.code,
|
|
133
|
+
severity: finding.severity === "warning" ? "warning" : "hazard",
|
|
134
|
+
nodeCode: finding.nodeCode,
|
|
135
|
+
message: finding.message,
|
|
136
|
+
}))
|
|
137
|
+
: undefined;
|
|
138
|
+
// r73 #2(GitLab #40,8.6.41 实测):roundTrip = 整图原样回存的显式判定。
|
|
139
|
+
// safe:true 也是显式键(不是缺键)——agent 要能区分「判定过、可回存」与
|
|
140
|
+
// 「没判定」。与 full/keys 选择器无关:它是回执顶层键,与 nodes 并列。
|
|
141
|
+
const hazards = findings.filter((finding) => finding.severity !== "warning");
|
|
142
|
+
const roundTrip = hazards.length === 0
|
|
143
|
+
? { safe: true }
|
|
144
|
+
: {
|
|
145
|
+
safe: false,
|
|
146
|
+
gaps: hazards.map((finding) => ({
|
|
147
|
+
code: finding.code,
|
|
148
|
+
...(finding.nodeCode !== undefined ? { nodeCode: finding.nodeCode } : {}),
|
|
149
|
+
...(finding.key !== undefined ? { key: finding.key } : {}),
|
|
150
|
+
message: finding.message,
|
|
151
|
+
fix: roundTripFixOf(finding.code),
|
|
152
|
+
})),
|
|
153
|
+
hint: RULE_ROUND_TRIP_HINT,
|
|
154
|
+
};
|
|
155
|
+
return { ...(semanticFindings ? { semanticFindings } : {}), roundTrip };
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
return {};
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* 摘要面的节点摘要——**不能叫 `nodes`**:A6 测试钉住 `summary.nodes === undefined`
|
|
163
|
+
* ("summary never inlines the node bodies")。`nodeDigests` 只留扫图需要的三个
|
|
164
|
+
* 信息(nodeCode/nodeType/调到哪个方法),单节点的 inputMappings/outputMappings
|
|
165
|
+
* 不进摘要(可达 600B+)。
|
|
166
|
+
*/
|
|
167
|
+
function nodeDigestOf(node) {
|
|
168
|
+
if (node === null || typeof node !== "object" || Array.isArray(node))
|
|
169
|
+
return null;
|
|
170
|
+
const row = node;
|
|
171
|
+
const mapping = row.methodMapping !== null && typeof row.methodMapping === "object" && !Array.isArray(row.methodMapping)
|
|
172
|
+
? row.methodMapping
|
|
173
|
+
: null;
|
|
174
|
+
const serviceCode = typeof mapping?.serviceCode === "string" ? mapping.serviceCode : null;
|
|
175
|
+
const serviceMethodCode = typeof mapping?.serviceMethodCode === "string" ? mapping.serviceMethodCode : null;
|
|
176
|
+
return {
|
|
177
|
+
nodeCode: row.nodeCode ?? null,
|
|
178
|
+
nodeType: row.nodeType ?? null,
|
|
179
|
+
...(serviceCode !== null || serviceMethodCode !== null ? { methodMapping: { serviceCode, serviceMethodCode } } : {}),
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
/** 摘要面只留 gap 的码(message/fix 用不带 summary 的面取)。 */
|
|
183
|
+
function ruleSummaryRoundTrip(roundTrip) {
|
|
184
|
+
if (!roundTrip)
|
|
185
|
+
return undefined;
|
|
186
|
+
if (roundTrip.safe === true)
|
|
187
|
+
return { safe: true };
|
|
188
|
+
const gaps = Array.isArray(roundTrip.gaps) ? roundTrip.gaps : [];
|
|
189
|
+
return {
|
|
190
|
+
safe: false,
|
|
191
|
+
gapCount: gaps.length,
|
|
192
|
+
gapCodes: gaps.map((gap) => String(gap.code ?? "")),
|
|
193
|
+
gapsHint: "gap 的 message/fix 用 rule.get(不带 summary)取 roundTrip.gaps",
|
|
194
|
+
};
|
|
195
|
+
}
|
|
196
|
+
/** 摘要面公共体:身份 + 体量 + 节点摘要。正文仍在默认面(nodes/routes)。 */
|
|
197
|
+
function ruleSummaryBody(record, graph, roundTrip) {
|
|
198
|
+
const nodes = Array.isArray(graph.nodes) ? graph.nodes : [];
|
|
199
|
+
const routes = Array.isArray(graph.routes) ? graph.routes : [];
|
|
200
|
+
const nodeDigests = nodes.map(nodeDigestOf).filter((digest) => digest !== null);
|
|
201
|
+
return {
|
|
202
|
+
id: record.id,
|
|
203
|
+
code: record.code,
|
|
204
|
+
name: record.name,
|
|
205
|
+
schemaCode: record.schemaCode,
|
|
206
|
+
bizRuleType: record.bizRuleType,
|
|
207
|
+
enabled: record.enabled,
|
|
208
|
+
ruleStatus: record.status,
|
|
209
|
+
executable: record.enabled === true,
|
|
210
|
+
executableBasis: RULE_EXECUTABLE_BASIS,
|
|
211
|
+
defaultRule: record.defaultRule,
|
|
212
|
+
ruleVersion: record.ruleVersion,
|
|
213
|
+
nodeCount: nodes.length,
|
|
214
|
+
routeCount: routes.length,
|
|
215
|
+
nodeDigests,
|
|
216
|
+
methodMappingCount: nodeDigests.filter((digest) => digest.methodMapping !== undefined).length,
|
|
217
|
+
// 被省略的 node+route 原始字节("省略了多少"可量化;正文在默认面/artifact)
|
|
218
|
+
bytesOmitted: Buffer.byteLength(JSON.stringify({ nodes: graph.nodes, routes: graph.routes }), "utf8"),
|
|
219
|
+
schedulerSettingPresent: graph.schedulerSetting !== null && graph.schedulerSetting !== undefined,
|
|
220
|
+
schedulerSettingDataSourceType: graph.schedulerSetting && typeof graph.schedulerSetting === "object" && !Array.isArray(graph.schedulerSetting)
|
|
221
|
+
? graph.schedulerSetting.dataSourceType
|
|
222
|
+
: undefined,
|
|
223
|
+
...(record.enabled === true && String(record.status ?? "") !== "ENABLED" ? { statusLag: true, statusNote: RULE_STATUS_LAG_NOTE } : {}),
|
|
224
|
+
...(roundTrip ? { roundTrip } : {}),
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* r79-w2b(issue 06):`ruleCodes[]` 同模型批量摘要。一次
|
|
229
|
+
* `list_by_schemacode` 解析全部 id 与 node(8.6.26 的 list 面是完整
|
|
230
|
+
* BusinessRuleModel,含 node/route——BusinessRule.getModel():128-156),
|
|
231
|
+
* 个别行缺 node 时才对该规则回落一 次 `businessrule/get`。
|
|
232
|
+
* 诚实口径:wire 字节没少(list 面把 N 张图一起搬回),少的是往返次数与信封体积。
|
|
233
|
+
*/
|
|
234
|
+
async function readRuleBatch(session, args) {
|
|
235
|
+
const schemaCode = args.schemaCode;
|
|
236
|
+
if (!schemaCode)
|
|
237
|
+
throw new ToolInputError({
|
|
238
|
+
status: "error",
|
|
239
|
+
blocker: "tool-input-invalid",
|
|
240
|
+
tool: "rule.get",
|
|
241
|
+
message: "ruleCodes 批量只在同一 schemaCode 内(跨模型 schemaCodes[] 是二期)——请同时传 schemaCode",
|
|
242
|
+
});
|
|
243
|
+
if (args.summary !== true)
|
|
244
|
+
throw new ToolInputError({
|
|
245
|
+
status: "error",
|
|
246
|
+
blocker: "rule-batch-requires-summary",
|
|
247
|
+
tool: "rule.get",
|
|
248
|
+
message: "ruleCodes 批量读必须同时传 summary:true——逐条内联整图(每条约 13KB)的批量正是本工具要消灭的形状",
|
|
249
|
+
nextCommand: `omc call rule.get --env <env> --args '{"schemaCode":"${schemaCode}","ruleCodes":[${args.ruleCodes.map((code) => JSON.stringify(code)).join(",")}],"summary":true}'`,
|
|
250
|
+
});
|
|
251
|
+
const parse = (value) => decodeJsonColumn(value, JSON_COLUMN_NULL_COALESCE);
|
|
252
|
+
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode } })).data);
|
|
253
|
+
const byCode = new Map();
|
|
254
|
+
for (const row of rows)
|
|
255
|
+
if (typeof row.code === "string" && row.code !== "")
|
|
256
|
+
byCode.set(row.code, row);
|
|
257
|
+
const rules = [];
|
|
258
|
+
const failed = [];
|
|
259
|
+
let fallbackReads = 0;
|
|
260
|
+
for (const code of args.ruleCodes) {
|
|
261
|
+
let record = byCode.get(code);
|
|
262
|
+
// 部分 code 不存在:其余照常,failed 逐条点名(不把「没有这条规则」读成「没有方法映射」)。
|
|
263
|
+
if (!record) {
|
|
264
|
+
failed.push({ code, reason: "rule-absent" });
|
|
265
|
+
continue;
|
|
266
|
+
}
|
|
267
|
+
let nodes = parse(record.node);
|
|
268
|
+
let routes = parse(record.route);
|
|
269
|
+
let schedulerSetting = parse(record.schedulerSetting);
|
|
270
|
+
if (typeof record.node !== "string") {
|
|
271
|
+
// 运行时逐行校验:该版本/该行 list 面没带 node 时回落 get(+1 wire),
|
|
272
|
+
// 回执 wireNote 会点名;仍读不到图才进 failed。
|
|
273
|
+
const id = typeof record.id === "string" && record.id !== "" ? record.id : "";
|
|
274
|
+
if (id === "") {
|
|
275
|
+
failed.push({ code, reason: "graph-unreadable" });
|
|
276
|
+
continue;
|
|
277
|
+
}
|
|
278
|
+
fallbackReads += 1;
|
|
279
|
+
const fetched = (await wireCall(session, { path: ENDPOINTS.businessRuleGet, query: { id } })).data;
|
|
280
|
+
if (!fetched || typeof fetched.node !== "string") {
|
|
281
|
+
failed.push({ code, reason: "graph-unreadable" });
|
|
282
|
+
continue;
|
|
283
|
+
}
|
|
284
|
+
record = fetched;
|
|
285
|
+
nodes = parse(fetched.node);
|
|
286
|
+
routes = parse(fetched.route);
|
|
287
|
+
schedulerSetting = parse(fetched.schedulerSetting);
|
|
288
|
+
}
|
|
289
|
+
const lint = await lintRuleGraphFace(record, { nodes, routes, schedulerSetting });
|
|
290
|
+
rules.push(ruleSummaryBody(record, { nodes, routes, schedulerSetting }, ruleSummaryRoundTrip(lint.roundTrip)));
|
|
291
|
+
}
|
|
292
|
+
// 全部失败/全部不存在 → fail closed(空 ok 会被读成「这些规则没有方法映射」)。
|
|
293
|
+
if (rules.length === 0)
|
|
294
|
+
return {
|
|
295
|
+
status: "refused",
|
|
296
|
+
blocker: "rule-batch-empty",
|
|
297
|
+
schemaCode,
|
|
298
|
+
requestedCount: args.ruleCodes.length,
|
|
299
|
+
rulesCount: 0,
|
|
300
|
+
partial: true,
|
|
301
|
+
rules,
|
|
302
|
+
failed,
|
|
303
|
+
nextCommand: `omc call rule.list --env <env> --args '{"schemaCode":"${schemaCode}"}'`,
|
|
304
|
+
message: "没有一个 ruleCode 读到规则图——空结果不等于「没有方法映射」;先用 rule.list 核对规则 code",
|
|
305
|
+
};
|
|
306
|
+
// partial 用 status:"ok" + partial:true(不是 status:"partial"):classifyResult 的
|
|
307
|
+
// partial 分支把 failed 当**数字**(--args-list 形状),本面 failed 是数组,
|
|
308
|
+
// 走那条分支会打出「7/7 成功,NaN 失败」。全失败才升级为 refused。
|
|
309
|
+
return {
|
|
310
|
+
schemaCode,
|
|
311
|
+
requestedCount: args.ruleCodes.length,
|
|
312
|
+
rulesCount: rules.length,
|
|
313
|
+
partial: failed.length > 0,
|
|
314
|
+
source: "draft-list",
|
|
315
|
+
wireNote: `1 次 list_by_schemacode 解析全部 id 与 node${fallbackReads > 0 ? `;${fallbackReads} 条 list 行缺 node 已回落 businessrule/get(+${fallbackReads} wire)` : ";无回落 get"}`,
|
|
316
|
+
rules,
|
|
317
|
+
failed,
|
|
318
|
+
};
|
|
319
|
+
}
|
|
113
320
|
export function registerBusinessRuleLane(tools) {
|
|
114
321
|
tools.push(defineTool({
|
|
115
322
|
name: "rule.list",
|
|
@@ -436,16 +643,44 @@ export function registerBusinessRuleLane(tools) {
|
|
|
436
643
|
ruleCode: z.string().min(1).optional().describe("业务键定位:规则 code(如 Create/Update/自定义),与 schemaCode 同传"),
|
|
437
644
|
full: z.boolean().optional().describe("返回原始存储图(含确定性布局 x/y/width/height 与路由 points);默认返回语义图,确定性布局已投影去掉(可直接重存,保存时会重新生成布局)"),
|
|
438
645
|
keys: z.array(z.string().min(1)).min(1).optional().describe("工具经济(A6):只返回列出的顶层键(identity 键 id/code/schemaCode 恒在)。例 ['schedulerSetting'] 只看调度配置,不内联整图——对照生产规则形状时用"),
|
|
439
|
-
summary: z.boolean().optional().describe("工具经济(A6
|
|
646
|
+
summary: z.boolean().optional().describe("工具经济(A6):身份+体量摘要(含 nodeDigests 节点/方法摘要、methodMappingCount、bytesOmitted),不含 nodes/routes 正文——节点摘要在 nodeDigests,不是 nodes"),
|
|
647
|
+
ruleCodes: z.array(z.string().min(1)).min(1).max(50).optional().describe("同 schemaCode 批量摘要(≤50;必须同时 summary:true):1 次 list 解析全部 id 与 node,回 rules[] + partial/failed[];全读不到 → refused rule-batch-empty"),
|
|
440
648
|
withRuntime: z.boolean().optional().describe("opt-in 聚合运行态:合并规则存在性、可执行性、源码版本与最近日志;默认不增加 wire 读取"),
|
|
441
649
|
capability: capabilityArg,
|
|
442
650
|
},
|
|
443
651
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
652
|
+
// r79-w2b(issue 06):同工具多主键(ruleCodes[])——不改身份/判定逻辑,
|
|
653
|
+
// 只把「一个主键」换成「同一 schemaCode 下的一批主键」。
|
|
654
|
+
if (args.ruleCodes !== undefined) {
|
|
655
|
+
if (args.ruleCode !== undefined || args.id !== undefined)
|
|
656
|
+
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "rule.get", message: "ruleCodes 与 ruleCode/id 互斥——批量面只认 ruleCodes[],单条面才用 ruleCode 或 id" });
|
|
657
|
+
return readRuleBatch(session, { schemaCode: args.schemaCode, ruleCodes: args.ruleCodes, summary: args.summary });
|
|
658
|
+
}
|
|
444
659
|
// Identity seam: prefer the business key (schemaCode + ruleCode) when
|
|
445
660
|
// given; fall back to the row id. Resolving the business key here removes
|
|
446
661
|
// the forced rule.list → rule.get dance and the "same code, new id"
|
|
447
662
|
// confusion (we always read the CURRENT effective row for that code).
|
|
448
663
|
let ruleId = args.id;
|
|
664
|
+
// 摘要面的 1 wire 路径:list 行本身就带 node(8.6.26 BusinessRuleModel),
|
|
665
|
+
// 不必 resolveRuleRowId + get + 陈旧复核(3 wire)。仅当行缺 node 时回落 get。
|
|
666
|
+
let summaryListedAuthoritatively = false;
|
|
667
|
+
if (!ruleId && args.summary === true && args.schemaCode !== undefined && args.ruleCode !== undefined) {
|
|
668
|
+
const parseColumn = (value) => decodeJsonColumn(value, JSON_COLUMN_NULL_COALESCE);
|
|
669
|
+
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode: args.schemaCode } })).data);
|
|
670
|
+
summaryListedAuthoritatively = true;
|
|
671
|
+
const row = rows.find((candidate) => candidate.code === args.ruleCode);
|
|
672
|
+
if (!row)
|
|
673
|
+
return { schemaCode: args.schemaCode, ruleCode: args.ruleCode, absent: true };
|
|
674
|
+
if (typeof row.node === "string") {
|
|
675
|
+
const nodes = parseColumn(row.node);
|
|
676
|
+
const routes = parseColumn(row.route);
|
|
677
|
+
const schedulerSetting = parseColumn(row.schedulerSetting);
|
|
678
|
+
const lint = await lintRuleGraphFace(row, { nodes, routes, schedulerSetting });
|
|
679
|
+
return ruleSummaryBody(row, { nodes, routes, schedulerSetting }, ruleSummaryRoundTrip(lint.roundTrip));
|
|
680
|
+
}
|
|
681
|
+
// 该行没有 node 字符串:用行里的 id 直接 get,跳过多余的二次 list。
|
|
682
|
+
ruleId = typeof row.id === "string" && row.id !== "" ? row.id : undefined;
|
|
683
|
+
}
|
|
449
684
|
if (!ruleId) {
|
|
450
685
|
if (!args.schemaCode || !args.ruleCode)
|
|
451
686
|
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "rule.get", message: "需要 id,或 schemaCode + ruleCode 两者一起" });
|
|
@@ -490,7 +725,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
490
725
|
let staleRow = false;
|
|
491
726
|
let effectiveId;
|
|
492
727
|
let staleRowMessage;
|
|
493
|
-
if (typeof record.schemaCode === "string" && record.schemaCode && typeof record.code === "string" && record.code) {
|
|
728
|
+
if (!summaryListedAuthoritatively && typeof record.schemaCode === "string" && record.schemaCode && typeof record.code === "string" && record.code) {
|
|
494
729
|
try {
|
|
495
730
|
const currentRows = wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode: record.schemaCode } })).data);
|
|
496
731
|
const current = currentRows.find((row) => row.code === record.code);
|
|
@@ -509,47 +744,13 @@ export function registerBusinessRuleLane(tools) {
|
|
|
509
744
|
// 存量体检(2026-10-16 中冶反馈):读回不只给结构,还跑一次写面同源的
|
|
510
745
|
// dry-lint,把"已启用但运行时会被静默跳过/UI 独有算子/选项 key 撞车"
|
|
511
746
|
// 等语义隐患以 semanticFindings 暴露——"可读不可验"到此为止。
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
const graphForLint = { nodes: projected.nodes, routes: projected.routes, ...(recordSc !== undefined && recordSc !== null ? { schedulerSetting: recordSc } : {}) };
|
|
520
|
-
const findings = validateRuleNodeGraph(graphForLint, record.code === undefined ? undefined : String(record.code), record.schemaCode === undefined ? undefined : String(record.schemaCode)).filter(
|
|
521
|
-
// r45 I5:读回体检只看「平台持久化后仍有害」的形状——UI 坐标类
|
|
522
|
-
// (route points)平台自己会归一化/补全,读回图缺失属正常,不是隐患。
|
|
523
|
-
(finding) => finding.code !== "rule-graph-route-points");
|
|
524
|
-
if (findings.length > 0) {
|
|
525
|
-
semanticFindings = findings.map((finding) => ({
|
|
526
|
-
code: finding.code,
|
|
527
|
-
severity: finding.severity === "warning" ? "warning" : "hazard",
|
|
528
|
-
nodeCode: finding.nodeCode,
|
|
529
|
-
message: finding.message,
|
|
530
|
-
}));
|
|
531
|
-
}
|
|
532
|
-
// r73 #2(GitLab #40,8.6.41 实测):roundTrip = 整图原样回存的显式判定。
|
|
533
|
-
// safe:true 也是显式键(不是缺键)——agent 要能区分「判定过、可回存」与
|
|
534
|
-
// 「没判定」。与 full/keys 选择器无关:它是回执顶层键,与 nodes 并列。
|
|
535
|
-
const hazards = findings.filter((finding) => finding.severity !== "warning");
|
|
536
|
-
roundTrip = hazards.length === 0
|
|
537
|
-
? { safe: true }
|
|
538
|
-
: {
|
|
539
|
-
safe: false,
|
|
540
|
-
gaps: hazards.map((finding) => ({
|
|
541
|
-
code: finding.code,
|
|
542
|
-
...(finding.nodeCode !== undefined ? { nodeCode: finding.nodeCode } : {}),
|
|
543
|
-
...(finding.key !== undefined ? { key: finding.key } : {}),
|
|
544
|
-
message: finding.message,
|
|
545
|
-
fix: roundTripFixOf(finding.code),
|
|
546
|
-
})),
|
|
547
|
-
hint: RULE_ROUND_TRIP_HINT,
|
|
548
|
-
};
|
|
549
|
-
}
|
|
550
|
-
catch {
|
|
551
|
-
// 体检失败不破坏读回本身
|
|
552
|
-
}
|
|
747
|
+
const lint = await lintRuleGraphFace(record, {
|
|
748
|
+
nodes: projected.nodes,
|
|
749
|
+
routes: projected.routes,
|
|
750
|
+
schedulerSetting: record.schedulerSetting,
|
|
751
|
+
});
|
|
752
|
+
const semanticFindings = lint.semanticFindings;
|
|
753
|
+
const roundTrip = lint.roundTrip;
|
|
553
754
|
const payload = {
|
|
554
755
|
id: ruleId,
|
|
555
756
|
absent: false,
|
|
@@ -559,14 +760,14 @@ export function registerBusinessRuleLane(tools) {
|
|
|
559
760
|
bizRuleType: record.bizRuleType,
|
|
560
761
|
enabled: record.enabled,
|
|
561
762
|
executable: record.enabled === true,
|
|
562
|
-
executableBasis:
|
|
763
|
+
executableBasis: RULE_EXECUTABLE_BASIS,
|
|
563
764
|
// The platform's `status` column lags behind the enable switch: r10
|
|
564
765
|
// saw `enabled:true` with `ruleStatus:"DISABLED"` while rule.list said
|
|
565
766
|
// ENABLED. `enabled` is the dispatch truth; flag the disagreement
|
|
566
767
|
// instead of letting two faces contradict each other silently.
|
|
567
768
|
ruleStatus: record.status,
|
|
568
769
|
...(record.enabled === true && String(record.status ?? "") !== "ENABLED"
|
|
569
|
-
? { statusLag: true, statusNote:
|
|
770
|
+
? { statusLag: true, statusNote: RULE_STATUS_LAG_NOTE }
|
|
570
771
|
: {}),
|
|
571
772
|
defaultRule: record.defaultRule,
|
|
572
773
|
developmentMode: record.developmentMode,
|
|
@@ -620,21 +821,11 @@ export function registerBusinessRuleLane(tools) {
|
|
|
620
821
|
// 身份+体量;keys 保留列出的键 + 恒定的 identity 键。两者都作用于投影后
|
|
621
822
|
// 的返回体,full 语义不变。
|
|
622
823
|
if (args.summary === true) {
|
|
824
|
+
// r79-w2b(issue 06):summary 不再只是计数——给 nodeDigests(扫 methodMapping
|
|
825
|
+
// 的唯一入口,**不叫 nodes**:A6 钉住 summary.nodes===undefined)、
|
|
826
|
+
// methodMappingCount 与 bytesOmitted(省略了多少正文可量化)。
|
|
623
827
|
return {
|
|
624
|
-
|
|
625
|
-
bizRuleType: payload.bizRuleType, enabled: payload.enabled, ruleStatus: payload.ruleStatus,
|
|
626
|
-
executable: payload.executable, executableBasis: payload.executableBasis,
|
|
627
|
-
defaultRule: payload.defaultRule, ruleVersion: payload.ruleVersion,
|
|
628
|
-
nodeCount: Array.isArray(payload.nodes) ? payload.nodes.length : 0,
|
|
629
|
-
routeCount: Array.isArray(payload.routes) ? payload.routes.length : 0,
|
|
630
|
-
schedulerSettingPresent: payload.schedulerSetting !== null && payload.schedulerSetting !== undefined,
|
|
631
|
-
schedulerSettingDataSourceType: payload.schedulerSetting && typeof payload.schedulerSetting === "object" && !Array.isArray(payload.schedulerSetting)
|
|
632
|
-
? payload.schedulerSetting.dataSourceType
|
|
633
|
-
: undefined,
|
|
634
|
-
...(payload.statusLag ? { statusLag: payload.statusLag, statusNote: payload.statusNote } : {}),
|
|
635
|
-
// r73 #2:summary 面同样带 roundTrip 显式判定(不内联正文也要能回答
|
|
636
|
-
// 「这张图能不能原样回存」)。
|
|
637
|
-
...(roundTrip ? { roundTrip } : {}),
|
|
828
|
+
...ruleSummaryBody(record, { nodes: parse(record.node), routes: parse(record.route), schedulerSetting: parse(record.schedulerSetting) }, ruleSummaryRoundTrip(roundTrip)),
|
|
638
829
|
// #39 摩擦 E:summary 面也要带 stale 提示——持旧 id 的调用方常只看
|
|
639
830
|
// summary,漏掉 stale 会把旧图当成「改了没生效」。
|
|
640
831
|
...(staleRow ? { staleId: true, latestId: effectiveId, note: staleNote } : {}),
|
|
@@ -646,7 +837,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
646
837
|
return Object.fromEntries(Object.entries(payload).filter(([key]) => wanted.has(key)));
|
|
647
838
|
}
|
|
648
839
|
return payload;
|
|
649
|
-
}, { full: args.full === true, compact: ruleCompactProjection, target: `rule.get:${args.id ?? `${args.schemaCode}/${args.ruleCode}`}` }),
|
|
840
|
+
}, { full: args.full === true, compact: ruleCompactProjection, target: `rule.get:${args.id ?? (args.ruleCodes !== undefined ? `${args.schemaCode}/${args.ruleCodes.join(",")}` : `${args.schemaCode}/${args.ruleCode}`)}` }),
|
|
650
841
|
}));
|
|
651
842
|
writeTool({
|
|
652
843
|
tools,
|
|
@@ -17,12 +17,14 @@ export const FORM_WIRE = Object.freeze({
|
|
|
17
17
|
emptyLayoutGuard: "ticket 74: the platform designer's Save is NOT lossless — it clears draftViewJson to \"[]\" and draftAttributesJson to \"{}\"; form.draft refuses CALLER-PROVIDED empty layouts (blocker form-empty-layout, zero wire, escape allowEmptyLayout:true) and form.publish refuses to promote a draft with fewer controls than the published face (blocker form-publish-degrade, escape allowDegrade:true); the recovery path is the form version history (/api/api/app/bizsheet/history/list) — fetch the intact version's view/attributes originals and rewrite the draft before publishing",
|
|
18
18
|
formButtons: "form toolbar buttons are a three-layer configuration (live 2026-10-23, 1.1.25; shape corrected by GitLab #38 live 8.6.26 2026-11-16): (1) bizsheet.options.customButtonJson — a JSON ARRAY with each entry's actionConfig as an OBJECT (the designer's save shape; a STRINGIFIED array is double encoding the platform stores verbatim and the form page then silently drops every button — the pre-r72 CLI form, now unwrapped+healed on every write and linted via shapeWarning in readbacks) — is the authoring face; ModelManagementFacadeImpl.publishBizForm:1022 turns it into h_biz_button rows with triggerType=FORM, triggerCode=<formCode> at publish; (2) those rows are what ActionPermissionHandler.getByTriggerTypeAndCode(FORM, bizCode) reads; (3) whether a button shows at a node is filtered by the workflow activity's buttonPermission.customBtns[].enabled (the designer 表单操作 checkboxes) plus showPermCode; the execute face is POST /api/api/runtime/form/executeCustomButton {bizButtonModel, bizObjectList:[<full bizObject>], reacquireDataFromDb:true} — NOT the list-button launcher path with ids[]",
|
|
19
19
|
actionsColumns: "ticket 100: draftActionsJson/publishedActionsJson are REAL bizsheet columns (BizForm.java:95-100 @SerializableField; BizFormModel.java:59-62 serialized by bizsheet/get) — the designer writes draftActionsJson on save and both faces on publish (frontend-dist/admin/js/4280.cfa75764.js offsets 193538/185347); form.get full:true surfaces them; publish promotes draftActionsJson → publishedActionsJson",
|
|
20
|
+
sheetListFace: "form.list: GET /api/api/app/bizsheet/list?schemaCode= (BizFormController.java:137-152 → ModelManagementFacadeImpl.getBizForms:481-488) answers the BizFormHeaderModel HEADER projection only — code, name, schemaCode, published, formType, sortKey, icon. formType is the INTEGER index (@JsonValue getIndex(), BizFormType.java:45-48): 0 DEFAULT_SHEET / 1 CUSTOMIZE_SHEET / 2 PRINT_TEMPLATE — decoded to the name with formTypeIndex kept (ADR 0002). existDraft/buttonCount/hasCustomScript are NOT on this face, so the default read never fabricates them: detail:true pays 1+N bizsheet/get for the content-derived faces. published is the same platform flag bit (r79-04): publish→draft leaves it false while the content is intact — the flag is reported as-is, content judgement needs detail:true. HTTP 404 means the version family has no /list endpoint: the tool answers sheetListUnavailable:true + the default slot only, never a fabricated list; a 601003 业务模型不存在 refusal is modelPresent:false (zero retries)",
|
|
20
21
|
});
|
|
21
22
|
const FORM_GET_DESCRIPTION = '读取默认表单(bizsheet/get)的发布状态与控件清单(紧凑默认)。**发布态以返回的 `published` / `existDraft` 布尔为准**(`published:true`=已发布;`published:false,existDraft:true`=只有草稿,**未发布**)——不要用 `publishedControlCodes` 是否非空来推断(草稿字段会让它非空,误判为已发布)。**每个模型交付前其默认表单必须 `published:true`**:用 `configure_form` 或 `form.draft(rebuild:true)`+`form.publish` 发布,并逐模型 `form.get` 核对。`full:true` 还返回 `options` 与 `customButtonJson`(表单工具栏按钮,数组原样;库里是字符串脏形时附 `customButtonJsonShapeWarning`——线上 #38 前端按钮不渲染)。传 `controls:["code",…]` 只取指定控件的 options(如关联控件的 mappings);传 `full:true` 才返回 draft/published 的完整 view/attributes/html/actions JSON(actions 列为设计器保存/发布的表单级按钮动作)。体积大,仅在需要整体布局时用。';
|
|
22
23
|
const FORM_DRAFT_DESCRIPTION = "Save the default-form DRAFT (bizsheet/update). Reads the current sheet, merges the caller's explicit draftViewJson/draftAttributesJson (or preserves the existing draft); when both are absent on a fresh default form, composes the designer-standard scaffold from the model's published fields. A redundant field (relation-mapping carry-through target) always stays bound; with no workflow it is hidden in the design (options.visible=false), with a workflow it stays visible for per-node propertyPermissions. Pass `draftHtmlJson` to thread custom online-script HTML through. Empty-layout guard: explicitly passing \"[]\"/\"{}\" view/attributes is refused (form-empty-layout) — the platform designer's Save is NOT lossless and clears drafts to exactly that shape; escape with allowEmptyLayout:true, and recover cleared drafts from the form version history (/api/api/app/bizsheet/history/list). **读回原样回写**:从 `form.get` 取回的 view/attributes 直接回传时加 `fromReadback:true`——工具会与已存草稿/发布面逐字比对,一致才放行(平台自身布局可能含子表列行/系统行默认宽度),被改动过的面照常按 validation 拒绝。**表单工具栏按钮**:`buttons`(数组)或 `customButtonJson`(原样字符串)写进 `biz_sheet.options.customButtonJson`(**数组+actionConfig 对象**,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,重写即自愈);**要到 form.publish 才生成 h_biz_button(triggerType=FORM)**,且表单页是否显示还取决于流程节点 `buttonPermission.customBtns[].enabled`(设计器「表单操作」勾选)。`useLocation` 用 FORM/ROW/LIST,表单工具栏按钮用 FORM。 **表单控件属性(含关联填充 mappings)从字段行派生**:改关联映射的事实源在字段 options.mappings(field.update → field.publish),直接改这里的控件映射会被平台按字段重算覆盖(真机 2026-10-14 实证);字段发布后如需刷新已发布表单的控件映射,用本工具 rebuild:false 重存(保留现有布局与在线JS)再 form.publish。";
|
|
23
24
|
const FORM_PUBLISH_DESCRIPTION = "Publish the default form (bizsheet/publish, proven shape: draft*Json promoted to published*Json verbatim) with published-face readback. **不影响在线 JS**:本工具只提拔布局草稿;改 JS 请用 onlinejs.compose(它自己会连同整张表单一起发布,不必再调本工具)。 Degrade guard: refuses to promote a draft carrying FEWER controls than the published face (form-publish-degrade) — the designer's Save clears drafts non-losslessly; recover via the form version history (/api/api/app/bizsheet/history/list) and rewrite the draft first, or pass allowDegrade:true to force the reduction. rebuild:true is the one-call refresh: discard the existing draft, re-scaffold from the published fields (non-structural control options preserved), then force-promote — use it after a field shape change. **表单工具栏按钮**:传 `buttons`(或 `customButtonJson`)→ 写进 `options.customButtonJson` 并在本次 publish 生成 `h_biz_button(triggerType=FORM, triggerCode=<formCode>)`(平台 `publishBizForm:1022`);`options.customButtonJson` 以**数组**写入(条目 `actionConfig` 为对象,设计器同形——线上 #38:字符串形=双重编码,前端按钮不渲染,回执给 formButtonsShapeWarning);表单页是否显示再由流程节点 `buttonPermission.customBtns[].enabled` 过滤。";
|
|
24
25
|
const FORM_RUN_BUTTON_DESCRIPTION = "执行表单工具栏按钮(平台同款面:`POST /api/api/runtime/form/executeCustomButton`,body `{bizButtonModel, bizObjectList:[<完整业务对象>], reacquireDataFromDb:true}`)。**与列表行按钮不同**:列表按钮发 `launcher/domain_service_runtime/<schema>/<rule>` + `ids[]`(用 `rule.run`),表单按钮带**整条记录**,不能互换。按钮来源 `GET /api/api/system/getCustomButtons`(只列 triggerType=FORM 的 h_biz_button)。前提:按钮已由 `form.publish` 的 `buttons`/`customButtonJson` 生成。返回是执行结果信封,规则副作用用 `data.load` 另读;被规则 UPDATE 的目标行须是 COMPLETED(引擎查不到 DRAFT)。`302045` = 数据被占用。**`10005` 执行失败时优先换等价面 `rule.run`(launcher/domain_service_runtime/<schema>/<rule> + ids[])**——同一绑定规则在 rule.run 面已验证可用(r28b 实证),不要在 executeCustomButton 上反复重试。";
|
|
25
26
|
const CONFIGURE_FORM_DESCRIPTION = "High-level: bind fields into the default form and publish it (form.draft → form.publish), subject to the write permission gate. Delegates to the proven form.draft scaffold + form.publish paths so the real empty-form layout (and any caller-supplied draftHtmlJson) is persisted and promoted — never bypasses with a shortcut body. `sheetCode` is optional: omitted means the model's default sheet (sheetCode = schemaCode).";
|
|
27
|
+
const FORM_LIST_DESCRIPTION = "列出模型的多张表单(`/api/api/app/bizsheet/list?schemaCode=`,header-only 投影):每行 `sheetCode`/`name`/`formType`(整数索引解码为名字,另带 formTypeIndex)/`published`。默认只发 1 次 wire;`detail:true` 才逐面 `bizsheet/get`(上限 maxSheets=12,超出回 partial+omittedSheets)补 existDraft/controlCount/buttonCount/publishedActionCount/hasCustomScript/faces。**默认面不伪造这些内容推导键,也不改旗标**:`published` 是平台旗标位(publish→draft 后它为 false 而内容俱在),判「有没有发布面内容」用 detail:true 的 faces。业务模型不存在 → modelPresent:false;该版本族无 /list 端点(HTTP 404)→ sheetListUnavailable:true + 只回默认槽(明确标注是推断,不是清单)。`defaultSheetCode` 由清单推导(formType=DEFAULT_SHEET 且 sheetCode===schemaCode),权威仍是 form.get 的显式 sheetCode。";
|
|
26
28
|
export const FORM_LANE_CONTRACT = Object.freeze({
|
|
27
29
|
lane: LANES.form,
|
|
28
30
|
family: CONTRACT_FAMILY,
|
|
@@ -44,6 +46,7 @@ export const FORM_LANE_CONTRACT = Object.freeze({
|
|
|
44
46
|
forceRepublish: FORM_WIRE.forceRepublish,
|
|
45
47
|
emptyLayoutGuard: FORM_WIRE.emptyLayoutGuard,
|
|
46
48
|
actionsColumns: FORM_WIRE.actionsColumns,
|
|
49
|
+
sheetListFace: FORM_WIRE.sheetListFace,
|
|
47
50
|
formButtons: FORM_WIRE.formButtons,
|
|
48
51
|
}),
|
|
49
52
|
wireBindings: Object.freeze({
|
|
@@ -57,6 +60,7 @@ export const FORM_LANE_CONTRACT = Object.freeze({
|
|
|
57
60
|
forceRepublish: Object.freeze([behaviorBinding("test/issue-11-online-js.test.ts#onlinejs.compose merges customScript into the existing draftHtmlJson layout", assertFormContract)]),
|
|
58
61
|
emptyLayoutGuard: Object.freeze([behaviorBinding("test/ticket-74-form-empty-layout.test.ts#ticket 74: form.draft refuses an explicitly empty draftViewJson", assertFormContract)]),
|
|
59
62
|
actionsColumns: Object.freeze([behaviorBinding("test/ticket-100-form-actions-columns.test.ts#form.get full:true surfaces draftActionsJson/publishedActionsJson", assertFormContract)]),
|
|
63
|
+
sheetListFace: Object.freeze([behaviorBinding("test/friction-06-form-list.test.ts#form.list defaults to one bizsheet/list wire and never fabricates draft/button fields", assertFormContract)]),
|
|
60
64
|
formButtons: Object.freeze([behaviorBinding("test/form-buttons.test.ts#form.publish with buttons materialises FORM-trigger buttons and form.get surfaces them", assertFormContract)]),
|
|
61
65
|
}),
|
|
62
66
|
evidence: Object.freeze([
|
|
@@ -65,8 +69,8 @@ export const FORM_LANE_CONTRACT = Object.freeze({
|
|
|
65
69
|
"packages/omc-cli/test/form-scaffold.test.ts",
|
|
66
70
|
]),
|
|
67
71
|
tools: Object.freeze({
|
|
68
|
-
"form.
|
|
69
|
-
"form.draft": Object.freeze({ scope: "draft publish publishedHtmlJson readback", description: FORM_DRAFT_DESCRIPTION }),
|
|
72
|
+
"form.list": Object.freeze({ scope: "sheet list projection", description: FORM_LIST_DESCRIPTION }),
|
|
73
|
+
"form.get": Object.freeze({ scope: "publishedHtmlJson authoritative readback", description: FORM_GET_DESCRIPTION }), "form.draft": Object.freeze({ scope: "draft publish publishedHtmlJson readback", description: FORM_DRAFT_DESCRIPTION }),
|
|
70
74
|
"form.publish": Object.freeze({ scope: "draft publish publishedHtmlJson readback", description: FORM_PUBLISH_DESCRIPTION }),
|
|
71
75
|
configure_form: Object.freeze({ scope: "draft publish publishedHtmlJson readback", description: CONFIGURE_FORM_DESCRIPTION }),
|
|
72
76
|
"form.runButton": Object.freeze({ scope: "form toolbar button execution", description: FORM_RUN_BUTTON_DESCRIPTION }),
|
|
@@ -77,6 +81,7 @@ export function assertFormContract() {
|
|
|
77
81
|
if (FORM_WIRE.missingFieldsErrcode !== 302020)
|
|
78
82
|
throw new Error("form contract pins the empty-form scaffold errcode to 302020");
|
|
79
83
|
assertDescriptionCarries(FORM_LANE_CONTRACT, "form.get", ["bizsheet/get", "draft/published", "mappings", "`full:true`", "actions"]);
|
|
84
|
+
assertDescriptionCarries(FORM_LANE_CONTRACT, "form.list", ["bizsheet/list", "formType", "sheetCode", "detail"]);
|
|
80
85
|
if (!FORM_WIRE.actionsColumns.includes("BizForm.java:95-100"))
|
|
81
86
|
throw new Error("form contract must pin the actions-columns evidence (ticket 100)");
|
|
82
87
|
assertDescriptionCarries(FORM_LANE_CONTRACT, "form.draft", ["bizsheet/update", "draftViewJson", "draftAttributesJson", "scaffold", "draftHtmlJson", "form-empty-layout", "fromReadback"]);
|
|
@@ -6,6 +6,7 @@ export const FORM_COVERAGE = declareLaneCoverage(FORM_LANE_CONTRACT.lane, [
|
|
|
6
6
|
capability: "Form publish chain (draft-first → publish → publishedHtmlJson readback)",
|
|
7
7
|
evidence: [".scratch/omc-route-wayfinder/leg2-closeout.md", "packages/omc-cli/src/lanes/form.ts", "r11 2026-10-23 (1.1.25): form buttons live on bizsheet.options.customButtonJson → h_biz_button(triggerType=FORM) at publish; execution is POST runtime/form/executeCustomButton with the full bizObject (Playwright capture)"],
|
|
8
8
|
tools: [
|
|
9
|
+
claim("form.list", T["form.list"].scope),
|
|
9
10
|
claim("form.get", T["form.get"].scope),
|
|
10
11
|
claim("form.draft", T["form.draft"].scope),
|
|
11
12
|
claim("form.publish", T["form.publish"].scope),
|