@stalfh233/omc-cli 0.6.68 → 0.6.70

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/graph.js CHANGED
@@ -5,7 +5,7 @@ import { joinConfigRoot } from "./command-transport.js";
5
5
  import { decodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "./json-column.js";
6
6
  import { ENDPOINTS } from "./endpoints.js";
7
7
  import { applicationResolutionOf, flattenTreeRows, resolveApplicationScope, sha256 } from "./support.js";
8
- import { wireCall, wireRows } from "./wire.js";
8
+ import { wireCall, wireRows, WireError } from "./wire.js";
9
9
  import { walkConditionLeaves } from "./lanes/rule-graph.js";
10
10
  /**
11
11
  * `node:sqlite` must stay OUT of the CLI's startup module graph: a static
@@ -35,7 +35,9 @@ function nodeSqlite() {
35
35
  * - edges are api-fact only, extracted with rule.references' matching
36
36
  * semantics (service/model/field) plus, since r72g, rule CONDITION leaves
37
37
  * (via rule.condition — the online face's blind spot; see
38
- * extractReferenceEdges);
38
+ * extractReferenceEdges) and, since r75, workflow route conditions + field
39
+ * permissions (published template face) and default-slot form controls
40
+ * (extractWorkflowEdges / extractFormEdges);
39
41
  * - fail-closed completeness: every swallowed read/parse failure is a recorded
40
42
  * gap; a zero-hit answer over a gapped index never claims "no references";
41
43
  * - derived locator, never authority: results are candidate pointers; plan /
@@ -51,7 +53,11 @@ function nodeSqlite() {
51
53
  */
52
54
  // r72g(2026-11-17):规则条件叶子入边(via rule.condition)——v7 索引没有这类
53
55
  // 边,若不升版,旧库会在新覆盖声明下静默漏答「谁的条件引用了字段 X」。
54
- export const GRAPH_SCHEMA_VERSION = "8";
56
+ // r75(2026-11-18):workflow 路由条件(workflow.condition)+ 字段权限
57
+ //(workflow.permissions / .sub)+ form 控件(form.controls)三面入边——同样的
58
+ // 先例:v8 库没有这三类边,不升版则旧库在新覆盖声明下静默漏答「删字段断流程/
59
+ // 表单」。schema 9 强制重拉。
60
+ export const GRAPH_SCHEMA_VERSION = "9";
55
61
  const STALE_LOCK_MS = 15 * 60 * 1000;
56
62
  export const DEFAULT_PULL_CONCURRENCY = 16;
57
63
  export const MAX_PULL_CONCURRENCY = 32;
@@ -438,6 +444,110 @@ export function extractListViewEdges(schemaCode, viewCode, model) {
438
444
  push(condition.propertyCode, "listview.conditions");
439
445
  return edges;
440
446
  }
447
+ /**
448
+ * r75:workflow 路由条件的条件叶 walker。叶子键是 `currentDataItem`——与
449
+ * businessrule 条件叶的 `currentSchemaDataItem`/`targetSchemaDataItem` 是**不同
450
+ * 的键**(r75 真机证据),`walkConditionLeaves` 的 isLeaf 判定不认识这种叶子,
451
+ * 不能复用。组形状是 `[[leaf,…],…]`(组间 AND);空组 `[]` 自然零叶。叶子只认
452
+ * currentDataItem 侧(左=字段、右=字面量;未观察到 target 侧字段——遇到未来
453
+ * 新形态如实漏,不猜)。
454
+ */
455
+ function walkWorkflowConditionLeaves(container, visit) {
456
+ if (Array.isArray(container)) {
457
+ for (const entry of container)
458
+ walkWorkflowConditionLeaves(entry, visit);
459
+ return;
460
+ }
461
+ if (container !== null && typeof container === "object") {
462
+ const record = container;
463
+ if (typeof record.currentDataItem === "string" && record.currentDataItem !== "")
464
+ visit(record);
465
+ }
466
+ }
467
+ /**
468
+ * r75(2026-11-18,调查 A):workflow 面(已发布模板)入边——路由条件
469
+ *(`data.rules[].ruleConditionGroup` 叶子)+ 字段权限
470
+ *(`activities[].propertyPermissions[]` 与 `subPropertyPermissions[]`)。
471
+ *
472
+ * 宿主模型 = `data.schemaCode`(发布模板顶层自带,r75 真机 9/9 全带;缺失时
473
+ * 回退调用方传入的模型码)。`ruleCode` 列承载 workflowCode(与 datarule/listview
474
+ * 借 nodeCode 的惯例不同:流程码在查询面就是「引用者」身份)。权限行全量入边
475
+ *(含全 false 默认行)——删除字段时它们同样是存储引用;子表列权限的
476
+ * nodeCode 带 `activityCode!父码` 消歧(子表列码可能与主表字段同名)。
477
+ */
478
+ export function extractWorkflowEdges(schemaCode, workflowCode, data) {
479
+ const host = typeof data.schemaCode === "string" && data.schemaCode !== "" ? data.schemaCode : schemaCode;
480
+ const edges = [];
481
+ const seen = new Set();
482
+ const push = (code, nodeCode, via) => {
483
+ if (typeof code !== "string" || code === "")
484
+ return;
485
+ const dedupeKey = `${via}/${nodeCode}/${code}`;
486
+ if (seen.has(dedupeKey))
487
+ return;
488
+ seen.add(dedupeKey);
489
+ edges.push({ kind: "field", code, schemaCode: host, ruleCode: workflowCode, nodeCode, nodeType: via === "workflow.condition" ? "workflow-condition" : "workflow-permission", via });
490
+ };
491
+ for (const route of Array.isArray(data.rules) ? data.rules : []) {
492
+ const routeCode = `${String(route.preActivityCode ?? "")}->${String(route.postActivityCode ?? "")}`;
493
+ walkWorkflowConditionLeaves(route.ruleConditionGroup, (leaf) => push(leaf.currentDataItem, routeCode, "workflow.condition"));
494
+ }
495
+ for (const activity of Array.isArray(data.activities) ? data.activities : []) {
496
+ const activityCode = String(activity.activityCode ?? "");
497
+ if (activityCode === "")
498
+ continue;
499
+ for (const permission of Array.isArray(activity.propertyPermissions) ? activity.propertyPermissions : []) {
500
+ push(permission.propertyCode, activityCode, "workflow.permissions");
501
+ for (const sub of Array.isArray(permission.subPropertyPermissions) ? permission.subPropertyPermissions : [])
502
+ push(sub.propertyCode, `${activityCode}!${String(permission.propertyCode ?? "")}`, "workflow.permissions.sub");
503
+ }
504
+ }
505
+ return edges;
506
+ }
507
+ /**
508
+ * r75:form 面(默认表单槽)入边——`draftAttributesJson`/`publishedAttributesJson`
509
+ * 双面并集(一面有即有)。字段绑定控件的 key == 字段 code,但 attributes 里还
510
+ * 有 Title/Group 等非数据控件(固定 type,码不在字段表)——只发「码在该模型
511
+ * fieldList(draft∪published)里」的控件,滤掉噪声。子表控件的 `columns[].key`
512
+ * 是子模型字段码,不在本模型 fieldList 里(fields 表本就无子表列,与 datarule/
513
+ * workflow 子表语义一致),结构上即数据绑定,不按 fieldList 过滤;nodeCode 带
514
+ * `sheetCode!父控件码` 消歧(子表列码可能与主表字段同名)。
515
+ */
516
+ export function extractFormEdges(schemaCode, sheet, knownFieldCodes) {
517
+ const sheetCode = typeof sheet.sheetCode === "string" && sheet.sheetCode !== "" ? sheet.sheetCode : schemaCode;
518
+ const edges = [];
519
+ const seen = new Set();
520
+ const push = (code, nodeCode) => {
521
+ if (code === "" || seen.has(`${nodeCode}/${code}`))
522
+ return;
523
+ seen.add(`${nodeCode}/${code}`);
524
+ edges.push({ kind: "field", code, schemaCode, ruleCode: "", nodeCode, nodeType: "form-control", via: "form.controls" });
525
+ };
526
+ for (const face of [sheet.draftAttributesJson, sheet.publishedAttributesJson]) {
527
+ if (typeof face !== "string" || face.trim() === "")
528
+ continue;
529
+ let controls = {};
530
+ try {
531
+ const parsed = JSON.parse(face);
532
+ if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed))
533
+ controls = parsed;
534
+ }
535
+ catch {
536
+ continue; // 该面 JSON 损坏:另一面仍可用,损坏面不产边也不撒谎
537
+ }
538
+ for (const [key, control] of Object.entries(controls)) {
539
+ if (knownFieldCodes.has(key))
540
+ push(key, sheetCode);
541
+ const record = control;
542
+ if (record !== null && typeof record === "object" && Array.isArray(record.columns))
543
+ for (const column of record.columns) {
544
+ if (typeof column.key === "string")
545
+ push(column.key, `${sheetCode}!${key}`);
546
+ }
547
+ }
548
+ }
549
+ return edges;
550
+ }
441
551
  /**
442
552
  * The full pull walk, PIPELINED: one shared bounded worker pool executes both
443
553
  * task kinds — per-model face reads (rule.list + dataruleList) and per-rule
@@ -486,6 +596,14 @@ export async function pullRuleGraph(session, concurrency = DEFAULT_PULL_CONCURRE
486
596
  gaps.push({ kind: "field-list", ref: schemaCode, note: error instanceof Error ? error.message : String(error) });
487
597
  }
488
598
  }));
599
+ // r75:form 控件边按「码在该模型 fieldList 里」过滤——这里是已知字段的按模型
600
+ // 索引(fields 收集在上面 await 完成,此时已齐)。
601
+ const knownFields = new Map();
602
+ for (const field of fields) {
603
+ const codes = knownFields.get(field.schemaCode) ?? new Set();
604
+ codes.add(field.code);
605
+ knownFields.set(field.schemaCode, codes);
606
+ }
489
607
  try {
490
608
  await wireCall(session, { path: ENDPOINTS.bizServiceCategoryList });
491
609
  const rows = wireRows((await wireCall(session, { path: ENDPOINTS.bizServiceListByCategoryId, query: { categoryId: "" } })).data);
@@ -503,6 +621,8 @@ export async function pullRuleGraph(session, concurrency = DEFAULT_PULL_CONCURRE
503
621
  let parseFailures = 0;
504
622
  let dataruleCount = 0;
505
623
  let viewCount = 0;
624
+ let workflowCount = 0;
625
+ let formCount = 0;
506
626
  // --- shared scheduler: bounded starts, dynamic task submission ---
507
627
  class Semaphore {
508
628
  // Handoff semantics: a released slot is handed DIRECTLY to the head
@@ -592,6 +712,51 @@ export async function pullRuleGraph(session, concurrency = DEFAULT_PULL_CONCURRE
592
712
  catch (error) {
593
713
  gaps.push({ kind: "listview-list", ref: schemaCode, note: error instanceof Error ? error.message : String(error) });
594
714
  }
715
+ // r75:workflow 面(路由条件 + 字段权限)。isworkflow=false 是「该模型没有
716
+ // 流程」的缺席信号,不是缺口;401001 同理(与 lanes/workflow.ts 的
717
+ // isWorkflowAbsent 同语义——该函数未导出,这里局部判定)。读失败记
718
+ // workflow-read gap,不静默。
719
+ try {
720
+ if ((await wireCall(session, { path: ENDPOINTS.workflowIsWorkflow, query: { schemaCode } })).data === true) {
721
+ const linked = (await wireCall(session, { path: ENDPOINTS.workflowGetBySchema, query: { schemaCode } })).data;
722
+ const workflowCode = linked !== null && typeof linked.workflowCode === "string" && linked.workflowCode !== "" ? linked.workflowCode : "";
723
+ if (workflowCode === "") {
724
+ gaps.push({ kind: "workflow-read", ref: schemaCode, note: "isworkflow=true 但 getWorkflow 未返回 workflowCode" });
725
+ }
726
+ else {
727
+ // 只读发布面(运行时生效面);未发布流程该端点回草稿形态,照常入边
728
+ //(发布标记不阻断采集,草稿独有差异不追——见 r75 调查报告)。
729
+ let published = null;
730
+ try {
731
+ published = (await wireCall(session, { path: ENDPOINTS.workflowGetPublished, query: { workflowCode } })).data;
732
+ }
733
+ catch (error) {
734
+ if (!(error instanceof WireError && error.kind === "business" && error.errcode === 401001))
735
+ throw error;
736
+ }
737
+ if (published !== null) {
738
+ workflowCount += 1;
739
+ edges.push(...extractWorkflowEdges(schemaCode, workflowCode, published).map((edge) => ({ ...edge, applicationCode })));
740
+ }
741
+ }
742
+ }
743
+ }
744
+ catch (error) {
745
+ gaps.push({ kind: "workflow-read", ref: schemaCode, note: error instanceof Error ? error.message : String(error) });
746
+ }
747
+ // r75:form 面(默认表单槽,sheetCode=schemaCode)。bizsheet/get 对「还没有
748
+ // 表单」的模型回 data:null——缺席不是缺口。多表单模型的其它槽位
749
+ //(sheetCode≠schemaCode)无清单端点,只扫默认槽(GRAPH_COVERAGE.note 声明)。
750
+ try {
751
+ const sheet = (await wireCall(session, { path: ENDPOINTS.sheetGet, query: { schemaCode, sheetCode: schemaCode } })).data;
752
+ if (sheet !== null) {
753
+ formCount += 1;
754
+ edges.push(...extractFormEdges(schemaCode, sheet, knownFields.get(schemaCode) ?? new Set()).map((edge) => ({ ...edge, applicationCode })));
755
+ }
756
+ }
757
+ catch (error) {
758
+ gaps.push({ kind: "form-read", ref: schemaCode, note: error instanceof Error ? error.message : String(error) });
759
+ }
595
760
  listMs += Date.now() - faceStart;
596
761
  if (!ruleListOk)
597
762
  return;
@@ -701,7 +866,7 @@ export async function pullRuleGraph(session, concurrency = DEFAULT_PULL_CONCURRE
701
866
  fields: fields.sort((a, b) => `${a.schemaCode}/${a.code}`.localeCompare(`${b.schemaCode}/${b.code}`)),
702
867
  services: services.sort((a, b) => a.code.localeCompare(b.code)),
703
868
  gaps,
704
- scanned: { models: schemaCodes.length, rules: rules.length, datarules: dataruleCount, views: viewCount, parseFailures },
869
+ scanned: { models: schemaCodes.length, rules: rules.length, datarules: dataruleCount, views: viewCount, workflows: workflowCount, forms: formCount, parseFailures },
705
870
  timings: { listMs, readMs, totalMs: Date.now() - totalStart },
706
871
  };
707
872
  }
@@ -796,7 +961,7 @@ export async function publishGraphPull(session, concurrency = DEFAULT_PULL_CONCU
796
961
  fields: parts.flatMap((part) => part.fields),
797
962
  services: parts.flatMap((part) => part.services),
798
963
  gaps: parts.flatMap((part) => part.gaps),
799
- scanned: parts.reduce((sum, part) => ({ models: sum.models + part.scanned.models, rules: sum.rules + part.scanned.rules, datarules: sum.datarules + part.scanned.datarules, views: sum.views + part.scanned.views, parseFailures: sum.parseFailures + part.scanned.parseFailures }), { models: 0, rules: 0, datarules: 0, views: 0, parseFailures: 0 }),
964
+ scanned: parts.reduce((sum, part) => ({ models: sum.models + part.scanned.models, rules: sum.rules + part.scanned.rules, datarules: sum.datarules + part.scanned.datarules, views: sum.views + part.scanned.views, workflows: sum.workflows + part.scanned.workflows, forms: sum.forms + part.scanned.forms, parseFailures: sum.parseFailures + part.scanned.parseFailures }), { models: 0, rules: 0, datarules: 0, views: 0, workflows: 0, forms: 0, parseFailures: 0 }),
800
965
  timings: { listMs: parts.reduce((n, part) => n + part.timings.listMs, 0), readMs: parts.reduce((n, part) => n + part.timings.readMs, 0), totalMs: parts.reduce((n, part) => n + part.timings.totalMs, 0) },
801
966
  };
802
967
  const staging = `${dbPath}.staging-${process.pid}`;
@@ -1006,19 +1171,21 @@ export const GRAPH_COVERAGE = Object.freeze({
1006
1171
  // r72g(2026-11-17):businessrule 面从「结构引用」扩到「条件叶子」——规则
1007
1172
  // nodeGraph 各条件容器(filterCondition/targetConditionGroups/
1008
1173
  // exitConditionGroups/dataCondition/…)+ 定时规则 schedulerSetting.
1009
- // filterConditionGroups 的字段引用以 rule.condition 边入索引;schema 升到
1010
- // 8 强制旧库重拉,避免旧索引在新声明下静默漏答。
1011
- scanned: Object.freeze(["businessrule", "datarule", "listview"]),
1012
- notScanned: Object.freeze(["form", "workflow.permissions", "workflow.bindings", "onlinejs"]),
1013
- answerable: Object.freeze(["businessrule", "datarule", "listview"]),
1174
+ // filterConditionGroups 的字段引用以 rule.condition 边入索引。
1175
+ // r75(2026-11-18):workflow 路由条件(workflow.condition 边)+ 字段权限
1176
+ //(workflow.permissions / workflow.permissions.sub 边)+ form 控件
1177
+ //(form.controls 边,默认表单槽)入索引,schema 升到 9 强制旧库重拉。
1178
+ // workflow.bindings(规则绑定,需扩 rule kind,跨面改动留二期)与 onlinejs
1179
+ //(任意 JS 表达式的字符串引用,无法证伪)仍在 notScanned。
1180
+ scanned: Object.freeze(["businessrule", "datarule", "listview", "form", "workflow.condition", "workflow.permissions"]),
1181
+ notScanned: Object.freeze(["workflow.bindings", "onlinejs"]),
1182
+ answerable: Object.freeze(["businessrule", "datarule", "listview", "form", "workflow.condition", "workflow.permissions"]),
1014
1183
  mustCheckManually: Object.freeze([
1015
- { surface: "form", why: "表单控件关联未扫描,可能仍引用目标字段", how: "omc call form.get --args '{\"schemaCode\":\"<x>\"}'" },
1016
- { surface: "workflow.permissions", why: "流程权限未扫描,无法判断谁能发起/操作", how: "omc call workflow.get --args '{\"schemaCode\":\"<x>\"}'" },
1017
- { surface: "workflow.bindings", why: "流程规则绑定未扫描,规则删除可能留下绑定", how: "omc call workflow.get --args '{\"schemaCode\":\"<x>\"}'" },
1184
+ { surface: "workflow.bindings", why: "流程规则绑定未扫描,规则删除可能留下绑定(workflow.get 不存在:草稿/已发布分别用 get_draft/get_published)", how: "omc call workflow.get_published --args '{\"workflowCode\":\"<x>\"}'" },
1018
1185
  { surface: "onlinejs", why: "在线 JS 可能通过字符串引用字段", how: "omc call onlinejs.get --args '{\"schemaCode\":\"<x>\"}'" },
1019
1186
  ]),
1020
- note: "零命中/全零 totals 只代表 scanned 面没有命中;notScanned 面(尤其 form 与 workflow.permissions)未扫描,不可据此判定可安全删除或无影响",
1021
- crossFace: "在线对照面:`omc call rule.references`(实时,仅 businessrule,不含条件叶子);本索引(离线快照,businessrule+datarule+listview,且含规则条件叶子 rule.condition 边)——条件里的字段引用离线一次可答,在线面要 rule.get 逐条看",
1187
+ note: "零命中/全零 totals 只代表 scanned 面没有命中;notScanned 面(workflow.bindings 与 onlinejs)未扫描,不可据此判定可安全删除或无影响。form 面只扫默认表单槽(sheetCode=schemaCode),多表单模型的其它槽位未扫;workflow 只读已发布端点 get_published(未发布流程回草稿形态,照常入边);流程条件叶子只认 currentDataItem 裸码(未观察到子表/跨模型限定形态,遇到新形态会如实漏)",
1188
+ crossFace: "在线对照面:`omc call rule.references`(实时,仅 businessrule,不含条件叶子);本索引(离线快照,businessrule+datarule+listview+form+workflow.condition+workflow.permissions,且含规则条件叶子 rule.condition 边)——条件/表单控件/流程权限里的字段引用离线一次可答;在线面对 workflow/form 没有快查工具(逐条 workflow.get_published / form.get 才能答),离线索引是这两个面的唯一快查面",
1022
1189
  });
1023
1190
  /**
1024
1191
  * Zero-hit disambiguation (2026-10-31 capability-test friction, hit twice in
@@ -1162,7 +1329,7 @@ export function queryGraphReferences(kind, rawCode, selector = {}) {
1162
1329
  ? {
1163
1330
  note: (gapped
1164
1331
  ? "零命中,但索引存在扫描缺口——不可作为「无引用」证明;先 omc graph pull 重建再查"
1165
- : `零命中=仅 scanned 面(规则/数据规则/视图)没有引用它;本索引覆盖应用:${summary.coverage.applicationCodes.join("、") || "(未知)"},不代表其他应用没有引用;form(表单控件)与 workflow.permissions 未扫描,见 coverage.notScanned——不可据此判定可安全删除`) +
1332
+ : `零命中=scanned 面(规则/数据规则/视图/表单/流程)没有引用它;本索引覆盖应用:${summary.coverage.applicationCodes.join("、") || "(未知)"},不代表其他应用没有引用;workflow.bindings 与 onlinejs 未扫描,见 coverage.notScanned——不可据此判定可安全删除`) +
1166
1333
  (zeroHitKindHint(db, kind, code, "references") ?? "") +
1167
1334
  (kind === "field" && scoped === null ? unresolvedScopedCodeNote(rawCode) ?? "" : ""),
1168
1335
  }
@@ -1181,7 +1348,21 @@ export function queryGraphReferencesBatch(kind, codes, selector = {}) {
1181
1348
  try {
1182
1349
  const wanted = [...new Set(codes.filter(Boolean))];
1183
1350
  const rows = wanted.length === 0 ? [] : db.prepare(`SELECT code, schema_code, rule_code, node_code, node_type, via FROM edges WHERE kind = ? AND code IN (${wanted.map(() => "?").join(",")}) ORDER BY code, schema_code, rule_code, node_code, via`).all(kind, ...wanted);
1184
- return { kind, codes: wanted, matches: rows.map((row) => ({ targetCode: row.code, schemaCode: row.schema_code, ruleCode: row.rule_code, nodeCode: row.node_code ?? "", nodeType: row.node_type ?? "", via: row.via, referrer: { schemaCode: row.schema_code, ruleCode: row.rule_code }, isSelf: row.schema_code === row.code })), index: summary, coverage: GRAPH_COVERAGE };
1351
+ // r73 探针03-P2:裸码批量查询不告诉调用方「这个 code 解析到了哪些宿主模型」,
1352
+ // 同名跨模型时要额外抽查才能确认。resolved 汇总每个 code 的宿主 schema 集合,
1353
+ // 跨模型同名直接标 sameCodeAcrossSchemas(消歧用 schemaCode.field 写法)。
1354
+ const resolved = wanted.map((code) => {
1355
+ const schemaCodes = [...new Set(rows.filter((row) => row.code === code).map((row) => row.schema_code))];
1356
+ return { code, schemaCodes, ...(schemaCodes.length > 1 ? { sameCodeAcrossSchemas: true } : {}) };
1357
+ });
1358
+ return {
1359
+ kind,
1360
+ codes: wanted,
1361
+ resolved,
1362
+ matches: rows.map((row) => ({ targetCode: row.code, schemaCode: row.schema_code, ruleCode: row.rule_code, nodeCode: row.node_code ?? "", nodeType: row.node_type ?? "", via: row.via, referrer: { schemaCode: row.schema_code, ruleCode: row.rule_code }, isSelf: row.schema_code === row.code })),
1363
+ index: summary,
1364
+ coverage: GRAPH_COVERAGE,
1365
+ };
1185
1366
  }
1186
1367
  finally {
1187
1368
  db.close();
@@ -1315,7 +1496,7 @@ export function searchGraphRules(term, limit = 20, offset = 0, selector = {}) {
1315
1496
  matches: entityMatches,
1316
1497
  index: summary,
1317
1498
  ...(scoped !== null ? { resolvedScope: { schemaCode: scoped.schemaCode, code: scoped.code } } : {}),
1318
- coverage: { scanned: ["rule.code", "rule.name", "model.code", "model.name", "field.code", "field.name", "service.code", "service.name"], notScanned: ["rule.body", "form", "workflow.permissions"], answerable: ["rule.code", "rule.name", "model.code", "model.name", "field.code", "field.name", "service.code", "service.name"], mustCheckManually: [{ surface: "rule.body", why: "规则体未检索", how: "omc call rule.list --args '{\"schemaCode\":\"<x>\"}'" }, { surface: "form", why: "表单控件未扫描", how: "omc call form.get --args '{\"schemaCode\":\"<x>\"}'" }, { surface: "workflow.permissions", why: "流程权限未扫描", how: "omc call workflow.get --args '{\"schemaCode\":\"<x>\"}'" }], note: "检索覆盖规则与实体的 code/name;规则体、表单与流程权限未扫描" },
1499
+ coverage: { scanned: ["rule.code", "rule.name", "model.code", "model.name", "field.code", "field.name", "service.code", "service.name"], notScanned: ["rule.body", "workflow.bindings", "onlinejs"], answerable: ["rule.code", "rule.name", "model.code", "model.name", "field.code", "field.name", "service.code", "service.name"], mustCheckManually: [{ surface: "rule.body", why: "规则体未检索", how: "omc call rule.list --args '{\"schemaCode\":\"<x>\"}'" }, { surface: "workflow.bindings", why: "流程规则绑定未扫描,规则删除可能留下绑定", how: "omc call workflow.get_published --args '{\"workflowCode\":\"<x>\"}'" }, { surface: "onlinejs", why: "在线 JS 可能通过字符串引用字段", how: "omc call onlinejs.get --args '{\"schemaCode\":\"<x>\"}'" }], note: "检索覆盖规则与实体的 code/name;规则体、流程规则绑定与在线 JS 未检索(表单控件/流程条件与权限里的字段引用已入索引,走 references/impact)" },
1319
1500
  ...(term.trim() !== "" && !/^[A-Za-z][A-Za-z0-9_.-]*$/.test(term.trim()) ? { note: "疑似业务词;本工具同时检索实体 name/code 与规则 code/name,引用明细请使用匹配到的 code 再查 references/impact" } : {}),
1320
1501
  ...(matches.length === 0 && entityMatches.model.total === 0 && entityMatches.field.total === 0 && entityMatches.service.total === 0
1321
1502
  ? {
@@ -1354,7 +1535,7 @@ export function impactGraph(kind, rawCode, selector = {}) {
1354
1535
  const schemaPredicate = scoped ? " AND schema_code = ?" : "";
1355
1536
  const schemaParams = scoped ? [scoped.schemaCode] : [];
1356
1537
  const hop1 = db
1357
- .prepare(`SELECT DISTINCT schema_code, rule_code FROM edges WHERE kind = ? AND code = ?${schemaPredicate} AND node_type NOT IN ('datarule', 'listview') ORDER BY schema_code, rule_code LIMIT 51`)
1538
+ .prepare(`SELECT DISTINCT schema_code, rule_code FROM edges WHERE kind = ? AND code = ?${schemaPredicate} AND node_type NOT IN ('datarule', 'listview', 'workflow-condition', 'workflow-permission', 'form-control') ORDER BY schema_code, rule_code LIMIT 51`)
1358
1539
  .all(kind, code, ...schemaParams);
1359
1540
  const dataruleHits = db
1360
1541
  .prepare(`SELECT DISTINCT schema_code, node_code AS targets, via FROM edges WHERE kind = ? AND code = ?${schemaPredicate} AND node_type = 'datarule' ORDER BY schema_code, node_code, via LIMIT 21`)
@@ -1362,8 +1543,16 @@ export function impactGraph(kind, rawCode, selector = {}) {
1362
1543
  const listViewHits = db
1363
1544
  .prepare(`SELECT DISTINCT schema_code, node_code AS view_code, via FROM edges WHERE kind = ? AND code = ?${schemaPredicate} AND node_type = 'listview' ORDER BY schema_code, node_code, via LIMIT 21`)
1364
1545
  .all(kind, code, ...schemaParams);
1546
+ // r75:workflow/form 独立命中桶(与 datarule/listview 平级,20 条上限)——
1547
+ // 不分桶则这两面的边会混进 hop1「规则」列表且在 rules 表查无名字。
1548
+ const workflowHits = db
1549
+ .prepare(`SELECT DISTINCT schema_code, rule_code, node_code, node_type, via FROM edges WHERE kind = ? AND code = ?${schemaPredicate} AND node_type IN ('workflow-condition', 'workflow-permission') ORDER BY schema_code, rule_code, node_code, node_type, via LIMIT 21`)
1550
+ .all(kind, code, ...schemaParams);
1551
+ const formHits = db
1552
+ .prepare(`SELECT DISTINCT schema_code, node_code AS sheet_code, via FROM edges WHERE kind = ? AND code = ?${schemaPredicate} AND node_type = 'form-control' ORDER BY schema_code, node_code, via LIMIT 21`)
1553
+ .all(kind, code, ...schemaParams);
1365
1554
  const capped = hop1.length > 50;
1366
- const refsFor = db.prepare("SELECT kind, code, via FROM edges WHERE schema_code = ? AND rule_code = ? AND node_type <> 'datarule' ORDER BY kind, code, via");
1555
+ const refsFor = db.prepare("SELECT kind, code, via FROM edges WHERE schema_code = ? AND rule_code = ? AND node_type NOT IN ('datarule', 'listview', 'workflow-condition', 'workflow-permission', 'form-control') ORDER BY kind, code, via");
1367
1556
  const ruleName = db.prepare("SELECT name FROM rules WHERE schema_code = ? AND rule_code = ?");
1368
1557
  const services = new Set();
1369
1558
  const models = new Set();
@@ -1402,21 +1591,23 @@ export function impactGraph(kind, rawCode, selector = {}) {
1402
1591
  rules,
1403
1592
  datarules: dataruleHits.slice(0, 20).map((hit) => ({ schemaCode: hit.schema_code, targets: hit.targets ?? "", via: hit.via })),
1404
1593
  listviews: listViewHits.slice(0, 20).map((hit) => ({ schemaCode: hit.schema_code, viewCode: hit.view_code ?? "", via: hit.via })),
1405
- totals: { rules: hop1.length, datarules: dataruleHits.length, listviews: listViewHits.length, touchedServices: services.size, touchedModels: models.size, touchedFields: fields.size },
1594
+ workflows: workflowHits.slice(0, 20).map((hit) => ({ schemaCode: hit.schema_code, workflowCode: hit.rule_code, nodeCode: hit.node_code ?? "", nodeType: hit.node_type ?? "", via: hit.via })),
1595
+ forms: formHits.slice(0, 20).map((hit) => ({ schemaCode: hit.schema_code, sheetCode: hit.sheet_code ?? "", via: hit.via })),
1596
+ totals: { rules: hop1.length, datarules: dataruleHits.length, listviews: listViewHits.length, workflows: workflowHits.length, forms: formHits.length, touchedServices: services.size, touchedModels: models.size, touchedFields: fields.size },
1406
1597
  index: summary,
1407
1598
  coverage: GRAPH_COVERAGE,
1408
1599
  ...(scoped !== null ? { resolvedScope: { schemaCode: scoped.schemaCode, code: scoped.code } } : {}),
1409
- ...(hop1.length === 0 && dataruleHits.length === 0 && listViewHits.length === 0
1600
+ ...(hop1.length === 0 && dataruleHits.length === 0 && listViewHits.length === 0 && workflowHits.length === 0 && formHits.length === 0
1410
1601
  ? {
1411
1602
  note: (gapped
1412
1603
  ? "零命中,但索引存在扫描缺口——不可作为「无影响」证明;先 omc graph pull 重建再查"
1413
- : "零命中=仅 scanned 面(规则/数据规则/视图)没有影响;form(表单控件)与 workflow.permissions 未扫描,见 coverage.notScanned——不可据此判定「删除无影响」") +
1604
+ : "零命中=scanned 面(规则/数据规则/视图/表单/流程)没有影响;workflow.bindings 与 onlinejs 未扫描,见 coverage.notScanned——不可据此判定「删除无影响」") +
1414
1605
  (zeroHitKindHint(db, kind, code, "impact") ?? "") +
1415
1606
  (kind === "field" && scoped === null ? unresolvedScopedCodeNote(rawCode) ?? "" : ""),
1416
1607
  }
1417
1608
  : {}),
1418
- ...(capped || dataruleHits.length > 20 || listViewHits.length > 20
1419
- ? { truncated: true, note: `命中超过上限已截断(规则 50/实际 ${hop1.length},数据规则 20/实际 ${dataruleHits.length},视图 20/实际 ${listViewHits.length});完整规则清单用 references` }
1609
+ ...(capped || dataruleHits.length > 20 || listViewHits.length > 20 || workflowHits.length > 20 || formHits.length > 20
1610
+ ? { truncated: true, note: `命中超过上限已截断(规则 50/实际 ${hop1.length},数据规则 20/实际 ${dataruleHits.length},视图 20/实际 ${listViewHits.length},流程 20/实际 ${workflowHits.length},表单 20/实际 ${formHits.length});完整规则清单用 references` }
1420
1611
  : {}),
1421
1612
  ...(gapped ? { gapWarning: `索引有 ${summary.gaps.count} 个扫描缺口(${Object.entries(summary.gaps.byKind).map(([k, v]) => `${k}:${v}`).join(", ")});影响面可能不完整` } : {}),
1422
1613
  };
@@ -52,6 +52,10 @@ export function registerApplyChangesLane(tools) {
52
52
  confirmProduction: confirmProductionArg,
53
53
  dryRun: z.boolean().optional().describe("true = 只返回整包预览(plan/actions + planFingerprint),零环境写入"),
54
54
  },
55
+ // R75-B:dry-run 逐项跑 writePreflight(纯参数门),但各步的 session-aware
56
+ // lint 尚未在批量预览里执行——如实声明,不能读成「整批可执行」。
57
+ lintScope: "partial",
58
+ lintUnchecked: ["batch-step-session-lint", "local-write-gates", "platform-side-validation", "post-write-readback"],
55
59
  handler: async (ctx, args) => {
56
60
  const changes = args.changes;
57
61
  // ---- 1. Structural validation (zero wire calls) --------------------
@@ -1191,6 +1191,31 @@ export function registerB2Lane(tools) {
1191
1191
  }
1192
1192
  },
1193
1193
  });
1194
+ // R75-B:service.update 的只读前置门(id 解析、分类悬空、adapter 白名单/必需键、
1195
+ // 连接池解析)。dry-run 与真写共用同一个函数,杜绝「dry-run 绿、真写拒」。
1196
+ const lintServiceUpdate = async (session, args) => {
1197
+ const found = await wireCall(session, { path: ENDPOINTS.bizServiceGetByCode, query: { serviceCode: args.serviceCode } });
1198
+ const row = found.data;
1199
+ const id = row?.id;
1200
+ if (typeof id !== "string" || !id)
1201
+ return { row, id, adapterCode: "", serviceConfigJson: undefined };
1202
+ const adapterCode = typeof row.adapterCode === "string" ? String(row.adapterCode) : "";
1203
+ // Ticket 103: a NEW serviceCategoryId must resolve before the update
1204
+ // write (the platform writes it verbatim without validation).
1205
+ if (args.serviceCategoryId !== undefined)
1206
+ await assertCategoryResolves(session, args.serviceCategoryId);
1207
+ // A structured serviceConfig targets the designer write face: the same
1208
+ // adapter whitelist + required-key preflight as register (ticket 92).
1209
+ const serviceConfigJson = args.serviceConfig !== undefined ? compileServiceConfig(assertBizServiceAdapterWhitelisted(adapterCode), args.serviceConfig) : undefined;
1210
+ // Ticket 104: a DATA_SQL/DATA_TABLE binding must reference an existing
1211
+ // connection pool before the update write.
1212
+ if (serviceConfigJson !== undefined && (adapterCode === "DATA_SQL" || adapterCode === "DATA_TABLE")) {
1213
+ const poolCode = dbConnPoolCodeOf(args.serviceConfig);
1214
+ if (poolCode !== undefined)
1215
+ await assertDbConnPoolResolves(session, poolCode);
1216
+ }
1217
+ return { row, id, adapterCode, serviceConfigJson };
1218
+ };
1194
1219
  writeTool({
1195
1220
  tools,
1196
1221
  name: "service.update",
@@ -1212,28 +1237,13 @@ export function registerB2Lane(tools) {
1212
1237
  // Ticket 93 — patch an existing service without delete/recreate. The id
1213
1238
  // is resolved via get_by_code first (BizServiceController update path
1214
1239
  // requires it); metadata keys pass through verbatim.
1215
- const found = await wireCall(session, { path: ENDPOINTS.bizServiceGetByCode, query: { serviceCode: args.serviceCode } });
1216
- const row = found.data;
1217
- const id = row?.id;
1218
- if (typeof id !== "string" || !id)
1240
+ // R75-B(2026-11-18):与 dryRunPayload 共用 lintServiceUpdate —— 此前这四道
1241
+ // 读面门只在 execute,`service.update --dry-run` 绿灯、真写拒(investigate-B
1242
+ // E4:分类悬空)。现在 dry-run 与真写逐字同源。
1243
+ const linted = await lintServiceUpdate(session, args);
1244
+ const { row, id, adapterCode, serviceConfigJson } = linted;
1245
+ if (!row || typeof id !== "string" || !id)
1219
1246
  return { performed: { errcode: 500001 }, readback: { absent: true }, summary: `业务服务不存在:${args.serviceCode}` };
1220
- const adapterCode = typeof row.adapterCode === "string" ? row.adapterCode : "";
1221
- // Ticket 103: a NEW serviceCategoryId must resolve before the update
1222
- // write (the platform writes it verbatim without validation).
1223
- if (args.serviceCategoryId !== undefined)
1224
- await assertCategoryResolves(session, args.serviceCategoryId);
1225
- // A structured serviceConfig targets the designer write face: the same
1226
- // adapter whitelist + required-key preflight as register (ticket 92).
1227
- // Refusal here precedes the update WRITE (only the read-only id
1228
- // resolution may have preceded it).
1229
- const serviceConfigJson = args.serviceConfig !== undefined ? compileServiceConfig(assertBizServiceAdapterWhitelisted(adapterCode), args.serviceConfig) : undefined;
1230
- // Ticket 104: a DATA_SQL/DATA_TABLE binding must reference an existing
1231
- // connection pool before the update write.
1232
- if (serviceConfigJson !== undefined && (adapterCode === "DATA_SQL" || adapterCode === "DATA_TABLE")) {
1233
- const poolCode = dbConnPoolCodeOf(args.serviceConfig);
1234
- if (poolCode !== undefined)
1235
- await assertDbConnPoolResolves(session, poolCode);
1236
- }
1237
1247
  // Live incident 2026-09-14 (user-visible): the platform update path is a
1238
1248
  // FULL-ROW overwrite (ModelUtility.toEntity → save/update) — a body that
1239
1249
  // omits configJson/serviceCategoryId wipes them to NULL on the platform
@@ -1277,6 +1287,22 @@ export function registerB2Lane(tools) {
1277
1287
  // any update write (see the execute body).
1278
1288
  assertStructuredConfig(args.serviceConfig, "serviceConfig");
1279
1289
  },
1290
+ dryRunPayload: async (session, args) => {
1291
+ const { id, adapterCode, serviceConfigJson } = await lintServiceUpdate(session, args);
1292
+ if (typeof id !== "string" || !id)
1293
+ return { wouldChange: false, servicePresent: false, summary: `业务服务不存在:${args.serviceCode}——真写会回 absent(零写入)` };
1294
+ return {
1295
+ wouldChange: true,
1296
+ serviceCode: args.serviceCode,
1297
+ adapterCode,
1298
+ summary: `即将更新业务服务 ${args.serviceCode}(adapter=${adapterCode || "?"});分类/连接池/配置必需键已按真写同门校验`,
1299
+ ...(args.name !== undefined ? { name: args.name } : {}),
1300
+ ...(args.serviceCategoryId !== undefined ? { serviceCategoryId: args.serviceCategoryId } : {}),
1301
+ ...(serviceConfigJson !== undefined ? { configJsonBytes: Buffer.byteLength(serviceConfigJson, "utf8") } : {}),
1302
+ };
1303
+ },
1304
+ lintScope: "full",
1305
+ lintUnchecked: ["platform-side-validation", "post-write-readback"],
1280
1306
  rollback: b2ServiceRollbackSpec("service.update"),
1281
1307
  });
1282
1308
  writeTool({
@@ -5,7 +5,7 @@ import { governedRead } from "../read.js";
5
5
  import { writeTool } from "../write.js";
6
6
  import { decodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "../json-column.js";
7
7
  import { applicationResolutionOf, applicationScopeHint, flattenTreeRows, resolveApplicationScope, suggestModelNames } from "../support.js";
8
- import { assertRuleNamePlatformAcceptable, executeRuleSaveWrite, lintRuleGraphForWrite, ruleNodeGraphArg } from "../rule-support.js";
8
+ import { assertRuleNamePlatformAcceptable, executeRuleSaveWrite, lintRuleGraphForWrite, lintRuleSaveWrite, ruleNodeGraphArg } from "../rule-support.js";
9
9
  import { defineTool, ToolInputError, ToolRefusalError } from "../tool-types.js";
10
10
  import { resolveRuleRowId } from "../identity.js";
11
11
  import { wireCall, wireCallWith404Fallback, wireRows } from "../wire.js";
@@ -235,7 +235,7 @@ export function registerBusinessRuleLane(tools) {
235
235
  inputSchema: {
236
236
  environment: environmentArg,
237
237
  kind: z.enum(["service", "model", "field"]).describe("按什么找引用:service=BIZ_ACTION methodMapping.serviceCode;model=CREATE/UPDATE/DELETE targetObjectCode 与 methodMapping.schemaCode;field=dataActions.targetDataItem 与映射 bizCode"),
238
- code: z.string().min(1).describe("要查引用的编码(服务 code / 模型 code / 字段 code)"),
238
+ code: z.string().min(1).describe("要查引用的编码(服务/模型/字段 code);kind=field 可用 schemaCode.field 消歧"),
239
239
  schemaCodes: z.union([z.array(z.string().min(1)), z.string()]).optional().describe("只扫这些模型(省 wire 读);省略=全平台模型"),
240
240
  capability: capabilityArg,
241
241
  },
@@ -301,7 +301,22 @@ export function registerBusinessRuleLane(tools) {
301
301
  nextCommand: `omc call rule.references --args '{"kind":"${args.kind}","code":"${args.code}","schemaCodes":["<模型code>",...]}'(显式指定扫描范围)`,
302
302
  });
303
303
  }
304
- const wanted = args.code;
304
+ // r73 探针02-P1(2026-11-17):kind=field 支持 `schemaCode.field` 限定写法
305
+ // (与 graph references 一致)。裸 code 会把别的模型的同名字段并进来(实证:
306
+ // 查 crm_contract.amount 命中 crm_receipt.Create 的自身 amount)——消歧此前
307
+ // 只能靠逐条 rule.get 人工核对。前缀不在本次扫描范围时按原样查(code 可能真含点)。
308
+ const rawCode = args.code;
309
+ let wanted = rawCode;
310
+ let fieldScope;
311
+ if (args.kind === "field" && rawCode.includes(".")) {
312
+ const cut = rawCode.lastIndexOf(".");
313
+ const prefix = rawCode.slice(0, cut);
314
+ const bare = rawCode.slice(cut + 1);
315
+ if (bare !== "" && scoped.includes(prefix)) {
316
+ wanted = bare;
317
+ fieldScope = prefix;
318
+ }
319
+ }
305
320
  const matches = [];
306
321
  let scannedRules = 0;
307
322
  let parseFailures = 0;
@@ -348,13 +363,17 @@ export function registerBusinessRuleLane(tools) {
348
363
  matches.push({ schemaCode, ruleCode, nodeCode, nodeType, via: "methodMapping.schemaCode" });
349
364
  }
350
365
  else {
366
+ // dataActions 的 targetDataItem 宿主是 targetObjectCode(跨模型写回),
367
+ // mapping.bizCode 宿主是承载模型——dot 限定按宿主过滤,与 graph 边归属一致。
368
+ const actionHost = String(rawNode.targetObjectCode ?? "") || schemaCode;
351
369
  if (["CREATE", "UPDATE", "DELETE"].includes(nodeType) && Array.isArray(rawNode.dataActions)
370
+ && (fieldScope === undefined || actionHost === fieldScope)
352
371
  && rawNode.dataActions.some((action) => String(action.targetDataItem ?? "") === wanted))
353
- matches.push({ schemaCode, ruleCode, nodeCode, nodeType, via: "dataActions.targetDataItem", ...(String(rawNode.targetObjectCode ?? "") !== "" ? { targetObjectCode: String(rawNode.targetObjectCode) } : {}) });
354
- if (mapping) {
372
+ matches.push({ schemaCode, ruleCode, nodeCode, nodeType, via: "dataActions.targetDataItem", hostSchemaCode: actionHost, ...(String(rawNode.targetObjectCode ?? "") !== "" ? { targetObjectCode: String(rawNode.targetObjectCode) } : {}) });
373
+ if (mapping && (fieldScope === undefined || schemaCode === fieldScope)) {
355
374
  for (const [key, label] of [["inputMappings", "inputMappings.bizCode"], ["outputMappings", "outputMappings.bizCode"]]) {
356
375
  if (Array.isArray(mapping[key]) && mapping[key].some((row2) => String(row2.bizCode ?? "") === wanted && (row2.codeType === undefined || row2.codeType === 1)))
357
- matches.push({ schemaCode, ruleCode, nodeCode, nodeType, via: label });
376
+ matches.push({ schemaCode, ruleCode, nodeCode, nodeType, via: label, hostSchemaCode: schemaCode });
358
377
  }
359
378
  }
360
379
  }
@@ -364,6 +383,7 @@ export function registerBusinessRuleLane(tools) {
364
383
  return {
365
384
  kind: args.kind,
366
385
  code: wanted,
386
+ ...(fieldScope !== undefined ? { requestedCode: rawCode, resolvedScope: { schemaCode: fieldScope, code: wanted } } : {}),
367
387
  scanned: { models: scoped.length, rules: scannedRules, ...(parseFailures > 0 ? { parseFailures } : {}) },
368
388
  matches,
369
389
  // r35a-F4(真机 2026-11-06):matches:[] 曾被当成「可安全删除」的依据,
@@ -382,7 +402,11 @@ export function registerBusinessRuleLane(tools) {
382
402
  : {}),
383
403
  ...(matches.length === 0
384
404
  ? {
385
- note: "零命中=" +
405
+ // r73 探针01-P1(2026-11-17):旧首句「零命中=全平台没有规则引用它」与
406
+ // 同一载荷的 notScanned(不含条件叶子/datarule/listview)自相矛盾——快读
407
+ // 者会直接答「没有规则用它」,而 daily_expiry_scan 的条件正引用该字段。
408
+ // 首句先声明「本面」盲区,再给范围与离线替代。
409
+ note: "零命中(本在线面仅 businessrule 的 methodMapping/targetObjectCode/dataActions;**不含规则条件叶子/datarule/listview**——条件里的引用用 `graph references field <code>`)= " +
386
410
  (args.schemaCodes !== undefined
387
411
  ? `仅扫描了 schemaCodes 收窄的 ${scoped.length} 个模型(${scoped.slice(0, 5).join(", ")}${scoped.length > 5 ? "…" : ""})——引用常发生在**其他**模型上;要全平台结论请去掉 schemaCodes`
388
412
  : "全平台没有规则引用它") +
@@ -641,6 +665,27 @@ export function registerBusinessRuleLane(tools) {
641
665
  customTrigger: z.boolean().optional().describe("默认开:自定义 ruleCode + bizRuleType 0(非平台触发码 Create/Update/Delete/GetList/Load/Available/Cancel)即按钮/流程规则,工具在 START 后合成平台标准 CUSTOM_NODE「自定义按钮/流程触发」系统触发节点(nodeCode=ruleCode,live 布局 x558/y233);调用方已写 CUSTOM_NODE 则原样保留;显式 false 退回"),
642
666
  },
643
667
  execute: async (session, args) => executeRuleSaveWrite(session, args),
668
+ // R75-B(2026-11-18):dry-run 与真写共用 lintRuleSaveWrite(同一套只读门:
669
+ // 图 lint / 公式 fail-closed / 字段归属 / schema 存在 / BizMethod wire /
670
+ // 调度映射)。此前 semanticGate 只跑图形状(relaxEnums),formula-lint 等
671
+ // 门只在 execute —— `rule.save --dry-run` 绿灯、真写 refused(E1 实证)。
672
+ dryRunPayload: async (session, args) => {
673
+ const linted = await lintRuleSaveWrite(session, args);
674
+ return {
675
+ ruleCode: args.ruleCode,
676
+ mode: linted.existing?.id ? "update" : "create",
677
+ nodeCount: linted.nodes.length,
678
+ routeCount: linted.routes.length,
679
+ publish: args.publish === true,
680
+ customTrigger: linted.customTriggerApplied,
681
+ ...(linted.bizMethodChecks > 0 ? { bizMethodChecks: linted.bizMethodChecks } : {}),
682
+ ...(linted.lintWarnings.length > 0 ? { lintWarnings: linted.lintWarnings } : {}),
683
+ ...(linted.lintHazards.length > 0 ? { lintHazards: linted.lintHazards } : {}),
684
+ summary: `rule.save 只读门全过:${args.schemaCode}.${args.ruleCode} ${linted.existing?.id ? "更新" : "新建"},${linted.nodes.length} 节点/${linted.routes.length} 路由${args.publish === true ? ",并发布" : ""};真写只差平台侧规则自检与写后回读`,
685
+ };
686
+ },
687
+ lintScope: "full",
688
+ lintUnchecked: ["platform-rule-self-check", "post-write-readback"],
644
689
  rollback: businessRuleRollbackSpec("rule.save"),
645
690
  });
646
691
  // Round 10 (issue 04) — precise modify. `rule.save` replaces the WHOLE nodeGraph,
@@ -709,8 +754,9 @@ export function registerBusinessRuleLane(tools) {
709
754
  nodeCode: args.nodeCode,
710
755
  patchedKeys: Object.keys(args.patch),
711
756
  // 本次 dry-run 覆盖的是**全图** lint(patch 合并进存量图后整图过门),
712
- // 不是只验 patch 本身。
713
- lintScope: "fullGraph",
757
+ // 不是只验 patch 本身。`lintScope` 现在是 R75-B 的契约字段
758
+ // (full/partial/plan,由 writeTool 声明)——图谱细节用独立键,避免同名双义。
759
+ lintGraphScope: "fullGraph",
714
760
  validation: linted.blockers,
715
761
  };
716
762
  },