fix(acceptance): enforce immutable confirmed fees

This commit is contained in:
2026-09-10 21:18:52 +08:00
parent 7b35373da3
commit 800ebb875f
14 changed files with 116 additions and 53 deletions
+8 -5
View File
@@ -531,6 +531,7 @@ export class AcceptanceRun {
this.modules = []
this.scenarios = []
this.createdResources = {}
this.phase4ProducerAttempts = new Map()
this.deploymentBlockers = []
this.coverageGaps = []
this.context = {}
@@ -1466,7 +1467,9 @@ export class AcceptanceRun {
async runPhase4ProducerVariant(label, destinationType, fulfillmentType = 'STANDARD', pickupRequired = false) {
const matrixMarker = this.marker
const variantMarker = `${matrixMarker}-P4-${label}`
const attempt = (this.phase4ProducerAttempts.get(label) || 0) + 1
this.phase4ProducerAttempts.set(label, attempt)
const variantMarker = `${matrixMarker}-P4-${label}${attempt === 1 ? '' : `-R${attempt}`}`
const contextKeys = ['orderDestinationType', 'orderFulfillmentType', 'phase4ProducerMatrixMarker']
const createdKeys = [
'phase3Loading', 'phase3LoadingCompletedProducer', 'phase3ContainerDocuments', 'orchestrationFixtures', 'oceanBooking',
@@ -1571,7 +1574,7 @@ export class AcceptanceRun {
const hasStandardFbaProducer = () => (this.createdResources.phase4InboundProducerFixtures?.containers || [])
.some((item) => item?.destinationType === 'FBA'
&& item?.fulfillmentType !== 'ONE_CLICK_DROPSHIP'
&& String(item?.resourceKey || '').includes('-P4-FBA-STANDARD:'))
&& /-P4-FBA-STANDARD(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
if (!hasStandardFbaProducer()) {
await this.runPhase4ProducerVariant('FBA-STANDARD', 'FBA', 'STANDARD', true)
}
@@ -1579,7 +1582,7 @@ export class AcceptanceRun {
await this.runPhase4ProducerVariant('OVERSEAS-PRIMARY', 'OVERSEAS', 'ONE_CLICK_DROPSHIP', true)
}
const hasSecondaryProducer = () => (this.createdResources.phase4InboundProducerFixtures?.containers || [])
.some((item) => String(item?.resourceKey || '').includes('-P4-SECONDARY:'))
.some((item) => /-P4-SECONDARY(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
if (!hasSecondaryProducer()) {
await this.runPhase4ProducerVariant('SECONDARY', 'FBA', 'STANDARD', false)
}
@@ -1588,10 +1591,10 @@ export class AcceptanceRun {
const dropshipReady = containers.find((item) => item?.fulfillmentType === 'ONE_CLICK_DROPSHIP')
const standardFbaReady = containers.find((item) => item?.destinationType === 'FBA'
&& item?.fulfillmentType !== 'ONE_CLICK_DROPSHIP'
&& String(item?.resourceKey || '').includes('-P4-FBA-STANDARD:'))
&& /-P4-FBA-STANDARD(?:-R\d+)?:/.test(String(item?.resourceKey || '')))
const overseasReady = containers.find((item) => item?.destinationType === 'OVERSEAS')
const awaitingVariants = containers.filter((item) => ['SECONDARY']
.some((label) => String(item?.resourceKey || '').includes(`-P4-${label}:`)))
.some((label) => new RegExp(`-P4-${label}(?:-R\\d+)?:`).test(String(item?.resourceKey || ''))))
const shippingMatrixReady = dropshipReady?.shippingReady === true
&& Boolean(dropshipReady?.carrierScheduleQueryId)
&& standardFbaReady?.shippingReady === true && Boolean(standardFbaReady?.carrierScheduleQueryId)