This commit is contained in:
2026-10-21 15:10:44 +08:00
parent 40a03978cd
commit 6fe632f28e
34 changed files with 372 additions and 110 deletions
@@ -284,8 +284,14 @@ test('offline verifier preserves original command and requires all phases before
const saved = JSON.parse(fs.readFileSync('reports/fleet-cross-offline/rollback.json', 'utf8'))
assert.equal(saved.verified, true); assert.ok(saved.finishedAt)
const caller = fs.readFileSync(new URL('./admin-test-env-modules/fleet-cross-customer-acceptance.mjs', import.meta.url), 'utf8')
assert.ok(caller.indexOf('await verifyDepartureRollback(') < caller.indexOf("const departed = await request('POST', departPath, departBody"))
assert.match(caller, /Platform exact replay of PDA native departure/); assert.match(caller, /This customer independently signed/)
assert.match(caller, /await confirmFleetLoading\([^\n]+async command => \{/)
assert.match(caller, /await verifyDepartureRollback\(\{ context, fixture, ready, departPath: command.path, departBody: command.body, snapshot \}\)/)
assert.match(caller, /Rollback restores both complete inventory snapshots before loading completion/)
const loading = fs.readFileSync(new URL('./admin-test-env-modules/fleet-trip-fulfillment.mjs', import.meta.url), 'utf8')
const hook = loading.indexOf('if (beforeComplete) await beforeComplete(proof.loadingCommand)')
const completion = loading.indexOf("const confirmed = await command(context, module, 'POST', proof.loadingCommand.path")
assert.ok(hook >= 0 && completion > hook, '回滚验证必须在真正提交装车完成命令前结束')
assert.match(caller, /Original PDA actor exact replay of loading completion/); assert.match(caller, /This customer independently signed/)
} finally {
process.chdir(original)
assert.ok(resolve(temp).startsWith(resolve(tmpdir()) + '\\') || resolve(temp).startsWith(resolve(tmpdir()) + '/'))