This commit is contained in:
2026-10-08 17:07:57 +08:00
parent 16d2d9111a
commit c1ddb658bd
111 changed files with 2914 additions and 941 deletions
+14 -8
View File
@@ -42,12 +42,18 @@ export const POOL_REMAINING = Object.freeze([
])
export function parsePoolArguments(args) { return parseCrossCustomerArguments(args) }
export function poolReportName(config) {
requireThat(['TEST', 'GRAY'].includes(config.environment) && /^[A-Za-z0-9][A-Za-z0-9_-]{0,47}$/.test(config.runId), 'EXPLICIT_POOL_REPORT_SCOPE_REQUIRED')
return `${config.environment === 'GRAY' ? 'fleet-pool-gray' : 'fleet-cross'}-${config.runId}`
}
export function poolPlan(config) {
return { environment: 'TEST', execute: Boolean(config.execute), runId: config.runId,
output: `reports/fleet-cross-${config.runId}`, coveredByThisEntry: POOL_COVERAGE, remainingSeparateAcceptance: POOL_REMAINING,
return { environment: config.environment || 'TEST', execute: Boolean(config.execute), runId: config.runId,
output: `reports/${poolReportName({ ...config, environment: config.environment || 'TEST' })}`, coveredByThisEntry: POOL_COVERAGE, remainingSeparateAcceptance: POOL_REMAINING,
sample: 'Two fresh qualified customers and owned one-box pallets, one 30-space trip. Each pool business type has one safely cancelled pre-incoming sample and one fulfilled order with one real incoming/pallet. Planning uses 18 spaces; actual physical load is separately confirmed.',
prerequisites: ['explicit TEST private env with CHONGCHONG_ENV=test and CHONGCHONG_ADMIN_*', 'current Warehouse/FBA IDs',
'TEST read-only inventory evidence credentials', 'current capacity-offer permission seeds and backend deployed'],
prerequisites: [config.environment === 'GRAY' ? 'explicit GRAY CLI with CHONGCHONG_ENV=gray|prod and CHONGCHONG_ADMIN_*'
: 'explicit TEST private env with CHONGCHONG_ENV=test and CHONGCHONG_ADMIN_*', 'current Warehouse/FBA IDs',
config.environment === 'GRAY' ? 'GRAY read-only evidence via JENKINS_* and verified production container/database identity'
: 'TEST read-only inventory evidence credentials', 'current capacity-offer permission seeds and backend deployed'],
boundary: 'Default plan performs no network or filesystem writes. Execute retains every sample and original command, blocks all further writes on an unknown outcome, never deploys or writes business SQL. No automatic rerun or resume.' }
}
@@ -613,7 +619,7 @@ export async function runPoolAcceptance(config, { env = process.env, outputRoot
}
return response
}
const directory = join(outputRoot, 'reports', `fleet-cross-${config.runId}`, 'pool-write-journal')
const directory = join(outputRoot, 'reports', poolReportName(config), 'pool-write-journal')
mkdirSync(directory)
restoreWrites = guardFleetWrites(context, async entry => {
const file = openSync(join(directory, `${entry.sequence}.json`), 'w')
@@ -622,10 +628,10 @@ export async function runPoolAcceptance(config, { env = process.env, outputRoot
return context
},
verify: (context, fixture, options) => poolScenario(context, fixture, { ...options, credentials }) })
result.scope = 'FLEET_CAPACITY_POOL_HTTP'; result.fullAcceptance = false
result.scope = config.environment === 'GRAY' ? 'FLEET_CAPACITY_POOL_GRAY' : 'FLEET_CAPACITY_POOL_HTTP'; result.fullAcceptance = false
result.remainingSeparateAcceptance = [...POOL_REMAINING]
const output = join(outputRoot, 'reports', `fleet-cross-${config.runId}`)
const sources = ['scripts/fleet-capacity-pool-test-env.mjs'].map(path => ({ path, sha256: createHash('sha256').update(readFileSync(join(ROOT, path))).digest('hex') }))
const output = join(outputRoot, 'reports', poolReportName(config))
const sources = ['scripts/fleet-capacity-pool-test-env.mjs', ...(config.environment === 'GRAY' ? ['scripts/fleet-capacity-pool-gray.mjs'] : [])].map(path => ({ path, sha256: createHash('sha256').update(readFileSync(join(ROOT, path))).digest('hex') }))
writeFileSync(join(output, 'pool-scope.json'), JSON.stringify({ plan: poolPlan(config), sources, success: result.success,
fullAcceptance: false, covered: result.createdResources?.fleetCapacityPool?.covered || [], remaining: POOL_REMAINING }, null, 2) + '\n', { flag: 'wx' })
return result