fix: stabilize overseas initialization and PDA acceptance

This commit is contained in:
2026-09-10 10:25:16 +08:00
parent 37a28b9c11
commit e72e74b21e
12 changed files with 160 additions and 375 deletions
+3 -1
View File
@@ -1582,7 +1582,9 @@ export class AcceptanceRun {
if (Number(readiness().overseasContainerCount || 0) < 1) {
await this.runPhase4ProducerVariant('OVERSEAS-PRIMARY', 'OVERSEAS', 'ONE_CLICK_DROPSHIP', true)
}
if (Number(readiness().distinctContainerCount || 0) < 4) {
const hasSecondaryProducer = () => (this.createdResources.phase4InboundProducerFixtures?.containers || [])
.some((item) => String(item?.resourceKey || '').includes('-P4-SECONDARY:'))
if (!hasSecondaryProducer()) {
await this.runPhase4ProducerVariant('SECONDARY', 'FBA', 'STANDARD', false)
}
const matrix = this.createdResources.phase4InboundProducerFixtures
@@ -92,18 +92,26 @@ test('海外空库基线为固定平台管理员提供完整version0授权投影
)?.[1]
assert.ok(authorityBlock, 'missing platform_admin overseas authority snapshot')
const authorities = [...authorityBlock.matchAll(/'([^']+)'/g)].map((match) => match[1])
assert.equal(authorities.length, 109)
const deferred = new Set([
'platform:overseas-warehouse:carton:list',
'platform:overseas-warehouse:carton:create',
'platform:overseas-warehouse:carton:edit',
'platform:overseas-warehouse:product:list',
'platform:overseas-warehouse:product:create',
'platform:overseas-warehouse:product:edit',
])
assert.equal(authorities.length, 105)
assert.equal(new Set(authorities).size, authorities.length, 'baseline authorities must not contain duplicates')
assert.equal(authorities.filter((item) => item.startsWith('platform:finance:')).length, 34)
assert.equal(authorities.filter((item) => item.startsWith('platform:overseas-business:')).length, 11)
assert.equal(authorities.filter((item) => item.startsWith('platform:overseas-master-data:')).length, 15)
assert.equal(authorities.filter((item) => item.startsWith('platform:overseas-warehouse:')).length, 49)
assert.equal(authorities.filter((item) => item.startsWith('platform:overseas-warehouse:')).length, 45)
for (const authority of authorities) {
assert.ok(sql.includes(`'${authority}'`), `authority is absent from the domestic IAM baseline: ${authority}`)
}
for (const source of [overseasWarehousePermissions, overseasBusinessPermissions, overseasMasterDataPermissions]) {
const declared = [...source.matchAll(/'((?:platform:overseas-warehouse|platform:overseas-business|platform:overseas-master-data):[^']+)'/g)]
.map((match) => match[1])
.map((match) => match[1]).filter((authority) => !deferred.has(authority))
for (const authority of declared) {
assert.ok(
[lastlegPermissionSeed, phase5DeliveryPermissionSeed].some((seed) => seed.includes(`'${authority}'`)),
@@ -112,6 +120,10 @@ test('海外空库基线为固定平台管理员提供完整version0授权投影
assert.ok(authorities.includes(authority), `Admin permission is absent from the fixed-admin overseas snapshot: ${authority}`)
}
}
for (const authority of deferred) {
assert.ok(!lastlegPermissionSeed.includes(`'${authority}'`), `deferred permission entered the IAM source seed: ${authority}`)
assert.ok(!authorities.includes(authority), `deferred permission entered the fixed-admin snapshot: ${authority}`)
}
for (const required of [
'platform:overseas-warehouse:last-mile-order:list',
'platform:overseas-warehouse:inbound-order:list',
@@ -120,6 +120,9 @@ test('only PDA-operated variants traverse real outbound and carrier nodes before
assert.match(entry, /runPhase4ProducerVariant\('OVERSEAS-PRIMARY', 'OVERSEAS', 'ONE_CLICK_DROPSHIP', true\)/)
assert.match(entry, /runPhase4ProducerVariant\('FBA-STANDARD', 'FBA', 'STANDARD', true\)/)
assert.match(entry, /runPhase4ProducerVariant\('SECONDARY', 'FBA', 'STANDARD', false\)/)
assert.match(entry, /const hasSecondaryProducer =/)
assert.match(entry, /if \(!hasSecondaryProducer\(\)\)/)
assert.doesNotMatch(entry, /if \(Number\(readiness\(\)\.distinctContainerCount \|\| 0\) < 4\)/)
const start = entry.indexOf('if (pickupRequired && producerKey)')
const end = entry.indexOf('} finally {', start)
const pickupChain = entry.slice(start, end)