@stalfh233/omc-cli 0.8.12 → 0.8.14
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/call.js +31 -0
- package/dist/cli.js +141 -8
- package/dist/human-summary.js +74 -2
- package/dist/intent/capabilities/datarule.js +126 -12
- package/dist/intent/compare.js +18 -0
- package/dist/intent/readback.js +3 -0
- package/dist/intent/schema.js +1 -1
- package/dist/lanes/datarule-contract.js +2 -1
- package/dist/lanes/datarule.js +59 -2
- package/dist/lanes/runtime-data.js +213 -5
- package/dist/recipes/datarule.js +1 -0
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +1 -1
package/dist/call.js
CHANGED
|
@@ -292,10 +292,41 @@ function readDiagnosticLine(result) {
|
|
|
292
292
|
const notes = [];
|
|
293
293
|
if (Array.isArray(result.columnsOutsideView) && result.columnsOutsideView.length > 0)
|
|
294
294
|
notes.push(`columns 只能从视图列里选:${result.columnsOutsideView.map(String).join("、")} 不在视图列里,不会返回值(扩列用 data.load 或把列加进视图)`);
|
|
295
|
+
const unprojectedNote = unprojectedSummaryNote(result);
|
|
296
|
+
if (unprojectedNote !== undefined)
|
|
297
|
+
notes.push(unprojectedNote);
|
|
295
298
|
if (typeof result.dateReadbackNote === "string" && result.dateReadbackNote.length > 0)
|
|
296
299
|
notes.push(result.dateReadbackNote);
|
|
297
300
|
return notes.length > 0 ? notes.join(";") : null;
|
|
298
301
|
}
|
|
302
|
+
/**
|
|
303
|
+
* F5(w112 探针 H,P2):`items[].fields` 缺键像「值丢了」。行级
|
|
304
|
+
* `items[].unprojected` 是权威点名,但 compact 外置 items 后行内证据不在信封里,
|
|
305
|
+
* 所以优先用 handler 给的 `unprojectedFieldCount`(同一份行级证据的跨行并集),
|
|
306
|
+
* 内联态再回落到读 `items[].unprojected` / `projectionHint.unprojected`。
|
|
307
|
+
* 人类行只在这个数 >0 时出现,全投影读保持零噪音。
|
|
308
|
+
*/
|
|
309
|
+
function unprojectedSummaryNote(result) {
|
|
310
|
+
let count = typeof result.unprojectedFieldCount === "number" && result.unprojectedFieldCount > 0 ? result.unprojectedFieldCount : 0;
|
|
311
|
+
if (count === 0 && Array.isArray(result.items)) {
|
|
312
|
+
const codes = new Set();
|
|
313
|
+
for (const item of result.items) {
|
|
314
|
+
if (item === null || typeof item !== "object")
|
|
315
|
+
continue;
|
|
316
|
+
const rowCodes = item.unprojected;
|
|
317
|
+
if (Array.isArray(rowCodes))
|
|
318
|
+
for (const code of rowCodes)
|
|
319
|
+
codes.add(String(code));
|
|
320
|
+
}
|
|
321
|
+
count = codes.size;
|
|
322
|
+
}
|
|
323
|
+
if (count === 0) {
|
|
324
|
+
const hint = result.projectionHint;
|
|
325
|
+
if (hint !== undefined && Array.isArray(hint.unprojected))
|
|
326
|
+
count = hint.unprojected.length;
|
|
327
|
+
}
|
|
328
|
+
return count > 0 ? `${count} 个未投影字段已省略(items[].unprojected),真值用 data.load` : undefined;
|
|
329
|
+
}
|
|
299
330
|
export function validateAgentPaths(args) {
|
|
300
331
|
const root = resolve(process.env.OMC_CONFIG_HOME ?? process.cwd());
|
|
301
332
|
const visit = (value, key) => {
|
package/dist/cli.js
CHANGED
|
@@ -1843,6 +1843,109 @@ function pageableCommand(query, lane, kind, options) {
|
|
|
1843
1843
|
parts.push("--compact");
|
|
1844
1844
|
return parts.join(" ");
|
|
1845
1845
|
}
|
|
1846
|
+
/**
|
|
1847
|
+
* F6(w114 探针 H,真机):`omc commands --lane data` 曾回 `tools:[]`——
|
|
1848
|
+
* `--lane` 只认完整 lane id(`M2-runtime-data`),而调用方很自然写能力 id
|
|
1849
|
+
* (`data`)或短别名(`list-view`)。`commands` 是发现面,写错名义上该被
|
|
1850
|
+
* 纠正而不是空手而归:先按完整 lane id(大小写不敏感),再按能力 id /
|
|
1851
|
+
* 别名 / lane 尾段 / lane 段 / 能力操作名解析;唯一命中才展开,多候选回
|
|
1852
|
+
* candidates + 可执行命令(不猜),零候选维持原有 availableLanes 提示。
|
|
1853
|
+
*/
|
|
1854
|
+
function resolveLaneQuery(registryInput, request) {
|
|
1855
|
+
const normalize = (value) => value.trim().toLowerCase().replace(/[_\s]+/g, "-");
|
|
1856
|
+
const query = normalize(request);
|
|
1857
|
+
if (query === "")
|
|
1858
|
+
return {};
|
|
1859
|
+
const lanes = [...new Set(registryInput.map((tool) => tool.lane).filter((lane) => typeof lane === "string").map((lane) => String(lane)))].sort();
|
|
1860
|
+
const nodes = buildCapabilityOverview(registryInput);
|
|
1861
|
+
const commandFor = (lane) => `omc commands --lane ${lane}`;
|
|
1862
|
+
const toCandidates = (rows) => {
|
|
1863
|
+
const seen = new Map();
|
|
1864
|
+
for (const row of rows) {
|
|
1865
|
+
if (seen.has(row.lane))
|
|
1866
|
+
continue;
|
|
1867
|
+
seen.set(row.lane, { lane: row.lane, via: row.via, nextCommand: commandFor(row.lane) });
|
|
1868
|
+
}
|
|
1869
|
+
// 候选排序:能力名/别名证据优先于通用操作词,但 lane 段(`list` ∈
|
|
1870
|
+
// W1-list-view、`publish` ∈ form-publish-chain)必须排在能力操作名之前——
|
|
1871
|
+
// 操作名(field/form 都有 publish)会把真正按段命中的 lane 压到最后,
|
|
1872
|
+
// nextCommand 就指错(w114 复审回归)。`rule` 仍由能力名证据排第一(B1)。
|
|
1873
|
+
const rankOf = (via) => via.startsWith("capability-id") ? 1
|
|
1874
|
+
: via.startsWith("capability-alias") ? 2
|
|
1875
|
+
: via.startsWith("capability-name") ? 3
|
|
1876
|
+
: via === "lane-tail" ? 4
|
|
1877
|
+
: via === "lane-segment" ? 5
|
|
1878
|
+
: via.startsWith("capability-operation") ? 6
|
|
1879
|
+
: 7;
|
|
1880
|
+
return [...seen.values()].sort((left, right) => rankOf(left.via) - rankOf(right.via) || left.lane.localeCompare(right.lane));
|
|
1881
|
+
};
|
|
1882
|
+
// 1. Exact lane id(callers copy it from coverage/capabilities; case-insensitive
|
|
1883
|
+
// because the flag value is typed by hand).
|
|
1884
|
+
const exactLane = lanes.find((lane) => lane.toLowerCase() === query);
|
|
1885
|
+
if (exactLane !== undefined)
|
|
1886
|
+
return { lane: exactLane, via: "lane-id" };
|
|
1887
|
+
// 2. Capability id(`data` → M2-runtime-data)and its declared aliases
|
|
1888
|
+
// (`list-view` → W1-list-view, `runtime-data` → M2-runtime-data).
|
|
1889
|
+
const capability = nodes.find((node) => normalize(node.id) === query);
|
|
1890
|
+
if (capability !== undefined)
|
|
1891
|
+
return { lane: capability.lane, via: "capability-id" };
|
|
1892
|
+
const alias = nodes.find((node) => node.aliases.some((entry) => normalize(entry) === query));
|
|
1893
|
+
if (alias !== undefined)
|
|
1894
|
+
return { lane: alias.lane, via: "capability-alias" };
|
|
1895
|
+
// 3. Equality against the lane's tail(M2-runtime-data → runtime-data)、any
|
|
1896
|
+
// lane segment(W1-list-view → list / view)、a capability operation name
|
|
1897
|
+
// (`list`/`aggregate` are task words, not lane ids), or a capability
|
|
1898
|
+
// name that CONTAINS the query(`rule` ∈ businessrule / datarule). All
|
|
1899
|
+
// axes are unioned first: `data` is unique(M2 only, exact id wins
|
|
1900
|
+
// earlier), while `list` legitimately matches W1-list-view AND every
|
|
1901
|
+
// capability whose operations include `list`, and `rule` matches the
|
|
1902
|
+
// rule-lifecycle lane segment plus businessrule/datarule — those
|
|
1903
|
+
// ambiguities must be reported, not silently guessed(旧版把 `rule`
|
|
1904
|
+
// 静默解析到 S25-rule-lifecycle,用户多半要的是 B1 的 rule.save).
|
|
1905
|
+
const tailOf = (lane) => normalize(lane.replace(/^[A-Za-z]+\d+[-_]/, ""));
|
|
1906
|
+
const segmentsOf = (lane) => lane.toLowerCase().split("-").filter(Boolean);
|
|
1907
|
+
const equality = [];
|
|
1908
|
+
for (const lane of lanes) {
|
|
1909
|
+
if (tailOf(lane) === query)
|
|
1910
|
+
equality.push({ lane, via: "lane-tail" });
|
|
1911
|
+
if (segmentsOf(lane).includes(query))
|
|
1912
|
+
equality.push({ lane, via: "lane-segment" });
|
|
1913
|
+
}
|
|
1914
|
+
for (const node of nodes) {
|
|
1915
|
+
if (node.operations.some((operation) => normalize(operation) === query))
|
|
1916
|
+
equality.push({ lane: node.lane, via: `capability-operation:${normalize(query)}` });
|
|
1917
|
+
// 只做「能力名包含查询词」的并入(≥3 字符:2 字符碎片 bi/mo/in 会静默
|
|
1918
|
+
// 命中半个注册表;`rule` 4 字符不受影响,`js` 走 lane 段等值)。
|
|
1919
|
+
if (query.length >= 3 && (normalize(node.id).includes(query) || node.aliases.some((entry) => normalize(entry).includes(query)))) {
|
|
1920
|
+
equality.push({ lane: node.lane, via: `capability-name:${normalize(node.id)}` });
|
|
1921
|
+
}
|
|
1922
|
+
}
|
|
1923
|
+
const equalityCandidates = toCandidates(equality);
|
|
1924
|
+
if (equalityCandidates.length === 1)
|
|
1925
|
+
return { lane: equalityCandidates[0].lane, via: equalityCandidates[0].via };
|
|
1926
|
+
if (equalityCandidates.length > 1)
|
|
1927
|
+
return { candidates: equalityCandidates };
|
|
1928
|
+
// 4. Prefix fallback for typed shortcuts(≥3 chars; `online` → online-js).
|
|
1929
|
+
if (query.length >= 3) {
|
|
1930
|
+
const prefixed = [];
|
|
1931
|
+
for (const lane of lanes) {
|
|
1932
|
+
if (tailOf(lane).startsWith(query) || segmentsOf(lane).some((segment) => segment.startsWith(query)))
|
|
1933
|
+
prefixed.push({ lane, via: "lane-prefix" });
|
|
1934
|
+
}
|
|
1935
|
+
for (const node of nodes) {
|
|
1936
|
+
if (normalize(node.id).startsWith(query))
|
|
1937
|
+
prefixed.push({ lane: node.lane, via: "capability-id-prefix" });
|
|
1938
|
+
if (node.aliases.some((entry) => normalize(entry).startsWith(query)))
|
|
1939
|
+
prefixed.push({ lane: node.lane, via: "capability-alias-prefix" });
|
|
1940
|
+
}
|
|
1941
|
+
const prefixCandidates = toCandidates(prefixed);
|
|
1942
|
+
if (prefixCandidates.length === 1)
|
|
1943
|
+
return { lane: prefixCandidates[0].lane, via: prefixCandidates[0].via };
|
|
1944
|
+
if (prefixCandidates.length > 1)
|
|
1945
|
+
return { candidates: prefixCandidates };
|
|
1946
|
+
}
|
|
1947
|
+
return {};
|
|
1948
|
+
}
|
|
1846
1949
|
/**
|
|
1847
1950
|
* ambiguous 的出口(issue 03):命中 >10 且头部近平局时,除了「行已按分数排序」
|
|
1848
1951
|
* 还要给一条真能跑的收窄命令。级联:top3 同能力 → --capability;同 kind →
|
|
@@ -1942,6 +2045,11 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1942
2045
|
// 显式分页——三者都能单独触发这个面。
|
|
1943
2046
|
if (options.filter !== undefined || options.lane !== undefined || kindFilter !== undefined || pagingActive) {
|
|
1944
2047
|
const tools = inventory.tools;
|
|
2048
|
+
// F6(w114 探针 H):`--lane` 接受完整 lane id(大小写不敏感)以及能力 id /
|
|
2049
|
+
// 别名 / 尾段 / 段 / 操作名(`data` → M2-runtime-data)。唯一命中才生效;
|
|
2050
|
+
// 多候选下面回 candidates,零候选保留 availableLanes。
|
|
2051
|
+
const laneResolution = options.lane !== undefined ? resolveLaneQuery(registry, options.lane) : undefined;
|
|
2052
|
+
const effectiveLane = laneResolution?.lane;
|
|
1945
2053
|
// r19 ticket 05: semantic filter — capability language(聚合/字典/业务集成)
|
|
1946
2054
|
// must locate tools, not dead-end on a name-substring miss.
|
|
1947
2055
|
const semantic = options.filter !== undefined ? filterTools(registry, options.filter) : undefined;
|
|
@@ -1951,7 +2059,7 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1951
2059
|
const semanticByName = semantic ? new Map(semantic.map((hit) => [hit.name, hit])) : undefined;
|
|
1952
2060
|
const scoreOf = (name) => semanticByName?.get(name)?.score ?? Number.NEGATIVE_INFINITY;
|
|
1953
2061
|
const matched = tools.filter((tool) => {
|
|
1954
|
-
if (options.lane !== undefined && tool.lane !==
|
|
2062
|
+
if (options.lane !== undefined && tool.lane !== effectiveLane)
|
|
1955
2063
|
return false;
|
|
1956
2064
|
if (kindFilter !== undefined && tool.kind !== kindFilter)
|
|
1957
2065
|
return false;
|
|
@@ -1967,7 +2075,13 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
1967
2075
|
}
|
|
1968
2076
|
inventory.filtered = {
|
|
1969
2077
|
filter: options.filter ?? null,
|
|
1970
|
-
|
|
2078
|
+
// 多候选时没有唯一 lane:回 null + candidates(不把原始查询伪装成 lane)。
|
|
2079
|
+
lane: effectiveLane ?? (laneResolution?.candidates !== undefined ? null : options.lane ?? null),
|
|
2080
|
+
// 只有「不是完整 lane id」的自动解析才加这一行,`--lane field-families`
|
|
2081
|
+
// 这类既有调用逐字节不变(golden master 钉住)。
|
|
2082
|
+
...(laneResolution?.via !== undefined && laneResolution.via !== "lane-id" && effectiveLane !== undefined
|
|
2083
|
+
? { laneResolution: { query: options.lane, lane: effectiveLane, via: laneResolution.via } }
|
|
2084
|
+
: {}),
|
|
1971
2085
|
// issue 03:只在有 --kind/--read-only 时出现(无 kind 的既有面逐字节不变)。
|
|
1972
2086
|
...(kindFilter !== undefined ? { kind: kindFilter } : {}),
|
|
1973
2087
|
matched: matched.length,
|
|
@@ -2035,13 +2149,32 @@ function cmdDiscovery(kind, transport, value, options = {}) {
|
|
|
2035
2149
|
// match plus governance prose pushed the agent back to the 20 KB face).
|
|
2036
2150
|
// r73 探针01-P2(2026-11-17):`--lane read` 这类不存在的 lane 回
|
|
2037
2151
|
// tools:[] 且没有任何下一步——列合法 lane 清单,别让调用方全量拉再自己汇总。
|
|
2038
|
-
|
|
2152
|
+
// F6(w114 探针 H):多候选(`--lane list` 同时像 list-view 与含 list 操作的
|
|
2153
|
+
// 能力)不猜,回可执行候选;只有一个候选的解析已在上面生效,不落到这里。
|
|
2154
|
+
if (matched.length === 0 && options.lane !== undefined && laneResolution?.candidates !== undefined) {
|
|
2155
|
+
const candidates = laneResolution.candidates;
|
|
2156
|
+
const filtered = inventory.filtered;
|
|
2157
|
+
filtered.candidates = candidates;
|
|
2158
|
+
inventory.note = `--lane "${options.lane}" 不是唯一的 lane:匹配到 ${candidates.length} 个(候选含 lane 与匹配依据)。不猜,先按 nextCommand 选一个完整 lane id 再展开;完整 lane 形如 B1-businessrule / W1-list-view / M2-runtime-data,能力→lane 映射用 omc capabilities`;
|
|
2159
|
+
inventory.nextCommand = candidates[0].nextCommand;
|
|
2160
|
+
}
|
|
2161
|
+
else if (matched.length === 0 && options.lane !== undefined && semantic === undefined) {
|
|
2039
2162
|
const availableLanes = [...new Set(registry.map((tool) => tool.lane).filter((lane) => typeof lane === "string").map((lane) => String(lane)))].sort();
|
|
2040
|
-
|
|
2041
|
-
|
|
2042
|
-
|
|
2163
|
+
const filtered = inventory.filtered;
|
|
2164
|
+
filtered.availableLanes = availableLanes;
|
|
2165
|
+
if (effectiveLane !== undefined) {
|
|
2166
|
+
// lane 本身解析成功却零行:真实原因是 --kind 把该 lane 的工具全滤掉了
|
|
2167
|
+
// (`--lane report --kind meta`)。别让调用方去改 lane 名。
|
|
2168
|
+
inventory.note = `--lane "${options.lane}" 已解析为 ${effectiveLane},但${kindFilter !== undefined ? ` --kind ${kindFilter} ` : "本次筛选"}下没有工具——lane 本身可解析,去掉 --kind 或换 kind 再看`;
|
|
2169
|
+
inventory.nextCommand = `omc commands --lane ${effectiveLane}`;
|
|
2170
|
+
}
|
|
2171
|
+
else {
|
|
2172
|
+
// 零候选:短名也解析不出来。文案不能再说「必须是完整 id」(短名可用)。
|
|
2173
|
+
inventory.note = `--lane "${options.lane}" 没有工具。lane 可用完整 id(大小写不敏感,形如 B1-businessrule / W1-list-view / M2-runtime-data)或能唯一解析的短名(能力 id/别名,如 data、list-view);也可能是 --kind 滤空。合法 lane:${availableLanes.join("、")};能力→lane 映射用 omc capabilities(或 --filter <能力词> 按语义找)`;
|
|
2174
|
+
inventory.nextCommand = "omc capabilities";
|
|
2175
|
+
}
|
|
2043
2176
|
}
|
|
2044
|
-
if (matched.length === 0 && semantic !== undefined) {
|
|
2177
|
+
if (matched.length === 0 && semantic !== undefined && laneResolution?.candidates === undefined) {
|
|
2045
2178
|
delete inventory.governance;
|
|
2046
2179
|
// r59 Step 1: candidates are CAPABILITIES, not tool names. The old
|
|
2047
2180
|
// closest match over tool names answered an unmet business ask with
|
|
@@ -3921,7 +4054,7 @@ async function main() {
|
|
|
3921
4054
|
// C6(0.8.4):--jq 的 miss 默认只回结论;排查载荷(available/correctPath/
|
|
3922
4055
|
// 成因 hint)统一由 --explain 开关,call/artifact get/发现面同口径。
|
|
3923
4056
|
const explainOption = () => new Option("--explain", "--jq 未命中时给出完整排查载荷(available 该层全部键、correctPath、nextCommand、成因 hint);默认 miss 只回 missedAt/didYouMean/helpRef");
|
|
3924
|
-
command.command("commands").description("路由索引(不是目录):工具计数+展开梯子;--kind read 一屏列全部只读工具与必填参数;--json 才是全量目录").option("--json").option("--compact").option("--inline", "commands --json 超过 32KiB 时仍内联").option("--filter <keyword>").option("--capability <id>").option("--lane <id>").option("--kind <kind>", "按读写维度过滤:read|write|meta(read = 只读工具索引)").option("--read-only", "等价 --kind read(与 --kind 互斥)").option("--limit <n>", "分页:最多 n 行(1..200;给定即关闭宽词分组)").option("--offset <n>", "分页起点(默认 0;未给 --limit 时按 50)").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (options) => { commandExitCode = await withTransport(options, request, (transport) => cmdDiscovery("commands", transport, undefined, { json: options.json === true, compact: options.compact === true, inline: options.inline === true, ...(options.filter ? { filter: options.filter } : {}), ...(options.capability ? { capability: options.capability } : {}), ...(options.lane ? { lane: options.lane } : {}), ...(options.kind !== undefined ? { kind: options.kind } : {}), ...(options.readOnly === true ? { readOnly: true } : {}), ...(options.limit !== undefined ? { limit: options.limit } : {}), ...(options.offset !== undefined ? { offset: options.offset } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}), explain: options.explain === true })); }); // C2(0.8.4):describe 是零环境接触的发现面,但 `--env` 是"人人都以为通用"的
|
|
4057
|
+
command.command("commands").description("路由索引(不是目录):工具计数+展开梯子;--kind read 一屏列全部只读工具与必填参数;--json 才是全量目录").option("--json").option("--compact").option("--inline", "commands --json 超过 32KiB 时仍内联").option("--filter <keyword>").option("--capability <id>").option("--lane <id>", "按 lane 过滤(完整 id 大小写不敏感;也接受能力 id/别名如 data、list-view;多候选会列出)").option("--kind <kind>", "按读写维度过滤:read|write|meta(read = 只读工具索引)").option("--read-only", "等价 --kind read(与 --kind 互斥)").option("--limit <n>", "分页:最多 n 行(1..200;给定即关闭宽词分组)").option("--offset <n>", "分页起点(默认 0;未给 --limit 时按 50)").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (options) => { commandExitCode = await withTransport(options, request, (transport) => cmdDiscovery("commands", transport, undefined, { json: options.json === true, compact: options.compact === true, inline: options.inline === true, ...(options.filter ? { filter: options.filter } : {}), ...(options.capability ? { capability: options.capability } : {}), ...(options.lane ? { lane: options.lane } : {}), ...(options.kind !== undefined ? { kind: options.kind } : {}), ...(options.readOnly === true ? { readOnly: true } : {}), ...(options.limit !== undefined ? { limit: options.limit } : {}), ...(options.offset !== undefined ? { offset: options.offset } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}), explain: options.explain === true })); }); // C2(0.8.4):describe 是零环境接触的发现面,但 `--env` 是"人人都以为通用"的
|
|
3925
4058
|
// flag——与 `next` 同处理:接受并忽略(不因反射性传参被 unknown option 打回)。
|
|
3926
4059
|
command.command("describe <tool>").option("--env <environment>", "接受并忽略:describe 零环境接触(参数表与运行时无关)").option("--environment <environment>", "同 --env(接受并忽略)").option("--full").option("--cache-ok", "允许 --full 在同会话重复读时短路为 artifact 指针(默认每次回全文)").option("--schema-only").option("--param <name>").option("--example [id]").option("--max-output-bytes <bytes>").addOption(jqOption()).addOption(explainOption()).action(async (tool, options) => {
|
|
3927
4060
|
commandExitCode = await withTransport(options, request, (transport) => cmdDiscovery("describe", transport, tool, { full: options.full === true, cacheOk: options.cacheOk === true, schemaOnly: options.schemaOnly === true, ...(options.param ? { param: options.param } : {}), ...(options.example ? { example: options.example } : {}), ...(options.jq !== undefined ? { jq: options.jq } : {}), explain: options.explain === true }));
|
package/dist/human-summary.js
CHANGED
|
@@ -273,10 +273,36 @@ function phraseOf(tool, args, outcome) {
|
|
|
273
273
|
// submit 被静默吞掉。summary 必须看 outcome:被拒就说被拒。
|
|
274
274
|
{
|
|
275
275
|
const submitRefused = outcome?.readback?.submitRefused;
|
|
276
|
+
// F2(w112 探针 H):普通 save 落在「有已发布流程 + 未带 workflowCode」时,
|
|
277
|
+
// 这行没有流程实例、之后永远提交不了。摘要行必须与 readback.workflowInstanceNote
|
|
278
|
+
// 同源,不能再说「加 submit:true 一调完成态」。
|
|
279
|
+
const workflowInstanceNote = outcome?.readback?.workflowInstanceNote;
|
|
280
|
+
// 更新行有独立键(workflowUpdateNote):对更新行说「重建流程草稿」是错的,
|
|
281
|
+
// 摘要必须分开表达。
|
|
282
|
+
const workflowUpdateNote = outcome?.readback?.workflowUpdateNote;
|
|
283
|
+
const workflowCheckSkipped = outcome?.readback?.workflowCheckSkipped;
|
|
276
284
|
// F8(w63):平台按模型「数据标题」覆盖显式传入的 name,摘要行必须抬头。
|
|
277
285
|
const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
|
|
278
286
|
if (args.submit === true && submitRefused !== undefined) {
|
|
279
|
-
|
|
287
|
+
// 更新行不得复用「重建流程草稿」口径(会诱导多建一行)。
|
|
288
|
+
if (workflowUpdateNote !== undefined) {
|
|
289
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——submit:true 被拒(${submitRefused.blocker ?? "?"}):更新既有行,不会创建/改动流程实例;推进用 workitem.list → data.submit 三件套;指引进 readback.workflowUpdateNote${nameNote}`;
|
|
290
|
+
}
|
|
291
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——submit:true 被拒(${submitRefused.blocker ?? "?"}):模型有已发布流程,行保持草稿 DRAFT;重建流程草稿的指引进 readback.submitRefused${nameNote}`;
|
|
292
|
+
}
|
|
293
|
+
if (workflowUpdateNote !== undefined) {
|
|
294
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——更新既有行,不创建/改动流程实例;流程模型上保存的直提标志会被拒,推进该行用 workitem.list → data.submit 三件套(不要为触发规则/推进流程再 data.save)${nameNote}`;
|
|
295
|
+
}
|
|
296
|
+
if (workflowInstanceNote !== undefined) {
|
|
297
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——普通草稿、无流程实例,不能提交;要可提交请用 data.save 带 workflowCode:"${workflowInstanceNote.workflowCode ?? "<wf>"}" 重建流程草稿(formData 不要带 id)${nameNote}`;
|
|
298
|
+
}
|
|
299
|
+
if (workflowCheckSkipped !== undefined) {
|
|
300
|
+
// 更新行不能再劝 data.save workflowCode(会多建一行)——只指复核面 + 现有待办。
|
|
301
|
+
const formDataId = args.formData !== null && typeof args.formData === "object" ? args.formData.id : undefined;
|
|
302
|
+
if (typeof formDataId === "string" && formDataId.length > 0) {
|
|
303
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped);更新既有行请先复核流程面(workflow.get_published / rule.references)+ workitem.list 看现有待办,不要为确认流程再 data.save 一次${nameNote}`;
|
|
304
|
+
}
|
|
305
|
+
return `保存数据(模型 ${schemaCode ?? "?"})——本次未能确认是否有已发布流程(见 workflowCheckSkipped),先复核流程面再决定 submit:true 或 data.save workflowCode${nameNote}`;
|
|
280
306
|
}
|
|
281
307
|
// r68 链2-D1(真机实证):带 workflowCode 存的是**流程草稿**,但通用草稿文案教
|
|
282
308
|
// 「加 submit:true」——流程模型会被拒;正确下一步是 data.submit 三件套。
|
|
@@ -297,7 +323,53 @@ function phraseOf(tool, args, outcome) {
|
|
|
297
323
|
// F4(w71,0.8.10):显式传 name 但被平台「数据标题」覆盖时,摘要行与
|
|
298
324
|
// data.save 同口径抬头(JSON 字段 readback.nameOverwrittenNote)。
|
|
299
325
|
const nameNote = readbackNoteClause(outcome, "nameOverwrittenNote");
|
|
300
|
-
|
|
326
|
+
// F4(w114 探针 H,真机):审批通过后 readback 已给
|
|
327
|
+
// workItemState:"none-flow-completed" / sequenceStatus:"COMPLETED" /
|
|
328
|
+
// decision:"APPROVE",summary 却只看 args.workItemId 就说「审批待办」——
|
|
329
|
+
// 人读到的是「流程走完了还在等审批」。摘要状态必须由回执决定:
|
|
330
|
+
// - none-flow-completed 或 COMPLETED/APPROVED → 流程已完成
|
|
331
|
+
// - 驳回(decision:"REJECT"):完成态说「流程已结束(驳回)」,
|
|
332
|
+
// pending 态说「已驳回(退回 X)」
|
|
333
|
+
// - nextWorkItems 非空 → 审批待办(可点名下一节点)
|
|
334
|
+
// - 回执没有状态字段(plan 阶段/旧回执)→ 保留原口径
|
|
335
|
+
const readback = outcome?.readback;
|
|
336
|
+
const workItemState = typeof readback?.workItemState === "string" ? readback.workItemState : undefined;
|
|
337
|
+
const sequenceStatus = typeof readback?.sequenceStatus === "string" ? readback.sequenceStatus : undefined;
|
|
338
|
+
const nextWorkItems = Array.isArray(readback?.nextWorkItems) ? readback.nextWorkItems : [];
|
|
339
|
+
const finishedStatus = sequenceStatus !== undefined && /^(COMPLETED|APPROVED)$/i.test(sequenceStatus);
|
|
340
|
+
const rejected = typeof readback?.decision === "string" && /^REJECT$/i.test(readback.decision);
|
|
341
|
+
const nextActivity = nextWorkItems.length > 0
|
|
342
|
+
? (() => {
|
|
343
|
+
const first = nextWorkItems[0];
|
|
344
|
+
const name = typeof first?.activityName === "string" ? first.activityName : undefined;
|
|
345
|
+
return name ?? (typeof first?.activityCode === "string" ? first.activityCode : undefined);
|
|
346
|
+
})()
|
|
347
|
+
: undefined;
|
|
348
|
+
// 驳回可能没有 nextWorkItems(退回节点不在当前登录人名下 → pending-elsewhere,
|
|
349
|
+
// 真相在 readback.returnedTo / flowWarning.activityName)。退回目标按这个优先级取。
|
|
350
|
+
const returnedTo = readback?.returnedTo;
|
|
351
|
+
const returnTarget = nextActivity
|
|
352
|
+
?? (typeof returnedTo?.activityName === "string" ? returnedTo.activityName : undefined)
|
|
353
|
+
?? (typeof returnedTo?.activityCode === "string" ? returnedTo.activityCode : undefined)
|
|
354
|
+
?? (typeof flowWarning?.activityName === "string" ? flowWarning.activityName : undefined)
|
|
355
|
+
?? (typeof flowWarning?.activityCode === "string" ? flowWarning.activityCode : undefined)
|
|
356
|
+
?? "上一节点";
|
|
357
|
+
const stateClause = workItemState === "none-flow-completed" || (finishedStatus && workItemState !== "none-no-workflow")
|
|
358
|
+
? rejected ? ",流程已结束(驳回)" : ",流程已完成"
|
|
359
|
+
: finishedStatus
|
|
360
|
+
// 无流程模型直提:完成的是数据提交,别宣称「流程」已走完。
|
|
361
|
+
? ",提交已完成(无流程)"
|
|
362
|
+
// 驳回判定必须在 nextWorkItems 之前:pending-elsewhere/无待办时
|
|
363
|
+
// 退回信息只在 returnedTo/flowWarning,旧顺序会退化成「审批待办」。
|
|
364
|
+
: rejected
|
|
365
|
+
? `,已驳回(退回 ${returnTarget})`
|
|
366
|
+
: nextWorkItems.length > 0
|
|
367
|
+
? `,审批待办${nextActivity !== undefined ? `:下一节点 ${nextActivity}` : ""}`
|
|
368
|
+
// 回执未给状态(plan 阶段/旧回执):保留原有按参数判定的口径。
|
|
369
|
+
: stringArg(args, "workItemId")
|
|
370
|
+
? ",审批待办"
|
|
371
|
+
: "";
|
|
372
|
+
return `提交数据(模型 ${schemaCode ?? "?"}${stateClause})${warnTag}${nameNote}`;
|
|
301
373
|
}
|
|
302
374
|
case "data.delete": {
|
|
303
375
|
const ids = Array.isArray(args.bizObjectIds) ? args.bizObjectIds.map(String) : [];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ENDPOINTS } from "../../endpoints.js";
|
|
2
2
|
import { assertDataRuleOptions } from "../../lanes/datarule.js";
|
|
3
3
|
import { wireCall, wireRows } from "../../wire.js";
|
|
4
|
-
import { optionalSame, sameValue } from "../compare.js";
|
|
4
|
+
import { optionalSame, sameValue, sortKeySame } from "../compare.js";
|
|
5
5
|
import { isScalarString, pushError } from "../validation.js";
|
|
6
6
|
import { toPlain } from "../yaml.js";
|
|
7
|
-
import { errorDetail } from "../../tool-types.js";
|
|
7
|
+
import { errorDetail, ToolRefusalError } from "../../tool-types.js";
|
|
8
8
|
const KEYS = new Set(["propertyCode", "dataRuleType", "options", "checkType", "childRule", "name", "sortKey", "absent"]);
|
|
9
9
|
/** Keys that describe a live rule and are meaningless on a declared-absent one. */
|
|
10
10
|
const PRESENT_ONLY_KEYS = ["options", "checkType", "childRule", "name", "sortKey"];
|
|
@@ -28,12 +28,96 @@ function rowOf(row) {
|
|
|
28
28
|
...(row.checkType !== undefined && row.checkType !== null ? { checkType: Number(row.checkType) } : {}),
|
|
29
29
|
...(row.childRule !== undefined ? { childRule: row.childRule === true } : {}),
|
|
30
30
|
...(row.name !== undefined && row.name !== null ? { name: String(row.name) } : {}),
|
|
31
|
-
//
|
|
32
|
-
//
|
|
33
|
-
|
|
34
|
-
...(row.sortKey !== undefined && row.sortKey !== null && Number(row.sortKey) !== 0 ? { sortKey: Number(row.sortKey) } : {}),
|
|
31
|
+
// Keep the platform's value verbatim (including 0): equivalence is decided
|
|
32
|
+
// by `sortKeySame`, which ignores it when the intent did not declare one.
|
|
33
|
+
...(row.sortKey !== undefined && row.sortKey !== null ? { sortKey: Number(row.sortKey) } : {}),
|
|
35
34
|
};
|
|
36
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Declared rule identity. For present rules the intent's declared `checkType`
|
|
38
|
+
* is part of the key: the platform seeds type1/checkType1..5 rules from field
|
|
39
|
+
* options (e.g. `maxLength` → type1/checkType4, `DataModelInitUtils:406-416`),
|
|
40
|
+
* so matching on `(propertyCode, dataRuleType)` alone made a user rule target
|
|
41
|
+
* the platform's auto row and silently rewrite it.
|
|
42
|
+
*
|
|
43
|
+
* A declared-absent rule carries no shape keys (validation forbids checkType),
|
|
44
|
+
* so delete keeps the historical `(propertyCode, dataRuleType)` identity.
|
|
45
|
+
*
|
|
46
|
+
* The checkType half is compared strictly (undeclared = `null`). A type1 auto
|
|
47
|
+
* row always has a numeric checkType 1..5, so an intent that omits checkType
|
|
48
|
+
* can never match — and therefore never update — a platform-seeded rule.
|
|
49
|
+
*/
|
|
50
|
+
function matchesDeclaredRule(rule, row) {
|
|
51
|
+
if (row.propertyCode !== rule.propertyCode || row.dataRuleType !== rule.dataRuleType)
|
|
52
|
+
return false;
|
|
53
|
+
if (rule.absent === true)
|
|
54
|
+
return true;
|
|
55
|
+
return (row.checkType ?? null) === (rule.checkType ?? null);
|
|
56
|
+
}
|
|
57
|
+
function candidateOf(row) {
|
|
58
|
+
return { id: row.id, ...(row.name !== undefined ? { name: row.name } : {}), ...(row.checkType !== undefined ? { checkType: row.checkType } : {}) };
|
|
59
|
+
}
|
|
60
|
+
function listRuleCommand(schemaCode, dataRuleType) {
|
|
61
|
+
return `omc call datarule.list --env <env> --args '${JSON.stringify({ schemaCode, dataRuleType })}'`;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Two live rows match the declared identity. Never pick one: the platform's
|
|
65
|
+
* auto-seeded rules and a user rule can share `(propertyCode, dataRuleType)`,
|
|
66
|
+
* and guessing is exactly how an apply silently rewrote the wrong row.
|
|
67
|
+
*/
|
|
68
|
+
function ambiguousRefusal(schemaCode, rule, rows) {
|
|
69
|
+
const candidates = rows.map(candidateOf);
|
|
70
|
+
const nextCommand = listRuleCommand(schemaCode, rule.dataRuleType);
|
|
71
|
+
const checkLabel = rule.checkType !== undefined ? ` / checkType ${rule.checkType}` : "";
|
|
72
|
+
return new ToolRefusalError({
|
|
73
|
+
status: "refused",
|
|
74
|
+
blocker: "datarule-ambiguous",
|
|
75
|
+
resource: `datarule:${schemaCode}.${rule.propertyCode}.${rule.dataRuleType}`,
|
|
76
|
+
propertyCode: rule.propertyCode,
|
|
77
|
+
dataRuleType: rule.dataRuleType,
|
|
78
|
+
...(rule.checkType !== undefined ? { checkType: rule.checkType } : {}),
|
|
79
|
+
candidates,
|
|
80
|
+
message: `字段 ${schemaCode}.${rule.propertyCode} 的 dataRuleType ${rule.dataRuleType}${checkLabel} 有 ${rows.length} 条同键规则,无法判定声明目标;本次零写入。先列出候选,声明 checkType 消歧;平台自动规则需改走 omc call datarule.update --args '{"id":"<候选 id>",...}'`,
|
|
81
|
+
nextCommand,
|
|
82
|
+
options: [
|
|
83
|
+
{ id: "read-only", destructive: false, summary: "保留现有行,先列出候选;本次未写入任何配置", readFirst: nextCommand },
|
|
84
|
+
{ id: "edit-intent", destructive: false, summary: "给 intent 的 datarule 补 checkType(type1 的校验类别)消歧后重新 plan;平台自动规则(如 maxLength 生成的 type1/checkType4)不要作为 update 目标" },
|
|
85
|
+
],
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Declared-vs-live drift with the exact key/value pairs that differ.
|
|
90
|
+
* `sortKey` only participates when the intent declares it (the platform owns
|
|
91
|
+
* the default order: first rule = 1, then max+1, per
|
|
92
|
+
* `BizDataRuleFacadeImpl.addBizDataRule:98-110`). The returned `expected` /
|
|
93
|
+
* `actual` make the difference actionable instead of a bare "不等价".
|
|
94
|
+
*/
|
|
95
|
+
function ruleMismatch(rule, row) {
|
|
96
|
+
const expected = {};
|
|
97
|
+
const actual = {};
|
|
98
|
+
if (!sameValue(optionsForComparison(rule.options, row.options), rule.options)) {
|
|
99
|
+
expected.options = rule.options;
|
|
100
|
+
actual.options = row.options;
|
|
101
|
+
}
|
|
102
|
+
if (!optionalSame(row.checkType, rule.checkType)) {
|
|
103
|
+
expected.checkType = rule.checkType ?? null;
|
|
104
|
+
actual.checkType = row.checkType ?? null;
|
|
105
|
+
}
|
|
106
|
+
if (!optionalSame(row.childRule, rule.childRule)) {
|
|
107
|
+
expected.childRule = rule.childRule ?? null;
|
|
108
|
+
actual.childRule = row.childRule ?? null;
|
|
109
|
+
}
|
|
110
|
+
if (!optionalSame(row.name, rule.name)) {
|
|
111
|
+
expected.name = rule.name ?? null;
|
|
112
|
+
actual.name = row.name ?? null;
|
|
113
|
+
}
|
|
114
|
+
if (!sortKeySame(rule.sortKey, row.sortKey)) {
|
|
115
|
+
expected.sortKey = rule.sortKey ?? null;
|
|
116
|
+
actual.sortKey = row.sortKey ?? null;
|
|
117
|
+
}
|
|
118
|
+
const keys = Object.keys(expected);
|
|
119
|
+
return keys.length > 0 ? { keys, expected, actual } : null;
|
|
120
|
+
}
|
|
37
121
|
function normalizeOptions(dataRuleType, options, propertyCode) {
|
|
38
122
|
const normalized = { ...options };
|
|
39
123
|
// The tool mirrors the target field(s) into options.propertyCodes (the real
|
|
@@ -157,24 +241,38 @@ export const dataruleCapability = {
|
|
|
157
241
|
if (!intent.datarules?.length)
|
|
158
242
|
return;
|
|
159
243
|
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.dataRuleList, query: { schemaCode: draft.code } })).data);
|
|
160
|
-
draft.datarules = rows
|
|
244
|
+
draft.datarules = rows
|
|
245
|
+
.filter((row) => row.schemaCode === draft.code)
|
|
246
|
+
.filter((row) => {
|
|
247
|
+
const dataRuleType = Number(row.dataRuleType);
|
|
248
|
+
const checkType = row.checkType !== undefined && row.checkType !== null ? Number(row.checkType) : undefined;
|
|
249
|
+
return rowCodes(row).some((propertyCode) => intent.datarules.some((rule) => matchesDeclaredRule(rule, { propertyCode, dataRuleType, ...(checkType !== undefined ? { checkType } : {}) })));
|
|
250
|
+
})
|
|
251
|
+
.map(rowOf);
|
|
161
252
|
},
|
|
162
253
|
plan(intent, baseline, emit) {
|
|
163
254
|
if (!intent.datarules?.length)
|
|
164
255
|
return;
|
|
165
256
|
for (const rule of intent.datarules) {
|
|
166
|
-
const
|
|
257
|
+
const candidates = (baseline.datarules ?? []).filter((row) => matchesDeclaredRule(rule, row));
|
|
167
258
|
const resource = `datarule:${intent.code}.${rule.propertyCode}.${rule.dataRuleType}`;
|
|
168
259
|
if (rule.absent === true) {
|
|
260
|
+
const current = candidates[0];
|
|
169
261
|
if (current)
|
|
170
262
|
emit.change("datarule.delete", { id: current.id, schemaCode: intent.code }, resource, "datarule-declared-absent");
|
|
171
263
|
else
|
|
172
264
|
emit.skip(resource, "datarule-already-absent");
|
|
173
265
|
continue;
|
|
174
266
|
}
|
|
267
|
+
// Never guess between two same-key rows (platform auto rule + user rule).
|
|
268
|
+
// Throwing here aborts the whole compile with zero writes (plan payload is
|
|
269
|
+
// a refusal; arrays are local to compileIntent).
|
|
270
|
+
if (candidates.length > 1)
|
|
271
|
+
throw ambiguousRefusal(intent.code, rule, candidates);
|
|
272
|
+
const current = candidates[0];
|
|
175
273
|
if (!current)
|
|
176
274
|
emit.change("datarule.create", { schemaCode: intent.code, ...rule }, resource, "datarule-absent");
|
|
177
|
-
else if (
|
|
275
|
+
else if (ruleMismatch(rule, current) !== null)
|
|
178
276
|
emit.change("datarule.update", { id: current.id, schemaCode: intent.code, ...rule }, resource, "datarule-drift");
|
|
179
277
|
else
|
|
180
278
|
emit.skip(resource, "datarule-present");
|
|
@@ -188,17 +286,33 @@ export const dataruleCapability = {
|
|
|
188
286
|
return;
|
|
189
287
|
const current = live.datarules ?? [];
|
|
190
288
|
for (const rule of intent.datarules) {
|
|
191
|
-
const
|
|
289
|
+
const candidates = current.filter((item) => matchesDeclaredRule(rule, item));
|
|
290
|
+
const row = candidates[0];
|
|
192
291
|
const resource = `datarule:${intent.code}.${rule.propertyCode}.${rule.dataRuleType}`;
|
|
193
292
|
if (rule.absent === true) {
|
|
194
293
|
if (row)
|
|
195
294
|
emit.difference("datarule-present-unexpected", resource, `字段 ${intent.code}.${rule.propertyCode} 的数据规则声明 absent:true 但仍存在`);
|
|
196
295
|
continue;
|
|
197
296
|
}
|
|
297
|
+
if (candidates.length > 1) {
|
|
298
|
+
// Mirrors the plan-time refusal: a converged-looking environment with
|
|
299
|
+
// two same-key rows never gets a guessed pass/fail.
|
|
300
|
+
emit.difference("datarule-mismatch", resource, `字段 ${intent.code}.${rule.propertyCode} 的 dataRuleType ${rule.dataRuleType} 有 ${candidates.length} 条同键规则,无法判定声明目标`, {
|
|
301
|
+
keys: ["candidates"],
|
|
302
|
+
expected: { candidates: 1 },
|
|
303
|
+
actual: { candidates: candidates.map(candidateOf) },
|
|
304
|
+
sourceTool: "datarule.list",
|
|
305
|
+
next: { kind: "call", command: listRuleCommand(intent.code, rule.dataRuleType) },
|
|
306
|
+
});
|
|
307
|
+
continue;
|
|
308
|
+
}
|
|
198
309
|
if (!row)
|
|
199
310
|
emit.difference("datarule-missing", resource, `字段 ${intent.code}.${rule.propertyCode} 的数据规则不存在`);
|
|
200
|
-
else
|
|
201
|
-
|
|
311
|
+
else {
|
|
312
|
+
const mismatch = ruleMismatch(rule, row);
|
|
313
|
+
if (mismatch !== null)
|
|
314
|
+
emit.difference("datarule-mismatch", resource, `字段 ${intent.code}.${rule.propertyCode} 的数据规则不等价(${mismatch.keys.join("、")})`, { keys: mismatch.keys, expected: mismatch.expected, actual: mismatch.actual });
|
|
315
|
+
}
|
|
202
316
|
}
|
|
203
317
|
},
|
|
204
318
|
};
|
package/dist/intent/compare.js
CHANGED
|
@@ -35,6 +35,24 @@ export function canonicalValue(value) {
|
|
|
35
35
|
export function sameValue(left, right) {
|
|
36
36
|
return canonicalValue(left) === canonicalValue(right);
|
|
37
37
|
}
|
|
38
|
+
/**
|
|
39
|
+
* Equivalence for a platform-owned ordering column. The platform ASSIGNS
|
|
40
|
+
* `sortKey` on insert (first rule = 1, then max+1 — see
|
|
41
|
+
* `BizDataRuleFacadeImpl.addBizDataRule`, 8.6.26 :98-110 and 2.1.5 :116-133);
|
|
42
|
+
* the value is not derived from the caller. So an intent that omits `sortKey`
|
|
43
|
+
* accepts whatever order the platform backfilled; only an explicitly declared
|
|
44
|
+
* value is compared.
|
|
45
|
+
*
|
|
46
|
+
* Probe H F1: the platform backfilled `sortKey:1` on the first rule while the
|
|
47
|
+
* intent omitted it, so comparing `undefined` against `1` made a fully applied
|
|
48
|
+
* environment report `datarule-mismatch`, and every re-plan re-sent the
|
|
49
|
+
* update — plan/apply never converged.
|
|
50
|
+
*/
|
|
51
|
+
export function sortKeySame(declared, live) {
|
|
52
|
+
if (declared === undefined || declared === null)
|
|
53
|
+
return true;
|
|
54
|
+
return sameValue(declared, live);
|
|
55
|
+
}
|
|
38
56
|
/**
|
|
39
57
|
* Equivalence for an optional field: a missing value equals the platform's
|
|
40
58
|
* `false` default in EITHER direction. The real platform stores `childRule:false`
|
package/dist/intent/readback.js
CHANGED
|
@@ -81,6 +81,9 @@ function differenceOf(kind, resource, message, detail) {
|
|
|
81
81
|
...(next !== undefined ? { next } : {}),
|
|
82
82
|
...(escapeHatch !== undefined ? { escapeHatch } : {}),
|
|
83
83
|
...(safeToReplan !== undefined ? { safeToReplan } : {}),
|
|
84
|
+
...(detail?.expected !== undefined ? { expected: detail.expected } : {}),
|
|
85
|
+
...(detail?.actual !== undefined ? { actual: detail.actual } : {}),
|
|
86
|
+
...(detail?.keys !== undefined ? { keys: detail.keys } : {}),
|
|
84
87
|
};
|
|
85
88
|
}
|
|
86
89
|
/**
|
package/dist/intent/schema.js
CHANGED
|
@@ -148,7 +148,7 @@ export function intentSchemaBlock() {
|
|
|
148
148
|
},
|
|
149
149
|
form: { required: ["publish"], optional: ["fieldCodes"] },
|
|
150
150
|
listview: { required: [], optional: ["code", "name", "fieldCodes", "absent"], note: "intent 只声明列;业务筛选/排序/按钮 apply 后用 omc call listview.configure 补" },
|
|
151
|
-
datarules: { required: ["propertyCode", "dataRuleType"], optional: ["options", "checkType", "childRule", "name", "sortKey", "absent"], note: "type3/4/5 不驱动门户;门户条件走 fields[].options" },
|
|
151
|
+
datarules: { required: ["propertyCode", "dataRuleType"], optional: ["options", "checkType", "childRule", "name", "sortKey", "absent"], note: "type3/4/5 不驱动门户;门户条件走 fields[].options;未声明 sortKey=顺序归平台、不参与比较,显式声明才严格比较" },
|
|
152
152
|
rules: {
|
|
153
153
|
required: ["code", "name(预置触发行 Create/Update/Delete… 可省略,声明的 name 不会生效)", "enabled"],
|
|
154
154
|
optional: ["bizRuleType", "customTrigger", "actions", "nodeGraph"],
|
|
@@ -17,7 +17,7 @@ export const DATARULE_WIRE = Object.freeze({
|
|
|
17
17
|
delete: "bizdatarule/delete?id=<ruleId> (@RequestParam String id) with list exact-absence readback",
|
|
18
18
|
dataRuleTypes: "DataRuleType: 1 CHECK_RULE (校验), 2 CALCULATE_RULE (计算/拼接), 3 DISPLAY_RULE (显示), 4 OTHER_RULE (必填), 5 READ_ONLY_RULE (只读); 8 EXTENSION_RULE is out of scope",
|
|
19
19
|
dataRuleCheckTypes: "dataRuleType 1 (CHECK_RULE 提交校验规则) 的 checkType 判别(cloudpivot-shared DataRuleCheckType.java)——**校验类需求走这里,不要写在线 JS**:1 REGEX_CHECK 正则校验 / 2 SUBMIT_CHECK 提交校验(含跨字段比较)/ 3 EMPTY_ROW_CHECK 空行校验 / 4 MAX_LENGTH_CHECK 最大长度校验 / 5 REPEAT_CHECK 重复校验;checkType 只配 dataRuleType 1,缺省或非法值由工具拒绝。**数值上下限没有专用类型——用 checkType 2 提交校验表达(如 数量≥0:options 提交校验条件 {quantity}>=0,r21 实证)**",
|
|
20
|
-
optionsByCheckType: "各 checkType 的 options 白名单(工具会拒绝 unknownOptionKeys,避免平台静默忽略;运行版 1.1.25 SubmitCheckValidator/RepeatCheckValidator 反编译实证 2026-11-06):1 REGEX_CHECK{regexp,regexpText};2 SUBMIT_CHECK{conditions,verifyType,prompt}(verifyType 的拒用取值=submitDenied——它是 verifyType 的值,不是独立键);3 EMPTY_ROW_CHECK{isEmptyRow,isEmptyRowTips};4 MAX_LENGTH_CHECK{maxLength};5 REPEAT_CHECK{noRepeat,properties,isSubTableValidationAllData,prompt}。checkType-2 的 prompt 是纯文本(门户 raw 渲染 options.prompt,不做富文本解析)。重复提示逐项/数组解析,RepeatCheckValidator:258-272:isDataItem=0 → code 是字面文案;isDataItem=1 → code 是字段 code。checkType=5 的唯一去重键是 options.noRepeat(配合 properties),平台 REST 也会拦重复;conditions/regexp/maxLength
|
|
20
|
+
optionsByCheckType: "各 checkType 的 options 白名单(工具会拒绝 unknownOptionKeys,避免平台静默忽略;运行版 1.1.25 SubmitCheckValidator/RepeatCheckValidator 反编译实证 2026-11-06):1 REGEX_CHECK{regexp,regexpText};2 SUBMIT_CHECK{conditions,verifyType,prompt}(verifyType 的拒用取值=submitDenied——它是 verifyType 的值,不是独立键);3 EMPTY_ROW_CHECK{isEmptyRow,isEmptyRowTips};4 MAX_LENGTH_CHECK{maxLength};5 REPEAT_CHECK{noRepeat,properties,isSubTableValidationAllData,prompt}。checkType-2 的 prompt 是纯文本(门户 raw 渲染 options.prompt,不做富文本解析)。重复提示逐项/数组解析,RepeatCheckValidator:258-272:isDataItem=0 → code 是字面文案;isDataItem=1 → code 是字段 code。checkType=5 的唯一去重键是 options.noRepeat(配合 properties),平台 REST 也会拦重复;conditions/regexp/maxLength 等默认只在门户前端提交面执行(**dist 级证据**:同一表单 HTTP 模块在 admin `19497.069256cf.js` 与 portal-app `34987.2913aa1b.js` 为同名双份,过滤条件相同)。CLI `data.submit`/`data.save` 走 runtime/form,服务端 `DataRuleProcessor.checkMainNonNullProperty` 只对**空值**跑规则:非空 continue(2.1.5 :102 / 8.6.26 :115),null 才 `executeDataRules`(2.1.5 :112 / 8.6.26 :125),所以字段为空时仍可能按必填类错误拒。提交面只额外跑 checkType5 重复校验(BizFormRuntimeFacadeImpl.java:164)与 2.1.5 独有的 validateHiddenProperties 隐藏字段校验(AbstractFormRuntimeController.java:157-208;8.6.26/8.7 的 DataRuleOptions 无此键、不执行);条件校验只在 OpenAPI 表单保存入口 `BaseController.checkDataRules`(2.1.5 :1245-1281)执行。`data.submit` 按此分类回执:dataRulesNotExecuted{count,checkTypes,hiddenRulesPresent,autoLengthRules?};平台自动 type1+checkType4 长度规则不计入 count。",
|
|
21
21
|
optionsByType: "options is a JSON string read per type: 1 check keys (verifyFormula/regexp/maxLength/isEmptyRow/noRepeat/conditions), 2 FormulaConfig — `shortTextStitch` (falling back to `value`) MUST be a JSON OBJECT STRING whose `formula` key holds the expression, e.g. {\"shortTextStitch\":\"{\\\"formula\\\":\\\"{field}\\\",\\\"editorText\\\":\\\"{字段名}\\\"}\"}; a bare \"{field}\" string fails JSONUtil.isJson → getCalRuleExpression returns null → false 305003 dead-cycle; `formulaType:\"AGGREGATION\"` instead reads `aggregation`; a top-level `expression` is NEVER read (it is only a key INSIDE that nested JSON), 3 displayFormula, 4 requiredFormula, 5 readonlyCondition",
|
|
22
22
|
formulaReference: "类型2 公式引用按位置解析:裸 {字段}=**主记录**字段;带点 {子表code.字段}=**子表**字段(FormulaProcessor.constructSubExprParamsValueMap 要求点前等于子表 schema)。所以**主表公式**用裸 {字段}(带 {主表code.字段} 会按子表解析 → 值空/静默 null),**子表公式**(childRule:true)引用同级子字段必须带点 {子表code.字段}(裸引用被当主记录字段 → 值缺失 → 提交 50000)。工具在写前按子表已发布字段判定并拒绝裸引用(blocker datarule-formula-child-bare-reference),读回对存量子表公式加 formulaHint 提示复核。",
|
|
23
23
|
optionsEncoding: "the engine JSON-parses the `options` column and reads requiredFormula / readonlyCondition / displayFormula / verifyFormula / shortTextStitch (whose VALUE is itself a JSON string carrying `formula`); send options as a stringified object",
|
|
@@ -87,6 +87,7 @@ export const DATARULE_LANE_CONTRACT = Object.freeze({
|
|
|
87
87
|
"`dataRuleType` → options 键:3→displayFormula、4→requiredFormula(无条件必填=`\"true\"`)、5→readonlyCondition;1/2 的键与逐类型白名单见 `dataRuleType` 参数。8 EXTENSION out of scope.",
|
|
88
88
|
"`childRule:true` 仅用于已发布的子表列(propertyCode/propertyCodes 必须是子表列 code;主表字段省略)。子表列在发布面不可见时先用 field.create + field.publish 生成列,不要直接 POST datarule.create。",
|
|
89
89
|
"**⚠️ type3/4/5 两个读面**:门户**运行时**读**字段 options**(`field.create/update` 写),设计器**设计态** Set/Unset 读 **bizdatarule/list**(本行)。**type3/4/5 规则单独不会让门户表单控件变必填/只读**,符号式经 `historyOpt` 镜像还会让表单渲染崩溃——运行时条件请用中文操作符;表单条件优先走 `field.update`(自动配对本行)。",
|
|
90
|
+
"**type1(checkType1–4)默认仅门户提交执行;REST 数据面(data.submit/save)对非空值不跑**(空值仍校验)。`datarule.list` 读回为准,服务端强制用业务规则。",
|
|
90
91
|
"**类型3/4/5 条件串协议(平台 create 不校验,坏形状落库即雷,工具按此协议拒绝)**:`{字段code} 操作符 [值]`。操作符取 **bizdatarule 词表**(与字段 options 的表单交互引擎不同——那是符号式):**中文** 等于/不等于/大于/小于/大于等于/小于等于/包含/不包含/包含全部/不包含全部/包含任意一个/不包含任意一个/等于任意一个/属于/不属于/介于/为空/不为空,也接受符号 `==` `!=` `>` `<` `>=` `<=` `Contains` `IsEmpty` 等。为空/不为空**不带值**(`{field} 不为空`);其余带值(JSON 对象或标量)。多条件 ` && `、多组 ` || `。示例 type4:`options:{requiredFormula:\"{amount} 等于 {\\\"valueType\\\":\\\"specifyOption\\\",\\\"value\\\":\\\"A\\\"}\"}`。**字段绑定用 `propertyCodes`(数组)**,工具自动把 `options.propertyCodes` 也补上。",
|
|
91
92
|
"`options` is a JSON object sent to the wire as a JSON string(逐类型必读键见 `options` 参数面)。",
|
|
92
93
|
"类型2(计算/拼接):`options.shortTextStitch`(或 `value`)的值**必须是含 `formula` 的 JSON 对象字符串**,裸串会被工具拒绝(否则引擎返回 null → 误报 305003 死循环);顶层没有 `expression` 键——它只是该嵌套 JSON 内部的字段名(可照抄 `--example field-compute-rule`)。",
|
package/dist/lanes/datarule.js
CHANGED
|
@@ -15,6 +15,7 @@ import { DATARULE_LANE_CONTRACT, DATARULE_TYPE_OPTION_KEYS } from "./datarule-co
|
|
|
15
15
|
import { normalizeAggregationFormula } from "../field-families.js";
|
|
16
16
|
import { CONDITION_PROTOCOL_EXAMPLES, dataRuleOptionsShapeError } from "./datarule-protocol.js";
|
|
17
17
|
import { readModelRecord } from "../model-record.js";
|
|
18
|
+
import { partitionVersion } from "../version-partition.js";
|
|
18
19
|
const DATARULE_LANE = DATARULE_LANE_CONTRACT.lane;
|
|
19
20
|
const DATARULE_TOOLS = DATARULE_LANE_CONTRACT.tools;
|
|
20
21
|
const dataRuleTypeArg = z
|
|
@@ -195,9 +196,58 @@ function dataRuleExecutionWarning(checkType) {
|
|
|
195
196
|
if (checkType === 5)
|
|
196
197
|
return "重复校验 noRepeat 由服务端拦截,REST `data.submit` 亦会拒绝重复数据(errcode 800150006);properties 指定参与去重的字段。";
|
|
197
198
|
if (checkType === 1 || checkType === 2 || checkType === 3 || checkType === 4)
|
|
198
|
-
return "
|
|
199
|
+
return "该校验规则默认仅由门户前端提交校验执行;REST `data.submit` 不拦截违规数据(显式声明 validateHiddenProperties 的隐藏字段校验除外)。需要服务端拦截请改用业务规则(BIZ_ACTION/条件)。";
|
|
199
200
|
return "校验规则的执行面取决于 checkType;请在门户提交面验收,未提供 checkType 时不要把 REST 行为视为已验证。";
|
|
200
201
|
}
|
|
202
|
+
/** 版本证据 → hidden 校验执行面。2.1.x(含客户口径 8.8)执行;8.6/8.7/1.1 不执行。 */
|
|
203
|
+
export function dataRuleSubmitContext(session) {
|
|
204
|
+
const raw = session.detectedVersion() ?? session.rawSystemVersion() ?? "";
|
|
205
|
+
const partition = partitionVersion(raw);
|
|
206
|
+
const match = /^(\d+)\.(\d+)/u.exec(partition.matched);
|
|
207
|
+
const versionLabel = raw.trim().length > 0 ? raw.trim() : "版本证据不足";
|
|
208
|
+
const versionFamilyLabel = partition.family === "anchor-8.6"
|
|
209
|
+
? "8.6.x"
|
|
210
|
+
: partition.family === "legacy-8.0-8.5"
|
|
211
|
+
? "8.0–8.5(8.1.108 等)"
|
|
212
|
+
: partition.family === "legacy-1.1"
|
|
213
|
+
? "1.1.x(1.1.25 等)"
|
|
214
|
+
: partition.family === "ai-platform"
|
|
215
|
+
? /^8\.7\./u.test(partition.matched)
|
|
216
|
+
? "8.7.x(AI-Platform v1.1.x)"
|
|
217
|
+
: "2.1.x(AI-Platform 2.1+)"
|
|
218
|
+
: "版本族未识别";
|
|
219
|
+
const base = { versionLabel, versionFamilyLabel };
|
|
220
|
+
if (match === null)
|
|
221
|
+
return { hiddenSubmitCheck: "unknown", ...base };
|
|
222
|
+
const major = Number(match[1]);
|
|
223
|
+
const minor = Number(match[2]);
|
|
224
|
+
if (major === 2 && minor === 1)
|
|
225
|
+
return { hiddenSubmitCheck: "yes", ...base };
|
|
226
|
+
if (major === 8 && minor === 8)
|
|
227
|
+
return { hiddenSubmitCheck: "yes", ...base }; // 客户口径 8.8 = 2.1.x
|
|
228
|
+
if (major === 8 && minor >= 6 && minor <= 7)
|
|
229
|
+
return { hiddenSubmitCheck: "no", ...base };
|
|
230
|
+
if (major === 8 && minor <= 5)
|
|
231
|
+
return { hiddenSubmitCheck: "no", ...base };
|
|
232
|
+
if (major === 1 && minor === 1)
|
|
233
|
+
return { hiddenSubmitCheck: "no", ...base };
|
|
234
|
+
return { hiddenSubmitCheck: "unknown", ...base };
|
|
235
|
+
}
|
|
236
|
+
const PORTAL_NOTE_NON_HIDDEN = "该校验在门户表单提交时执行;CLI `data.submit`/`data.save`(REST runtime/form 路径)对**非空值**不执行(字段为空时平台仍会走空值校验,可能按必填类错误拒)——配置正确性以 datarule.list 读回为准,服务端强制请改用业务规则(BIZ_ACTION/条件)。";
|
|
237
|
+
/**
|
|
238
|
+
* `datarule.create` 的执行面 note。声明 `validateHiddenProperties` 时**只换
|
|
239
|
+
* 文案不抑制**:该键 2.1.5 独有,2.1.x 的 submit 面会跑,8.6.26/8.7 不跑。
|
|
240
|
+
*/
|
|
241
|
+
export function dataRuleRuntimeNote(options, context) {
|
|
242
|
+
const hidden = options.validateHiddenProperties;
|
|
243
|
+
if (!Array.isArray(hidden) || hidden.length === 0)
|
|
244
|
+
return PORTAL_NOTE_NON_HIDDEN;
|
|
245
|
+
if (context.hiddenSubmitCheck === "yes")
|
|
246
|
+
return `该规则声明 validateHiddenProperties:2.1.5+ 的 \`data.submit\` submit 面会执行这组隐藏字段校验(当前环境 ${context.versionLabel});其余条件仍以门户提交为准。配置正确性以 datarule.list 读回为准。`;
|
|
247
|
+
if (context.hiddenSubmitCheck === "no")
|
|
248
|
+
return `该规则声明 validateHiddenProperties,但该键是 2.1.5+ 独有:当前环境 ${context.versionLabel}(${context.versionFamilyLabel})的 \`data.submit\` 不执行它。配置正确性以 datarule.list 读回为准,验收走门户或 2.1.5+ 环境。`;
|
|
249
|
+
return `该规则声明 validateHiddenProperties:只有 2.1.5+(含客户口径 8.8)的 submit 面会执行;当前环境 ${context.versionLabel}(${context.versionFamilyLabel}),按未执行对待。配置正确性以 datarule.list 读回为准。`;
|
|
250
|
+
}
|
|
201
251
|
/**
|
|
202
252
|
* Fail closed when the options object cannot carry the key the engine reads
|
|
203
253
|
* for this type (RequiredDataRuleValidator / ReadOnlyValidator /
|
|
@@ -964,6 +1014,7 @@ export function registerDataRuleLane(tools) {
|
|
|
964
1014
|
? await runtimeWriteWithAppMapping(session, args.schemaCode, 305003, "datarule.create 类型2 CALCULATE 报死循环(305003,误判)", createRule)
|
|
965
1015
|
: await createRule();
|
|
966
1016
|
const rules = (await listDataRules(session, args.schemaCode, args.dataRuleType)).filter((row) => storedTargetCodes(row).some((code) => codes.includes(code)));
|
|
1017
|
+
const submitContext = dataRuleSubmitContext(session);
|
|
967
1018
|
return {
|
|
968
1019
|
performed: { errcode: performed.errcode },
|
|
969
1020
|
readback: {
|
|
@@ -977,7 +1028,13 @@ export function registerDataRuleLane(tools) {
|
|
|
977
1028
|
// 提交违规数据(-50 / 超阈值)errcode 0 放行、原值落库——校验在门户前端
|
|
978
1029
|
// 提交管线执行,REST 不拦。先告知执行面,省掉「先实测两轮才发现不生效」。
|
|
979
1030
|
...(args.dataRuleType === 1
|
|
980
|
-
? {
|
|
1031
|
+
? {
|
|
1032
|
+
executionWarning: dataRuleExecutionWarning(args.checkType),
|
|
1033
|
+
// P1(探针 H F3,复核 2026-11-27):声明 validateHiddenProperties
|
|
1034
|
+
// 的行**不抑制**提示——该键 2.1.5 独有,8.6.26/8.7 不执行;只按
|
|
1035
|
+
// 版本事实换文案。checkType5 是服务端重复校验,单独一类。
|
|
1036
|
+
...(args.checkType !== 5 ? { runtimeNote: dataRuleRuntimeNote(args.options, submitContext) } : {}),
|
|
1037
|
+
}
|
|
981
1038
|
: {}),
|
|
982
1039
|
...(() => { const w = dataRuleFormulaWarnings(args.dataRuleType, args.options); return w.length ? { lintWarnings: w } : {}; })(),
|
|
983
1040
|
},
|
|
@@ -15,6 +15,7 @@ import { getInstanceBaseInfo, getReplayToken, isFinishedInstanceStatus, listInst
|
|
|
15
15
|
import { PLATFORM_ADMIN_START_BYPASS, resolvePermissionActor } from "../identity.js";
|
|
16
16
|
import { ENGINE_OWNED_KEYS, RUNTIME_DATA_LANE_CONTRACT, RUNTIME_DATA_WIRE, runtimeFormDataArg, } from "./runtime-data-contract.js";
|
|
17
17
|
import { scanPages } from "./runtime-paging.js";
|
|
18
|
+
import { dataRuleSubmitContext } from "./datarule.js";
|
|
18
19
|
import { decodeJsonColumn, JSON_COLUMN_NULL_COALESCE } from "../json-column.js";
|
|
19
20
|
import { FIELD_PROPERTY_TYPES, SYSTEM_FIELD_CODES, familyName } from "../field-families.js";
|
|
20
21
|
import { applicationResolutionOf, resolveApplicationScope } from "../support.js";
|
|
@@ -186,6 +187,31 @@ async function resolvePublishedWorkflowCode(session, schemaCode) {
|
|
|
186
187
|
const code = template && typeof template.workflowCode === "string" && template.workflowCode.length > 0 ? template.workflowCode : null;
|
|
187
188
|
return code;
|
|
188
189
|
}
|
|
190
|
+
/**
|
|
191
|
+
* F2(w112 探针 H,P1):`data.save` 不带 `workflowCode` 落的是**普通 sheet
|
|
192
|
+
* 草稿**,没有流程实例。该模型若有已发布流程,这行之后永远提交不了:
|
|
193
|
+
* `data.submit` 只能走 `submit-existing-workflow-unsupported`。
|
|
194
|
+
*
|
|
195
|
+
* 检测只读**一次** `workflow/getWorkflow`:该面就是
|
|
196
|
+
* `WorkflowTemplateController.getWorkflow`(8.6.26 decompiled-engine
|
|
197
|
+
* `1372-1393`:按 schemaCode 取 published 头 `:1378`,返回已发布模板
|
|
198
|
+
* `:1383-1384`,无则 `data:null` `:1379-1380`),一次同时回答「有没有」和
|
|
199
|
+
* 「code 是什么」。不用 `workflow/isworkflow` 先探——它只证明「有任意头」,
|
|
200
|
+
* 且真机会滞后于真实绑定(BUG-05-F8),单读 getWorkflow 既少一跳也更准。
|
|
201
|
+
*
|
|
202
|
+
* 读失败只意味着「**本次无法确认**」,绝不把已落库的写退化成 error,也绝不
|
|
203
|
+
* 把「没查到」当「没流程」(回执带 `workflowCheckSkipped.reason`)。
|
|
204
|
+
*/
|
|
205
|
+
async function resolvePublishedWorkflowCodeForNote(session, schemaCode) {
|
|
206
|
+
try {
|
|
207
|
+
const template = (await wireCall(session, { path: ENDPOINTS.workflowGetBySchema, query: { schemaCode } })).data;
|
|
208
|
+
return { code: template && typeof template.workflowCode === "string" && template.workflowCode.length > 0 ? template.workflowCode : null };
|
|
209
|
+
}
|
|
210
|
+
catch (error) {
|
|
211
|
+
const detail = error instanceof WireError ? `errcode ${error.errcode ?? "?"}: ${error.message}` : error instanceof Error ? error.message : String(error);
|
|
212
|
+
return { code: null, skipped: { reason: `workflow/getWorkflow 读取失败,本次未能确认是否有已发布流程(${detail})` } };
|
|
213
|
+
}
|
|
214
|
+
}
|
|
189
215
|
export function extractBizObjectPage(value) {
|
|
190
216
|
const root = value && typeof value === "object" ? value : {};
|
|
191
217
|
const candidate = root.bizObjectPage && typeof root.bizObjectPage === "object" ? root.bizObjectPage : root;
|
|
@@ -479,6 +505,13 @@ const isKeyTwinProjectionCode = (key) => key.endsWith("_") || key.endsWith("_key
|
|
|
479
505
|
* 它们**不由视图列决定**,所以视图清单里没有也不代表「未投影」——此时 null 就是真值。
|
|
480
506
|
* 只有白名单外的系统列(典型 `sequenceNo`、`version`)才随视图列证据判。
|
|
481
507
|
*/
|
|
508
|
+
/**
|
|
509
|
+
* 即便列在视图里,平台 `runtime/query/list` 也不回值、恒为 null 的系统列。
|
|
510
|
+
* `sequenceNo` 就是典型(`completeSystemFields` 白名单不含它:8.6.26
|
|
511
|
+
* `BizObjectFacadeImpl:4870` / 2.1.5 `QueryDisplayFieldResolver.REQUIRED_SYSTEM_FIELDS:38`),
|
|
512
|
+
* 而 `data.load` 同记录有值。null 因此不代表真空值——与未投影同判(省略键)。
|
|
513
|
+
*/
|
|
514
|
+
const RUNTIME_NEVER_VALUED_WHEN_NULL = new Set(["sequenceNo"]);
|
|
482
515
|
const RUNTIME_ALWAYS_PROJECTED_FIELD_CODES = new Set([
|
|
483
516
|
"id", "name", "owner", "creater", "createdTime", "modifiedTime", "sequenceStatus",
|
|
484
517
|
"workflowInstanceId", "ownerDeptId", "ownerDeptQueryCode",
|
|
@@ -495,6 +528,9 @@ export function itemUnprojectedFields(fields, projectionMiss, viewColumnCodes) {
|
|
|
495
528
|
if (value !== null && value !== undefined)
|
|
496
529
|
return false;
|
|
497
530
|
if (inView !== undefined) {
|
|
531
|
+
// 视图含 sequenceNo 也不代表平台会回值(completeSystemFields 白名单不含它)。
|
|
532
|
+
if (RUNTIME_NEVER_VALUED_WHEN_NULL.has(code))
|
|
533
|
+
return true;
|
|
498
534
|
if (RUNTIME_ALWAYS_PROJECTED_FIELD_CODES.has(code))
|
|
499
535
|
return false;
|
|
500
536
|
return !inView.has(code);
|
|
@@ -535,6 +571,19 @@ export function omitUnprojectedFields(items) {
|
|
|
535
571
|
return { ...item, fields };
|
|
536
572
|
});
|
|
537
573
|
}
|
|
574
|
+
/**
|
|
575
|
+
* F5(w112 探针 H,P2):行级 `unprojected` 是权威点名,但 compact 会把大结果的
|
|
576
|
+
* `items` 外置——外置后行内证据只剩 artifact 里。顶层给一个**跨行并集计数**,
|
|
577
|
+
* 让人类摘要行在外置/内联两种形状下都能说「N 个未投影字段已省略」(仍是同一份
|
|
578
|
+
* `items[].unprojected` 证据,不新增判据)。
|
|
579
|
+
*/
|
|
580
|
+
export function unprojectedFieldCodes(items) {
|
|
581
|
+
const seen = new Set();
|
|
582
|
+
for (const item of items)
|
|
583
|
+
for (const code of item.unprojected ?? [])
|
|
584
|
+
seen.add(code);
|
|
585
|
+
return [...seen];
|
|
586
|
+
}
|
|
538
587
|
/** 人类/脚本读 null 的唯一权威口径;与行级 `unprojected` 同时出现才完整。 */
|
|
539
588
|
export const DATA_LIST_NULL_SEMANTICS = "items[].fields.<code> 键缺席=字段不存在或该行已判定未投影(items[].unprojected 已省略该键;有视图列证据时系统列如 sequenceNo 与业务列同判);键在且值为 null 才是真空值;判真值用 data.load。";
|
|
540
589
|
/**
|
|
@@ -1182,6 +1231,88 @@ async function portalRequiredViolations(session, schemaCode, sheetCode, formData
|
|
|
1182
1231
|
});
|
|
1183
1232
|
return { requiredFields, missingRequired, requiredFace: publishedJson !== undefined ? "published" : "draft" };
|
|
1184
1233
|
}
|
|
1234
|
+
/**
|
|
1235
|
+
* `dataRuleType:1` checkType 1–4 (提交校验/正则/长度/空行) default to the PORTAL
|
|
1236
|
+
* form's submit validation. The REST runtime/form/save|submit path that
|
|
1237
|
+
* `data.save`/`data.submit` use only runs rules for NULL field values:
|
|
1238
|
+
* `BizObjectManagerImpl.insert/update → executeDataRule →
|
|
1239
|
+
* DataRuleProcessor.checkMainNonNullProperty` calls `executeDataRules` only for
|
|
1240
|
+
* null values (2.1.5 DataRuleProcessor.java:102 continue / :112 execute;
|
|
1241
|
+
* 8.6.26 :115 / :125). An empty field may still be rejected by the required
|
|
1242
|
+
* pass. `verifyControlProperty` runs only checkType5 repeat rules.
|
|
1243
|
+
*
|
|
1244
|
+
* Two classifications the warning must keep straight:
|
|
1245
|
+
* - platform auto `type1+checkType4` max-length rows (one per text field) are
|
|
1246
|
+
* counted separately, never as user rules (AGENTS 0.6.97: 35 per model);
|
|
1247
|
+
* - `validateHiddenProperties` is a 2.1.5-only key and its rows ARE run by
|
|
1248
|
+
* `hiddenPropertySubmitCheck` on submit in 2.1.x, but NOT on 8.6.26/8.7 —
|
|
1249
|
+
* never suppress the disclosure, only change the wording (review 2026-11-27).
|
|
1250
|
+
*
|
|
1251
|
+
* Read once, best effort; a read failure must never block the submit and must
|
|
1252
|
+
* be distinguishable from "no rules" (`dataRulesExecution:"unknown"`).
|
|
1253
|
+
*/
|
|
1254
|
+
function isAutoMaxLengthRule(row) {
|
|
1255
|
+
return Number(row.dataRuleType) === 1 && Number(row.checkType) === 4;
|
|
1256
|
+
}
|
|
1257
|
+
function hasHiddenValidation(row) {
|
|
1258
|
+
let options = row.options;
|
|
1259
|
+
if (typeof options === "string") {
|
|
1260
|
+
try {
|
|
1261
|
+
options = JSON.parse(options);
|
|
1262
|
+
}
|
|
1263
|
+
catch {
|
|
1264
|
+
return false;
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1267
|
+
const hidden = options && typeof options === "object" ? options.validateHiddenProperties : undefined;
|
|
1268
|
+
return Array.isArray(hidden) && hidden.length > 0;
|
|
1269
|
+
}
|
|
1270
|
+
async function portalOnlyDataRules(session, schemaCode) {
|
|
1271
|
+
const context = dataRuleSubmitContext(session);
|
|
1272
|
+
try {
|
|
1273
|
+
const rows = wireRows((await wireCall(session, { path: ENDPOINTS.dataRuleList, query: { schemaCode, dataRuleType: "1" } })).data);
|
|
1274
|
+
const autoLengthRules = rows.filter(isAutoMaxLengthRule).length;
|
|
1275
|
+
const userRules = rows.filter((row) => Number(row.dataRuleType ?? 1) === 1 &&
|
|
1276
|
+
!isAutoMaxLengthRule(row) &&
|
|
1277
|
+
[1, 2, 3, 4].includes(Number(row.checkType)));
|
|
1278
|
+
return {
|
|
1279
|
+
kind: "checked",
|
|
1280
|
+
count: userRules.length,
|
|
1281
|
+
checkTypes: [...new Set(userRules.map((row) => Number(row.checkType)))].sort((a, b) => a - b),
|
|
1282
|
+
hiddenRulesPresent: userRules.filter(hasHiddenValidation).length,
|
|
1283
|
+
autoLengthRules,
|
|
1284
|
+
context,
|
|
1285
|
+
};
|
|
1286
|
+
}
|
|
1287
|
+
catch (error) {
|
|
1288
|
+
return { kind: "unknown", reason: error instanceof Error ? error.message : String(error), context };
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
/** The `dataRulesNotExecuted.message`; hidden rows and auto length rows are classified, not swallowed. */
|
|
1292
|
+
function dataRuleNotExecutedMessage(schemaCode, scan) {
|
|
1293
|
+
const hidden = scan.hiddenRulesPresent;
|
|
1294
|
+
const nonHidden = scan.count - hidden;
|
|
1295
|
+
const opening = nonHidden > 0
|
|
1296
|
+
? `本次提交未经过门户提交校验:${schemaCode} 有 ${scan.count} 条 dataRuleType=1 校验规则(checkType ${scan.checkTypes.join("/")})`
|
|
1297
|
+
: `本次提交的数据规则按 validateHiddenProperties 分类:${schemaCode} 有 ${scan.count} 条 dataRuleType=1 校验规则(checkType ${scan.checkTypes.join("/")})`;
|
|
1298
|
+
const parts = [opening];
|
|
1299
|
+
if (nonHidden > 0)
|
|
1300
|
+
parts.push(`其中 ${nonHidden} 条未声明 validateHiddenProperties:REST data.submit 对**非空值**不执行它们(字段为空时平台仍会走空值校验,可能按必填类错误拒)`);
|
|
1301
|
+
if (hidden > 0) {
|
|
1302
|
+
const both = `其中 ${hidden} 条声明 validateHiddenProperties:2.1.5+ 的 submit 面会执行;8.6.26/8.7 不执行`;
|
|
1303
|
+
const env = scan.context.hiddenSubmitCheck === "yes"
|
|
1304
|
+
? `当前环境 ${scan.context.versionLabel} 属 2.1.x,这 ${hidden} 条会跑`
|
|
1305
|
+
: scan.context.hiddenSubmitCheck === "no"
|
|
1306
|
+
? `当前环境 ${scan.context.versionLabel}(${scan.context.versionFamilyLabel})不执行`
|
|
1307
|
+
: `当前环境 ${scan.context.versionLabel}(${scan.context.versionFamilyLabel}),按未执行对待`;
|
|
1308
|
+
parts.push(`${both}(${env})`);
|
|
1309
|
+
}
|
|
1310
|
+
if (!(nonHidden === 0 && hidden > 0 && scan.context.hiddenSubmitCheck === "yes"))
|
|
1311
|
+
parts.push("这些规则对非空值不生效,违规值会照常落库/进入审批");
|
|
1312
|
+
parts.push("配置正确性以 datarule.list 读回为准;要在服务端强制拦截请改用业务规则");
|
|
1313
|
+
const message = `${parts.join(";")}。`;
|
|
1314
|
+
return scan.autoLengthRules > 0 ? `${message}另有 ${scan.autoLengthRules} 条平台自动生成长度规则(type1+checkType4,无法区分手工创建的 checkType4)未计入。` : message;
|
|
1315
|
+
}
|
|
1185
1316
|
/** 提交面:formData 里出现任何非空人员字段值即返回(issue#10:两种形状都可能 50000,可靠链路是提交省略)。 */
|
|
1186
1317
|
async function staffFieldsPresent(session, schemaCode, formData) {
|
|
1187
1318
|
const STAFF_TYPES = new Set([50, 51, 52]);
|
|
@@ -2256,6 +2387,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2256
2387
|
// F5(w53):已判定未投影的列从 fields 省略键(unprojected 仍是证据);
|
|
2257
2388
|
// 无证据的 null(真空值)保留。诊断都已用带 null 的 items 算完再省略。
|
|
2258
2389
|
const itemsFinal = omitUnprojectedFields(itemsWithProjection);
|
|
2390
|
+
const unprojectedCodes = unprojectedFieldCodes(itemsFinal);
|
|
2259
2391
|
const anyNullField = itemsFinal.some((item) => Object.values(item.fields).some((value) => value === null));
|
|
2260
2392
|
// F5(w63,P1):columns 只能收窄视图列;视图外的 code 点名。
|
|
2261
2393
|
const columnsOutsideView = columnsOutsideViewOf(fields, viewEvidence?.viewColumnCodes, projectionMissAll);
|
|
@@ -2319,6 +2451,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2319
2451
|
: {}),
|
|
2320
2452
|
...(projectionHintAll !== undefined ? { projectionHint: projectionHintAll } : {}),
|
|
2321
2453
|
...(anyNullField ? { nullSemantics: DATA_LIST_NULL_SEMANTICS } : {}),
|
|
2454
|
+
...(unprojectedCodes.length > 0 ? { unprojectedFieldCount: unprojectedCodes.length } : {}),
|
|
2322
2455
|
...(projectionMissAll.length > 0 ? { projectionMiss: projectionMissAll } : {}),
|
|
2323
2456
|
...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
|
|
2324
2457
|
...(columnsOutsideView.length > 0 ? { columnsOutsideView, columnsNarrowingOnly: true, columnsNote: DATA_LIST_COLUMNS_NARROWING_NOTE } : {}),
|
|
@@ -2467,6 +2600,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2467
2600
|
const itemsWithProjection = attachItemUnprojected(items, projectionMissPaged, viewEvidence?.viewColumnCodes);
|
|
2468
2601
|
// F5(w53):已判定未投影的列从 fields 省略键;无证据的 null 保留。
|
|
2469
2602
|
const itemsFinal = omitUnprojectedFields(itemsWithProjection);
|
|
2603
|
+
const unprojectedCodes = unprojectedFieldCodes(itemsFinal);
|
|
2470
2604
|
const anyNullField = itemsFinal.some((item) => Object.values(item.fields).some((value) => value === null));
|
|
2471
2605
|
// F5(w63,P1):columns 只能收窄视图列;视图外的 code 点名。
|
|
2472
2606
|
const columnsOutsideView = columnsOutsideViewOf(fields, viewEvidence?.viewColumnCodes, projectionMissPaged);
|
|
@@ -2522,6 +2656,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
2522
2656
|
...(choiceFilterFields.length > 0 && Number(total ?? 0) === 0 ? { filterValueHint: choiceFilterValueHint(choiceFilterFields) } : {}),
|
|
2523
2657
|
...(projectionHintPaged !== undefined ? { projectionHint: projectionHintPaged } : {}),
|
|
2524
2658
|
...(anyNullField ? { nullSemantics: DATA_LIST_NULL_SEMANTICS } : {}),
|
|
2659
|
+
...(unprojectedCodes.length > 0 ? { unprojectedFieldCount: unprojectedCodes.length } : {}),
|
|
2525
2660
|
...(projectionMissPaged.length > 0 ? { projectionMiss: projectionMissPaged } : {}),
|
|
2526
2661
|
...(columnsNotProjected.length > 0 ? { columnsNotProjected } : {}),
|
|
2527
2662
|
...(columnsOutsideView.length > 0 ? { columnsOutsideView, columnsNarrowingOnly: true, columnsNote: DATA_LIST_COLUMNS_NARROWING_NOTE } : {}),
|
|
@@ -3509,10 +3644,51 @@ export function registerRuntimeDataLane(tools) {
|
|
|
3509
3644
|
const nameOverwrittenNote = nameOverwrittenNoteOf(rawSaveData.name, savedRecord?.name);
|
|
3510
3645
|
const savedEmptyFields = readbackEmptyFields(formData, savedRecord);
|
|
3511
3646
|
const dataWarnings = await runtimeDataWarnings(session, args.schemaCode, sheetCode, formData, 1);
|
|
3512
|
-
|
|
3647
|
+
// F2(w112 探针 H):本段只在**未带 workflowCode** 的普通 save 上到达
|
|
3648
|
+
// (带 workflowCode 的流程草稿在上面的分支已 return)——所以这里至多付
|
|
3649
|
+
// 一次 workflow/getWorkflow,正常流程草稿保存零额外 wire。
|
|
3650
|
+
const workflowCheck = await resolvePublishedWorkflowCodeForNote(session, args.schemaCode);
|
|
3651
|
+
const publishedWorkflow = workflowCheck.code;
|
|
3652
|
+
// 新建:普通草稿没有实例,要可提交只能带 workflowCode 重建。
|
|
3513
3653
|
const workflowDraftHint = publishedWorkflow
|
|
3514
|
-
? `本模型有已发布流程 ${publishedWorkflow}
|
|
3654
|
+
? `本模型有已发布流程 ${publishedWorkflow};本行是普通草稿、没有流程实例,不能提交(submit 面会拒绝)。要可提交请重建流程草稿:data.save {schemaCode:"${args.schemaCode}", workflowCode:"${publishedWorkflow}", formData:{...}}(formData 不要带 id;回执取 bizObjectId/workItemId/workflowInstanceId 再提交)`
|
|
3655
|
+
: null;
|
|
3656
|
+
// 更新:本次只改既有行,不会创建/改动实例——绝不能回落「加 submit:true」
|
|
3657
|
+
// (流程模型上 submit:true 必被拒 submit-model-has-workflow)。
|
|
3658
|
+
const workflowUpdateHint = publishedWorkflow
|
|
3659
|
+
? `本模型有已发布流程 ${publishedWorkflow};本次是更新既有行(不会创建/改动流程实例)——流程模型上保存的直提标志会被拒(submit-model-has-workflow);推进该行用 workitem.list 看现有待办 → data.submit 三件套;不要为触发规则/推进流程再 data.save 一次`
|
|
3515
3660
|
: null;
|
|
3661
|
+
// 读失败时用中性指路:不把「没查到」当「没流程」。更新行不能再给
|
|
3662
|
+
// `data.save … workflowCode`(会多建一行),只指到复核面 + 现有待办。
|
|
3663
|
+
const workflowCheckSkippedHint = workflowCheck.skipped !== undefined
|
|
3664
|
+
? saveIsUpdate
|
|
3665
|
+
? "本次未能确认该模型是否有已发布流程(workflow/getWorkflow 读取失败,见 workflowCheckSkipped)——先复核流程面(workflow.get_published / rule.references)+ workitem.list 看现有待办,不要为确认流程再 data.save 一次"
|
|
3666
|
+
: "本次未能确认该模型是否有已发布流程(workflow/getWorkflow 读取失败,见 workflowCheckSkipped)——先复核流程面,再决定用 submit:true(无流程)还是 data.save workflowCode(有流程)"
|
|
3667
|
+
: null;
|
|
3668
|
+
// 只对**新建**行断言「没有流程实例」:带 formData.id 的 save 是更新语义,
|
|
3669
|
+
// 该行可能本来就是流程草稿(甚至已在途),再劝「重建草稿」会造成重复数据。
|
|
3670
|
+
// submit:true 时已有 submitRefused,抑制本键避免同现两个 blocker 名。
|
|
3671
|
+
const workflowInstanceNote = publishedWorkflow && !saveIsUpdate && args.submit !== true
|
|
3672
|
+
? {
|
|
3673
|
+
blocker: "plain-save-no-workflow-instance",
|
|
3674
|
+
workflowCode: publishedWorkflow,
|
|
3675
|
+
message: `本行是普通草稿、没有流程实例(本次 data.save 未带 workflowCode),之后无法 data.submit——submit 面会回 submit-existing-workflow-unsupported:` +
|
|
3676
|
+
`8.6.26 没有 REST in-place 流程发起(submitWorkflowByWorkflowCode → createAndGetBizObject INSERT → 40000 duplicate primary key)。` +
|
|
3677
|
+
`要可提交请重新建流程草稿:data.save {schemaCode:"${args.schemaCode}", workflowCode:"${publishedWorkflow}", formData:{...}}(formData 不要带 id),再从回执 performed 取 bizObjectId/workItemId/workflowInstanceId。`,
|
|
3678
|
+
nextCommand: `omc call data.save --env <env> --args '{"schemaCode":"${args.schemaCode}","workflowCode":"${publishedWorkflow}","formData":{...}}'`,
|
|
3679
|
+
}
|
|
3680
|
+
: undefined;
|
|
3681
|
+
// 更新行的独立键:不冒充 workflowInstanceNote(那条讲「重建草稿」,对更新行是错的)。
|
|
3682
|
+
const workflowUpdateNote = publishedWorkflow && saveIsUpdate
|
|
3683
|
+
? {
|
|
3684
|
+
blocker: "workflow-model-update-no-instance-change",
|
|
3685
|
+
workflowCode: publishedWorkflow,
|
|
3686
|
+
message: `本次是更新既有行(data.save 带 formData.id),不会创建/改动流程实例;本模型有已发布流程 ${publishedWorkflow}。` +
|
|
3687
|
+
`流程模型的 submit:true 会被拒(submit-model-has-workflow);推进该行用 workitem.list 看现有待办 → data.submit 三件套(bizObjectId/workItemId/workflowInstanceId)。` +
|
|
3688
|
+
`不要为触发规则/推进流程再 data.save 一次。`,
|
|
3689
|
+
nextCommand: `omc call workitem.list --args '{"workflowInstanceId":"<workflowInstanceId>"}'`,
|
|
3690
|
+
}
|
|
3691
|
+
: undefined;
|
|
3516
3692
|
// F4(w53):仅在本次 formData 含子表数组时读该子表字段元数据;没有数组 /
|
|
3517
3693
|
// 读不到元数据 → 零提示、零额外 wire(读失败不阻断写)。
|
|
3518
3694
|
const mappingRuntimeNote = mappingRuntimeNoteFor(await childTableMappingHits(session, formData, prepared.childCodes));
|
|
@@ -3524,6 +3700,13 @@ export function registerRuntimeDataLane(tools) {
|
|
|
3524
3700
|
authoritative: projectReadbackRecord(savedRecord, args),
|
|
3525
3701
|
...(savedEmptyFields.length > 0 ? { readbackWarning: readbackWarningFor(savedEmptyFields, "data.save") } : {}),
|
|
3526
3702
|
...(dataWarnings.length > 0 ? { warnings: dataWarnings } : {}),
|
|
3703
|
+
// F2(w112 探针 H):有已发布流程的模型 + 未带 workflowCode = 没有流程实例的
|
|
3704
|
+
// 孤儿草稿。机器键与人类摘要行同源(summary 读 readback.workflowInstanceNote)。
|
|
3705
|
+
...(workflowInstanceNote !== undefined ? { workflowInstanceNote } : {}),
|
|
3706
|
+
// 更新既有行的独立提示(不冒充 workflowInstanceNote,也不劝重建草稿)。
|
|
3707
|
+
...(workflowUpdateNote !== undefined ? { workflowUpdateNote } : {}),
|
|
3708
|
+
// 读失败 = 本次未能确认,不是「没有流程」。
|
|
3709
|
+
...(workflowCheck.skipped !== undefined ? { workflowCheckSkipped: workflowCheck.skipped } : {}),
|
|
3527
3710
|
// 券商 issue 1.3(cpdocs 2026-10-27):写前校验(save-update-target-absent)
|
|
3528
3711
|
// 之后的第二道防线——返回 objectId ≠ 传入 formData.id 就是平台没按更新处理
|
|
3529
3712
|
// (静默新建孤儿行的真机判据),如实报警而不是回一个"成功"。
|
|
@@ -3537,7 +3720,7 @@ export function registerRuntimeDataLane(tools) {
|
|
|
3537
3720
|
},
|
|
3538
3721
|
}
|
|
3539
3722
|
: {}),
|
|
3540
|
-
draftRuleHint: workflowDraftHint ?? "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true(仅 data.save 有此参数;data.submit 不收);已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
|
|
3723
|
+
draftRuleHint: ((saveIsUpdate ? workflowUpdateHint : workflowDraftHint) ?? workflowCheckSkippedHint) ?? "草稿态(DRAFT)保存不触发业务规则——DRAFT 行跳过 Create/Update 分发(DomainServiceImpl.java:240-248);要一调完成态本调用加 submit:true(仅 data.save 有此参数;data.submit 不收);已存草稿直提形状:data.submit {schemaCode, bizObjectId: 本读回的 bizObjectId, formData}(submit 自持久化)",
|
|
3541
3724
|
};
|
|
3542
3725
|
// r18 retro (G3): one-call COMPLETED creation — the agent goal is usually
|
|
3543
3726
|
// "record AND rule effect", not "a draft". Chain the no-flow submit in
|
|
@@ -3555,7 +3738,9 @@ export function registerRuntimeDataLane(tools) {
|
|
|
3555
3738
|
submitRefused: {
|
|
3556
3739
|
blocker: "submit-model-has-workflow",
|
|
3557
3740
|
workflowCode: publishedWorkflow,
|
|
3558
|
-
|
|
3741
|
+
// 更新行不能复用新建语义(「没有流程实例 / 重建草稿 / formData 不要带 id」
|
|
3742
|
+
// 都会让调用方多建一行);按 saveIsUpdate 分路。
|
|
3743
|
+
message: `草稿已保存;${saveIsUpdate ? workflowUpdateHint : workflowDraftHint}(见 describe data.submit --example workflow-backed-data-submit)`,
|
|
3559
3744
|
},
|
|
3560
3745
|
},
|
|
3561
3746
|
};
|
|
@@ -4703,6 +4888,10 @@ export function registerRuntimeDataLane(tools) {
|
|
|
4703
4888
|
actor = { ...actor, bypassReason: PLATFORM_ADMIN_START_BYPASS };
|
|
4704
4889
|
}
|
|
4705
4890
|
}
|
|
4891
|
+
// P1(探针 H F3,复核 2026-11-27):模型有 type1 门户校验规则时,本次 REST
|
|
4892
|
+
// 提交对非空值不执行它们——在成功回执里点名。读一次 datarule.list;读失败
|
|
4893
|
+
// 不阻断,但回 dataRulesExecution:"unknown" 与原因,别和「没有规则」同形。
|
|
4894
|
+
const dataRulesScan = await portalOnlyDataRules(session, args.schemaCode);
|
|
4706
4895
|
return {
|
|
4707
4896
|
performed: {
|
|
4708
4897
|
errcode: performed.errcode,
|
|
@@ -4755,8 +4944,27 @@ export function registerRuntimeDataLane(tools) {
|
|
|
4755
4944
|
}
|
|
4756
4945
|
: {}),
|
|
4757
4946
|
...(startNote ? { startNote } : {}),
|
|
4947
|
+
// P1(探针 H F3,复核 2026-11-27):
|
|
4948
|
+
// - 读失败 → dataRulesExecution:"unknown" + reason(与「无规则」可区分);
|
|
4949
|
+
// - 有规则 → dataRulesNotExecuted(自动长度规则单列、hidden 行只分类不吞);
|
|
4950
|
+
// - 无规则 → dataRulesExecution:"checked" 且不加提示键。
|
|
4951
|
+
dataRulesExecution: dataRulesScan.kind === "unknown" ? "unknown" : "checked",
|
|
4952
|
+
...(dataRulesScan.kind === "unknown"
|
|
4953
|
+
? { dataRulesExecutionReason: `bizdatarule/list 读取失败:${dataRulesScan.reason}——本次提交未执行门户数据规则校验(读面不可用,不代表没有规则)` }
|
|
4954
|
+
: {}),
|
|
4955
|
+
...(dataRulesScan.kind === "checked" && dataRulesScan.count > 0
|
|
4956
|
+
? {
|
|
4957
|
+
dataRulesNotExecuted: {
|
|
4958
|
+
count: dataRulesScan.count,
|
|
4959
|
+
checkTypes: dataRulesScan.checkTypes,
|
|
4960
|
+
hiddenRulesPresent: dataRulesScan.hiddenRulesPresent,
|
|
4961
|
+
...(dataRulesScan.autoLengthRules > 0 ? { autoLengthRules: dataRulesScan.autoLengthRules } : {}),
|
|
4962
|
+
message: dataRuleNotExecutedMessage(args.schemaCode, dataRulesScan),
|
|
4963
|
+
},
|
|
4964
|
+
}
|
|
4965
|
+
: {}),
|
|
4758
4966
|
portalRulesExecuted: false,
|
|
4759
|
-
portalRulesNote: "portalRulesExecuted
|
|
4967
|
+
portalRulesNote: "portalRulesExecuted 只指门户客户端的必填/控件校验与 dataRuleType=1 校验(checkType1–4)未在 REST 提交时执行:非空值不跑,字段为空时平台仍会走空值校验(可能按必填类错误拒)。显式 validateHiddenProperties 的规则在 2.1.5+ 的 submit 面会执行、8.6.26/8.7 不执行;checkType5 重复校验与服务端业务规则照常运行。",
|
|
4760
4968
|
requiredFields: validation.requiredFields,
|
|
4761
4969
|
missingRequired: validation.missingRequired,
|
|
4762
4970
|
requiredFace: validation.requiredFace,
|
package/dist/recipes/datarule.js
CHANGED
|
@@ -18,6 +18,7 @@ const submitCrossFieldCheck = Object.freeze({
|
|
|
18
18
|
},
|
|
19
19
|
preconditions: [
|
|
20
20
|
"需求是**提交时跨字段校验并弹提示拦截**(A 字段与 B 字段的比较)——这有**配置正解**,先于在线 JS onValidate 考虑(在线 JS 只在该协议确实表达不了时用)。",
|
|
21
|
+
"**执行面**:本规则默认只在**门户表单提交**时由前端执行;CLI `data.submit`/`data.save`(REST runtime/form 路径)对**非空值**不执行条件校验(字段为空时平台仍会走空值/必填校验);2.1.5 独有的 `validateHiddenProperties` 隐藏字段校验在 2.1.x submit 面会执行、8.6.26/8.7 不执行。CLI 侧只能用 `datarule.list` 核对配置,验收必须在门户点验;要在服务端强制拦截请改用业务规则。",
|
|
21
22
|
"比较符支持:等于/不等于/大于/大于等于/小于/小于等于/包含/属于/介于 等(中文或符号)。",
|
|
22
23
|
],
|
|
23
24
|
conditionalRequirements: [
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.14",
|
|
4
4
|
"description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"commander": "14.0.3",
|
|
61
|
-
"omc-core": "0.8.
|
|
61
|
+
"omc-core": "0.8.14",
|
|
62
62
|
"proper-lockfile": "4.1.2",
|
|
63
63
|
"write-file-atomic": "6.0.0",
|
|
64
64
|
"zod": "^3.23.8",
|
|
@@ -76,6 +76,6 @@
|
|
|
76
76
|
"directory": "packages/omc-cli"
|
|
77
77
|
},
|
|
78
78
|
"optionalDependencies": {
|
|
79
|
-
"@stalfh233/omc-fake-platform": "0.8.
|
|
79
|
+
"@stalfh233/omc-fake-platform": "0.8.14"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -135,7 +135,7 @@ rules:
|
|
|
135
135
|
datarules:
|
|
136
136
|
- { propertyCode: order_note, dataRuleType: 4, options: { requiredFormula: '{amount} 大于 {"valueType":"custom","value":5000}' }, name: 金额超5000说明必填 }
|
|
137
137
|
```
|
|
138
|
-
⚠️ **type 3/4/5 不驱动门户表单控件**(真机复核):平台存成 bizdatarule,只镜像进控件 `historyOpt`,运行时门户读的是控件 `options`。门户条件(如「金额>5000 时必填」)必须写在 `fields[].options`(`requiredFormula`/`readonlyCondition`/`shortTextStitch`);写进 `datarules[]` 设计器可见但门户不拦(validate/plan 给 `datarule-not-portal-facing` 警告)。datarule
|
|
138
|
+
⚠️ **type 3/4/5 不驱动门户表单控件**(真机复核):平台存成 bizdatarule,只镜像进控件 `historyOpt`,运行时门户读的是控件 `options`。门户条件(如「金额>5000 时必填」)必须写在 `fields[].options`(`requiredFormula`/`readonlyCondition`/`shortTextStitch`);写进 `datarules[]` 设计器可见但门户不拦(validate/plan 给 `datarule-not-portal-facing` 警告)。datarule 只用于服务端引擎(校验/计算)。未声明 `sortKey` = 顺序归平台、不参与比较;显式声明才严格比较。
|
|
139
139
|
|
|
140
140
|
- 规则排在字段发布之后(编译器按能力排序:先建全部模型/字段,再跑规则)。
|
|
141
141
|
- `rule.save` 只写草稿;`enabled` 由 `rule.enable` 保证(publish+启用)——readback 用 `enabled` 和**语义图摘要**(忽略画布几何)判等价。
|