@stalfh233/omc-cli 0.6.87 → 0.6.89
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/cli.js +44 -11
- package/dist/endpoints.js +14 -0
- package/dist/intent/capabilities/bizservice.js +7 -82
- package/dist/lanes/b2-registration.js +97 -4
- package/dist/lanes/businessrule-contract.js +3 -3
- package/dist/lanes/businessrule.js +403 -9
- package/dist/lanes/online-js.js +1 -1
- package/dist/lanes/runtime-data-contract.js +5 -1
- package/dist/lanes/runtime-data.js +253 -27
- package/dist/method-references.js +134 -0
- package/dist/path-projection.js +120 -37
- package/dist/read-shapes.js +28 -2
- package/dist/tool-types.js +5 -0
- package/package.json +3 -3
- package/skills/omc-refusals.md +1 -0
|
@@ -10,7 +10,9 @@ import { defineTool, isRequiredAlternativePlaceholder, ToolInputError, ToolRefus
|
|
|
10
10
|
import { resolveRuleRowId } from "../identity.js";
|
|
11
11
|
import { extractDataRuleEdges, extractReferenceEdges } from "../graph.js";
|
|
12
12
|
import { DEFAULT_SCAN_CONCURRENCY, mapWithConcurrency } from "../concurrency.js";
|
|
13
|
+
import { readFormButtons, readFormOrNull } from "../form-support.js";
|
|
13
14
|
import { scanModelWorkflowBindings } from "./workflow.js";
|
|
15
|
+
import { readCustomScriptSource } from "./online-js.js";
|
|
14
16
|
import { wireCall, wireCallWith404Fallback, wireRows } from "../wire.js";
|
|
15
17
|
import { readModelRecord } from "../model-record.js";
|
|
16
18
|
import { BUSINESSRULE_LANE_CONTRACT } from "./businessrule-contract.js";
|
|
@@ -753,6 +755,208 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
753
755
|
})),
|
|
754
756
|
};
|
|
755
757
|
}
|
|
758
|
+
/**
|
|
759
|
+
* T02(2026-11-20,retro 25):触发器视图——`kind:"trigger"` 把「一个模型有哪些
|
|
760
|
+
* 触发点」从 4–5 个读面拼成一张清单:workflow.get_published 的三面绑定、表单
|
|
761
|
+
* 按钮(form.get 紧凑面同一读法)、规则清单(预置 vs 自建)、表单在线 JS 直连
|
|
762
|
+
* 调用。零新工具、零新写面;只做一层清单(不做触发链路传递闭包)。
|
|
763
|
+
*
|
|
764
|
+
* wire 受控:应用树 1(出处 + 存在性)+ 流程面(isworkflow→getWorkflow→
|
|
765
|
+
* get_published,复用 scanModelWorkflowBindings)+ 规则清单 1(**不逐条
|
|
766
|
+
* rule.get**,因此本 kind 不回 bizRuleType/schedulerSetting)+ 表单 1
|
|
767
|
+
* (按钮与在线 JS 共用一次 bizsheet/get)。activityCode 过滤只读流程面,其余
|
|
768
|
+
* 面逐条记 notScanned。
|
|
769
|
+
*/
|
|
770
|
+
const TRIGGER_PRESET_CODES = ["Create", "Update", "Delete"];
|
|
771
|
+
/**
|
|
772
|
+
* 在线 JS 触发点的**文本**匹配:每行至多一条(优先级 axios → fetch( → /api/)。
|
|
773
|
+
* 可能漏动态拼 URL、可能命中注释——这是协议局限,回执标 scanMode:"text"。
|
|
774
|
+
*/
|
|
775
|
+
const ONLINEJS_TRIGGER_PATTERNS = [
|
|
776
|
+
{ kind: "axios", test: /axios/ },
|
|
777
|
+
{ kind: "fetch", test: /fetch\(/ },
|
|
778
|
+
{ kind: "/api/", test: /\/api\// },
|
|
779
|
+
];
|
|
780
|
+
function onlineJsTriggerHits(script) {
|
|
781
|
+
const hits = [];
|
|
782
|
+
script.split("\n").forEach((raw, index) => {
|
|
783
|
+
const line = raw.trim();
|
|
784
|
+
if (line === "")
|
|
785
|
+
return;
|
|
786
|
+
const matched = ONLINEJS_TRIGGER_PATTERNS.find((pattern) => pattern.test.test(line));
|
|
787
|
+
if (matched === undefined)
|
|
788
|
+
return;
|
|
789
|
+
// excerpt ≤120 字(含截断省略号本身)。
|
|
790
|
+
hits.push({ line: index + 1, excerpt: line.length > 120 ? `${line.slice(0, 119)}…` : line, kind: matched.kind });
|
|
791
|
+
});
|
|
792
|
+
return hits;
|
|
793
|
+
}
|
|
794
|
+
/**
|
|
795
|
+
* `action:"create"|"update"|"delete"` 的「绑定到该事件的自定义规则」反推:
|
|
796
|
+
* workflow 行的 activityCode/nodeEvent/handler、按钮的 buttonCode/targetCode
|
|
797
|
+
* 含该动作词即视为相关绑定(例:nodeEvent `onCreate`、activityCode
|
|
798
|
+
* `ACTIVITY_CREATE`、按钮 targetCode `Create`)。启发式——回执 note 写明判据,
|
|
799
|
+
* 拿不准时用省略 action 的全量清单。
|
|
800
|
+
*/
|
|
801
|
+
function ruleCodesBoundToEvent(workflowRows, buttonRows, action) {
|
|
802
|
+
const codes = new Set();
|
|
803
|
+
const mentions = (...parts) => parts.filter((part) => typeof part === "string" && part !== "").join(" ").toLowerCase().includes(action);
|
|
804
|
+
for (const row of workflowRows) {
|
|
805
|
+
if (!mentions(row.activityCode, row.nodeEvent, row.handler))
|
|
806
|
+
continue;
|
|
807
|
+
for (const code of row.ruleCodes)
|
|
808
|
+
codes.add(code);
|
|
809
|
+
}
|
|
810
|
+
for (const row of buttonRows)
|
|
811
|
+
if (mentions(row.buttonCode, row.targetCode) && typeof row.targetCode === "string" && row.targetCode !== "")
|
|
812
|
+
codes.add(row.targetCode);
|
|
813
|
+
return codes;
|
|
814
|
+
}
|
|
815
|
+
async function scanSchemaTriggers(session, args) {
|
|
816
|
+
const schemaCode = args.code;
|
|
817
|
+
const sheetCode = args.sheetCode ?? schemaCode;
|
|
818
|
+
const mode = args.mode ?? "summary";
|
|
819
|
+
const action = args.action;
|
|
820
|
+
const activityCodeFilter = args.activityCode;
|
|
821
|
+
const notScanned = [];
|
|
822
|
+
// 1. 出处 + 模型存在性:沿用 kind=model 的 references-scan-empty 口径(空扫描
|
|
823
|
+
// 不能读成「没有触发」)。kind=trigger 只扫一个模型,不扫全平台。
|
|
824
|
+
const scope = await resolveApplicationScope(session, undefined);
|
|
825
|
+
const appScopeRefusal = (message, models) => new ToolRefusalError({
|
|
826
|
+
status: "refused",
|
|
827
|
+
blocker: "references-scan-empty",
|
|
828
|
+
message,
|
|
829
|
+
applicationResolution: { ...applicationResolutionOf(scope), mode: "trigger", models, schemaCode },
|
|
830
|
+
nextCommand: `omc call rule.references --env <env> --args '{"kind":"trigger","code":"<schemaCode>"}'`,
|
|
831
|
+
});
|
|
832
|
+
const treeModels = flattenTreeRows(wireRows((await wireCall(session, { path: ENDPOINTS.applicationTree, query: { appCode: scope.code } })).data))
|
|
833
|
+
.filter((row) => row.type === "BizModel" && typeof row.code === "string" && row.code !== "")
|
|
834
|
+
.map((row) => String(row.code));
|
|
835
|
+
if (!treeModels.includes(schemaCode))
|
|
836
|
+
throw appScopeRefusal(`模型 ${schemaCode} 不在应用 ${scope.code} 的模型树(${treeModels.length} 个模型)里——本次没有扫描任何东西,空 triggers 不代表「没有触发」;kind:"trigger" 的 code 是 schemaCode(不是规则码),先用 model.list 核对`, 0);
|
|
837
|
+
// 2. 流程三面(flow 级 handler / 节点级 nodeEvent / SYSTEM_ACTIVITY 顶层 bizActions)。
|
|
838
|
+
let workflows = 0;
|
|
839
|
+
let workflowFace = null;
|
|
840
|
+
try {
|
|
841
|
+
workflowFace = await scanModelWorkflowBindings(session, schemaCode);
|
|
842
|
+
if (workflowFace !== null)
|
|
843
|
+
workflows = 1;
|
|
844
|
+
}
|
|
845
|
+
catch (error) {
|
|
846
|
+
notScanned.push(`流程读取失败(${error instanceof Error ? error.message : String(error)}):workflow 三面未扫描`);
|
|
847
|
+
}
|
|
848
|
+
const workflowRows = [];
|
|
849
|
+
if (workflowFace !== null) {
|
|
850
|
+
for (const binding of workflowFace.ruleBindings)
|
|
851
|
+
workflowRows.push({ via: "workflow", workflowCode: workflowFace.workflowCode, published: workflowFace.published, activityCode: null, nodeEvent: null, handler: binding.handler, ruleCodes: binding.ruleCodes });
|
|
852
|
+
for (const binding of workflowFace.nodeRuleBindings)
|
|
853
|
+
workflowRows.push({ via: "workflow", workflowCode: workflowFace.workflowCode, published: workflowFace.published, activityCode: binding.activityCode, nodeEvent: binding.nodeEvent, handler: null, ruleCodes: binding.ruleCodes });
|
|
854
|
+
for (const binding of workflowFace.systemRuleBindings)
|
|
855
|
+
workflowRows.push({ via: "workflow", workflowCode: workflowFace.workflowCode, published: workflowFace.published, activityCode: binding.activityCode, nodeEvent: null, handler: null, ruleCodes: binding.ruleCodes, bizActionType: binding.bizActionType });
|
|
856
|
+
}
|
|
857
|
+
// 3. 表单按钮 + 在线 JS(同一次 bizsheet/get:form.get 紧凑面的同一读法)。
|
|
858
|
+
let scannedButtons = 0;
|
|
859
|
+
let onlinejsBytes = 0;
|
|
860
|
+
let script = null;
|
|
861
|
+
const buttonRows = [];
|
|
862
|
+
if (activityCodeFilter !== undefined) {
|
|
863
|
+
notScanned.push("activityCode 过滤:表单按钮/规则/预置事件/在线 JS 未扫描(只看该流程节点的绑定)");
|
|
864
|
+
}
|
|
865
|
+
else {
|
|
866
|
+
try {
|
|
867
|
+
const sheet = await readFormOrNull(session, schemaCode, sheetCode);
|
|
868
|
+
if (sheet === null) {
|
|
869
|
+
notScanned.push(`表单 ${sheetCode} 不存在:表单按钮与在线 JS 未扫描`);
|
|
870
|
+
}
|
|
871
|
+
else {
|
|
872
|
+
const buttons = readFormButtons(sheet.options) ?? [];
|
|
873
|
+
scannedButtons = buttons.length;
|
|
874
|
+
for (const button of buttons) {
|
|
875
|
+
// 只有 BUSINESS_RULE 绑定是触发点;其它按钮(SCRIPT/流程动作等)只计数。
|
|
876
|
+
if (button.bindAction !== "BUSINESS_RULE")
|
|
877
|
+
continue;
|
|
878
|
+
buttonRows.push({
|
|
879
|
+
via: "button",
|
|
880
|
+
sheetCode,
|
|
881
|
+
buttonCode: typeof button.code === "string" ? button.code : null,
|
|
882
|
+
buttonName: typeof button.name === "string" ? button.name : null,
|
|
883
|
+
bindAction: "BUSINESS_RULE",
|
|
884
|
+
targetCode: typeof button.targetCode === "string" ? button.targetCode : null,
|
|
885
|
+
});
|
|
886
|
+
}
|
|
887
|
+
script = readCustomScriptSource(typeof sheet.publishedHtmlJson === "string" ? sheet.publishedHtmlJson : null).script;
|
|
888
|
+
if (script === null)
|
|
889
|
+
notScanned.push(`在线 JS:表单 ${sheetCode} 的发布面无 customScript 脚本(未扫描)`);
|
|
890
|
+
}
|
|
891
|
+
}
|
|
892
|
+
catch (error) {
|
|
893
|
+
notScanned.push(`表单读取失败(${error instanceof Error ? error.message : String(error)}):表单按钮与在线 JS 未扫描`);
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
// 4. 规则清单:一次 list,自建行进 via:rule,预置 Create/Update/Delete 行进
|
|
897
|
+
// via:preset。默认 summary 不做 TIMING 识别(bizRuleType 只在 rule.get
|
|
898
|
+
// 的图里,逐条读会打爆 wire——定时摘要留给 rule.get {keys:["schedulerSetting"]})。
|
|
899
|
+
let scannedRules = 0;
|
|
900
|
+
const ruleRows = [];
|
|
901
|
+
const presetRows = [];
|
|
902
|
+
if (activityCodeFilter === undefined) {
|
|
903
|
+
const body = await readRuleListBody(session, schemaCode, { onlyCustom: false, full: false, withMappings: false });
|
|
904
|
+
if (body.modelPresent === false)
|
|
905
|
+
throw appScopeRefusal(`模型 ${schemaCode} 不存在(模型读面为空)——本次没有扫描任何东西,空 triggers 不代表「没有触发」`, 0);
|
|
906
|
+
const rows = Array.isArray(body.rules) ? body.rules : [];
|
|
907
|
+
scannedRules = rows.length;
|
|
908
|
+
for (const row of rows) {
|
|
909
|
+
const ruleCode = String(row.code ?? "");
|
|
910
|
+
if (row.defaultRule === true) {
|
|
911
|
+
const trigger = TRIGGER_PRESET_CODES.find((candidate) => candidate.toLowerCase() === ruleCode.toLowerCase());
|
|
912
|
+
if (trigger !== undefined)
|
|
913
|
+
presetRows.push({ via: "preset", trigger, ruleCode, enabled: row.enabled === true, note: "REST 写入面不派发数据事件——预置行只对平台内部写入生效" });
|
|
914
|
+
continue;
|
|
915
|
+
}
|
|
916
|
+
ruleRows.push({ via: "rule", ruleCode, name: row.name ?? null, defaultRule: false, enabled: row.enabled === true, status: row.status ?? null });
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
// 5. 在线 JS 文本匹配(零 wire;无脚本时第 3 步已记 notScanned)。
|
|
920
|
+
const hits = script === null ? [] : onlineJsTriggerHits(script);
|
|
921
|
+
onlinejsBytes = script === null ? 0 : Buffer.byteLength(script, "utf8");
|
|
922
|
+
const onlineRows = hits.length === 0
|
|
923
|
+
? []
|
|
924
|
+
: [{ via: "onlinejs", sheetCode, scanMode: "text", hitCount: hits.length, ...(mode === "sites" ? { hits } : {}) }];
|
|
925
|
+
// 6. 并集 + action/activityCode 过滤(分组顺序:workflow → button → rule → preset → onlinejs)。
|
|
926
|
+
let triggers;
|
|
927
|
+
if (activityCodeFilter !== undefined) {
|
|
928
|
+
triggers = workflowRows.filter((row) => row.activityCode === activityCodeFilter);
|
|
929
|
+
}
|
|
930
|
+
else if (action === "flow") {
|
|
931
|
+
triggers = [...workflowRows, ...buttonRows];
|
|
932
|
+
}
|
|
933
|
+
else if (action !== undefined) {
|
|
934
|
+
const bound = ruleCodesBoundToEvent(workflowRows, buttonRows, action);
|
|
935
|
+
triggers = [
|
|
936
|
+
...ruleRows.filter((row) => bound.has(row.ruleCode) || row.ruleCode.toLowerCase() === action),
|
|
937
|
+
...presetRows.filter((row) => row.trigger.toLowerCase() === action),
|
|
938
|
+
...onlineRows,
|
|
939
|
+
];
|
|
940
|
+
}
|
|
941
|
+
else {
|
|
942
|
+
triggers = [...workflowRows, ...buttonRows, ...ruleRows, ...presetRows, ...onlineRows];
|
|
943
|
+
}
|
|
944
|
+
const filterNote = action !== undefined && action !== "flow"
|
|
945
|
+
? `;action:"${action}" 的规则绑定判据=workflow 行的 activityCode/nodeEvent/handler 或按钮的 buttonCode/targetCode 含「${action}」,或规则 code 就是 ${action}(不区分大小写,启发式;完整清单去掉 action)`
|
|
946
|
+
: "";
|
|
947
|
+
return {
|
|
948
|
+
schemaCode,
|
|
949
|
+
action: action ?? null,
|
|
950
|
+
mode,
|
|
951
|
+
triggers,
|
|
952
|
+
scanned: { workflows, rules: scannedRules, buttons: scannedButtons, onlinejsBytes },
|
|
953
|
+
notScanned,
|
|
954
|
+
scanMode: "source",
|
|
955
|
+
note: "零命中=本次扫描未命中触发点,不代表没有触发;在线 JS 是文本匹配,可能漏动态拼 URL" + filterNote,
|
|
956
|
+
...(activityCodeFilter !== undefined ? { activityCode: activityCodeFilter } : {}),
|
|
957
|
+
applicationResolution: { ...applicationResolutionOf(scope), mode: "trigger", models: 1 },
|
|
958
|
+
};
|
|
959
|
+
}
|
|
756
960
|
export function registerBusinessRuleLane(tools) {
|
|
757
961
|
tools.push(defineTool({
|
|
758
962
|
name: "rule.list",
|
|
@@ -838,12 +1042,50 @@ export function registerBusinessRuleLane(tools) {
|
|
|
838
1042
|
description: RULE_TOOLS["rule.references"].description,
|
|
839
1043
|
inputSchema: {
|
|
840
1044
|
environment: environmentArg,
|
|
841
|
-
kind: z.enum(["service", "model", "field", "rule"]).describe("按什么找引用:service=BIZ_ACTION methodMapping.serviceCode(service 行带 serviceMethodCode);model=CREATE/UPDATE/DELETE targetObjectCode 与 methodMapping.schemaCode;field=dataActions.targetDataItem、映射 bizCode、规则条件叶子与 datarule;rule=流程事件绑定的规则码(flow 级 handler + 节点级 nodeEvent
|
|
1045
|
+
kind: z.enum(["service", "model", "field", "rule", "trigger"]).describe("按什么找引用:service=BIZ_ACTION methodMapping.serviceCode(service 行带 serviceMethodCode);model=CREATE/UPDATE/DELETE targetObjectCode 与 methodMapping.schemaCode;field=dataActions.targetDataItem、映射 bizCode、规则条件叶子与 datarule;rule=流程事件绑定的规则码(flow 级 handler + 节点级 nodeEvent,扫应用内模型的流程面);trigger=一个模型的全部触发点(code 是 schemaCode,不是规则码)"),
|
|
842
1046
|
code: z.string().min(1).describe("要查引用的编码(服务/模型/字段 code);kind=field 可用 schemaCode.field 消歧"),
|
|
843
1047
|
schemaCodes: z.union([z.array(z.string().min(1)), z.string()]).optional().describe("只扫这些模型(省 wire 读);省略=全平台模型"),
|
|
1048
|
+
action: z.enum(["create", "update", "delete", "flow"]).optional().describe("仅 kind=trigger:动作过滤,省略=全量"),
|
|
1049
|
+
activityCode: z.string().min(1).optional().describe("仅 kind=trigger:只看该流程节点的绑定(与 action 互斥)"),
|
|
1050
|
+
sheetCode: z.string().min(1).optional().describe("仅 kind=trigger:多表单模型指定槽位;省略=默认槽位"),
|
|
1051
|
+
mode: z.enum(["summary", "sites"]).optional().describe("仅 kind=trigger:summary=默认,在线 JS 只回计数;sites=回命中行"),
|
|
844
1052
|
capability: capabilityArg,
|
|
845
1053
|
},
|
|
846
1054
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
1055
|
+
// T02(2026-11-20,retro 25):触发器视图只扫一个模型(code=schemaCode),
|
|
1056
|
+
// 走独立分支。action/activityCode/sheetCode/mode 只在本 kind 有意义——其它
|
|
1057
|
+
// kind 传了拒绝(静默忽略会让调用方以为过滤生效了)。
|
|
1058
|
+
const triggerOnlyArgs = ["action", "activityCode", "sheetCode", "mode"].filter((key) => args[key] !== undefined);
|
|
1059
|
+
if (args.kind !== "trigger" && triggerOnlyArgs.length > 0)
|
|
1060
|
+
throw new ToolInputError({
|
|
1061
|
+
status: "error",
|
|
1062
|
+
blocker: "tool-input-invalid",
|
|
1063
|
+
tool: "rule.references",
|
|
1064
|
+
message: `${triggerOnlyArgs.join("/")} 只对 kind:"trigger" 有效;kind=${args.kind} 按 code 找引用,不收动作/槽位过滤`,
|
|
1065
|
+
});
|
|
1066
|
+
if (args.kind === "trigger") {
|
|
1067
|
+
if (args.action !== undefined && args.activityCode !== undefined)
|
|
1068
|
+
throw new ToolInputError({
|
|
1069
|
+
status: "error",
|
|
1070
|
+
blocker: "tool-input-invalid",
|
|
1071
|
+
tool: "rule.references",
|
|
1072
|
+
message: "action 与 activityCode 互斥——动作过滤(create/update/delete/flow)与单节点过滤(activityCode)是两种问题,二选一",
|
|
1073
|
+
});
|
|
1074
|
+
if (args.schemaCodes !== undefined)
|
|
1075
|
+
throw new ToolInputError({
|
|
1076
|
+
status: "error",
|
|
1077
|
+
blocker: "tool-input-invalid",
|
|
1078
|
+
tool: "rule.references",
|
|
1079
|
+
message: 'kind:"trigger" 只扫一个模型:code 就是 schemaCode,不接受 schemaCodes(全平台触发面清单不在本 kind)',
|
|
1080
|
+
});
|
|
1081
|
+
return scanSchemaTriggers(session, {
|
|
1082
|
+
code: args.code,
|
|
1083
|
+
...(args.action !== undefined ? { action: args.action } : {}),
|
|
1084
|
+
...(args.activityCode !== undefined ? { activityCode: args.activityCode } : {}),
|
|
1085
|
+
...(args.sheetCode !== undefined ? { sheetCode: args.sheetCode } : {}),
|
|
1086
|
+
...(args.mode !== undefined ? { mode: args.mode } : {}),
|
|
1087
|
+
});
|
|
1088
|
+
}
|
|
847
1089
|
// r23(2026-10-27):agent 为查「谁引用了服务 X」枚举了 147 个
|
|
848
1090
|
// schema×ruleCode 组合(171 次 rule.get / 229KB)。没有引用检索面时,
|
|
849
1091
|
// 全库枚举是理性选择——所以给它一个。客户端聚合:模型清单 → 每模型
|
|
@@ -1504,6 +1746,119 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1504
1746
|
// 读法/合并法(loadRuleNodePatchGraph)——dry-run 读存量行 → 浅合并 patch →
|
|
1505
1747
|
// 全图 lint(lintRuleGraphForWrite,与真写同门)。读失败(规则/节点不存在、
|
|
1506
1748
|
// 不可变键)按 execute 同款 refusal 抛出,绝不静默放行。
|
|
1749
|
+
//
|
|
1750
|
+
// ── F3(friction-first PLAN §8;retro 19/20「规则读→改写」):单条 mapping 局部 patch ──
|
|
1751
|
+
//
|
|
1752
|
+
// 摩擦:改一条映射(换个源字段/改个常量)此前只能整图 rule.save 重发,或 node 级
|
|
1753
|
+
// patch 重发整个 dataActions/inputMappings 数组——未选中的 mappings/routes/
|
|
1754
|
+
// editorText/未知字段全凭调用方自觉拼回。本面在既有入口上加 mapping-selector:
|
|
1755
|
+
// list(方向/数组)+ select(稳定标识)唯一定位**一条**映射,patch 只浅合并进那
|
|
1756
|
+
// 一条;其余条目、节点其余键、routes、x/y/width/height/points、未知字段逐字节
|
|
1757
|
+
// 保留。底层仍是「读整图→合并→整图保存」:executeRuleSaveWrite 与 rule.save 同
|
|
1758
|
+
// 一 seam,wire(method/path/query/body 形状)完全一致,不新增平台端点。
|
|
1759
|
+
//
|
|
1760
|
+
// 平台证据(存储/执行/设计器三侧,8.6.26 反编译树 + 前端源码):
|
|
1761
|
+
// - 存储:节点列是 writer-managed 原始 JSON,按节点类型反序列化
|
|
1762
|
+
// (BusinessRuleParser.java:74-102 的 parseMapToBean 分发表);
|
|
1763
|
+
// dataActions 挂 DataUpdateNode.java:23(CREATE 同族),
|
|
1764
|
+
// 方法映射挂 BizActionNode.java:28 → BizMethodMappingModel.java:31-33
|
|
1765
|
+
// (inputMappings/outputMappings 两个 List<MappingModel>)。
|
|
1766
|
+
// - 执行(「一条映射」的平台侧稳定标识从这里来):
|
|
1767
|
+
// dataActions 逐条按 targetDataItem 定位目标字段,按 ruleValueType/value/
|
|
1768
|
+
// currentDataItemValue 取值(ServiceExecutorImpl.mappingUpdatedData:74-88,
|
|
1769
|
+
// 目标字段不存在抛 BUSINESS_RULE_PROPERTY_NOEXIT);
|
|
1770
|
+
// 方法映射逐条按 serviceMethodParameterCode 对账方法参数表并作为传参键
|
|
1771
|
+
// (MapOps.java:497、525-528、689——constMap.put(serviceMethodParameterCode,…))。
|
|
1772
|
+
// —— selector 用这两个键,不用数组下标猜;identity 撞重时只接受显式 index。
|
|
1773
|
+
// - 设计器写入面:admin 前端类型就是 bizCode + serviceMethodParameterCode +
|
|
1774
|
+
// inputMappings(frontend-src .../admin/src/typings/biz-method.d.ts:35-57);
|
|
1775
|
+
// 映射元素的设计器键(index/displayName/required/bizCodeName)是非语义键,
|
|
1776
|
+
// 工具原样透传不增删(MappingModel.java:26-40 只有语义键,Ticket 96 判例)。
|
|
1777
|
+
// 设计器保存走同一 businessrule/update 整行 seam——本面不引入第二种写路径。
|
|
1778
|
+
// (注:LIST/OBJECT(codeType 2/3) 的 subParameters 嵌套映射未做真机采样,
|
|
1779
|
+
// 本轮 selector 只覆盖顶层数组元素。)
|
|
1780
|
+
const RULE_MAPPING_IDENTITY = Object.freeze({
|
|
1781
|
+
dataActions: "targetDataItem",
|
|
1782
|
+
"methodMapping.inputMappings": "serviceMethodParameterCode",
|
|
1783
|
+
"methodMapping.outputMappings": "serviceMethodParameterCode",
|
|
1784
|
+
});
|
|
1785
|
+
/**
|
|
1786
|
+
* Pure merge: shallow-merge `face.patch` into exactly ONE element of the
|
|
1787
|
+
* selected mapping array. Every refusal is fail-closed BEFORE any wire call:
|
|
1788
|
+
* selector 不合法 / 数组不存在 / 命中 0 条 / 命中 >1 条 / index 越界,全部
|
|
1789
|
+
* 拒绝并给候选/现况——宁可拒绝也不猜一条。
|
|
1790
|
+
*/
|
|
1791
|
+
const applyRuleMappingPatch = (node, face) => {
|
|
1792
|
+
const identityKey = RULE_MAPPING_IDENTITY[face.list];
|
|
1793
|
+
const selectKeys = Object.keys(face.select ?? {});
|
|
1794
|
+
if (selectKeys.length !== 1 || (selectKeys[0] !== identityKey && selectKeys[0] !== "index"))
|
|
1795
|
+
throw new ToolRefusalError({
|
|
1796
|
+
status: "refused",
|
|
1797
|
+
blocker: "rule-mapping-selector-key",
|
|
1798
|
+
message: `select 必须恰好一个键:${face.list} 用 {"${identityKey}":"…"}(identity 撞重时 {"index":N},0 基按 rule.get 数组序);收到 ${JSON.stringify(face.select)}`,
|
|
1799
|
+
});
|
|
1800
|
+
// Resolve the array that holds the mappings.
|
|
1801
|
+
let holder;
|
|
1802
|
+
let listKey;
|
|
1803
|
+
if (face.list === "dataActions") {
|
|
1804
|
+
holder = node;
|
|
1805
|
+
listKey = "dataActions";
|
|
1806
|
+
}
|
|
1807
|
+
else {
|
|
1808
|
+
const mapping = node.methodMapping;
|
|
1809
|
+
if (mapping === null || typeof mapping !== "object" || Array.isArray(mapping))
|
|
1810
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-list-absent", message: `节点没有 methodMapping 对象(${face.list} 不可达)——方法映射只存在于 BIZ_ACTION / GET_LIST(BIZ_SERVICE) 节点;节点现有键:${Object.keys(node).join(",")}` });
|
|
1811
|
+
holder = mapping;
|
|
1812
|
+
listKey = face.list.slice("methodMapping.".length);
|
|
1813
|
+
}
|
|
1814
|
+
const list = holder[listKey];
|
|
1815
|
+
if (!Array.isArray(list))
|
|
1816
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-list-absent", message: `${face.list} 不是数组${list === undefined ? "(缺键)" : ""};${holder === node ? "节点" : "methodMapping"} 现有键:${Object.keys(holder).join(",")}` });
|
|
1817
|
+
const elements = list;
|
|
1818
|
+
const describeEntry = (index) => {
|
|
1819
|
+
const entry = elements[index];
|
|
1820
|
+
const value = entry !== null && typeof entry === "object" && !Array.isArray(entry) ? entry[identityKey] : undefined;
|
|
1821
|
+
return { index, [identityKey]: value === undefined ? null : String(value) };
|
|
1822
|
+
};
|
|
1823
|
+
const selectorKey = selectKeys[0];
|
|
1824
|
+
let index;
|
|
1825
|
+
if (selectorKey === "index") {
|
|
1826
|
+
const raw = face.select.index;
|
|
1827
|
+
if (typeof raw !== "number" || !Number.isInteger(raw) || raw < 0 || raw >= elements.length)
|
|
1828
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-index-invalid", message: `select.index 必须是 0..${elements.length - 1} 的整数(${face.list} 现有 ${elements.length} 条);收到 ${JSON.stringify(raw)}。优先用 {"${identityKey}":"…"} 按稳定标识选` });
|
|
1829
|
+
index = raw;
|
|
1830
|
+
}
|
|
1831
|
+
else {
|
|
1832
|
+
const wanted = face.select[selectorKey];
|
|
1833
|
+
if (typeof wanted !== "string" || wanted.trim() === "")
|
|
1834
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-selector-key", message: `select.${selectorKey} 必须是非空字符串;收到 ${JSON.stringify(wanted)}` });
|
|
1835
|
+
const hits = elements
|
|
1836
|
+
.map((entry, position) => ({ entry, position }))
|
|
1837
|
+
.filter(({ entry }) => entry !== null && typeof entry === "object" && !Array.isArray(entry) && String(entry[identityKey] ?? "") === wanted);
|
|
1838
|
+
if (hits.length === 0)
|
|
1839
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-not-found", message: `${face.list} 没有 ${identityKey}=${wanted} 的映射;现有:${JSON.stringify(elements.map((_entry, position) => describeEntry(position)))}` });
|
|
1840
|
+
if (hits.length > 1)
|
|
1841
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-ambiguous", message: `${face.list} 有 ${hits.length} 条 ${identityKey}=${wanted}(identity 撞重),拒绝猜一条;候选:${JSON.stringify(hits.map(({ position }) => describeEntry(position)))};确信目标时用 {"index":N} 显式定位` });
|
|
1842
|
+
index = hits[0].position;
|
|
1843
|
+
}
|
|
1844
|
+
const target = elements[index];
|
|
1845
|
+
if (target === null || typeof target !== "object" || Array.isArray(target))
|
|
1846
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-element-not-object", message: `${face.list}[${index}] 不是对象,无法浅合并` });
|
|
1847
|
+
const merged = { ...target, ...face.patch };
|
|
1848
|
+
const nextList = elements.map((entry, position) => (position === index ? merged : entry));
|
|
1849
|
+
const nextNode = face.list === "dataActions"
|
|
1850
|
+
? { ...node, dataActions: nextList }
|
|
1851
|
+
: { ...node, methodMapping: { ...node.methodMapping, [listKey]: nextList } };
|
|
1852
|
+
return {
|
|
1853
|
+
node: nextNode,
|
|
1854
|
+
receipt: {
|
|
1855
|
+
list: face.list,
|
|
1856
|
+
index,
|
|
1857
|
+
identity: { key: selectorKey, value: selectorKey === "index" ? index : String(face.select[selectorKey]) },
|
|
1858
|
+
patchedKeys: Object.keys(face.patch ?? {}),
|
|
1859
|
+
},
|
|
1860
|
+
};
|
|
1861
|
+
};
|
|
1507
1862
|
const loadRuleNodePatchGraph = async (session, args) => {
|
|
1508
1863
|
const id = await resolveRuleRowId(session, args.schemaCode, args.ruleCode);
|
|
1509
1864
|
if (!id)
|
|
@@ -1511,9 +1866,16 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1511
1866
|
const record = (await wireCall(session, { path: ENDPOINTS.businessRuleGet, query: { id } })).data;
|
|
1512
1867
|
if (!record)
|
|
1513
1868
|
throw new ToolRefusalError({ status: "refused", blocker: "rule-absent", message: `规则 ${args.schemaCode}.${args.ruleCode}(id ${id})读回为空` });
|
|
1869
|
+
// F3:node 级 patch 与 mapping 级 patch 至少给一个(都不是 → 无操作,拒绝);
|
|
1870
|
+
// 同时给时不得指向同一数组(patch.dataActions vs mapping.list=dataActions 是
|
|
1871
|
+
// 自相矛盾的指令——整组替换与单条替换打架,拒绝而不是定隐式优先级)。
|
|
1872
|
+
if (args.patch === undefined && args.mapping === undefined)
|
|
1873
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-node-patch-empty", message: "patch 与 mapping 至少给一个:patch=节点级浅合并,mapping=单条映射局部 patch(list+select+patch)" });
|
|
1514
1874
|
for (const key of ["nodeCode", "nodeType"])
|
|
1515
|
-
if (key in args.patch)
|
|
1875
|
+
if (args.patch !== undefined && key in args.patch)
|
|
1516
1876
|
throw new ToolRefusalError({ status: "refused", blocker: "rule-node-immutable-key", message: `node patch 不允许改 ${key}(平台按 nodeCode 连接路由、节点类型不可变);要改名/改型请整图 rule.save` });
|
|
1877
|
+
if (args.patch !== undefined && args.mapping !== undefined && args.mapping.list.split(".")[0] in args.patch)
|
|
1878
|
+
throw new ToolRefusalError({ status: "refused", blocker: "rule-mapping-patch-conflict", message: `patch 与 mapping 同时写了 ${args.mapping.list.split(".")[0]}:node 级 patch 已整组替换该键,单条 mapping patch 无从定位;去掉 patch 里的这个键,或去掉 mapping` });
|
|
1517
1879
|
// node/route are SEPARATE JSON-string columns (see rule.get): `node` is the
|
|
1518
1880
|
// nodes array, `route` the routes array — not one {nodes,routes} object.
|
|
1519
1881
|
const nodes = decodeJsonColumn(record.node, JSON_COLUMN_NULL_COALESCE);
|
|
@@ -1522,14 +1884,32 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1522
1884
|
const target = nodeList.find((node) => node.nodeCode === args.nodeCode);
|
|
1523
1885
|
if (!target)
|
|
1524
1886
|
throw new ToolRefusalError({ status: "refused", blocker: "rule-node-absent", message: `现有图中没有 nodeCode=${args.nodeCode};用 rule.get schemaCode+ruleCode 查看 nodeCode` });
|
|
1525
|
-
|
|
1526
|
-
|
|
1527
|
-
|
|
1887
|
+
let mergedNode = { ...target, ...(args.patch ?? {}) };
|
|
1888
|
+
let mappingReceipt;
|
|
1889
|
+
if (args.mapping !== undefined) {
|
|
1890
|
+
// F3:mapping 面作用于(可选 node patch 合并后的)目标节点;单条浅合并,
|
|
1891
|
+
// 其余元素/键逐字节保留——由 applyRuleMappingPatch 纯函数保证。
|
|
1892
|
+
const applied = applyRuleMappingPatch(mergedNode, args.mapping);
|
|
1893
|
+
mergedNode = applied.node;
|
|
1894
|
+
mappingReceipt = applied.receipt;
|
|
1895
|
+
}
|
|
1896
|
+
const mergedGraph = {
|
|
1897
|
+
nodes: nodeList.map((node) => (node.nodeCode === args.nodeCode ? mergedNode : node)),
|
|
1898
|
+
...(Array.isArray(routes) ? { routes } : {}),
|
|
1899
|
+
// F5(2026-11-20 真机 R2/B):TIMING 规则的调度参数在**规则行**
|
|
1900
|
+
// schedulerSetting(JSON 字符串),不在 SCHEDULER 节点上。只重建
|
|
1901
|
+
// {nodes,routes} 会把它丢掉 → 出门 lint 拒 rule-graph-scheduler-setting-missing
|
|
1902
|
+
// (rule-graph.ts:1814),定时规则因此没法用节点/映射 patch。行级配置
|
|
1903
|
+
// 原样带回;bizRuleType 一并保留,避免定时规则被 prepareRuleGraph 降级。
|
|
1904
|
+
...(record.schedulerSetting !== undefined && record.schedulerSetting !== null ? { schedulerSetting: record.schedulerSetting } : {}),
|
|
1905
|
+
...(typeof record.bizRuleType === "number" ? { bizRuleType: record.bizRuleType } : {}),
|
|
1906
|
+
};
|
|
1907
|
+
return { id, record, mergedGraph, ruleName: String(record.name ?? args.ruleCode), ...(mappingReceipt !== undefined ? { mappingReceipt } : {}) };
|
|
1528
1908
|
};
|
|
1529
1909
|
writeTool({
|
|
1530
1910
|
tools,
|
|
1531
1911
|
name: "rule.node.update",
|
|
1532
|
-
search: { intents: ["改规则节点", "改一个节点的条件", "调整规则里的节点", "改分支阈值"] },
|
|
1912
|
+
search: { intents: ["改规则节点", "改一个节点的条件", "调整规则里的节点", "改分支阈值", "改一条映射", "改字段映射"] },
|
|
1533
1913
|
lane: RULE_LANE,
|
|
1534
1914
|
scope: RULE_TOOLS["rule.node.update"].scope,
|
|
1535
1915
|
description: RULE_TOOLS["rule.node.update"].description,
|
|
@@ -1537,7 +1917,17 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1537
1917
|
schemaCode: z.string().min(1),
|
|
1538
1918
|
ruleCode: z.string().min(1),
|
|
1539
1919
|
nodeCode: z.string().min(1).describe("要改的节点 nodeCode(在现有图里定位,不是新建)"),
|
|
1540
|
-
patch: z.record(z.string(), z.unknown()).describe("浅合并到该节点的字段(如 exitConditionGroups/filterCondition/dataActions/
|
|
1920
|
+
patch: z.record(z.string(), z.unknown()).optional().describe("浅合并到该节点的字段(如 exitConditionGroups/filterCondition/nodeName);改 dataActions/methodMapping 里的单条映射优先用 mapping 面;不允许改 nodeCode/nodeType;与 mapping 至少给一个"),
|
|
1921
|
+
// F3:单条 mapping 局部 patch。嵌套 describe 不进 tools/list 字节预算
|
|
1922
|
+
// (toolsListBytes 只序列化顶层参数名+描述),语义细节放这里零成本。
|
|
1923
|
+
mapping: z
|
|
1924
|
+
.object({
|
|
1925
|
+
list: z.enum(["dataActions", "methodMapping.inputMappings", "methodMapping.outputMappings"]).describe("要 patch 的映射数组:dataActions=CREATE/UPDATE/ASSIGN 的字段映射叶;methodMapping.inputMappings/outputMappings=BIZ_ACTION 的方法入/出参映射"),
|
|
1926
|
+
select: z.record(z.string(), z.unknown()).describe('稳定标识唯一选中一条:dataActions→{"targetDataItem":"目标字段code"};入/出参→{"serviceMethodParameterCode":"参数code"};identity 撞重时 {"index":N}(0 基,按 rule.get 数组序)。命中 0 条或 >1 条都拒绝并列候选,绝不猜'),
|
|
1927
|
+
patch: z.record(z.string(), z.unknown()).describe("浅合并进选中那条映射的声明字段(如 bizCode/value/codeType/currentDataItemValue);未声明的键、其余条目、节点其余键、routes、设计器 layout 键(x/y/width/height/points)逐字节保留"),
|
|
1928
|
+
})
|
|
1929
|
+
.optional()
|
|
1930
|
+
.describe("单条映射局部 patch:只改 select 命中的那一条映射(与 patch 可并用,但不得与 patch 同时写同一数组)"),
|
|
1541
1931
|
publish: z.boolean().optional().describe("改完同样顺带 publish(默认 false,仅存草稿;生效仍需 rule.enable)"),
|
|
1542
1932
|
customTrigger: z.boolean().optional(),
|
|
1543
1933
|
},
|
|
@@ -1545,7 +1935,10 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1545
1935
|
const base = await loadRuleNodePatchGraph(session, args);
|
|
1546
1936
|
// A4:patch 入口的统一状态段——operation:"patch" + target.nodeCode(图仍是
|
|
1547
1937
|
// 整图重存,graph.saved:true 报的是全图,与 rule.save 同构)。
|
|
1548
|
-
|
|
1938
|
+
const result = await executeRuleSaveWrite(session, { schemaCode: args.schemaCode, ruleCode: args.ruleCode, name: base.ruleName, nodeGraph: base.mergedGraph, ...(args.publish === true ? { publish: true } : {}), ...(args.customTrigger === true ? { customTrigger: true } : {}) }, { operation: "patch", nodeCode: args.nodeCode });
|
|
1939
|
+
// F3:mapping 面的回执增量(选中数组/下标/标识/改了哪些键)——readback 顶层
|
|
1940
|
+
// additive 键;ruleStatus 共享形状不动,未选中的部分不变由整图合并语义保证。
|
|
1941
|
+
return base.mappingReceipt === undefined ? result : { ...result, readback: { ...result.readback, mappingPatch: { nodeCode: args.nodeCode, ...base.mappingReceipt } } };
|
|
1549
1942
|
},
|
|
1550
1943
|
// r73 #1(GitLab #40):dry-run 此前走 write.ts 通用 dry-run(只出 plan),不跑
|
|
1551
1944
|
// 图 lint——非法 patch(如 CREATE 节点 originatorValue 置空)dry-run 过、真写
|
|
@@ -1559,7 +1952,8 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1559
1952
|
const linted = await lintRuleGraphForWrite(session, { schemaCode: args.schemaCode, ruleCode: args.ruleCode, nodeGraph: base.mergedGraph, ...(args.customTrigger === true ? { customTrigger: true } : {}) }, { validationRefusalMessage: "nodeGraph 未过出门前校验(dry lint,与真写同门);按 validation 逐项修正" });
|
|
1560
1953
|
return {
|
|
1561
1954
|
nodeCode: args.nodeCode,
|
|
1562
|
-
patchedKeys: Object.keys(args.patch),
|
|
1955
|
+
patchedKeys: Object.keys(args.patch ?? {}),
|
|
1956
|
+
...(base.mappingReceipt !== undefined ? { mapping: base.mappingReceipt } : {}),
|
|
1563
1957
|
// 本次 dry-run 覆盖的是**全图** lint(patch 合并进存量图后整图过门),
|
|
1564
1958
|
// 不是只验 patch 本身。`lintScope` 现在是 R75-B 的契约字段
|
|
1565
1959
|
// (full/partial/plan,由 writeTool 声明)——图谱细节用独立键,避免同名双义。
|
package/dist/lanes/online-js.js
CHANGED
|
@@ -44,7 +44,7 @@ function parseLayoutElements(rawHtml) {
|
|
|
44
44
|
* template area — omitting toolbar/template leaves the panel regions empty.
|
|
45
45
|
*/
|
|
46
46
|
/** Extract the customScript element's innerHTML from a layout-JSON face; null when absent. */
|
|
47
|
-
function readCustomScriptSource(rawHtml) {
|
|
47
|
+
export function readCustomScriptSource(rawHtml) {
|
|
48
48
|
const elements = parseLayoutElements(rawHtml);
|
|
49
49
|
// Match by id ONLY: beforeCustomScript/afterCustomScript are also
|
|
50
50
|
// tagName:'script' elements with an empty innerHTML and would shadow the
|
|
@@ -8,7 +8,7 @@ export function dataListDescription() {
|
|
|
8
8
|
return `按简化过滤 DSL 查询业务对象(runtime/query/list);DSL 在 CLI 内翻译为平台 queryCondition(${wire.dslShape}),并按发布字段元数据为每个条件注入 propertyType(未知过滤字段将被拒绝,可用 rawCondition 逃生);响应行在 items[],业务字段在 items[].fields.<code>(不是 rows[],也不是 item 顶层——--jq 常用 items[].fields.sku);空模型返回空列表;未配列的自定义字段投影为 null——这是显示面缺列配置、不是数据缺失(data.load 有值),显式选列在结果中全为 null 而发布字段元数据显示其存在时,readback 追加 projectionHint(先用 listview.configure 配置该模型的默认视图列,或用 data.load 读单条权威值)。`;
|
|
9
9
|
}
|
|
10
10
|
export function dataAggregateDescription() {
|
|
11
|
-
return `临时计数与数值聚合(纯读)。count:runtime/query/list size:1 读 totalElements(服务端精确、不受 cap 影响;带 filter +1 field.list)。sum/avg/min/max:field 必填且已发布 propertyType=2(NUMERICAL);无 GET_LIST 改源时优先 /sum ALL_DATA(coverage.mode=server-aggregate,全量精确),否则/失败/键不符回退本地折叠(strategyFallback;size:200 翻页至 cap 1000,null 不进聚合、avg=sum/非 null 行数,nonNullCount=0→value:null)。complete 看 rowsScanned>=total,否则 missingCount+capNotice,绝不外推。groupBy 单列:count 值域可枚举(options/字典)→值域×count(V+3 wire),分桶并发窗口 4(限流退化 2,见 wire.concurrency),桶序稳定;按 count 降序取 topN(默认 10/上限 20),截断给 truncatedBuckets/bucketsTruncatedCount,null 单列 nullBucket;不可枚举或数值指标→本地扫描(coverage.mode=paged-local-scan/local-scan),数值桶 {key,count,nonNullCount,value} 按 value 降序、并列按 key,null 行进 nullBucket。filter.draftPolicy:count+groupBy 默认 includeDrafts:false 注入 sequenceStatus≠DRAFT;数值指标不默认排除;count 省略=平台默认(无条件含草稿、带条件排草稿);显式 false 强制排除。边界:临时问句用本工具;持久图表/看板用 report.chartdata,视图汇总列用 sumType,写时计算用 datarule type2
|
|
11
|
+
return `临时计数与数值聚合(纯读)。count:runtime/query/list size:1 读 totalElements(服务端精确、不受 cap 影响;带 filter +1 field.list)。sum/avg/min/max:field 必填且已发布 propertyType=2(NUMERICAL);无 GET_LIST 改源时优先 /sum ALL_DATA(coverage.mode=server-aggregate,全量精确),否则/失败/键不符回退本地折叠(strategyFallback;size:200 翻页至 cap 1000,null 不进聚合、avg=sum/非 null 行数,nonNullCount=0→value:null)。complete 看 rowsScanned>=total,否则 missingCount+capNotice,绝不外推。groupBy 单列:count 值域可枚举(options/字典)→值域×count(V+3 wire),分桶并发窗口 4(限流退化 2,见 wire.concurrency),桶序稳定;按 count 降序取 topN(默认 10/上限 20),截断给 truncatedBuckets/bucketsTruncatedCount,null 单列 nullBucket;不可枚举或数值指标→本地扫描(coverage.mode=paged-local-scan/local-scan),数值桶 {key,count,nonNullCount,value} 按 value 降序、并列按 key,null 行进 nullBucket。filter.draftPolicy:count+groupBy 默认 includeDrafts:false 注入 sequenceStatus≠DRAFT;数值指标不默认排除;count 省略=平台默认(无条件含草稿、带条件排草稿);显式 false 强制排除。边界:临时问句用本工具;持久图表/看板用 report.chartdata,视图汇总列用 sumType,写时计算用 datarule type2。子表计数/求和用 child(主表 schemaCode + childSchemaCode/bizObjectId)。`;
|
|
12
12
|
}
|
|
13
13
|
export function dataUpdateDescription() {
|
|
14
14
|
const wire = RUNTIME_DATA_WIRE;
|
|
@@ -93,6 +93,7 @@ export const RUNTIME_DATA_LANE_CONTRACT = Object.freeze({
|
|
|
93
93
|
updateAbsentGuard: RUNTIME_DATA_WIRE.updateAbsentGuard,
|
|
94
94
|
childRowStatusNote: RUNTIME_DATA_WIRE.childRowStatusNote,
|
|
95
95
|
projectionHint: RUNTIME_DATA_WIRE.projectionHint,
|
|
96
|
+
projectionEvidence: RUNTIME_DATA_WIRE.projectionEvidence,
|
|
96
97
|
}),
|
|
97
98
|
wireBindings: Object.freeze({
|
|
98
99
|
queryConditionShape: Object.freeze([emitterBinding("data-list-filter.toQueryCondition", assertRuntimeDataContract)]),
|
|
@@ -116,6 +117,9 @@ export const RUNTIME_DATA_LANE_CONTRACT = Object.freeze({
|
|
|
116
117
|
updateAbsentGuard: Object.freeze([behaviorBinding("test/data-update.test.ts#data.update does NOT silently insert", assertRuntimeDataContract)]),
|
|
117
118
|
childRowStatusNote: Object.freeze([behaviorBinding("test/data-update.test.ts#data.update stamps rowStatus on child-table rows", assertRuntimeDataContract)]),
|
|
118
119
|
projectionHint: Object.freeze([behaviorBinding("test/data-list.test.ts#data.list appends projectionHint", assertRuntimeDataContract)]),
|
|
120
|
+
// F2(retro 24,ticket 138):未投影判定只在有 queryColumns 证据时给
|
|
121
|
+
// projectedFields/unprojected,否则 projectionKnown:false(mapped 原义不变)。
|
|
122
|
+
projectionEvidence: Object.freeze([behaviorBinding("test/ticket-138-f2-locator-provenance.test.ts#data.list classifies unprojected columns only with view evidence", assertRuntimeDataContract)]),
|
|
119
123
|
}),
|
|
120
124
|
evidence: Object.freeze([
|
|
121
125
|
"ticket 01 B (2026-09-11): queryCondition must be List<List<List<FilterModel>>>; a 2-level array answers 10009 类型转换异常",
|