This commit is contained in:
2026-10-27 17:44:41 +08:00
parent 57cd211973
commit db0e72daeb
37 changed files with 701 additions and 671 deletions
+6 -3
View File
@@ -18,8 +18,8 @@ export function requireTestProfile(execArgs) {
const joined = execArgs.find(value => value.startsWith('--env-file='))
const index = execArgs.indexOf('--env-file')
const file = joined?.slice('--env-file='.length) || (index >= 0 ? execArgs[index + 1] : '')
if (!file || !resolve(file).replaceAll('\\', '/').endsWith('/.codex/env/chongchong-global/test-acceptance.env'))
throw new Error('须在脚本前显式指定授权目录的test-acceptance.env,禁止复用其他环境或任务会话文件')
if (!file || !resolve(file).replaceAll('\\', '/').endsWith('/.codex/env/chongchong-global/test/acceptance.env'))
throw new Error('须在脚本前显式指定授权目录的test/acceptance.env,禁止复用其他环境或任务会话文件')
return resolve(file)
}
@@ -35,8 +35,11 @@ export async function execute(args = process.argv.slice(2), execArgs = process.e
const repository = resolve(dirname(fileURLToPath(import.meta.url)), '..')
if (!repository.replaceAll('\\', '/').endsWith('/chongchong-global/baiyue-firstleg')) throw new Error('公司成本验收只允许在登记的TEST项目运行')
const output = resolve(repository, `reports/fleet-cost-live-20261003/${preflight ? `preflight-${new Date().toISOString().replace(/\D/g, '').slice(0,17)}` : 'api-report'}.json`)
const fixedCompanyCostResources = JSON.parse(env.CHONGCHONG_ACCEPTANCE_COMPANY_COST_RESOURCES || 'null')
if (!preflight && (!fixedCompanyCostResources || !['supplierId', 'vehicleId'].every(key => typeof fixedCompanyCostResources[key] === 'string' && /^[1-9]\d*$/.test(fixedCompanyCostResources[key]))))
throw new Error('请配置 CHONGCHONG_ACCEPTANCE_COMPANY_COST_RESOURCES 的既有 supplierId/vehicleId,禁止自动创建')
await mkdir(dirname(output), { recursive: true })
const context = new AcceptanceRun({ gateway: base.origin, quiet: true, modules: [] })
const context = new AcceptanceRun({ gateway: base.origin, quiet: true, modules: [], fixedCompanyCostResources })
context.marker = MARKER
const report = { marker: MARKER, mode: preflight ? 'READ_ONLY_PREFLIGHT' : 'BUSINESS_ACCEPTANCE', expectedCommit: READY_COMMIT, status: 'PREPARING', startedAt: new Date().toISOString(), session: { login: 'NOT_STARTED', logout: 'NOT_STARTED' }, createdResources: context.createdResources, steps: context.steps }
let refresh = '', failure