This commit is contained in:
2026-08-12 12:35:29 +08:00
parent 0fceece378
commit e4f65dae5f
8 changed files with 434 additions and 41 deletions
@@ -129,6 +129,19 @@ test('PDA completion acceptance verifies immutable BATCH audit with operator met
assert.match(convergence, /item\.actionType === 'BATCH'/)
})
test('phase3 loading proves mixed-line rollback across task, all items and operations', () => {
const loading = source('./phase3-loading.mjs')
assertOrder(loading, [
'非法混合批次前读取 PDA 全量任务基线',
'PDA 原子批次任一非法明细时整批拒绝',
'回查失败批次后的 PDA 任务快照',
'非法混合批次后回查 PDA 操作历史',
'合法明细加非法明细失败后任务、全部明细和操作历史零写入',
])
assert.match(loading, /itemSignature\(unchangedAfterInvalid\) === itemSignature\(beforeInvalidTask\)/)
assert.match(loading, /operationsSignature\(afterInvalidOperations\) === operationsSignature\(beforeInvalidOperations\)/)
})
test('customs provisions released booking and completed truck for the selected loading container', () => {
const value = source('./phase3-customs.mjs')
assertOrder(value, [
@@ -199,3 +212,41 @@ test('customs and finalize consume the same loading inbound identity', () => {
assert.equal(finalized.inboundId, loading.inboundId)
assert.equal(finalized.finalStatus, 'LOADED')
})
test('loading evidence acceptance covers idempotency, reversible missing-type gate and scope isolation', () => {
const loading = source('./phase3-loading.mjs')
assertOrder(loading, [
'装柜证据绑定同键同参幂等重放',
'装柜证据绑定同键异参返回冲突',
'装柜证据作废旧版本返回冲突',
'临时作废唯一 PHOTO_STEP_4 证据',
'证据作废同键同参重放保持同一 VOID 结果',
'证据作废同键异参返回冲突',
'已作废证据使用新请求重复作废返回冲突',
'作废唯一证据类型后 LOADED 门禁拒绝',
'补传恢复 PHOTO_STEP_4 有效证据',
'客户身份无权访问平台装柜证据',
'错误客户作用域不可读取本轮装柜证据',
'错误入库单不可读取本轮装柜证据',
])
assert.match(loading, /missingTypeVoidedEvidenceId/)
assert.match(loading, /replacementEvidenceFileId/)
})
test('loaded boundary acceptance proves evidence and transport immutability with zero drift', () => {
const finalize = source('./phase3-loading-finalize.mjs')
assertOrder(finalize, [
'LOADED 后使用新键重复 complete 幂等保持终态',
'LOADED complete 同键异参返回冲突',
'LOADED 后新增装柜证据被拒绝',
'LOADED 后作废装柜证据被拒绝',
'LOADED 后运输信息修改被拒绝',
'回查 LOADED 高风险边界后的入库快照',
'回查 LOADED 高风险边界后的证据快照',
'回查 LOADED 高风险边界后的计划快照',
'LOADED 后拒绝与幂等请求保持状态、版本、证据、计划和审计零漂移',
])
assert.match(finalize, /evidenceSignature\(afterEvidence\) === immutableEvidenceSignature/)
assert.match(finalize, /afterHistorySignature === historySignature/)
assert.match(finalize, /afterPlanSignature === immutablePlanSignature/)
})