test(firstleg): formalize late container gate acceptance

This commit is contained in:
2026-09-01 15:53:12 +08:00
parent aa828ca1eb
commit ca8127ce83
3 changed files with 37 additions and 6 deletions
@@ -123,6 +123,25 @@ test('bridge loading confirms preload before creating and claiming the PDA task'
assert.match(value, /bookingConfirmed\?\.oceanBooking\?\.status === 'RELEASED'/)
})
test('late container gate mode proves the final gate without requiring evidence completion', () => {
const value = source('./phase3-loading.mjs')
assert.match(value, /LATE_CONTAINER_GATE_ONLY = process\.env\.LATE_CONTAINER_GATE_ONLY === '1'/)
assertOrder(value, [
'无号模拟柜原地关联三期 RELEASED 订舱需求',
'计划级原子确认整份预装并触发唯一 PDA 任务',
'领取柜次 PDA 任务',
'原子提交柜次 PDA 整批拣货',
'无号拣货完成后 PDA complete 精确返回 A0409',
'LOADING 阶段通过预装运输信息首次补录真实柜号',
'补号后 complete 已越过柜号门禁并受理异步命令',
'补号后已越过柜号门禁并允许进入柜级证据门禁',
])
assert.match(value, /String\(missingComplete\.body\?\.message \|\| ''\)\.includes\('真实集装箱号'\)/)
assert.match(value, /nextStage === 'CABINET_EVIDENCE' && nextCode === 'A0409'/)
assert.match(value, /!nextMessage\.includes\('集装箱号'\)/)
assert.match(value, /context\.createdResources\.phase3LateContainerGate/)
})
test('push replay and both conflict modes preserve the complete pre-PDA snapshot', () => {
for (const file of ['./phase3-loading.mjs', './phase3-container-loading.mjs']) {
const value = source(file)
@@ -220,7 +239,8 @@ test('PDA inventory snapshot gates batch and records the only safe mutation gap'
])
assert.match(loading, /inventorySnapshotToken: refreshedInventory\.snapshotToken/)
assert.match(loading, /warehouseId, loadingPlanId, containerBookingId,/)
assert.match(loading, /inventory\?\.currentContainerNo === containerNo/)
assert.match(loading,
/LATE_CONTAINER_GATE_ONLY \? inventory\?\.currentContainerNo == null : inventory\?\.currentContainerNo === containerNo/)
const batchPayload = loading.slice(loading.indexOf('const batchPayload ='), loading.indexOf('const staleBatch ='))
assert.doesNotMatch(batchPayload, /containerNo[,\s]/)
assert.doesNotMatch(loading, /\/loading\/picking\/(?:start|complete)/)