@stalfh233/omc-cli 0.4.94 → 0.4.95

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.
Files changed (2) hide show
  1. package/dist/compute.js +43 -1
  2. package/package.json +3 -3
package/dist/compute.js CHANGED
@@ -106,6 +106,38 @@ export function composeComputeArgs(options) {
106
106
  dryRun: !options.apply,
107
107
  };
108
108
  }
109
+ /**
110
+ * The receipt for a `compute --apply` must not imply the rule will fire.
111
+ *
112
+ * 0.4.95 source evidence (8.6.26):
113
+ * - a type-2 rule whose carrier is `shortTextStitch` runs only when
114
+ * `CalcSwitchConf.forceExecuteCalculateRule` is true
115
+ * (`CalculateHandler.onHandler`, 8.6.26 :50);
116
+ * - that flag comes from `BizObjectOptions.executeCalRule`
117
+ * (`BizObjectOpConf.constructCalcSwitchConf` :95), and the only builder that
118
+ * sets it (`.executeCalRule()`) has NO caller in the tree — only the
119
+ * open-engine API can pass it.
120
+ * So data.save / data.submit / data.update never refresh the target field.
121
+ * r12 believed otherwise; r16 could not reproduce r12's success.
122
+ */
123
+ export function computeExecutionNotice() {
124
+ return {
125
+ executionWarning: "字段计算规则已写入,但**提交/更新不会触发它**:type2 的 shortTextStitch 载体只在 " +
126
+ "CalcSwitchConf.forceExecuteCalculateRule=true 时求值,该开关来自 BizObjectOptions.executeCalRule," +
127
+ "而 8.6.26 全代码库没有任何 REST 路径把它置真(.executeCalRule() 仅 open-engine 显式 API 使用)。" +
128
+ "所以 data.save / data.submit / data.update 都不会刷新目标字段。",
129
+ executionEvidence: [
130
+ "BizObjectManagerImpl.java:377,424 — calculateHandler.onHandler(settings.getCalcSwitchConf(), …)",
131
+ "CalculateHandler.java:50 — if (switchConf.isForceExecuteCalculateRule())",
132
+ "BizObjectOpConf.java:95 — setForceExecuteCalculateRule(options.isExecuteCalRule())",
133
+ "engine/bizobject/BizObjectOptions.java:58 — 唯一的 executeCalRule() builder,全库无调用方",
134
+ ],
135
+ aggregationPathNote: "子表聚合的正解是 AGGREGATION 形状(options.formulaType=\"AGGREGATION\" + aggregation),它走 " +
136
+ "FormulaPropertySupport.onTriggerObjectChanged 的事件回算,不依赖 executeCalRule。" +
137
+ "0.4.95 取证时该形状仍未跑通(平台把 JSON 绑定失败掩码成 305003「死循环」),因此 OMC 暂不提供;" +
138
+ "在补齐前不要用字段计算规则做服务端聚合,改用 business rule 或二开接口。",
139
+ };
140
+ }
109
141
  export async function cmdCompute(args) {
110
142
  const request = requestId();
111
143
  const flag = (name) => argvValue(args, name);
@@ -121,6 +153,7 @@ export async function cmdCompute(args) {
121
153
  const usage = [
122
154
  "用法:omc compute --schema <模型code> --target <目标字段> --formula \"<公式,{字段} 引用>\" [--name 规则名] [--env 环境] [--apply]",
123
155
  "条件聚合:--formula \"{<子表code>.<子列code>}\" --where \"<子列code> = <值>\" [--aggregate count|sum] → 编译为 COUNTIF / SUMIF",
156
+ "⚠️ 但 1.1.25 上这条规则**不会**被 data.save/submit/update 触发(源码取证:type2 的 shortTextStitch 载体只在 executeCalRule=true 时执行,而 REST 路径从不置真)。子表聚合的正解是 AGGREGATION 形状,OMC 尚未做对;见 --apply 回执的 executionWarning。",
124
157
  "公式语法:同类字段 {字段code};子表列 {子表code.子列code};无条件聚合 SUM/COUNT/MAX/MIN/AVG({子表.子列}) 需加 --allow-unfiltered 显式确认。",
125
158
  "默认 dry-run,--apply 才写入。",
126
159
  ].join("\n");
@@ -167,7 +200,16 @@ export async function cmdCompute(args) {
167
200
  return CLI_EXIT_CODES.internal;
168
201
  }
169
202
  const classified = classifyResult(result);
170
- writeEnvelope(envelope(classified.status, result, request, classified.error));
203
+ // 0.4.95 source-verified: a type-2 rule whose carrier is `shortTextStitch`
204
+ // (what this command writes) is executed ONLY when
205
+ // `CalcSwitchConf.forceExecuteCalculateRule` is true. That flag comes from
206
+ // `BizObjectOptions.executeCalRule`, and `.executeCalRule()` is never called
207
+ // anywhere in the 8.6.26 tree — only the open-engine API can pass it. So
208
+ // data.save / data.submit / data.update never refresh the target field, no
209
+ // matter how correct the formula is. Say so in the receipt instead of letting
210
+ // the caller believe the write took effect (r12 believed it; r16 disproved it).
211
+ const withWarning = apply && classified.status === "ok" ? { ...result, ...computeExecutionNotice() } : result;
212
+ writeEnvelope(envelope(classified.status, withWarning, request, classified.error));
171
213
  return exitCode;
172
214
  }
173
215
  //# sourceMappingURL=compute.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stalfh233/omc-cli",
3
- "version": "0.4.94",
3
+ "version": "0.4.95",
4
4
  "description": "CloudPivot 8.6 configuration capability CLI — governed, fail-closed, coverage-manifest bounded.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -50,9 +50,9 @@
50
50
  "access": "public"
51
51
  },
52
52
  "dependencies": {
53
- "@stalfh233/omc-fake-platform": "0.4.94",
53
+ "@stalfh233/omc-fake-platform": "0.4.95",
54
54
  "commander": "14.0.3",
55
- "omc-core": "0.4.94",
55
+ "omc-core": "0.4.95",
56
56
  "proper-lockfile": "4.1.2",
57
57
  "write-file-atomic": "6.0.0",
58
58
  "zod": "^3.23.8",