@stalfh233/omc-cli 0.8.39 → 0.8.40
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-execute.js +13 -2
- package/dist/call-input.js +65 -0
- package/dist/human-summary.js +4 -1
- package/dist/lanes/businessrule.js +33 -9
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +19 -1
- package/dist/lanes/runtime-data/record-write.js +7 -3
- package/dist/lanes/runtime-data/write-support.js +14 -10
- package/dist/path-projection.js +2 -0
- package/dist/read-projection.js +3 -0
- package/dist/read-shapes.js +3 -3
- package/dist/recipes/field.js +16 -14
- package/dist/recipes/runtime-data.js +2 -1
- package/dist/write-coordinator.js +9 -0
- package/dist/write-lock.js +3 -1
- package/package.json +3 -3
- package/skills/omc-business-configuration.md +5 -5
package/dist/call-execute.js
CHANGED
|
@@ -7,7 +7,7 @@ import { buildToolRegistry } from "./tools.js";
|
|
|
7
7
|
import { parseToolInput, ToolInputError } from "./tool-types.js";
|
|
8
8
|
import { projectResultExtract, unwrapSinglePathProjection } from "./path-projection.js";
|
|
9
9
|
import { writeCoordinator, WriteLockConflictError } from "./write-coordinator.js";
|
|
10
|
-
import { argvValues, withUnknownEnvironmentRecovery } from "./call-input.js";
|
|
10
|
+
import { argvValues, lockRetryArgs, withUnknownEnvironmentRecovery } from "./call-input.js";
|
|
11
11
|
function resolvedDefaultEnvironment(store) {
|
|
12
12
|
try {
|
|
13
13
|
return store.resolveEnvironment(undefined).name;
|
|
@@ -46,8 +46,19 @@ export async function executeCall(store, parsed) {
|
|
|
46
46
|
// before write admission, so it must not contend for the cross-process lock.
|
|
47
47
|
if (toolKind === "write" && !dryRun) {
|
|
48
48
|
const lockTarget = environment ?? resolvedDefaultEnvironment(store);
|
|
49
|
+
// F3(w57 探针 AB):锁冲突回执的 nextCommand 要能直接复制执行——把本次
|
|
50
|
+
// 参数按安全规则带过去(文件/stdin 原样引用,inline 仅在不含凭据且 ≤500B
|
|
51
|
+
// 时内联,否则占位并在回执披露)。
|
|
52
|
+
const retryArgs = lockRetryArgs({ ...(rawArgs !== undefined ? { rawArgs } : {}), ...(argsFile !== undefined ? { argsFile } : {}), parsedArgs });
|
|
49
53
|
try {
|
|
50
|
-
result = await writeCoordinator.run({
|
|
54
|
+
result = await writeCoordinator.run({
|
|
55
|
+
environment: lockTarget,
|
|
56
|
+
tool: toolName,
|
|
57
|
+
waitMs,
|
|
58
|
+
mode: "single",
|
|
59
|
+
...(retryArgs.nextArgs !== undefined ? { nextArgs: retryArgs.nextArgs } : {}),
|
|
60
|
+
...(retryArgs.omitted !== undefined ? { nextCommandArgsOmitted: retryArgs.omitted } : {}),
|
|
61
|
+
}, (lease) => callTool(lease));
|
|
51
62
|
}
|
|
52
63
|
catch (error) {
|
|
53
64
|
if (!(error instanceof WriteLockConflictError))
|
package/dist/call-input.js
CHANGED
|
@@ -182,6 +182,71 @@ function withoutEnvironmentCommand(input) {
|
|
|
182
182
|
return `omc call ${input.tool} --args -`;
|
|
183
183
|
return `omc call ${input.tool}`;
|
|
184
184
|
}
|
|
185
|
+
/**
|
|
186
|
+
* F3(w57 探针 AB):`write-lock-held` 的 `nextCommand` 必须是**可直接复制执行**
|
|
187
|
+
* 的同一次调用。参数按安全优先回填,绝不把凭据写进回执:
|
|
188
|
+
* - `--args-file <path>` 单引号 shell-safe 引用(不展开文件内容;含空格/单引号
|
|
189
|
+
* 的路径复制后仍是同一条命令);
|
|
190
|
+
* - `--args -` 原样保留(stdin);
|
|
191
|
+
* - inline `--args`:序列化 ≤500B 且递归键名不含凭据词才内联,否则回占位符
|
|
192
|
+
* 并让回执标 `nextCommandArgsOmitted:"sensitive-or-large"`。
|
|
193
|
+
*/
|
|
194
|
+
const SENSITIVE_ARG_KEY = /password|passwd|secret|token|credential|authorization|apikey|accesskey|privatekey/i;
|
|
195
|
+
/** 键名先去掉非字母数字再匹配,覆盖 api_key / access-key / private.key 等变体。 */
|
|
196
|
+
function isSensitiveArgKey(key) {
|
|
197
|
+
return SENSITIVE_ARG_KEY.test(key.replace(/[^a-z0-9]/gi, ""));
|
|
198
|
+
}
|
|
199
|
+
/** 与 inline `--args` 相同的单引号转义,供 `--args-file <path>` 复用。 */
|
|
200
|
+
function shellSingleQuote(value) {
|
|
201
|
+
return `'${value.replace(/'/g, "'\\''")}'`;
|
|
202
|
+
}
|
|
203
|
+
function sensitiveArgKeyIn(value, seen) {
|
|
204
|
+
if (value === null || typeof value !== "object")
|
|
205
|
+
return undefined;
|
|
206
|
+
if (seen.has(value))
|
|
207
|
+
return undefined;
|
|
208
|
+
seen.add(value);
|
|
209
|
+
if (Array.isArray(value)) {
|
|
210
|
+
for (const item of value) {
|
|
211
|
+
const hit = sensitiveArgKeyIn(item, seen);
|
|
212
|
+
if (hit !== undefined)
|
|
213
|
+
return hit;
|
|
214
|
+
}
|
|
215
|
+
return undefined;
|
|
216
|
+
}
|
|
217
|
+
for (const [key, child] of Object.entries(value)) {
|
|
218
|
+
if (isSensitiveArgKey(key))
|
|
219
|
+
return key;
|
|
220
|
+
const hit = sensitiveArgKeyIn(child, seen);
|
|
221
|
+
if (hit !== undefined)
|
|
222
|
+
return hit;
|
|
223
|
+
}
|
|
224
|
+
return undefined;
|
|
225
|
+
}
|
|
226
|
+
export function lockRetryArgs(input) {
|
|
227
|
+
if (input.argsFile !== undefined)
|
|
228
|
+
return { nextArgs: `--args-file ${shellSingleQuote(input.argsFile)}` };
|
|
229
|
+
if (input.rawArgs === "-")
|
|
230
|
+
return { nextArgs: "--args -" };
|
|
231
|
+
if (input.rawArgs === undefined)
|
|
232
|
+
return {};
|
|
233
|
+
let inline;
|
|
234
|
+
try {
|
|
235
|
+
const parsed = JSON.parse(input.rawArgs);
|
|
236
|
+
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed))
|
|
237
|
+
inline = parsed;
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
// 非法 JSON 在写面准入前就被拒,不会走到取锁这一步。
|
|
241
|
+
}
|
|
242
|
+
if (inline === undefined)
|
|
243
|
+
return {};
|
|
244
|
+
const serialized = JSON.stringify(inline);
|
|
245
|
+
if (serialized.length <= 500 && sensitiveArgKeyIn(inline, new Set()) === undefined) {
|
|
246
|
+
return { nextArgs: `--args ${shellSingleQuote(serialized)}` };
|
|
247
|
+
}
|
|
248
|
+
return { nextArgs: "--args '<本次参数>'", omitted: "sensitive-or-large" };
|
|
249
|
+
}
|
|
185
250
|
/** 给 `unknown environment` 错误补一条「去掉 --env 重跑」的可复制命令。 */
|
|
186
251
|
export function withUnknownEnvironmentRecovery(result, input) {
|
|
187
252
|
if (result.status !== "error" || typeof result.message !== "string")
|
package/dist/human-summary.js
CHANGED
|
@@ -316,7 +316,10 @@ function phraseOf(tool, args, outcome) {
|
|
|
316
316
|
return `保存数据(模型 ${schemaCode ?? "?"})——更新既有行,不创建/改动流程实例;流程模型上保存的直提标志会被拒,推进该行用 workitem.list → data.submit 三件套(不要为触发规则/推进流程再 data.save)${nameNote}${rulesNote}`;
|
|
317
317
|
}
|
|
318
318
|
if (workflowInstanceNote !== undefined) {
|
|
319
|
-
|
|
319
|
+
// F5(w57 探针 AB):保存是成功的;这行是「无实例」信息,不是失败。
|
|
320
|
+
// phase:"done" 会自动加「已」前缀,所以这里写「保存为普通草稿」,
|
|
321
|
+
// 最终 stderr 首句是「已保存为普通草稿(模型 X)」。
|
|
322
|
+
return `保存为普通草稿(模型 ${schemaCode ?? "?"})——无流程实例(本次未带 workflowCode),之后不能直接 data.submit;如需可提交,用 data.save 带 workflowCode:"${workflowInstanceNote.workflowCode ?? "<wf>"}" 重建流程草稿(formData 不要带 id)${nameNote}${rulesNote}`;
|
|
320
323
|
}
|
|
321
324
|
if (workflowCheckSkipped !== undefined) {
|
|
322
325
|
// 更新行不能再劝 data.save workflowCode(会多建一行)——只指复核面 + 现有待办。
|
|
@@ -727,7 +727,13 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
727
727
|
// #77.2:显式 withDraft 才额外读 app 面 DRAFT 行(与 rule.get 同源);
|
|
728
728
|
// 默认路径零额外 wire、零新增键。DRAFT 面在规则数 <7 时会补建预置——见
|
|
729
729
|
// RULE_WITH_DRAFT_NOTE,只有显式开关才付出这个代价。
|
|
730
|
-
|
|
730
|
+
// F4(探针 AB P2,0.8.40):读 DRAFT 面是**写副作用**。published 清单只含
|
|
731
|
+
// 「有 enabled DRAFT」的行,rows.length>=7 ⇒ DRAFT>=7 ⇒ 必不补建;<7 只是
|
|
732
|
+
// 可能补建。零额外 wire 的单边判据:<7 且未显式 ensurePresets 时不发 app 面,
|
|
733
|
+
// 回 published 行 + wouldCreatePresets 让调用方 opt-in(误报最多多一轮)。
|
|
734
|
+
const presetFillGuard = options.withDraft === true && options.ensurePresets !== true && rows.length < 7;
|
|
735
|
+
const draftRead = options.withDraft === true && !presetFillGuard;
|
|
736
|
+
const draftRows = draftRead
|
|
731
737
|
? wireRows((await wireCall(session, { path: ENDPOINTS.businessRuleListBySchemaCode, query: { schemaCode } })).data)
|
|
732
738
|
: undefined;
|
|
733
739
|
const draftByCode = new Map();
|
|
@@ -791,9 +797,26 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
791
797
|
// schemaCodes[] 跨模型面的 models[] 元素缺该键,与 read-shapes「同形」承诺不符)。
|
|
792
798
|
rulesCount: entries.length,
|
|
793
799
|
// r28g F18:list 投影的是 PUBLISH 行;运行时可执行性以 rule.get / rule.enable.verified 为准。
|
|
794
|
-
source:
|
|
795
|
-
...(
|
|
796
|
-
? {
|
|
800
|
+
source: draftRead ? "published-list+draft" : "published-list",
|
|
801
|
+
...(presetFillGuard
|
|
802
|
+
? {
|
|
803
|
+
draftFaceSkipped: "preset-fill-guard",
|
|
804
|
+
wouldCreatePresets: {
|
|
805
|
+
publishedRules: rows.length,
|
|
806
|
+
threshold: 7,
|
|
807
|
+
reason: "published 清单只含有 enabled DRAFT 的行;<7 时 app DRAFT 面可能补建 7 条预置(写副作用)——先不发 app 面,确认接受后加 ensurePresets:true",
|
|
808
|
+
nextCommand: `omc call rule.list --env <env> --args '${JSON.stringify({ schemaCode, withDraft: true, ensurePresets: true })}'`,
|
|
809
|
+
},
|
|
810
|
+
draftNote: "withDraft 已请求但未读 DRAFT 面:published 清单 <7 行,app 面读可能触发平台补建 7 条预置(BusinessRuleFacadeImpl.listViewsBySchemaCode → checkAndFillDefaultBusinessRule,写副作用)。确认接受补建后加 ensurePresets:true 重跑。",
|
|
811
|
+
}
|
|
812
|
+
: {}),
|
|
813
|
+
...(draftRead
|
|
814
|
+
? {
|
|
815
|
+
draftFace: "app/businessrule/list_by_schemacode",
|
|
816
|
+
draftRowsCount: draftRows?.length ?? 0,
|
|
817
|
+
draftNote: RULE_WITH_DRAFT_NOTE,
|
|
818
|
+
...(options.ensurePresets === true ? { presetFillConfirmed: true } : {}),
|
|
819
|
+
}
|
|
797
820
|
: {}),
|
|
798
821
|
executableHint: "rules[].enabled/status 来自 PUBLISH 投影;运行时判定读 DRAFT(rule.get 的 enabled+ruleStatus,或 rule.enable 回执的 executable/verified)。不要仅凭本面判定可 rule.run。",
|
|
799
822
|
...(statusLag
|
|
@@ -842,8 +865,8 @@ async function readRuleListBody(session, schemaCode, options) {
|
|
|
842
865
|
// ticket-80's update-mode readback teaches following the same-code
|
|
843
866
|
// latestPublished row — keep the flag on the default face (5 B).
|
|
844
867
|
...(row?.latestPublished !== undefined ? { latestPublished: row.latestPublished } : {}),
|
|
845
|
-
...(
|
|
846
|
-
...(
|
|
868
|
+
...(draftRead ? draftFaceOf(entry) : {}),
|
|
869
|
+
...(draftRead && row === undefined ? { draftOnly: true } : {}),
|
|
847
870
|
...(fullRows
|
|
848
871
|
? {
|
|
849
872
|
id: record.id,
|
|
@@ -1315,7 +1338,8 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1315
1338
|
onlyCustom: z.boolean().optional().describe("只回自建规则(defaultRule!==true)——读面收窄,省 token"),
|
|
1316
1339
|
full: z.boolean().optional().describe("行内联完整字段(id/createdTime/creator/…)并跳过 detailFile 外置"),
|
|
1317
1340
|
withMappings: z.boolean().optional().describe("true=规则附 mappings 摘要(服务/方法/入出参计数)"),
|
|
1318
|
-
withDraft: z.boolean().optional().describe("
|
|
1341
|
+
withDraft: z.boolean().optional().describe("**写副作用**:读 app DRAFT 面(+1 wire),规则<7 时平台补建 7 条预置;默认先跳过(回 wouldCreatePresets),ensurePresets:true 才接受。逐行 publishEnabled/draftEnabled/draftStatus/executable/executableBasis,含禁用/未发布草稿行"),
|
|
1342
|
+
ensurePresets: z.boolean().optional().describe("真正读 DRAFT 面前确认允许平台补建 7 条预置"),
|
|
1319
1343
|
capability: capabilityArg,
|
|
1320
1344
|
},
|
|
1321
1345
|
handler: async (ctx, args, self) => governedRead(ctx, self, args, async (session) => {
|
|
@@ -1330,7 +1354,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1330
1354
|
const schemaCodes = ruleSchemaCodesOf(args.schemaCodes, "rule.list");
|
|
1331
1355
|
const models = [];
|
|
1332
1356
|
const failed = [];
|
|
1333
|
-
const options = { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true, withDraft: args.withDraft === true };
|
|
1357
|
+
const options = { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true, withDraft: args.withDraft === true, ensurePresets: args.ensurePresets === true };
|
|
1334
1358
|
let firstError;
|
|
1335
1359
|
let rulesCount = 0;
|
|
1336
1360
|
// r83:三句提示(executableHint/statusNote/presetHint)逐模型逐字相同,
|
|
@@ -1383,7 +1407,7 @@ export function registerBusinessRuleLane(tools) {
|
|
|
1383
1407
|
}
|
|
1384
1408
|
if (singleSchemaCode === undefined)
|
|
1385
1409
|
throw new ToolInputError({ status: "error", blocker: "tool-input-invalid", tool: "rule.list", message: "需要 schemaCode(单个模型)或 schemaCodes(跨模型清单)" });
|
|
1386
|
-
return readRuleListBody(session, singleSchemaCode, { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true, withDraft: args.withDraft === true });
|
|
1410
|
+
return readRuleListBody(session, singleSchemaCode, { onlyCustom: args.onlyCustom === true, full: args.full === true, withMappings: args.withMappings === true, withDraft: args.withDraft === true, ensurePresets: args.ensurePresets === true });
|
|
1387
1411
|
}, { full: args.full === true, target: `rule.list:${args.schemaCodes !== undefined ? `schemaCodes:${args.schemaCodes.join(",")}` : args.schemaCode}` }),
|
|
1388
1412
|
}));
|
|
1389
1413
|
tools.push(defineTool({
|
|
@@ -272,7 +272,7 @@ export const FIELD_LANE_CONTRACT = Object.freeze({
|
|
|
272
272
|
controlEmissionPolicy: "ticket 101: controls PHONE(24)/PHOTO(10) are blocked for creation (no BizPropertyType maps to them — BizPropertyType.java:27-54); Tab(500) is a layout container (DataModelInitUtils.java:61-75 recurses panels, never a field); CreatedDeptId(102) is a system-field projection (DefaultPropertyType.java:18-21 → DEPARTMENT_SELECTOR 60, BizMainSystemPropertyRegistry.java:88-101); the scaffold SKIPS any field type without a control mapping — unknown/blocked control types are never auto-created (fail-closed)",
|
|
273
273
|
fieldRowDefaultPolicy: "ticket 108 determination (live 8.6.26 write+read 2026-09-15 + fwb 8.6.39 readback): the 2026-09-14 key unions are MULTI-FIELD UNIONS of designer rows, not per-field required keys — the platform accepts-and-persists minimal rows, so the minimal default + caller passthrough is the INTENTIONAL boundary. Selection families 12/13/14/15 MUST-FIXED to omit dictionaryData (designer rows carry none; live proves the platform merely accepts the extra key — omc_mcp_t108dd readback carried it only because we sent it). Families 0/1/2/9/11/17 keep the designer-carried {dictionaryData:\"\"}; DATE(3) keeps required format (BizObjectFacadeImpl.java:2949); ATTACHMENT(6) stays intentionally empty (system rows often have no options)",
|
|
274
274
|
orgSelectorFieldRowOptions: "org-selector families STAFF_SELECTOR / STAFF_MULTI_SELECTOR / DEPARTMENT_SELECTOR / DEPARTMENT_MULTI_SELECTOR (5/50/51/60/61): the field-row options are a publish-safe shape observed on the yst/fwb publish face (2656 rows) — null or {defaultValue, mappings, virtualField[, noRepeat]}; single-select defaultValue \"\" and multi-select []; deptVisible/multi are FORM-CONTROL discriminator keys (read from control.options via disposeUpdateType/updateSelectionType) and never appear on the field row",
|
|
275
|
-
relationMappingsSource: "`options.mappings` 形如 `[{source:<关联目标字段/父模型字段>,target:<本模型字段>}]`(裸 code),是关联填充的事实源(字段行,不是表单控件:改控件映射会被重算覆盖,live 2026-10-14 中冶)。Update chain: field.update with the full options (change only mappings, keep queryCode/displayField/schemaCode/conditions… as-is) → field.publish → form.draft rebuild:false (keeps the existing layout and any online JS) → form.publish → readback. Do NOT use cascadeRepublish on a form that already carries a custom layout or online JS — it re-scaffolds the default form.
|
|
275
|
+
relationMappingsSource: "`options.mappings` 形如 `[{source:<关联目标字段/父模型字段>,target:<本模型字段>}]`(裸 code),是关联填充的事实源(字段行,不是表单控件:改控件映射会被重算覆盖,live 2026-10-14 中冶)。Update chain: field.update with the full options (change only mappings, keep queryCode/displayField/schemaCode/conditions… as-is) → field.publish → form.draft rebuild:false (keeps the existing layout and any online JS) → form.publish → readback. Do NOT use cascadeRepublish on a form that already carries a custom layout or online JS — it re-scaffolds the default form. 子表关联列取主表字段是**两个字段**(先建并发布快照标量列,再建关联列);完整配方:`omc describe field.create --example child-map-fill`",
|
|
276
276
|
propertyEmptyReadback: "propertyEmpty overrides the data-model not-null declaration; false reopens a field the platform previously created wrongly (required/readonly belong to the form and workflow nodes). bizproperty/list rows do NOT carry propertyEmpty, so readback.propertyEmpty appears only when the draft face returns it — the CLI never fabricates it; readback.committed lists what actually went on the wire",
|
|
277
277
|
listFace: "field.list default face inlines code/name/type(+typeName)/conditions signal/shapeWarning only; the whole choices package is not inlined (a selection field measured ~500B/row) — verify options/subSchema with the code/fields selectors or full:true",
|
|
278
278
|
}),
|
package/dist/lanes/field.js
CHANGED
|
@@ -328,7 +328,25 @@ async function assertRelationOptionsFields(session, schemaCode, propertyType, re
|
|
|
328
328
|
: side === "target"
|
|
329
329
|
? `target=${mappedTarget || "(空)"} 不是本模型 ${schemaCode} 的发布面字段(target 只用本模型字段 code,不带前缀)。本模型候选:${targetCandidates.join("、") || "(无)"}`
|
|
330
330
|
: `source=${source || "(空)"} 不在${linkedHint}的发布面字段里;target=${mappedTarget || "(空)"} 不在本模型 ${schemaCode} 的发布面字段里。关联侧候选:${linkedCodes.join("、") || "(无)"};本模型候选:${targetCandidates.join("、") || "(无)"}`;
|
|
331
|
-
|
|
331
|
+
// F1(探针 AB P2,0.8.40):target 不存在时,消息必须给出「这是两个字段」
|
|
332
|
+
// 的可执行恢复——先建并发布快照标量列,再建关联列。父模型 code 不可硬编
|
|
333
|
+
// (子表关联目标可能与字段所在模型无关),field.publish 用占位符让平台/调用
|
|
334
|
+
// 方解析。source-only 缺口不涉及快照列,保持原提示不加 recovery。
|
|
335
|
+
const snapshotType = sourceField?.type !== undefined ? propertyTypeName(sourceField.type) : "<与 source 同族的标量类型>";
|
|
336
|
+
const fieldListHint = side === "source"
|
|
337
|
+
? `确认关联面 ${target} 的发布面字段用 omc call field.list --args '${JSON.stringify({ schemaCode: target, published: true })}'`
|
|
338
|
+
: side === "target"
|
|
339
|
+
? `确认本模型 ${schemaCode} 的发布面字段用 omc call field.list --args '${JSON.stringify({ schemaCode, published: true })}'`
|
|
340
|
+
: `确认关联面 ${target} 用 omc call field.list --args '${JSON.stringify({ schemaCode: target, published: true })}',本模型 ${schemaCode} 用 omc call field.list --args '${JSON.stringify({ schemaCode, published: true })}'`;
|
|
341
|
+
const targetRecovery = side === "source"
|
|
342
|
+
? undefined
|
|
343
|
+
: [
|
|
344
|
+
{ code: "create-snapshot-scalar", action: `先在本模型(子表)${schemaCode} 用 field.create 建快照标量列 code=${mappedTarget || "(空)"}、propertyType=${snapshotType}(与 source 同族的标量);关联/子表/附件等字段不能当快照标量。` },
|
|
345
|
+
{ code: "publish-then-retry", action: `field.publish 用拥有该子表的父模型 code(子表 code 会被 300004 拒,回执会给父模型):omc call field.publish --env <env> --args '{"schemaCode":"<父模型>"}';发布后重试本命令。` },
|
|
346
|
+
{ code: "read-example", action: "omc describe field.create --example child-map-fill" },
|
|
347
|
+
];
|
|
348
|
+
const twoFieldNote = side === "source" ? "" : "子表取主表是**两个字段**:先建并发布快照标量列,再建关联列。";
|
|
349
|
+
throw new ToolRefusalError({ status: "refused", blocker: "relation-mapping-field-not-found", side, schemaCode, relationTarget: target, ...(mainTableCode ? { mainTableCode } : {}), ...(targetParentCode ? { relationParentCode: targetParentCode } : {}), mappingIndex: index, source, targetField: mappedTarget, sourceCandidates: linkedCodes, targetCandidates, ...(targetRecovery ? { recovery: targetRecovery } : {}), ...(targetRecovery ? { nextCommand: `omc call field.create --env <env> --args '${JSON.stringify({ schemaCode, code: mappedTarget || "<target>", name: mappedTarget || "<target>", propertyType: sourceField?.type !== undefined ? propertyTypeName(sourceField.type) : "<与 source 同族的标量类型>" })}'`, nextCommandNote: "模板命令:<env>/<父模型> 等占位符需替换后执行;snapshot 的 options.scale 等按字段族补齐" } : {}), message: `关联映射第 ${index + 1} 行字段不存在:${detail}。请使用发布面业务字段 code;${fieldListHint}。${twoFieldNote}` });
|
|
332
350
|
}
|
|
333
351
|
// r52:类型兼容门。设计器 filterCondition(admin/js/17170.93392489.js)是产品承认的
|
|
334
352
|
// 可映射不变量,但它只活在下拉框里——保存、导入、field.create 全都绕过;平台后端
|
|
@@ -110,7 +110,8 @@ export function registerDataSave(tools) {
|
|
|
110
110
|
const prepared = await prepareRuntimeFormData(session, args.schemaCode, rawSaveData, { isUpdate: saveIsUpdate, assignChildSortKeys: !saveIsUpdate });
|
|
111
111
|
const formData = prepared.formData;
|
|
112
112
|
const writeDiagnostics = { ...ignoredNullDiagnostic(formData), ...unknownFieldDiagnostic(formData, prepared.fieldCodes, prepared.childCodes, prepared.schemaLoaded) };
|
|
113
|
-
// issue #100:选择字段的伴生 `<f>_key`
|
|
113
|
+
// issue #100:选择字段的伴生 `<f>_key` 只做写前告警(2.1.5 普通 form/save 不反推该键、
|
|
114
|
+
// 缺键通常保持空;OMC 不代写;8.6 是否反推需真机复核)。
|
|
114
115
|
// 复用 prepare 已读的 field.list(meta),成功路径零新增 wire。
|
|
115
116
|
const optionWarnings = optionKeyWarnings(prepared.meta, formData);
|
|
116
117
|
// issue#9 C1 + issue#10 勘误:提交面(submit:true / data.submit)的人员字段
|
|
@@ -341,9 +342,12 @@ export function registerDataSave(tools) {
|
|
|
341
342
|
// submit:true 时已有 submitRefused,抑制本键避免同现两个 blocker 名。
|
|
342
343
|
const workflowInstanceNote = publishedWorkflow && !saveIsUpdate && args.submit !== true
|
|
343
344
|
? {
|
|
344
|
-
blocker
|
|
345
|
+
// F5(w57 探针 AB):保存本身是成功的——这不是 blocker,只是「以后
|
|
346
|
+
// 不能直接提交」的信息。用 code/severity 表述,避免调用方读成失败。
|
|
347
|
+
code: "plain-save-no-workflow-instance",
|
|
348
|
+
severity: "info",
|
|
345
349
|
workflowCode: publishedWorkflow,
|
|
346
|
-
message:
|
|
350
|
+
message: `已保存为普通草稿、没有流程实例(本次 data.save 未带 workflowCode),之后无法 data.submit——submit 面会回 submit-existing-workflow-unsupported:` +
|
|
347
351
|
`8.6.26 没有 REST in-place 流程发起(submitWorkflowByWorkflowCode → createAndGetBizObject INSERT → 40000 duplicate primary key)。` +
|
|
348
352
|
`要可提交请重新建流程草稿:data.save {schemaCode:"${args.schemaCode}", workflowCode:"${publishedWorkflow}", formData:{...}}(formData 不要带 id),再从回执 performed 取 bizObjectId/workItemId/workflowInstanceId。`,
|
|
349
353
|
nextCommand: `omc call data.save --env <env> --args '{"schemaCode":"${args.schemaCode}","workflowCode":"${publishedWorkflow}","formData":{...}}'`,
|
|
@@ -774,14 +774,17 @@ export function childSortKeyOutOfRangeWarnings(formData, childCodes, existingRec
|
|
|
774
774
|
return warnings;
|
|
775
775
|
}
|
|
776
776
|
/**
|
|
777
|
-
* Advisory only (issue #100): 8.6
|
|
778
|
-
* a `<field>_key` companion column
|
|
779
|
-
* `OptionKeySupportImpl.getValueKeyMap` (8.6.26 :164-183)
|
|
780
|
-
*
|
|
781
|
-
*
|
|
782
|
-
*
|
|
783
|
-
*
|
|
784
|
-
*
|
|
777
|
+
* Advisory only (issue #100): 8.6 *may* mirror a RADIO(12)/DROPDOWN(14) value into
|
|
778
|
+
* a `<field>_key` companion column via
|
|
779
|
+
* `OptionKeySupportImpl.getValueKeyMap`/`setOptionsKey` (8.6.26 :164-183), but
|
|
780
|
+
* that path is only called by rule assignment / workflow child instances / import
|
|
781
|
+
* — NOT by the ordinary form/save facade. 2.1.5 live (w53, 2026-12-05):
|
|
782
|
+
* `BizObjectManagerImpl.insertBizObject/updateBizObject` has no companion-key write,
|
|
783
|
+
* so a missing key usually stays empty; a supplied wrong key is persisted as-is
|
|
784
|
+
* (save readback + data.load both returned it). OMC never writes the companion key;
|
|
785
|
+
* the warning only tells the caller when a hand-built payload has a value without
|
|
786
|
+
* one (or a key that disagrees with the readable snapshot), so a key-based filter
|
|
787
|
+
* can opt to supply it explicitly.
|
|
785
788
|
*/
|
|
786
789
|
export function optionKeyWarnings(meta, formData, row = 1) {
|
|
787
790
|
if (!meta)
|
|
@@ -806,9 +809,10 @@ export function optionKeyWarnings(meta, formData, row = 1) {
|
|
|
806
809
|
keyField: keyCode,
|
|
807
810
|
value: String(value),
|
|
808
811
|
optionSource: map.source,
|
|
812
|
+
usuallyNoAction: true,
|
|
809
813
|
...(suggested !== undefined ? { suggestedKey: suggested } : {}),
|
|
810
|
-
message: `字段 ${code} 传了值 "${String(value)}" 但没有伴生键 ${keyCode}
|
|
811
|
-
|
|
814
|
+
message: `字段 ${code} 传了值 "${String(value)}" 但没有伴生键 ${keyCode}。通常无需处理:2.1.5 普通 form/save 不反推该键(CLI 不代写),缺键列通常保持空;8.6 是否反推需真机复核。` +
|
|
815
|
+
`${suggested !== undefined ? `按当前${map.source === "snapshot" ? "字典快照" : "自定义选项"}可推出 ${keyCode}="${suggested}";若后续按 key 筛选/规则比较,显式带 ${keyCode}。` : map.source === "unresolved" ? `选项来源(businessModel)无法离线解析,本次给不出建议键。` : ""}`.trim(),
|
|
812
816
|
});
|
|
813
817
|
continue;
|
|
814
818
|
}
|
package/dist/path-projection.js
CHANGED
package/dist/read-projection.js
CHANGED
|
@@ -88,6 +88,9 @@ const ALWAYS_INLINE_KEYS = new Map([
|
|
|
88
88
|
// #77.2:withDraft 的「app 面会补建 7 条预置」披露是教学键——compact 折叠
|
|
89
89
|
// 成 {length,sha256,omitted} 后,调用方看不到自己多出来的预置行是怎么来的。
|
|
90
90
|
["draftNote", 1200],
|
|
91
|
+
// F4(探针 AB P2):DRAFT 面补建预置的 opt-in 判据 + 可复制命令必须活到 compact;
|
|
92
|
+
// 折叠成 {count,sha256,omitted} 后调用方会以为 `withDraft` 已读完 DRAFT 面。
|
|
93
|
+
["wouldCreatePresets", 1200],
|
|
91
94
|
]);
|
|
92
95
|
/** Config-inventory keys that compact to a code list (not a bare count). */
|
|
93
96
|
const CODE_LIST_KEYS = new Set(["fields", "columns", "conditions", "sorts", "datarules", "buttons", "views", "sheets"]);
|
package/dist/read-shapes.js
CHANGED
|
@@ -178,12 +178,12 @@ const READ_SHAPES = {
|
|
|
178
178
|
],
|
|
179
179
|
},
|
|
180
180
|
"rule.list": {
|
|
181
|
-
keys: ["rules:array<{code,name,enabled,status,ruleVersion,defaultRule,preset,mappings?,mappingsUnavailable?,publishEnabled?,draftEnabled?,draftStatus?,executable?,executableBasis?,draftOnly?}>", "rulesCount", "modelPresent", "source", "executableHint", "draftFace?/draftRowsCount?/draftNote?", "mappingsWireNote?", "schemaCodes?/modelsCount?/models?/partial?/failed?/absentModels?"],
|
|
181
|
+
keys: ["rules:array<{code,name,enabled,status,ruleVersion,defaultRule,preset,mappings?,mappingsUnavailable?,publishEnabled?,draftEnabled?,draftStatus?,executable?,executableBasis?,draftOnly?}>", "rulesCount", "modelPresent", "source", "executableHint", "draftFace?/draftRowsCount?/draftNote?", "draftFaceSkipped?/wouldCreatePresets?/presetFillConfirmed?", "mappingsWireNote?", "schemaCodes?/modelsCount?/models?/partial?/failed?/absentModels?"],
|
|
182
182
|
notes: [
|
|
183
183
|
"入参/他面叫 ruleCode,本面返回 rules[].code",
|
|
184
184
|
"source=published-list:enabled/status 来自 PUBLISH 投影;可执行性看 rule.get / rule.enable.verified",
|
|
185
|
-
"withDraft:true
|
|
186
|
-
"modelPresent:false 时未发 list(避免幻影 schema
|
|
185
|
+
"withDraft:true 时 published 清单 <7 且未传 ensurePresets:true → 默认跳过 app DRAFT 面(写副作用门):回 draftFaceSkipped:\"preset-fill-guard\" + wouldCreatePresets;ensurePresets:true 才真正读 DRAFT 面(+1 wire)并回 presetFillConfirmed:true,≥7 时不需要该确认。DRAFT 面逐行 publishEnabled/draftEnabled/draftStatus/executable/executableBasis,并补入 PUBLISH 清单看不到的禁用/草稿行(draftOnly:true,enabled/status 为 null)。executable 按平台 getExecutableBySchemaCodeAndCode:DEFAULT 需 DRAFT enabled=true、status!=DISABLED、至少 1 条 latestPublished;CODING/DECISION 只要求 DRAFT 存在",
|
|
186
|
+
"modelPresent:false 时未发 list(避免幻影 schema 补建预置)",
|
|
187
187
|
"withMappings:true 时每行带 mappings[]={nodeCode,serviceCode,serviceMethodCode,inputCount,outputCount}(摘要,正文 inputMappings/outputMappings 用 rule.get);行里读不到图 → mappingsUnavailable:true(≠没有映射)",
|
|
188
188
|
"schemaCodes[] 跨模型清单:models[] 每元素与单模型回执同形(含 modelPresent:false/rulesCount;三句提示抬到顶层 crossModelNotes,逐模型相同不重复),失败汇总在 failed[](partial:true);上限 20 个模型",
|
|
189
189
|
],
|
package/dist/recipes/field.js
CHANGED
|
@@ -135,7 +135,7 @@ const numericPercent = Object.freeze({
|
|
|
135
135
|
],
|
|
136
136
|
conditionalRequirements: [
|
|
137
137
|
"`options.format` 必须是平台常量:百分比 `ratio`(20%)/`ratio.tenths`(20.0%)/`ratio.percentile`(20.00%),普通数字 `integer/tenths/percentile…`,货币 `RMB./dollar./euro./HK.` 前缀,`none`=裸值;`percentile` 是两位小数**不是**百分比。全表见 `omc contract field-families` 的 numericalFormat。",
|
|
138
|
-
"`scale` 与小数据对齐(两位百分比 = `scale:2`+`ratio.percentile`);只写 scale 门户显示 `2,000.00` 普通数字。别名 percent/currency/¥ 由 CLI 归一为常量再落库;**别绕过 CLI 把 `percent`
|
|
138
|
+
"`scale` 与小数据对齐(两位百分比 = `scale:2`+`ratio.percentile`);只写 scale 门户显示 `2,000.00` 普通数字。别名 percent/currency/¥ 由 CLI 归一为常量再落库;**别绕过 CLI 把 `percent` 写进字段行**——平台读不懂,门户跌回裸值(r64b:format:\"percent\"→`0.5`)。",
|
|
139
139
|
"生效:字段行 format 优先于表单控件,`field.publish` 即生效(无需重建表单);列表另是一套列枚举。",
|
|
140
140
|
],
|
|
141
141
|
priorToolReferences: [
|
|
@@ -253,7 +253,7 @@ const childTable = Object.freeze({
|
|
|
253
253
|
*/
|
|
254
254
|
const childTableParentFieldFill = Object.freeze({
|
|
255
255
|
id: "child-map-fill",
|
|
256
|
-
title: "
|
|
256
|
+
title: "子表取主表(快照标量列 + 关联列,两个字段)",
|
|
257
257
|
aliases: ["取主表", "关联填充"],
|
|
258
258
|
status: "requires-prior-readback",
|
|
259
259
|
tool: "field.create",
|
|
@@ -272,20 +272,22 @@ const childTableParentFieldFill = Object.freeze({
|
|
|
272
272
|
},
|
|
273
273
|
},
|
|
274
274
|
preconditions: [
|
|
275
|
+
"**这是两个字段**:先在子表 schemaCode 建并发布快照标量列(code=target、propertyType=与 source 同族的标量;关联/子表/附件不能当快照标量),再建 WORK_SHEET 关联列。",
|
|
275
276
|
"**子表子 schema code = 父模型 CHILD_TABLE(8) 字段的 code**(父字段 code 为 `items` 时 schemaCode 就是 `items`),不是 `<model>_items` 约定名:`omc call field.list --args '{\"schemaCode\":\"<父模型>\"}'` 找 type:8 字段的 code;同一口径见 `omc contract field-families` 的 `childTableSubSchema`。**任务书要 `<model>_items` 时,直接把父字段 code 命名成 `<model>_items`**;平台不接受另起 subSchemaCode,`field.create` 回执的 childSchema 会回显实际 schemaCode。",
|
|
276
|
-
"子表 code
|
|
277
|
+
"子表 code 全局唯一。",
|
|
277
278
|
"**发布用父模型 code**:`field.publish {\"schemaCode\":\"<父模型>\"}`——子表 code 会被拒(300004 → `field-publish-child-schema`);模型级一次发全部草稿字段,子表列随父模型发。",
|
|
278
279
|
],
|
|
279
280
|
conditionalRequirements: [
|
|
280
281
|
"映射只在门户选值时回填:CLI data.save(/api/runtime/form/save)不跑 options.mappings,快照列需调用方自填;配置正确性以字段行 options.mappings 为准。",
|
|
281
|
-
"schemaCode 填子表(=父字段 code),发布填父模型 code——两者不是同一个 code,别互相套用。",
|
|
282
282
|
"关联列必须带 relativeCode(=options.schemaCode=主模型);source=主模型字段、target=本子表列,均裸 code。",
|
|
283
283
|
"关联列不能是 CHILD_TABLE/OCR/ELECTRONIC_SIGN/MULT_WORK_SHEET/RELEVANCE_DATA/FORMULA。",
|
|
284
284
|
],
|
|
285
285
|
priorToolReferences: [],
|
|
286
286
|
dryRun: { supported: true, command: `omc call field.create --env ${environment} --dry-run --args '<args>'`, notes: "" },
|
|
287
287
|
expectedReadback: { readback: { fieldPresent: true }, next: ["field.publish {schemaCode:<父模型>}", "field.get 读回 options.mappings"] },
|
|
288
|
-
refusalRecovery: [
|
|
288
|
+
refusalRecovery: [
|
|
289
|
+
{ code: "relation-mapping-field-not-found", action: "两个字段两步走:① 子表 schemaCode 先建并发布快照标量列(code=target、propertyType=与 source 同族的标量;field.publish 用父模型 code);② 再建关联列。source 用主模型字段、target 用本子表列,均裸 code。示例 `omc describe field.create --example child-map-fill`" },
|
|
290
|
+
],
|
|
289
291
|
requiresEnvironmentDerivedIds: true,
|
|
290
292
|
});
|
|
291
293
|
const businessModelDropdown = Object.freeze({
|
|
@@ -315,7 +317,7 @@ const businessModelDropdown = Object.freeze({
|
|
|
315
317
|
"来源模型的显示字段已 field.publish 并已 form.publish(未发布字段不可作为下拉来源)",
|
|
316
318
|
],
|
|
317
319
|
conditionalRequirements: [
|
|
318
|
-
"sheetDataItem 指向来源模型上真正承载业务值的字段;**不要用系统字段 name
|
|
320
|
+
"sheetDataItem 指向来源模型上真正承载业务值的字段;**不要用系统字段 name**——它是自动生成的数据标题(人名+模型名+时间),下拉项会显示标题而非业务值",
|
|
319
321
|
"orderByFields/orderType 可选,用于下拉项排序;conditions 可选,用于过滤来源行",
|
|
320
322
|
],
|
|
321
323
|
priorToolReferences: [
|
|
@@ -360,17 +362,17 @@ const formulaAggregationCrossModel = Object.freeze({
|
|
|
360
362
|
},
|
|
361
363
|
},
|
|
362
364
|
preconditions: [
|
|
363
|
-
"**只能汇总「别的模型」**:同模型(含自己的子表)聚合在 field.publish 必抛 305003
|
|
365
|
+
"**只能汇总「别的模型」**:同模型(含自己的子表)聚合在 field.publish 必抛 305003(publishFormula 把相对码改写成子表父模型,checkCycleOfAggregation 判成环);工具拒 `aggregation-self-schema-cycle`。",
|
|
364
366
|
"目标字段用 FORMULA(100)(不是普通字段 + 计算规则——type2 计算规则在 REST 路径永不执行)。",
|
|
365
367
|
"`schemaCode` 是被汇总的**来源模型**;`dataItemCode` 是来源模型的**主表标量列**(不带 schema 前缀);`queryConditions` **不能为空**,否则反向过滤器为空、找不到要回算的目标行(真机:空条件时 recalc 日志照常打印但目标字段恒为 0)。",
|
|
366
|
-
"**不要指向子表 schema**(r18
|
|
368
|
+
"**不要指向子表 schema**(r18 真机):`schemaCode:\"<子表>\"` 能发布,但目标模型从此**整个不可写** —— `data.submit`/`data.update` 一律回 40000「调用数据库发生异常」且无明细;而且子表 schema 没有父单单号列,按父单匹配恒为 0。`dataItemCode` 写成 `<子表>.<子列>` 则在 publish 直接 309004「使用的聚合数据项不存在」。要汇总子表:先在来源**主模型**上物化一个数值字段(门户计算规则或写入方维护),再聚合该标量。OMC 已写前拒绝 `aggregation-target-is-child-schema` / `aggregation-data-item-not-scalar`。",
|
|
367
369
|
],
|
|
368
370
|
conditionalRequirements: [
|
|
369
371
|
"**DYNAMIC 条件的两个 code 分属两侧,写反了就静默 0**:`propertyCode` = **来源模型**的字段(这里是 r17_c.nm),`currentPropertyCode` = **目标模型**的字段(这里是 r17_d.srcNo)。语义 = 「来源行的 nm 等于本目标行的 srcNo」。",
|
|
370
372
|
"`propertyType`/`currentPropertyType` 是 BizPropertyType 的**整数码**(0=SHORT_TEXT 2=NUMERICAL 9=WORK_SHEET…),`operatorType` 是 OperatorType 的**整数码**(1=EQ 6=ITEQ 9=IS_NULL 10=IS_NOT_NULL…)。写名字会被 ObjectMapperUtils 抛 json processing exception 并掩码成 305003;工具会自动转码。",
|
|
371
373
|
"`calculateType` 是**字符串**(SUM/COUNT/COUNTIF/SUMIF/AVG/MAX/MIN/**LARGE/SMALL/UNION/PRODUCT**),不是枚举 code。2.1.5 新增 `PRODUCT`(累乘;8.6 无)。r18b 真机三种特殊算法:LARGE/SMALL **必须带位置参数** `LARGE({<来源>.<列>},2)`(缺 k → 平台 NumberFormatException → 目标写入 50000);**UNION 是文本拼接**,顶层 `resultType` 必须是 0/LONG_TEXT=1(写 2 会 50000,读回是去重串,如单号本身);SUM/AVG/MAX/MIN/COUNT 用 resultType:2。",
|
|
372
|
-
"
|
|
373
|
-
"**回算时机(r17b
|
|
374
|
+
"发布后平台**自动生成 t100 CALCULATE_RULE 镜像行**(h_biz_data_rule,propertyCode=字段 code),它是回算触发的前置条件,别手动删。",
|
|
375
|
+
"**回算时机(r17b 真机图谱)**:① 目标行**自己 submit** 时镜像规则一定算;② 来源行 submit/update/delete 触发 `RollUpEventListener`→`FormulaPropertySupport` 事件回算——FIXED+DYNAMIC 混用、多组 OR、COUNTIF/MAX、子表行级条件(propertyCode 带 `.`)都验证过,DELETE 也会回算;③ ⚠️ 事件回算**只在目标模型发布后的几分钟内可靠**,之后静默停止(源端数据变了目标字段不更新、无报错)——重新 `field.publish --force` 目标模型即可恢复。定时巡检/对账场景务必重发或依赖目标行写入路径。",
|
|
374
376
|
],
|
|
375
377
|
priorToolReferences: [
|
|
376
378
|
{ tool: "field.list", args: { environment, schemaCode: "r17_c", published: true }, purpose: "确认来源模型与其列已发布,取 dataItemCode 与 DYNAMIC 条件的 propertyCode" },
|
|
@@ -457,12 +459,12 @@ const externalLookupModel = Object.freeze({
|
|
|
457
459
|
},
|
|
458
460
|
preconditions: [
|
|
459
461
|
"映射模型已建且字段与接口返回字段一一对应(如 qcc_company: company_name/credit_code)",
|
|
460
|
-
"
|
|
462
|
+
"数据段已通:接口数据能落进映射模型表(见 conditionalRequirements 第 1 条)",
|
|
461
463
|
],
|
|
462
464
|
conditionalRequirements: [
|
|
463
|
-
"**数据段首选(平台标准模式)**:映射模型的 GetList/Load 规则挂 BIZ_ACTION 实时调接口(接口方法配 frontEndExtensionEnable:true)——门户关联控件**打开即触发**前端查询链→GetList 规则→BIZ_ACTION 实时调外部接口(引擎日志 bizBusService.invoke + 外部网关日志双侧铁证)。**验证必须走门户填表;data.list
|
|
465
|
+
"**数据段首选(平台标准模式)**:映射模型的 GetList/Load 规则挂 BIZ_ACTION 实时调接口(接口方法配 frontEndExtensionEnable:true)——门户关联控件**打开即触发**前端查询链→GetList 规则→BIZ_ACTION 实时调外部接口(引擎日志 bizBusService.invoke + 外部网关日志双侧铁证)。**验证必须走门户填表;data.list 不反映此链**。配置侧三个收尾点:① WORK_SHEET 字段必须带 relativeCode(仅 options.schemaCode 发布表单会 301015 关联业务模型为空);② GetList 规则的 BIZ_ACTION 入参映射要接前端搜索词(实测未配词时 invoke 参数为空 {});③ 出参→列表行的映射配完候选才回显(未配时弹窗 Total 0 但接口已调)。备选(不需要实时时):预置 Create/Update 规则落映射表 / TIMING 定时同步。图内「BIZ_ACTION→CREATE 落表→再查」回环在 1.1.25 不可表达,不要走这条岔路。",
|
|
464
466
|
"**表单段是平台原生能力**:关联单选指向映射模型后,门户上输入关键字回车即查映射表、选中即 mappings 带出——前台填表时映射自然出现,无需按钮/脚本。",
|
|
465
|
-
"
|
|
467
|
+
"「下拉框形态(输关键字回车查询)」是表单 attributes 层控件形态(默认弹窗),在 form.draft 配置;映射表要有数据下拉才有选项。",
|
|
466
468
|
"**关联填充映射的事实源是字段行 `options.mappings`**:改表单控件属性里的 mappings 会被平台按字段重算覆盖、回读不生效(真机 2026-10-14 中冶实证)。改映射走 `field.update` 按完整 options 提交(只改 mappings,其余键 queryCode/displayField/schemaCode/conditions… 原值保留)→ `field.publish` → `form.draft`(**rebuild:false**,保留现有布局与已挂在线JS)重存 → `form.publish` → 回读核对。**别用 cascadeRepublish 刷已带布局/在线JS 的表单**(会 rebuild 脚手架)。",
|
|
467
469
|
],
|
|
468
470
|
priorToolReferences: [
|
|
@@ -475,7 +477,7 @@ const externalLookupModel = Object.freeze({
|
|
|
475
477
|
{ code: "field-family-options-invalid", action: "WORK_SHEET options 必带 schemaCode/queryCode/displayField;mappings 用数组或 JSON 字符串均可(CLI 就地归一)" },
|
|
476
478
|
...commonRecovery,
|
|
477
479
|
],
|
|
478
|
-
notes: "r29
|
|
480
|
+
notes: "r29 定案:此模式是「外部数据填表带出」的平台正解;按钮触发回写是下策(多一次交互)。数据段三组合基于出参回写三前提。",
|
|
479
481
|
requiresEnvironmentDerivedIds: true,
|
|
480
482
|
});
|
|
481
483
|
export const FIELD_METADATA = Object.freeze({
|
|
@@ -43,9 +43,10 @@ const basicDraftSave = Object.freeze({
|
|
|
43
43
|
"formData 只放标量字段,不带 id(带 id 是更新既有记录的语义)",
|
|
44
44
|
],
|
|
45
45
|
conditionalRequirements: [
|
|
46
|
-
"纯草稿保存:不带 workflowCode
|
|
46
|
+
"纯草稿保存:不带 workflowCode/submit——行落为 DRAFT,不推进流程、不触发 Create/Update 规则(DRAFT 跳过分发)",
|
|
47
47
|
"子表数组、关联/人员字段形状、流程草稿走 `omc describe data.save --example workflow-backed-data-save`;正式数据一调完成态用 data.submit",
|
|
48
48
|
"关联字段(WORK_SHEET)在 formData 里写 `\"<relationField>\":\"<bizObjectId>\"`(`{id}` 也接受);子表行内关联列同理;人员/组织字段写数组 `[{id,type,name}]`。",
|
|
49
|
+
"选择字段伴生 `<code>_key`:OMC 不代写,2.1.5 普通保存不反推(缺键常空,optionKeyMissing 通常无需处理);按 key 筛选/规则比较带 suggestedKey。",
|
|
49
50
|
],
|
|
50
51
|
priorToolReferences: [
|
|
51
52
|
{ tool: "model.list", args: { environment }, purpose: "确认 schemaCode(models[].schemaCode)" },
|
|
@@ -13,6 +13,11 @@ export class WriteLockConflictError extends Error {
|
|
|
13
13
|
* face, `intent apply` ships the minimal owner/recovery face, and `rollback
|
|
14
14
|
* apply` ships rollbackOf/waitMs/lockOwner. Freezing them here keeps the
|
|
15
15
|
* per-face shapes while moving the decision to one place.
|
|
16
|
+
*
|
|
17
|
+
* F3(w57 探针 AB):single 面的 `nextCommand` 现在带本次调用的参数段
|
|
18
|
+
* (`nextArgs`,由 `lockRetryArgs` 安全生成)——旧命令丢了 `--args`,复制执行
|
|
19
|
+
* 会变成空参数调用。batch/intent/rollback 的冻结形状不变(batch 用
|
|
20
|
+
* `--args-list`,无法用单条 `--args` 表达)。
|
|
16
21
|
*/
|
|
17
22
|
export function writeLockConflictReceipt(request, refused) {
|
|
18
23
|
if (request.mode === "rollback") {
|
|
@@ -56,12 +61,16 @@ export function writeLockConflictReceipt(request, refused) {
|
|
|
56
61
|
batch: true,
|
|
57
62
|
};
|
|
58
63
|
}
|
|
64
|
+
// F3(w57):single 面把本次参数带进 nextCommand,拒绝回执才是可执行命令;
|
|
65
|
+
// batch/intent/rollback 的三份冻结回执不变。
|
|
59
66
|
return writeLockHeldFace({
|
|
60
67
|
environment: request.environment,
|
|
61
68
|
owner: refused.owner,
|
|
62
69
|
recovery: refused.recovery,
|
|
63
70
|
refusedTool: request.tool,
|
|
64
71
|
waitMs: request.waitMs > 0 ? request.waitMs : 30_000,
|
|
72
|
+
...(request.nextArgs !== undefined ? { nextArgs: request.nextArgs } : {}),
|
|
73
|
+
...(request.nextCommandArgsOmitted !== undefined ? { nextCommandArgsOmitted: request.nextCommandArgsOmitted } : {}),
|
|
65
74
|
});
|
|
66
75
|
}
|
|
67
76
|
/** The frozen human line per face (`rollback apply` never printed one). */
|
package/dist/write-lock.js
CHANGED
|
@@ -172,6 +172,7 @@ export function staleLockPresent(environment) {
|
|
|
172
172
|
export function writeLockHeldFace(options) {
|
|
173
173
|
const wait = Math.max(1_000, options.waitMs && options.waitMs > 0 ? options.waitMs : 30_000);
|
|
174
174
|
const tool = options.refusedTool && options.refusedTool.length > 0 ? options.refusedTool : "<tool>";
|
|
175
|
+
const argsSegment = options.nextArgs !== undefined ? ` ${options.nextArgs}` : "";
|
|
175
176
|
const lockOwnerFace = options.owner
|
|
176
177
|
? {
|
|
177
178
|
tool: options.owner.tool ?? options.owner.command,
|
|
@@ -188,7 +189,8 @@ export function writeLockHeldFace(options) {
|
|
|
188
189
|
retryable: true,
|
|
189
190
|
owner: options.owner,
|
|
190
191
|
lockOwner: lockOwnerFace,
|
|
191
|
-
nextCommand: `omc call ${tool} --env ${options.environment} --wait ${wait}`,
|
|
192
|
+
nextCommand: `omc call ${tool} --env ${options.environment}${argsSegment} --wait ${wait}`,
|
|
193
|
+
...(options.nextCommandArgsOmitted !== undefined ? { nextCommandArgsOmitted: options.nextCommandArgsOmitted } : {}),
|
|
192
194
|
note: "不要写 shell 重试循环;用 --wait 排队",
|
|
193
195
|
message: `another process holds the write lock for environment ${options.environment}(retryable:true;用 --wait 排队,不要写 shell 重试循环)`,
|
|
194
196
|
recovery: options.recovery,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stalfh233/omc-cli",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.40",
|
|
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.40",
|
|
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.40"
|
|
80
80
|
}
|
|
81
81
|
}
|
|
@@ -5,7 +5,7 @@ description: 中文 CloudPivot 业务配置 runbook。用于把模型、字段
|
|
|
5
5
|
|
|
6
6
|
# CloudPivot 业务配置 Runbook
|
|
7
7
|
|
|
8
|
-
本技能讲业务需求如何落成配置包;底层 wire
|
|
8
|
+
本技能讲业务需求如何落成配置包;底层 wire 与白屏陷阱见 `omc-write-hazards`。
|
|
9
9
|
|
|
10
10
|
## 入口
|
|
11
11
|
|
|
@@ -23,7 +23,7 @@ omc help omc-five-piece-flow
|
|
|
23
23
|
|
|
24
24
|
## 需求五维
|
|
25
25
|
|
|
26
|
-
|
|
26
|
+
按五个需求维度拆:
|
|
27
27
|
|
|
28
28
|
1. **模型**:主对象、应用、业务 code。
|
|
29
29
|
2. **字段**:类型、选项、关联目标、模型可空性。
|
|
@@ -40,7 +40,7 @@ omc help omc-five-piece-flow
|
|
|
40
40
|
3. 取得用户明确确认;确认前不写环境。
|
|
41
41
|
4. 需求包含运行行为时,用 CLI 真实触发;测试数据的保留/清理要写进草稿。
|
|
42
42
|
|
|
43
|
-
完成标准:每项资源有 readback;每个运行写入有 delivery
|
|
43
|
+
完成标准:每项资源有 readback;每个运行写入有 delivery 状态;每个映射字段都有目标值;步骤与清理动作可追踪。
|
|
44
44
|
|
|
45
45
|
## 模型与字段
|
|
46
46
|
|
|
@@ -49,8 +49,8 @@ omc help omc-five-piece-flow
|
|
|
49
49
|
- **code 长度平台硬限**:模型 code ≤26 字符、字段 code ≤28(`business-code-invalid` 出门校验;长业务名先起短 code,长名放 name)。
|
|
50
50
|
- 模型层字段默认可空;必填、只读、可见性在表单和流程节点配置。
|
|
51
51
|
- `propertyEmpty` 默认 `false`,不要把业务必填硬编码在数据模型。
|
|
52
|
-
- **`<code>_key` 孪生列(单选/字典,8.6/2.1 同形)**:运行面成对存 `<code>`(显示值)与 `<code>_key`(字典 key
|
|
53
|
-
-
|
|
52
|
+
- **`<code>_key` 孪生列(单选/字典,8.6/2.1 同形)**:运行面成对存 `<code>`(显示值)与 `<code>_key`(字典 key),列表需 `displayBackupColumns` 才可见;**过滤用原字段名 + key 值**(不是显示值),否则静默 0 条(2.1.5 `BizObject.java:59`/`BizObjectFacadeImpl.java:1857`;8.6.26 `:83`/`:4182`)。写入侧 OMC 不代写,2.1.5 普通保存不反推,按键筛选显式带 suggestedKey。
|
|
53
|
+
- 关联单选优先读目标模型已发布字段并明确显示字段;无映射勿写空数组串。
|
|
54
54
|
|
|
55
55
|
## 子表
|
|
56
56
|
|