@stalfh233/omc-cli 0.8.32 → 0.8.34
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/arg-vocabulary.js +223 -0
- package/dist/artifact-cmd.js +443 -0
- package/dist/batch-call.js +56 -3
- package/dist/call-command.js +70 -0
- package/dist/call-execute.js +228 -0
- package/dist/call-input.js +557 -0
- package/dist/call-output.js +240 -0
- package/dist/cli.js +13 -1359
- package/dist/command-transport.js +4 -1
- package/dist/form-support.js +14 -3
- package/dist/intent/plan-apply.js +14 -24
- package/dist/lanes/datarule.js +21 -0
- package/dist/lanes/field-contract.js +1 -1
- package/dist/lanes/field.js +128 -1
- package/dist/lanes/list-view-shapes.js +8 -1
- package/dist/lanes/list-view.js +64 -2
- package/dist/lanes/runtime-data/aggregate-support.js +209 -0
- package/dist/lanes/runtime-data/aggregate.js +679 -0
- package/dist/lanes/runtime-data/field-options.js +52 -0
- package/dist/lanes/runtime-data/lane.js +4 -0
- package/dist/lanes/runtime-data/record-delete.js +419 -0
- package/dist/lanes/runtime-data/record-read.js +984 -0
- package/dist/lanes/runtime-data/record-write.js +562 -0
- package/dist/lanes/runtime-data/registration.js +22 -0
- package/dist/lanes/runtime-data/shapes.js +594 -0
- package/dist/lanes/runtime-data/submission.js +1304 -0
- package/dist/lanes/runtime-data/write-support.js +875 -0
- package/dist/lanes/runtime-data.js +10 -5590
- package/dist/lanes/workflow/approval-ops.js +983 -0
- package/dist/lanes/workflow/instance-read.js +284 -0
- package/dist/lanes/workflow/lifecycle-write.js +1499 -0
- package/dist/lanes/workflow/permissions.js +571 -0
- package/dist/lanes/workflow/recovery.js +361 -0
- package/dist/lanes/workflow/registration.js +14 -0
- package/dist/lanes/workflow/shapes.js +811 -0
- package/dist/lanes/workflow/template-fetch.js +197 -0
- package/dist/lanes/workflow/template-merge.js +1351 -0
- package/dist/lanes/workflow/template-read.js +327 -0
- package/dist/lanes/workflow.js +11 -6312
- package/dist/model-scaffold.js +6 -2
- package/dist/plan.js +23 -1
- package/dist/read-projection.js +442 -0
- package/dist/read.js +40 -335
- package/dist/rollback.js +17 -23
- package/dist/runtime-support.js +1 -1
- package/dist/verification.js +39 -0
- package/dist/write-coordinator.js +152 -0
- package/dist/write-outcome.js +295 -0
- package/dist/write.js +34 -115
- package/package.json +3 -3
- package/skills/omc-refusals.md +1 -1
- package/skills/omc-start-here.md +2 -2
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { acquireWriteLock, writeLockHeldFace } from "./write-lock.js";
|
|
2
|
+
export class WriteLockConflictError extends Error {
|
|
3
|
+
conflict;
|
|
4
|
+
constructor(conflict) {
|
|
5
|
+
super(`write lock held for environment ${String(conflict.receipt["environment"] ?? "")}`);
|
|
6
|
+
this.name = "WriteLockConflictError";
|
|
7
|
+
this.conflict = conflict;
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Single constructor for every `write-lock-held` refusal. The three faces do
|
|
12
|
+
* NOT share one shape: `omc call` ships the full retryable/lockOwner/nextCommand
|
|
13
|
+
* face, `intent apply` ships the minimal owner/recovery face, and `rollback
|
|
14
|
+
* apply` ships rollbackOf/waitMs/lockOwner. Freezing them here keeps the
|
|
15
|
+
* per-face shapes while moving the decision to one place.
|
|
16
|
+
*/
|
|
17
|
+
export function writeLockConflictReceipt(request, refused) {
|
|
18
|
+
if (request.mode === "rollback") {
|
|
19
|
+
if (request.rollbackOf === undefined)
|
|
20
|
+
throw new Error("write-coordinator: rollback mode requires rollbackOf");
|
|
21
|
+
return {
|
|
22
|
+
status: "refused",
|
|
23
|
+
blocker: "write-lock-held",
|
|
24
|
+
rollbackOf: { seq: request.rollbackOf.seq, tool: request.rollbackOf.tool },
|
|
25
|
+
waitMs: request.waitMs,
|
|
26
|
+
lockOwner: refused.owner ?? null,
|
|
27
|
+
message: `回滚写锁被占用;已等待 ${request.waitMs}ms。可用 --wait <ms> 有界排队后重试`,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
if (request.mode === "intent") {
|
|
31
|
+
return {
|
|
32
|
+
status: "refused",
|
|
33
|
+
blocker: "write-lock-held",
|
|
34
|
+
environment: request.environment,
|
|
35
|
+
owner: refused.owner,
|
|
36
|
+
recovery: refused.recovery,
|
|
37
|
+
message: refused.recovery[0],
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
if (request.mode === "batch") {
|
|
41
|
+
// One lock for the whole `--args-list`, so a refusal means ZERO entries ran.
|
|
42
|
+
// Same face as a single call (`--args-list` is `omc call` N times) plus
|
|
43
|
+
// `batch:true`; the tool label carries `:batch` for forensics, so the
|
|
44
|
+
// runnable nextCommand is built from the real tool name.
|
|
45
|
+
const face = writeLockHeldFace({
|
|
46
|
+
environment: request.environment,
|
|
47
|
+
owner: refused.owner,
|
|
48
|
+
recovery: refused.recovery,
|
|
49
|
+
refusedTool: request.batchTool ?? request.tool,
|
|
50
|
+
waitMs: request.waitMs > 0 ? request.waitMs : 30_000,
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
...face,
|
|
54
|
+
message: "another process holds the write lock for environment " +
|
|
55
|
+
`${request.environment}(retryable:true;整批零执行;用 --wait 排队,不要写 shell 重试循环)`,
|
|
56
|
+
batch: true,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
return writeLockHeldFace({
|
|
60
|
+
environment: request.environment,
|
|
61
|
+
owner: refused.owner,
|
|
62
|
+
recovery: refused.recovery,
|
|
63
|
+
refusedTool: request.tool,
|
|
64
|
+
waitMs: request.waitMs > 0 ? request.waitMs : 30_000,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
/** The frozen human line per face (`rollback apply` never printed one). */
|
|
68
|
+
function writeLockConflictStderr(mode, owner) {
|
|
69
|
+
if (mode === "rollback")
|
|
70
|
+
return undefined;
|
|
71
|
+
if (mode === "intent")
|
|
72
|
+
return `write lock conflict: ${JSON.stringify(owner)}`;
|
|
73
|
+
return `write lock conflict: ${JSON.stringify({ pid: owner?.pid, tool: owner?.tool ?? owner?.command, startedAt: owner?.startedAt })}`;
|
|
74
|
+
}
|
|
75
|
+
const RETRY_SLICE_MS = 200;
|
|
76
|
+
/**
|
|
77
|
+
* The only implementation of acquire → bounded wait → conflict → release.
|
|
78
|
+
*
|
|
79
|
+
* Frozen timeout details:
|
|
80
|
+
* - An exhausted `--wait` is a refusal with the face-specific receipt above,
|
|
81
|
+
* never an `ok:false` error and never a silent retry.
|
|
82
|
+
* - `omc call` retains the lock after `cli-timeout` (the operation calls
|
|
83
|
+
* `lease.retain()`); every other face releases in `finally` on every path.
|
|
84
|
+
* - `intent apply` re-checks the deadline after the final bounded sleep and
|
|
85
|
+
* stops there (its pre-extraction loop did); the other faces retry
|
|
86
|
+
* acquisition once more. Both live in this one loop.
|
|
87
|
+
*/
|
|
88
|
+
class WriteCoordinatorImpl {
|
|
89
|
+
acquire;
|
|
90
|
+
sleep;
|
|
91
|
+
now;
|
|
92
|
+
constructor(options = {}) {
|
|
93
|
+
this.acquire = options.acquire ?? acquireWriteLock;
|
|
94
|
+
this.sleep = options.sleep ?? ((ms) => new Promise((resolve) => setTimeout(resolve, ms)));
|
|
95
|
+
this.now = options.now ?? Date.now;
|
|
96
|
+
}
|
|
97
|
+
async run(request, operation) {
|
|
98
|
+
const held = await this.acquireWithinDeadline(request);
|
|
99
|
+
let retained = false;
|
|
100
|
+
let released = false;
|
|
101
|
+
const release = async () => {
|
|
102
|
+
if (released)
|
|
103
|
+
return;
|
|
104
|
+
released = true;
|
|
105
|
+
await held.release();
|
|
106
|
+
};
|
|
107
|
+
const lease = {
|
|
108
|
+
environment: request.environment,
|
|
109
|
+
tool: request.tool,
|
|
110
|
+
mode: request.mode,
|
|
111
|
+
retain: () => {
|
|
112
|
+
retained = true;
|
|
113
|
+
},
|
|
114
|
+
release,
|
|
115
|
+
};
|
|
116
|
+
try {
|
|
117
|
+
return await operation(lease);
|
|
118
|
+
}
|
|
119
|
+
finally {
|
|
120
|
+
if (!retained)
|
|
121
|
+
await release();
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
async acquireWithinDeadline(request) {
|
|
125
|
+
const deadline = this.now() + Math.max(0, request.waitMs);
|
|
126
|
+
const recheckAfterSleep = request.mode === "intent";
|
|
127
|
+
for (;;) {
|
|
128
|
+
const lock = await this.acquire(request.environment);
|
|
129
|
+
if (lock.held)
|
|
130
|
+
return lock;
|
|
131
|
+
if (this.now() >= deadline)
|
|
132
|
+
throw this.conflict(request, lock);
|
|
133
|
+
await this.sleep(Math.min(RETRY_SLICE_MS, Math.max(0, deadline - this.now())));
|
|
134
|
+
if (recheckAfterSleep && this.now() >= deadline)
|
|
135
|
+
throw this.conflict(request, lock);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
conflict(request, refused) {
|
|
139
|
+
return new WriteLockConflictError({
|
|
140
|
+
mode: request.mode,
|
|
141
|
+
receipt: writeLockConflictReceipt(request, refused),
|
|
142
|
+
stderr: writeLockConflictStderr(request.mode, refused.owner),
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
/** Production coordinator bound to the real cross-process lock. */
|
|
147
|
+
export const writeCoordinator = new WriteCoordinatorImpl();
|
|
148
|
+
/** Test factory (does not touch the singleton). */
|
|
149
|
+
export function createWriteCoordinator(options = {}) {
|
|
150
|
+
return new WriteCoordinatorImpl(options);
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=write-coordinator.js.map
|
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 写结果(write outcome)的内部判别联合——「这次写到底算不算完成」的唯一判定点。
|
|
3
|
+
*
|
|
4
|
+
* 为什么要有这一层:执行面以前用一个**全可选字段**的 `WriteExecuteOutcome` 表达
|
|
5
|
+
* 结果(`status?` / `blocker?` / `message?` / `submitRefused?` …),再由共享管道
|
|
6
|
+
* 用一段 if/else 反推信封状态与 deliveryState。同一个事实(例如「读回说目标不在」)
|
|
7
|
+
* 因此有两套说法:执行面写 `readback.present=false`,管道里翻译成
|
|
8
|
+
* `WRITE_UNVERIFIED`,信封层再翻译成 ok/exit 0——谁都能加一个可选字段,谁都能
|
|
9
|
+
* 悄悄改变完成态。这里收敛成:
|
|
10
|
+
*
|
|
11
|
+
* producer(执行面原始形状)
|
|
12
|
+
* ── reduceWriteOutcome ──▶ WriteOutcome(判别联合:事实)
|
|
13
|
+
* ── toWriteReceipt ──▶ 回执(信封字段,逐字节与旧形状一致)
|
|
14
|
+
*
|
|
15
|
+
* 三条不变量:
|
|
16
|
+
* 1. **判定只有一个方向**:`delivered` / `unverified` / `partial` / `stopped` /
|
|
17
|
+
* `refused` 由 `reduceWriteOutcome` 单点产生;`toWriteReceipt` 只做序列化,
|
|
18
|
+
* 不再判断「算不算成功」。
|
|
19
|
+
* 2. **外部 JSON 不变**:回执的键名、键序、取值与 0.8.x 旧实现逐字节一致
|
|
20
|
+
* (`behavior-freeze` 语料是判据)。联合只活在内部。
|
|
21
|
+
* 3. **不猜**:`readback` 证明不了自己的写 → `unverified`;执行面显式声明
|
|
22
|
+
* 「未建立结论」→ `unverified{claim:"unknown"}`(信封 `uncertain`,exit 14)。
|
|
23
|
+
* 两者都是 `WRITE_UNVERIFIED`,但回执状态不同——不能合并成一个布尔。
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Readback gate: a tool whose authoritative readback says the target is ABSENT
|
|
27
|
+
* has not proven its write. "Called without error" must never be stamped
|
|
28
|
+
* DELIVERED (live 2026-10-17: model.create returned errcode 0 + present:false
|
|
29
|
+
* while the menu row was orphaned; the AI read DELIVERED as success).
|
|
30
|
+
*
|
|
31
|
+
* Deletion receipts use the mirror key: `readback.absent`. The platform's
|
|
32
|
+
* physically_delete is an async task (AppPackageController.java:1351-1358 /
|
|
33
|
+
* 8.6.26 :1423 → AppIntegrationFacadeImpl.syncDeletePhysicalResources
|
|
34
|
+
* :1112-1131 creates `AppDeleteHistory(TaskStatus.RUN)` and returns
|
|
35
|
+
* immediately), so `absent:false` means "cascade still running", NOT success.
|
|
36
|
+
* Without this branch the same receipt was stamped DELIVERED (0.8.5 live).
|
|
37
|
+
*
|
|
38
|
+
* W37C(0.8.34):读回**缺席**不是读回通过。`deliveryStateFor` 以前把
|
|
39
|
+
* `undefined`/`null`/数组都落到末尾的 `DELIVERED`——「没报错」被读成「已完成」,
|
|
40
|
+
* 而契约是「未确认必须 WRITE_UNVERIFIED」(AGENTS:ok + DELIVERED ≠ 完成)。
|
|
41
|
+
* 空对象 `{}` 同理:它没有任何可证明字段(present/absent 都缺席),不能算证据。
|
|
42
|
+
* 非空对象仍走既有分支(present/absent/deleteTask/allAbsent),不改判据。
|
|
43
|
+
*/
|
|
44
|
+
const READBACK_MISSING_WARNING = "读回缺失或不是对象(readback 未提供):本次调用没有可判定的读回证据(WRITE_UNVERIFIED)——按 blocker/message 核对后再决定,勿当作完成";
|
|
45
|
+
const READBACK_EMPTY_WARNING = "读回为空对象:没有任何可证明字段(present/absent 均缺席),本次写入未被证明(WRITE_UNVERIFIED)——按 blocker/message 核对后再决定,勿当作完成";
|
|
46
|
+
export function deliveryStateFor(readback) {
|
|
47
|
+
if (readback === null || typeof readback !== "object" || Array.isArray(readback))
|
|
48
|
+
return { deliveryState: "WRITE_UNVERIFIED", readbackWarning: READBACK_MISSING_WARNING };
|
|
49
|
+
const record = readback;
|
|
50
|
+
if (Object.keys(record).length === 0)
|
|
51
|
+
return { deliveryState: "WRITE_UNVERIFIED", readbackWarning: READBACK_EMPTY_WARNING };
|
|
52
|
+
// The platform's async delete task itself failed (AppIntegrationFacadeImpl
|
|
53
|
+
// 8.6.26 :1348-1355: catch → message + TaskStatus.FAIL; read back through
|
|
54
|
+
// AppPackageController /delete/history). The record face still answers (the
|
|
55
|
+
// cascade aborted), so this must be checked FIRST — a FAIL can never be
|
|
56
|
+
// DELIVERED, and the platform text is the only real cause.
|
|
57
|
+
const rawDeleteTask = record?.deleteTask;
|
|
58
|
+
const deleteTask = rawDeleteTask !== null && typeof rawDeleteTask === "object" ? rawDeleteTask : undefined;
|
|
59
|
+
if (deleteTask?.taskStatus === "FAIL")
|
|
60
|
+
return {
|
|
61
|
+
deliveryState: "WRITE_UNVERIFIED",
|
|
62
|
+
readbackWarning: `未删除:平台删除任务失败(taskId=${String(deleteTask.taskId ?? "?")},平台原文:${String(deleteTask.message ?? "未返回 message")})——删除未完成,按平台原文拆引用/清残留后重试`,
|
|
63
|
+
};
|
|
64
|
+
if (record?.present === false)
|
|
65
|
+
return {
|
|
66
|
+
deliveryState: "WRITE_UNVERIFIED",
|
|
67
|
+
readbackWarning: "读回显示目标不存在(readback.present=false):平台接受了请求但权威面查不到——不要当作最终一致性豁免,按失败排查(模型挂载/路径/权限)",
|
|
68
|
+
};
|
|
69
|
+
// `absent:false` on a deletion receipt = the authoritative record face still
|
|
70
|
+
// returns the target. The platform accepted the request but the async delete
|
|
71
|
+
// has not completed; never read that as "deleted".
|
|
72
|
+
if (record?.absent === false)
|
|
73
|
+
return {
|
|
74
|
+
deliveryState: "WRITE_UNVERIFIED",
|
|
75
|
+
readbackWarning: "目标是删除级联中:平台 async 任务未完成(readback.absent=false,权威面仍查得到目标),勿当成功——以记录面 absent=true 且应用树无节点为准,稍后重跑本工具(幂等)复核",
|
|
76
|
+
};
|
|
77
|
+
// model.deleteMany reports the same fact per target: `allAbsent:false`.
|
|
78
|
+
if (record?.allAbsent === false)
|
|
79
|
+
return {
|
|
80
|
+
deliveryState: "WRITE_UNVERIFIED",
|
|
81
|
+
readbackWarning: "目标是删除级联中:平台 async 任务未完成(readback.allAbsent=false,见 perCode 逐项),勿当成功——稍后重跑本工具(幂等)复核",
|
|
82
|
+
};
|
|
83
|
+
return { deliveryState: "DELIVERED" };
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* The gate's WRITE_UNVERIFIED branches always carry their own text; this is a
|
|
87
|
+
* belt-and-braces fallback so a future gate branch cannot serialize `undefined`
|
|
88
|
+
* as "no warning" (which would read as success).
|
|
89
|
+
*/
|
|
90
|
+
const READBACK_GATE_FALLBACK = "读回未能证明本次写入已生效(WRITE_UNVERIFIED):按 blocker/message 核对后再决定,勿当作完成";
|
|
91
|
+
function diagnosisOf(producer) {
|
|
92
|
+
return {
|
|
93
|
+
...(producer.blocker !== undefined ? { blocker: producer.blocker } : {}),
|
|
94
|
+
...(producer.message !== undefined ? { message: producer.message } : {}),
|
|
95
|
+
...(producer.nextCommand !== undefined ? { nextCommand: producer.nextCommand } : {}),
|
|
96
|
+
...(producer.nextAction !== undefined ? { nextAction: producer.nextAction } : {}),
|
|
97
|
+
...(producer.retryable !== undefined ? { retryable: producer.retryable } : {}),
|
|
98
|
+
};
|
|
99
|
+
}
|
|
100
|
+
function mountsOf(producer) {
|
|
101
|
+
return {
|
|
102
|
+
...(producer.steps !== undefined ? { steps: producer.steps } : {}),
|
|
103
|
+
...(producer.halfSuccess !== undefined ? { halfSuccess: producer.halfSuccess } : {}),
|
|
104
|
+
...(producer.runtimeVerification !== undefined ? { runtimeVerification: producer.runtimeVerification } : {}),
|
|
105
|
+
...(typeof producer.irreversible === "string" ? { irreversible: producer.irreversible } : {}),
|
|
106
|
+
...(producer.ruleStatus !== undefined ? { ruleStatus: producer.ruleStatus } : {}),
|
|
107
|
+
...(producer.serviceStatus !== undefined ? { serviceStatus: producer.serviceStatus } : {}),
|
|
108
|
+
...(producer.submitRefused !== undefined ? { submitRefused: producer.submitRefused } : {}),
|
|
109
|
+
...(producer.submitOutcome !== undefined ? { submitOutcome: producer.submitOutcome } : {}),
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* A producer-declared `uncertain` can never be DELIVERED either: it means the
|
|
114
|
+
* tool could not establish that the target belonged to the requested model
|
|
115
|
+
* (e.g. data.delete with a wrong schemaCode). P1 复核:执行面的显式 uncertain
|
|
116
|
+
* 不能继承 `deliveryStateFor` 的 async 级联文案——批量混合删除的
|
|
117
|
+
* readback.absent=false 会被说成「删除级联中,稍后重跑」,而真实结论是
|
|
118
|
+
* delete-target-not-in-schema。生产者 blocker 优先。
|
|
119
|
+
*/
|
|
120
|
+
function uncertainWarning(producer) {
|
|
121
|
+
if (producer.blocker !== undefined)
|
|
122
|
+
return `本次调用未建立成功结论(${producer.blocker}):按 blocker/message/nextCommand 核对,勿当作已清理`;
|
|
123
|
+
if (producer.message !== undefined)
|
|
124
|
+
return producer.message;
|
|
125
|
+
return "本次调用不代表成功(WRITE_UNVERIFIED):目标是否属于该模型/是否已删除未建立;按 message/nextCommand 先核对,勿宣称已清理";
|
|
126
|
+
}
|
|
127
|
+
/** partial 同理:首段写已落,但复合目标未完成,必须用生产者自己的结论。 */
|
|
128
|
+
function partialWarning(producer) {
|
|
129
|
+
if (producer.message !== undefined)
|
|
130
|
+
return producer.message;
|
|
131
|
+
if (producer.blocker !== undefined)
|
|
132
|
+
return `本次只完成了复合操作的一部分(${producer.blocker}):按 blocker/message/nextCommand 继续,勿当作全部完成`;
|
|
133
|
+
return "本次只完成了复合操作的一部分(WRITE_UNVERIFIED):按 message/nextCommand 继续,勿当作全部完成";
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The single reduction from a producer's raw outcome to what actually happened.
|
|
137
|
+
* Priority is unchanged from the pre-union pipeline:
|
|
138
|
+
*
|
|
139
|
+
* producer.status "uncertain" → unverified{unknown} (outranks the readback gate)
|
|
140
|
+
* producer.status "partial" → partial (outranks the readback gate)
|
|
141
|
+
* readback gate WRITE_UNVERIFIED → unverified{withheld}
|
|
142
|
+
* otherwise → delivered
|
|
143
|
+
*
|
|
144
|
+
* `readbackGate` is injectable so the gate decision can be pinned in tests
|
|
145
|
+
* without a producer; the default is the gate itself.
|
|
146
|
+
*/
|
|
147
|
+
export function reduceWriteOutcome(producer, readbackGate = deliveryStateFor(producer.readback)) {
|
|
148
|
+
const performed = producer.performed;
|
|
149
|
+
const readback = producer.readback;
|
|
150
|
+
const diagnosis = diagnosisOf(producer);
|
|
151
|
+
const mounts = mountsOf(producer);
|
|
152
|
+
if (producer.status === "uncertain") {
|
|
153
|
+
return {
|
|
154
|
+
kind: "unverified",
|
|
155
|
+
claim: "unknown",
|
|
156
|
+
reason: uncertainWarning(producer),
|
|
157
|
+
performed,
|
|
158
|
+
readback,
|
|
159
|
+
diagnosis,
|
|
160
|
+
...(producer.recovery !== undefined ? { recovery: producer.recovery } : {}),
|
|
161
|
+
mounts,
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (producer.status === "partial") {
|
|
165
|
+
return {
|
|
166
|
+
kind: "partial",
|
|
167
|
+
completed: { performed, readback },
|
|
168
|
+
pending: {
|
|
169
|
+
leg: producer.submitRefused !== undefined ? "submit" : "composite",
|
|
170
|
+
...(producer.submitRefused !== undefined ? { detail: producer.submitRefused } : {}),
|
|
171
|
+
},
|
|
172
|
+
reason: partialWarning(producer),
|
|
173
|
+
diagnosis,
|
|
174
|
+
...(producer.recovery !== undefined ? { recovery: producer.recovery } : {}),
|
|
175
|
+
mounts,
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
if (readbackGate.deliveryState === "WRITE_UNVERIFIED") {
|
|
179
|
+
return {
|
|
180
|
+
kind: "unverified",
|
|
181
|
+
claim: "withheld",
|
|
182
|
+
reason: readbackGate.readbackWarning ?? READBACK_GATE_FALLBACK,
|
|
183
|
+
performed,
|
|
184
|
+
readback,
|
|
185
|
+
diagnosis,
|
|
186
|
+
...(producer.recovery !== undefined ? { recovery: producer.recovery } : {}),
|
|
187
|
+
mounts,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return {
|
|
191
|
+
kind: "delivered",
|
|
192
|
+
performed,
|
|
193
|
+
readback,
|
|
194
|
+
// A deletion receipt proves the target is GONE (`absent:true`), the mirror of
|
|
195
|
+
// a presence proof — same DELIVERED, honest label.
|
|
196
|
+
verification: readback?.absent === true ? "absent-confirmed" : "verified",
|
|
197
|
+
mounts,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
/** Receipt-facing facts for an outcome. `toWriteReceipt` uses this; so does the audit artifact. */
|
|
201
|
+
export function writeOutcomeVerdict(outcome) {
|
|
202
|
+
switch (outcome.kind) {
|
|
203
|
+
case "delivered":
|
|
204
|
+
return { status: "ok", deliveryState: "DELIVERED" };
|
|
205
|
+
case "unverified":
|
|
206
|
+
// `withheld` keeps the envelope status `ok` (byte-frozen): the write may
|
|
207
|
+
// have landed, this run just cannot certify it. `unknown` is the producer's
|
|
208
|
+
// explicit "cannot establish" → envelope uncertain (exit 14).
|
|
209
|
+
return { status: outcome.claim === "unknown" ? "uncertain" : "ok", deliveryState: "WRITE_UNVERIFIED", readbackWarning: outcome.reason };
|
|
210
|
+
case "partial":
|
|
211
|
+
return { status: "partial", deliveryState: "WRITE_UNVERIFIED", readbackWarning: outcome.reason };
|
|
212
|
+
case "stopped":
|
|
213
|
+
return { status: outcome.status, deliveryState: "STOPPED" };
|
|
214
|
+
case "refused":
|
|
215
|
+
return { status: "refused" };
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
/**
|
|
219
|
+
* Serialize an outcome into the receipt shape the envelope/exit-code layer reads.
|
|
220
|
+
* This is a **pure projection**: no status derivation happens here, and the key
|
|
221
|
+
* order below is the byte-frozen 0.8.x receipt order (behavior-freeze pins it).
|
|
222
|
+
*/
|
|
223
|
+
export function toWriteReceipt(outcome, mounts = {}) {
|
|
224
|
+
if (outcome.kind === "refused") {
|
|
225
|
+
// A refusal envelope is produced by the one WireError translation table; it
|
|
226
|
+
// already carries its own `status`, and spreading it keeps its key order.
|
|
227
|
+
return { status: "refused", ...outcome.refusal };
|
|
228
|
+
}
|
|
229
|
+
if (outcome.kind === "stopped") {
|
|
230
|
+
return {
|
|
231
|
+
status: outcome.status,
|
|
232
|
+
steps: outcome.steps,
|
|
233
|
+
failedStep: outcome.failedStep,
|
|
234
|
+
...outcome.envelope,
|
|
235
|
+
...(mounts.requestId !== undefined ? { requestId: mounts.requestId } : {}),
|
|
236
|
+
...(mounts.artifact !== undefined ? { artifactFingerprint: mounts.artifact.detailSha256 } : {}),
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
const verdict = writeOutcomeVerdict(outcome);
|
|
240
|
+
const diagnosis = outcome.kind === "delivered" ? {} : outcome.diagnosis;
|
|
241
|
+
const recovery = outcome.kind === "delivered" ? undefined : outcome.recovery;
|
|
242
|
+
const mountsBag = outcome.mounts;
|
|
243
|
+
const performed = outcome.kind === "partial" ? outcome.completed.performed : outcome.performed;
|
|
244
|
+
const readback = outcome.kind === "partial" ? outcome.completed.readback : outcome.readback;
|
|
245
|
+
// `applicationCode` is a convenience echo of what actually landed: the write's
|
|
246
|
+
// own performed block first, the readback second — never a pipeline guess.
|
|
247
|
+
// W37C:读回可能缺席(gate 已把它判成 unverified),这里不能直接取属性——
|
|
248
|
+
// 缺席时跳过回显,绝不崩溃、也绝不猜。
|
|
249
|
+
const readbackApplicationCode = readback !== null && typeof readback === "object" ? readback.applicationCode : undefined;
|
|
250
|
+
const applicationCode = typeof performed.applicationCode === "string"
|
|
251
|
+
? performed.applicationCode
|
|
252
|
+
: typeof readbackApplicationCode === "string"
|
|
253
|
+
? readbackApplicationCode
|
|
254
|
+
: undefined;
|
|
255
|
+
return {
|
|
256
|
+
status: verdict.status,
|
|
257
|
+
deliveryState: verdict.deliveryState,
|
|
258
|
+
// The producer's diagnosis only rides an accountable (non-ok) receipt — an
|
|
259
|
+
// `ok` receipt with a blocker would read as a contradiction.
|
|
260
|
+
...(verdict.status !== "ok" && diagnosis.blocker !== undefined ? { blocker: diagnosis.blocker } : {}),
|
|
261
|
+
...(verdict.status !== "ok" && diagnosis.message !== undefined ? { message: diagnosis.message } : {}),
|
|
262
|
+
...(verdict.status !== "ok" && diagnosis.nextCommand !== undefined ? { nextCommand: diagnosis.nextCommand } : {}),
|
|
263
|
+
...(verdict.status !== "ok" && diagnosis.nextAction !== undefined ? { nextAction: diagnosis.nextAction } : {}),
|
|
264
|
+
...(verdict.status !== "ok" && diagnosis.retryable !== undefined ? { retryable: diagnosis.retryable } : {}),
|
|
265
|
+
...(recovery !== undefined ? { recovery } : {}),
|
|
266
|
+
// submitRefused/submitOutcome are the composite write's own signal and ride
|
|
267
|
+
// every receipt (they are never paired with an `ok` status today).
|
|
268
|
+
...(mountsBag.submitRefused !== undefined ? { submitRefused: mountsBag.submitRefused } : {}),
|
|
269
|
+
...(mountsBag.submitOutcome !== undefined ? { submitOutcome: mountsBag.submitOutcome } : {}),
|
|
270
|
+
...(applicationCode !== undefined ? { applicationCode } : {}),
|
|
271
|
+
...(mounts.readOnlyEscape !== undefined ? { readOnlyEscape: mounts.readOnlyEscape } : {}),
|
|
272
|
+
performed,
|
|
273
|
+
readback,
|
|
274
|
+
...(mountsBag.ruleStatus !== undefined ? { ruleStatus: mountsBag.ruleStatus } : {}),
|
|
275
|
+
...(mountsBag.serviceStatus !== undefined ? { serviceStatus: mountsBag.serviceStatus } : {}),
|
|
276
|
+
...(verdict.readbackWarning ? { readbackWarning: verdict.readbackWarning } : {}),
|
|
277
|
+
...(mountsBag.steps !== undefined ? { steps: mountsBag.steps } : {}),
|
|
278
|
+
...(mountsBag.halfSuccess !== undefined ? { halfSuccess: mountsBag.halfSuccess } : {}),
|
|
279
|
+
...(mountsBag.runtimeVerification !== undefined ? { runtimeVerification: mountsBag.runtimeVerification } : {}),
|
|
280
|
+
...(mountsBag.irreversible !== undefined ? { irreversible: mountsBag.irreversible } : {}),
|
|
281
|
+
...(mounts.requestId !== undefined
|
|
282
|
+
? { requestId: mounts.requestId, ...(mounts.idempotency !== undefined ? { idempotency: mounts.idempotency } : {}) }
|
|
283
|
+
: {}),
|
|
284
|
+
...(mounts.productionConfirmed ? { productionConfirmed: true } : {}),
|
|
285
|
+
...(mounts.reason !== undefined ? { reason: mounts.reason } : {}),
|
|
286
|
+
...(mounts.versionEvidence !== undefined ? { versionEvidence: mounts.versionEvidence } : {}),
|
|
287
|
+
...(mounts.versionNotice !== undefined ? { versionNotice: mounts.versionNotice } : {}),
|
|
288
|
+
...(mounts.rollback !== undefined ? { rollback: mounts.rollback } : {}),
|
|
289
|
+
...(mounts.summary !== undefined ? { summary: mounts.summary } : {}),
|
|
290
|
+
...(mounts.artifact !== undefined
|
|
291
|
+
? { detailFile: mounts.artifact.detailFile, detailSha256: mounts.artifact.detailSha256, artifactFingerprint: mounts.artifact.detailSha256 }
|
|
292
|
+
: {}),
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
//# sourceMappingURL=write-outcome.js.map
|
package/dist/write.js
CHANGED
|
@@ -28,6 +28,11 @@ import { hardLayoutViolations, validateFormLayout } from "./form-layout.js";
|
|
|
28
28
|
import { prepareRuleGraph, validateRuleNodeGraph } from "./lanes/rule-graph.js";
|
|
29
29
|
import { assertRuleNamePlatformAcceptable } from "./rule-support.js";
|
|
30
30
|
import { WireError } from "./wire.js";
|
|
31
|
+
import { reduceWriteOutcome, toWriteReceipt, writeOutcomeVerdict } from "./write-outcome.js";
|
|
32
|
+
// The readback gate lives with the verdict it drives (write-outcome.ts) so there
|
|
33
|
+
// is exactly one place that answers "does this readback certify the write?".
|
|
34
|
+
// Re-exported here because it is part of this module's public face.
|
|
35
|
+
export { deliveryStateFor } from "./write-outcome.js";
|
|
31
36
|
/**
|
|
32
37
|
* The shared governed write pipeline and the low-level write registration
|
|
33
38
|
* factory every lane adapter uses.
|
|
@@ -171,8 +176,9 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
|
171
176
|
};
|
|
172
177
|
if (error instanceof ToolRefusalError)
|
|
173
178
|
throw error;
|
|
179
|
+
// 平台拒绝:回执就是那张唯一翻译表的产物,原样序列化(union 的 refused 分支)。
|
|
174
180
|
if (error instanceof WireError)
|
|
175
|
-
return refusalFromWireError(error);
|
|
181
|
+
return toWriteReceipt({ kind: "refused", refusal: refusalFromWireError(error) });
|
|
176
182
|
throw error;
|
|
177
183
|
}
|
|
178
184
|
// A write tool that runs a step chain (field.update cascadeRepublish) may
|
|
@@ -193,36 +199,17 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
|
193
199
|
recordedAt: new Date().toISOString(),
|
|
194
200
|
};
|
|
195
201
|
const artifactRef = writeArtifact(ctx, `${tool.name}-${randomUUID().slice(0, 8)}.json`, artifact);
|
|
196
|
-
|
|
202
|
+
// A stop is its own outcome kind: the completed prefix is reported, the
|
|
203
|
+
// failed step and its envelope carry through verbatim.
|
|
204
|
+
return toWriteReceipt({ kind: "stopped", status: executed.status, steps: executed.steps, failedStep: executed.failedStep, envelope: executed.envelope }, { requestId: args.requestId, artifact: artifactRef });
|
|
197
205
|
}
|
|
198
|
-
const
|
|
199
|
-
|
|
200
|
-
//
|
|
201
|
-
//
|
|
202
|
-
//
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
// tool could not establish that the target belonged to the requested model
|
|
206
|
-
// (e.g. data.delete with a wrong schemaCode). Keep the gate's text when it
|
|
207
|
-
// already says something, otherwise use the producer's own diagnosis.
|
|
208
|
-
const writeStatus = producedStatus === "uncertain" ? "uncertain" : producedStatus === "partial" ? "partial" : "ok";
|
|
209
|
-
const deliveryState = writeStatus === "ok" ? readbackGate.deliveryState : "WRITE_UNVERIFIED";
|
|
210
|
-
// P1 复核:执行面的显式 uncertain 不能继承 `deliveryStateFor` 的 async 级联
|
|
211
|
-
// 文案——批量混合删除的 readback.absent=false 会被说成「删除级联中,稍后重跑」,
|
|
212
|
-
// 而真实结论是 delete-target-not-in-schema。生产者 blocker 优先。partial 同理:
|
|
213
|
-
// 首段写已落,但复合目标未完成,必须用生产者自己的结论。
|
|
214
|
-
const producedWarning = producedStatus === "uncertain"
|
|
215
|
-
? (producedBlocker !== undefined
|
|
216
|
-
? `本次调用未建立成功结论(${producedBlocker}):按 blocker/message/nextCommand 核对,勿当作已清理`
|
|
217
|
-
: producedMessage)
|
|
218
|
-
: producedStatus === "partial"
|
|
219
|
-
? (producedMessage ?? (producedBlocker !== undefined ? `本次只完成了复合操作的一部分(${producedBlocker}):按 blocker/message/nextCommand 继续,勿当作全部完成` : undefined))
|
|
220
|
-
: undefined;
|
|
221
|
-
const readbackWarning = writeStatus !== "ok"
|
|
222
|
-
? (producedWarning ?? (writeStatus === "uncertain"
|
|
223
|
-
? "本次调用不代表成功(WRITE_UNVERIFIED):目标是否属于该模型/是否已删除未建立;按 message/nextCommand 先核对,勿宣称已清理"
|
|
224
|
-
: "本次只完成了复合操作的一部分(WRITE_UNVERIFIED):按 message/nextCommand 继续,勿当作全部完成"))
|
|
225
|
-
: readbackGate.readbackWarning;
|
|
206
|
+
const producer = executed;
|
|
207
|
+
const { performed, readback, steps, rollbackReceipt, ruleStatus, serviceStatus, submitRefused, submitOutcome } = producer;
|
|
208
|
+
// 单点判定(write-outcome.ts):producer 的原始形状 → 判别联合。信封状态与
|
|
209
|
+
// deliveryState 只从这一处推导,信封层不再各算一遍——「读回证明不了自己的写」
|
|
210
|
+
// 与「执行面自证未建立结论」是两种事实,以前都在同一个可选字段里表达。
|
|
211
|
+
const outcome = reduceWriteOutcome(producer);
|
|
212
|
+
const verdict = writeOutcomeVerdict(outcome);
|
|
226
213
|
// Every production write echoes the explicit acknowledgement into the audit
|
|
227
214
|
// trail, so the record can always answer "was this a confirmed production
|
|
228
215
|
// write?".
|
|
@@ -236,8 +223,8 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
|
236
223
|
...(steps !== undefined ? { steps } : {}),
|
|
237
224
|
...(ruleStatus !== undefined ? { ruleStatus } : {}),
|
|
238
225
|
...(serviceStatus !== undefined ? { serviceStatus } : {}),
|
|
239
|
-
...(
|
|
240
|
-
...(
|
|
226
|
+
...(submitRefused !== undefined ? { submitRefused } : {}),
|
|
227
|
+
...(submitOutcome !== undefined ? { submitOutcome } : {}),
|
|
241
228
|
...(productionConfirmed ? { productionConfirmed: true } : {}),
|
|
242
229
|
...(reason !== undefined ? { reason } : {}),
|
|
243
230
|
...(tool.rollback
|
|
@@ -251,8 +238,8 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
|
251
238
|
...(rollbackBefore !== undefined ? { before: rollbackBefore } : {}),
|
|
252
239
|
}
|
|
253
240
|
: {}),
|
|
254
|
-
deliveryState,
|
|
255
|
-
...(readbackWarning ? { readbackWarning } : {}),
|
|
241
|
+
deliveryState: verdict.deliveryState,
|
|
242
|
+
...(verdict.readbackWarning ? { readbackWarning: verdict.readbackWarning } : {}),
|
|
256
243
|
recordedAt: new Date().toISOString(),
|
|
257
244
|
};
|
|
258
245
|
const artifactRef = writeArtifact(ctx, `${tool.name}-${randomUUID().slice(0, 8)}.json`, artifact);
|
|
@@ -283,93 +270,25 @@ lintDeclaration = { lintScope: "partial", lintUnchecked: [] }) {
|
|
|
283
270
|
});
|
|
284
271
|
rollbackRef = { seq: entry.seq, hint: `omc rollback plan ${entry.seq}(--env ${entry.environment})` };
|
|
285
272
|
}
|
|
286
|
-
return {
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
...(writeStatus !== "ok" && producedBlocker !== undefined ? { blocker: producedBlocker } : {}),
|
|
290
|
-
...(writeStatus !== "ok" && producedMessage !== undefined ? { message: producedMessage } : {}),
|
|
291
|
-
...(writeStatus !== "ok" && producedNextCommand !== undefined ? { nextCommand: producedNextCommand } : {}),
|
|
292
|
-
...(writeStatus !== "ok" && producedNextAction !== undefined ? { nextAction: producedNextAction } : {}),
|
|
293
|
-
...(writeStatus !== "ok" && producedRetryable !== undefined ? { retryable: producedRetryable } : {}),
|
|
294
|
-
...(producedSubmitRefused !== undefined ? { submitRefused: producedSubmitRefused } : {}),
|
|
295
|
-
...(producedSubmitOutcome !== undefined ? { submitOutcome: producedSubmitOutcome } : {}),
|
|
296
|
-
...((typeof performed.applicationCode === "string" ? { applicationCode: performed.applicationCode } : typeof readback.applicationCode === "string" ? { applicationCode: readback.applicationCode } : {})),
|
|
297
|
-
...(readOnlyEscapeNote !== undefined ? { readOnlyEscape: readOnlyEscapeNote } : {}),
|
|
298
|
-
performed,
|
|
299
|
-
readback,
|
|
300
|
-
...(ruleStatus !== undefined ? { ruleStatus } : {}),
|
|
301
|
-
...(serviceStatus !== undefined ? { serviceStatus } : {}),
|
|
302
|
-
...(readbackWarning ? { readbackWarning } : {}),
|
|
303
|
-
...(steps !== undefined ? { steps } : {}),
|
|
304
|
-
...(halfSuccess !== undefined ? { halfSuccess } : {}),
|
|
305
|
-
...(runtimeVerification !== undefined ? { runtimeVerification } : {}),
|
|
306
|
-
...(typeof irreversible === "string" ? { irreversible } : {}),
|
|
273
|
+
return toWriteReceipt(outcome, {
|
|
274
|
+
readOnlyEscape: readOnlyEscapeNote,
|
|
275
|
+
requestId: args.requestId,
|
|
307
276
|
// r30a F1: first write → replay:"none"; duplicate only on true replay.
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
277
|
+
idempotency: args.requestId ? idempotencyDeclaration(tool.name, IDEMPOTENCY_REPLAY.none) : undefined,
|
|
278
|
+
productionConfirmed,
|
|
279
|
+
reason,
|
|
311
280
|
// 版本证据质量:只在探测不到版本串时出现(`absent`)。与 plan 里的同一字段
|
|
312
281
|
// 同源,写入照常放行;提示语说明「平台是最终门」。
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
? {
|
|
317
|
-
:
|
|
282
|
+
versionEvidence: plan.versionEvidence,
|
|
283
|
+
versionNotice: plan.versionNotice,
|
|
284
|
+
rollback: rollbackRef
|
|
285
|
+
? { ...(rollbackReceipt ?? {}), seq: rollbackRef.seq, ...(rollbackReceipt ? {} : { hint: rollbackRef.hint }) }
|
|
286
|
+
: undefined,
|
|
318
287
|
summary: writeSummary(tool.name, args, { performed, readback }, "done"),
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
artifactFingerprint: artifactRef.detailSha256,
|
|
322
|
-
};
|
|
288
|
+
artifact: artifactRef,
|
|
289
|
+
});
|
|
323
290
|
});
|
|
324
291
|
}
|
|
325
|
-
/**
|
|
326
|
-
* Readback gate: a tool whose authoritative readback says the target is ABSENT
|
|
327
|
-
* has not proven its write. "Called without error" must never be stamped
|
|
328
|
-
* DELIVERED (live 2026-10-17: model.create returned errcode 0 + present:false
|
|
329
|
-
* while the menu row was orphaned; the AI read DELIVERED as success).
|
|
330
|
-
*
|
|
331
|
-
* Deletion receipts use the mirror key: `readback.absent`. The platform's
|
|
332
|
-
* physically_delete is an async task (AppPackageController.java:1351-1358 /
|
|
333
|
-
* 8.6.26 :1423 → AppIntegrationFacadeImpl.syncDeletePhysicalResources
|
|
334
|
-
* :1112-1131 creates `AppDeleteHistory(TaskStatus.RUN)` and returns
|
|
335
|
-
* immediately), so `absent:false` means "cascade still running", NOT success.
|
|
336
|
-
* Without this branch the same receipt was stamped DELIVERED (0.8.5 live).
|
|
337
|
-
*/
|
|
338
|
-
export function deliveryStateFor(readback) {
|
|
339
|
-
const record = readback !== null && typeof readback === "object" ? readback : undefined;
|
|
340
|
-
// The platform's async delete task itself failed (AppIntegrationFacadeImpl
|
|
341
|
-
// 8.6.26 :1348-1355: catch → message + TaskStatus.FAIL; read back through
|
|
342
|
-
// AppPackageController /delete/history). The record face still answers (the
|
|
343
|
-
// cascade aborted), so this must be checked FIRST — a FAIL can never be
|
|
344
|
-
// DELIVERED, and the platform text is the only real cause.
|
|
345
|
-
const rawDeleteTask = record?.deleteTask;
|
|
346
|
-
const deleteTask = rawDeleteTask !== null && typeof rawDeleteTask === "object" ? rawDeleteTask : undefined;
|
|
347
|
-
if (deleteTask?.taskStatus === "FAIL")
|
|
348
|
-
return {
|
|
349
|
-
deliveryState: "WRITE_UNVERIFIED",
|
|
350
|
-
readbackWarning: `未删除:平台删除任务失败(taskId=${String(deleteTask.taskId ?? "?")},平台原文:${String(deleteTask.message ?? "未返回 message")})——删除未完成,按平台原文拆引用/清残留后重试`,
|
|
351
|
-
};
|
|
352
|
-
if (record?.present === false)
|
|
353
|
-
return {
|
|
354
|
-
deliveryState: "WRITE_UNVERIFIED",
|
|
355
|
-
readbackWarning: "读回显示目标不存在(readback.present=false):平台接受了请求但权威面查不到——不要当作最终一致性豁免,按失败排查(模型挂载/路径/权限)",
|
|
356
|
-
};
|
|
357
|
-
// `absent:false` on a deletion receipt = the authoritative record face still
|
|
358
|
-
// returns the target. The platform accepted the request but the async delete
|
|
359
|
-
// has not completed; never read that as "deleted".
|
|
360
|
-
if (record?.absent === false)
|
|
361
|
-
return {
|
|
362
|
-
deliveryState: "WRITE_UNVERIFIED",
|
|
363
|
-
readbackWarning: "目标是删除级联中:平台 async 任务未完成(readback.absent=false,权威面仍查得到目标),勿当成功——以记录面 absent=true 且应用树无节点为准,稍后重跑本工具(幂等)复核",
|
|
364
|
-
};
|
|
365
|
-
// model.deleteMany reports the same fact per target: `allAbsent:false`.
|
|
366
|
-
if (record?.allAbsent === false)
|
|
367
|
-
return {
|
|
368
|
-
deliveryState: "WRITE_UNVERIFIED",
|
|
369
|
-
readbackWarning: "目标是删除级联中:平台 async 任务未完成(readback.allAbsent=false,见 perCode 逐项),勿当成功——稍后重跑本工具(幂等)复核",
|
|
370
|
-
};
|
|
371
|
-
return { deliveryState: "DELIVERED" };
|
|
372
|
-
}
|
|
373
292
|
/**
|
|
374
293
|
* Single source of truth for requestId replay enum strings (r30a F1).
|
|
375
294
|
* Help / skills must quote these constants — do not invent parallel spellings.
|