test: align phase3 and overseas business acceptance

This commit is contained in:
2026-08-25 13:06:09 +08:00
parent d686b05966
commit 995c1833f8
8 changed files with 269 additions and 84 deletions
@@ -37,17 +37,26 @@ test('phase3 inventory mutation and downstream gates cannot pass as coverage gap
assert.doesNotMatch(aggregate, /报关与船期历史并入统一时间线|当前服务端聚合未公开/)
})
test('outbound lifecycle checks replay, hash conflict, stale version and final reread', () => {
test('outbound lifecycle checks confirm replay, immutable departure reverse boundary and final reread', () => {
const source = read('phase3-outbound-dispatch.mjs')
for (const step of [
'confirm-dispatch 幂等重放',
'相同 Idempotency-Key 不同请求拒绝',
'reverse-dispatch 幂等重放',
'reverse-dispatch 同键异参返回 A0409',
'撤销后旧版本再次确认返回 A0409',
'实际DEPARTED_WAREHOUSE节点产生后撤销精确返回A0409',
'禁止撤销边界重复请求仍精确返回A0409',
'负向与幂等验证后回查出仓聚合',
'出仓聚合保持 READY_FOR_DISPATCH、LOADED 和确认撤销历史',
'出仓聚合保持 WAITING_FOR_LOADING、LOADED 且无成功撤销历史',
]) assert.match(source, new RegExp(step))
assert.match(source, /if \(!confirmed\?\.aggregate\) return/)
assert.match(source, /hashConflict\.http === 200 && codeOf\(hashConflict\) === 'A0409'/)
const confirm = source.indexOf('确认国内出仓进入等待装船')
const reverse = source.indexOf('实际DEPARTED_WAREHOUSE节点产生后撤销精确返回A0409')
const finalRead = source.indexOf('负向与幂等验证后回查出仓聚合')
assert.ok(confirm >= 0 && reverse > confirm && finalRead > reverse)
assert.match(source, /confirmedStatus: confirmed\.aggregate\.dispatchStatus/)
assert.doesNotMatch(source, /outbound-confirm-final|finalConfirmed|reversedVersion/)
const waiting = read('phase3-waiting-for-loading.mjs')
assert.match(waiting, /confirmations\.length === 1 && reversed\.length === 0/)
assert.match(waiting, /实际离仓节点冻结后保持一次确认且零次成功撤销/)
assert.match(waiting, /detail\?\.aggregate\?\.dispatchStatus === 'WAITING_FOR_LOADING'/)
})