| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417 |
- #!/usr/bin/env node
- const fs = require('fs');
- const os = require('os');
- const path = require('path');
- const { spawnSync } = require('child_process');
- const ROOT = path.resolve(__dirname, '..');
- function main() {
- const bundleResult = spawnSync(process.execPath, [
- 'scripts/real-proof-intake-bundle.js',
- '--output',
- path.join(ROOT, 'outputs', 'real-proof-intake-bundle-latest'),
- '--strict'
- ], {
- cwd: ROOT,
- encoding: 'utf8',
- shell: false
- });
- if (bundleResult.stdout) process.stdout.write(bundleResult.stdout);
- if (bundleResult.stderr) process.stderr.write(bundleResult.stderr);
- assert(bundleResult.status === 0, 'real proof intake bundle should pass before latest form index smoke');
- const operatorPackResult = spawnSync(process.execPath, [
- 'scripts/proof-gap-operator-pack.js',
- '--output',
- path.join(ROOT, 'outputs', 'proof-gap-operator-pack-latest'),
- '--strict'
- ], {
- cwd: ROOT,
- encoding: 'utf8',
- shell: false
- });
- if (operatorPackResult.stdout) process.stdout.write(operatorPackResult.stdout);
- if (operatorPackResult.stderr) process.stderr.write(operatorPackResult.stderr);
- assert(operatorPackResult.status === 0, 'proof gap operator pack should pass before latest form index smoke');
- const businessExecutionResult = spawnSync(process.execPath, [
- 'scripts/business-execution-index.js',
- '--output',
- path.join(ROOT, 'outputs', 'business-execution-index-latest'),
- '--strict'
- ], {
- cwd: ROOT,
- encoding: 'utf8',
- shell: false
- });
- if (businessExecutionResult.stdout) process.stdout.write(businessExecutionResult.stdout);
- if (businessExecutionResult.stderr) process.stderr.write(businessExecutionResult.stderr);
- assert(businessExecutionResult.status === 0, 'business execution index should pass before latest form index smoke');
- const planExecutionResult = spawnSync(process.execPath, [
- 'scripts/plan-execution-status.js',
- '--outputs',
- path.join(ROOT, 'outputs'),
- '--output',
- path.join(ROOT, 'outputs', 'plan-execution-status-latest'),
- '--strict'
- ], {
- cwd: ROOT,
- encoding: 'utf8',
- shell: false
- });
- if (planExecutionResult.stdout) process.stdout.write(planExecutionResult.stdout);
- if (planExecutionResult.stderr) process.stderr.write(planExecutionResult.stderr);
- assert(planExecutionResult.status === 0, 'plan execution status should pass before latest form index smoke');
- const nextActionsResult = spawnSync(process.execPath, [
- 'scripts/business-proof-next-actions.js',
- '--outputs',
- path.join(ROOT, 'outputs'),
- '--output',
- path.join(ROOT, 'outputs', 'business-proof-next-actions-latest')
- ], { cwd: ROOT, encoding: 'utf8', shell: false });
- if (nextActionsResult.stdout) process.stdout.write(nextActionsResult.stdout);
- if (nextActionsResult.stderr) process.stderr.write(nextActionsResult.stderr);
- assert(nextActionsResult.status === 0, 'business proof next actions should pass before latest form index smoke');
- const localSeedWorklistResult = spawnSync(process.execPath, [
- 'scripts/local-seed-to-intake-worklist.js',
- '--outputs',
- path.join(ROOT, 'outputs'),
- '--output',
- path.join(ROOT, 'outputs', 'local-seed-to-intake-worklist-latest')
- ], { cwd: ROOT, encoding: 'utf8', shell: false });
- if (localSeedWorklistResult.stdout) process.stdout.write(localSeedWorklistResult.stdout);
- if (localSeedWorklistResult.stderr) process.stderr.write(localSeedWorklistResult.stderr);
- assert(localSeedWorklistResult.status === 0, 'local seed to intake worklist should pass before latest form index smoke');
- const realProofClosureWorkOrderResult = spawnSync(process.execPath, [
- 'scripts/real-proof-closure-work-order.js',
- '--outputs',
- path.join(ROOT, 'outputs'),
- '--output',
- path.join(ROOT, 'outputs', 'real-proof-closure-work-order-latest'),
- '--strict'
- ], { cwd: ROOT, encoding: 'utf8', shell: false });
- if (realProofClosureWorkOrderResult.stdout) process.stdout.write(realProofClosureWorkOrderResult.stdout);
- if (realProofClosureWorkOrderResult.stderr) process.stderr.write(realProofClosureWorkOrderResult.stderr);
- assert(realProofClosureWorkOrderResult.status === 0, 'real proof closure work order should pass before latest form index smoke');
- const outputDir = fs.mkdtempSync(path.join(os.tmpdir(), 'tihao-latest-form-index-'));
- const result = spawnSync(process.execPath, [
- 'scripts/latest-form-index.js',
- '--output',
- outputDir,
- '--strict'
- ], {
- cwd: ROOT,
- encoding: 'utf8',
- shell: false
- });
- if (result.stdout) process.stdout.write(result.stdout);
- if (result.stderr) process.stderr.write(result.stderr);
- assert(result.status === 0, 'latest form index should pass against current outputs');
- const summaryPath = path.join(outputDir, 'latest-form-index-summary.json');
- const reportPath = path.join(outputDir, 'latest-form-index.md');
- assert(fs.existsSync(summaryPath), 'summary should exist');
- assert(fs.existsSync(reportPath), 'report should exist');
- const summary = JSON.parse(fs.readFileSync(summaryPath, 'utf8'));
- const report = fs.readFileSync(reportPath, 'utf8').replace(/^\uFEFF/, '');
- const operatorOwnerArtifactCount = Number(summary.proofGapOperatorPack?.ownerArtifactCount || 0);
- const workOrderCount = Number(summary.realProofClosureWorkOrder?.workOrderCount || 0);
- const nextActionCount = Number(summary.nextActions?.actionCount || 0);
- const nextActionSourceState = summary.nextActions?.sourceState || {};
- assert(summary.passed === true, 'summary should pass');
- assert(summary.primaryForm.csv?.includes('tihao-proof-gap-software-form.csv'), 'primary form csv should point to proof gap software form');
- assert(summary.primaryForm.passed === true, 'primary form should be passed');
- assert(summary.primaryForm.rowCount === 5, 'primary form should have five proof gap rows');
- assert(summary.primaryForm.directCustomerProof === false, 'primary form must not be treated as customer proof');
- assert(summary.clientList.csv?.includes('software-client-list.final.csv'), 'client list csv should be indexed');
- assert(summary.clientList.directCustomerProof === false, 'client list must still require review/customer proof');
- assert(summary.clientList.sourceDuplicateRemovedCount >= 0, 'client list should expose source duplicate rows removed');
- assert(summary.clientList.duplicateCountMeaning === 'source_duplicate_removed_count', 'client list should define legacy duplicateCount meaning');
- assert(summary.clientList.finalDuplicateGroupCount === 0, 'client list should expose zero final duplicate groups');
- assert(summary.clientList.rankContinuous === true, 'client list should expose continuous rank status');
- assert(summary.businessExecutionIndex?.markdown?.includes('business-execution-index.md'), 'business execution index report should be indexed');
- assert(summary.businessExecutionIndex?.csv?.includes('business-execution-index.csv'), 'business execution index csv should be indexed');
- assert(summary.businessExecutionIndex?.directCustomerProof === false, 'business execution index must not be treated as customer proof');
- assert(summary.businessExecutionIndex?.operatorPackOwnerArtifactCount === operatorOwnerArtifactCount, 'business execution index should expose operator pack owner artifact count');
- assert(summary.businessExecutionIndex?.operatorPackOwnerArtifactRowCount === operatorOwnerArtifactCount, 'business execution index should expose operator pack owner artifact rows');
- assert(summary.businessExecutionIndex?.operatorPackOwnerArtifacts?.some(item => item.owner === '商务' && item.markdown?.includes('by-owner/business.md') && item.csv?.includes('by-owner/business.csv')), 'business execution index should expose business operator owner files');
- assert(summary.businessExecutionIndex?.fieldOwnerRowCount >= 1, 'business execution index should expose field owner rows');
- assert(summary.businessExecutionIndex?.recheckCommandRowCount >= 1, 'business execution index should expose recheck command rows');
- assert(summary.planExecutionStatus?.markdown?.includes('plan-execution-status.md'), 'plan execution status report should be indexed');
- assert(summary.planExecutionStatus?.csv?.includes('plan-execution-status.csv'), 'plan execution status csv should be indexed');
- assert(summary.planExecutionStatus?.summary?.includes('plan-execution-status-summary.json'), 'plan execution status summary should be indexed');
- assert(summary.planExecutionStatus?.directCustomerProof === false, 'plan execution status must not be treated as customer proof');
- assert(summary.planExecutionStatus?.rowCount === 8, 'plan execution status should expose eight plan sections');
- assert(summary.planExecutionStatus?.complete === false, 'plan execution status should keep incomplete boundary while proof gaps remain');
- assert(summary.planExecutionStatus?.proofOpenCount >= 1, 'plan execution status should expose open proof gap count');
- assert(summary.planExecutionStatus?.operatorPackOwnerArtifactCount === operatorOwnerArtifactCount, 'plan execution status should expose operator pack owner artifact count');
- assert(summary.planExecutionStatus?.operatorPackOwnerArtifacts?.some(item => item.markdown?.includes('by-owner/business.md') && item.csv?.includes('by-owner/business.csv')), 'plan execution status should expose business operator owner files');
- assert(summary.planExecutionStatus?.businessExecutionOperatorPackOwnerArtifactRowCount === operatorOwnerArtifactCount, 'plan execution status should expose business execution operator artifact rows');
- assert(summary.proofGapRequest?.markdown?.includes('proof-gap-request-report.md'), 'proof gap request report should be indexed');
- assert(summary.proofGapRequest?.csv?.includes('proof-gap-request-table.csv'), 'proof gap request csv should be indexed');
- assert(summary.proofGapRequest?.summary?.includes('proof-gap-request-summary.json'), 'proof gap request summary should be indexed');
- assert(summary.proofGapRequest?.directCustomerProof === false, 'proof gap request must not be treated as customer proof');
- assert(summary.proofGapRequest?.proofLevel === 'smoke_or_local', 'proof gap request should keep smoke/local proof level');
- assert(summary.proofGapRequest?.unresolvedCount >= 1, 'proof gap request should expose unresolved count');
- assert(summary.proofGapClosure?.summary?.includes('proof-gap-closure-summary.json'), 'proof gap closure summary should be indexed');
- assert(summary.proofGapClosure?.markdown?.includes('proof-gap-closure-report.md'), 'proof gap closure report should be indexed');
- assert(summary.proofGapClosure?.directCustomerProof === false, 'proof gap closure must not be treated as direct customer proof');
- assert(summary.proofGapClosure?.businessOpenCount === summary.proofGapClosure?.openCount, 'proof gap closure should keep openCount as businessOpenCount alias');
- assert(summary.proofGapClosure?.businessClosedCount === summary.proofGapClosure?.closedCount, 'proof gap closure should keep closedCount as businessClosedCount alias');
- assert(summary.proofGapClosure?.precheckRowCount >= 1, 'proof gap closure should expose precheck rows separately');
- assert(summary.proofGapClosure?.countSemantics?.openCount === 'business_gap_open_count_excludes_precheck_rows', 'proof gap closure should expose count semantics');
- assert(summary.proofGapOperatorPack?.markdown?.includes('proof-gap-operator-pack.md'), 'proof gap operator pack report should be indexed');
- assert(summary.proofGapOperatorPack?.csv?.includes('proof-gap-operator-pack.csv'), 'proof gap operator pack csv should be indexed');
- assert(summary.proofGapOperatorPack?.summary?.includes('proof-gap-operator-pack-summary.json'), 'proof gap operator pack summary should be indexed');
- assert(summary.proofGapOperatorPack?.directCustomerProof === false, 'proof gap operator pack must not be treated as customer proof');
- assert(summary.proofGapOperatorPack?.proofLevel === 'not_business_proof', 'proof gap operator pack should keep not-business-proof level');
- assert(summary.proofGapOperatorPack?.openCount >= 1, 'proof gap operator pack should expose open count');
- assert(summary.proofGapOperatorPack?.rowCount === 5, 'proof gap operator pack should expose five rows');
- assert(summary.proofGapOperatorPack?.ownerGroupCount >= operatorOwnerArtifactCount, 'proof gap operator pack should expose owner group count');
- assert(summary.proofGapOperatorPack?.ownerArtifactCount === operatorOwnerArtifactCount, 'proof gap operator pack should expose owner artifact count');
- assert(Array.isArray(summary.proofGapOperatorPack?.ownerArtifacts) && summary.proofGapOperatorPack.ownerArtifacts.length === operatorOwnerArtifactCount, 'proof gap operator pack should expose owner artifacts');
- assert(summary.proofGapOperatorPack.ownerArtifacts.some(item => item.owner === '商务' && item.markdown?.includes('by-owner/business.md') && item.csv?.includes('by-owner/business.csv')), 'proof gap operator pack should expose business owner files');
- assert(summary.proofGapOperatorPack.ownerArtifacts.some(item => item.owner === '技术/AI' && item.markdown?.includes('by-owner/tech-ai.md') && item.csv?.includes('by-owner/tech-ai.csv')), 'proof gap operator pack should expose tech/AI owner files');
- if (summary.proofGapOperatorPack.ownerArtifacts.some(item => item.owner === '商务/投放')) {
- assert(summary.proofGapOperatorPack.ownerArtifacts.some(item => item.markdown?.includes('by-owner/business-media.md') && item.csv?.includes('by-owner/business-media.csv')), 'proof gap operator pack should expose business/media owner files when present');
- }
- assert(summary.proofGapOperatorPack?.recheckCommandCount >= 5, 'proof gap operator pack should expose recheck command count');
- assert(summary.proofGapOperatorPack?.evidenceRowCount === 5, 'proof gap operator pack should expose evidence row count');
- assert(summary.proofGapOperatorPack?.nextActionCount === 5, 'proof gap operator pack should expose next action count');
- assert(summary.proofGapOperatorPack?.missingProofRequirementCount >= 1, 'proof gap operator pack should expose missing proof requirement count');
- assert(Array.isArray(summary.proofGapOperatorPack?.gapIds) && summary.proofGapOperatorPack.gapIds.includes('historical-dataset') && summary.proofGapOperatorPack.gapIds.includes('manual-review-and-customer-effect'), 'proof gap operator pack should expose stable gap ids');
- assert(summary.realProofIntakeBundle?.markdown?.includes('real-proof-intake-bundle.md'), 'real proof intake bundle report should be indexed');
- assert(summary.realProofIntakeBundle?.csv?.includes('real-proof-intake-bundle.csv'), 'real proof intake bundle csv should be indexed');
- assert(summary.realProofIntakeBundle?.directCustomerProof === false, 'real proof intake bundle must not be treated as customer proof');
- assert(summary.realProofIntakeBundle?.proofLevel === 'not_business_proof', 'real proof intake bundle should keep not-business-proof level');
- assert(summary.realProofIntakeBundle?.proofOpenCount >= 1, 'real proof intake bundle should expose open proof count');
- assert(summary.realProofIntakeBundle?.fillRowCount >= 3, 'real proof intake bundle should expose fill rows');
- assert(summary.realProofIntakeBundle?.recheckCommandCount >= 5, 'real proof intake bundle should expose recheck commands');
- assert(summary.realProofIntakeBundle?.operatorPackEvidenceRowCount === 5, 'real proof intake bundle should expose operator pack evidence row count');
- assert(summary.realProofIntakeBundle?.operatorPackNextActionCount === 5, 'real proof intake bundle should expose operator pack next action count');
- assert(summary.realProofIntakeBundle?.operatorPackMissingProofRequirementCount >= 1, 'real proof intake bundle should expose operator pack missing proof requirement count');
- assert(summary.realProofIntakeBundle?.operatorPackOwnerArtifactCount === operatorOwnerArtifactCount, 'real proof intake bundle should expose operator pack owner artifact count');
- assert(Array.isArray(summary.realProofIntakeBundle?.operatorPackOwnerArtifacts) && summary.realProofIntakeBundle.operatorPackOwnerArtifacts.length === operatorOwnerArtifactCount, 'real proof intake bundle should expose operator pack owner artifacts');
- assert(summary.realProofIntakeBundle.operatorPackOwnerArtifacts.some(item => item.owner === '商务' && item.markdown?.includes('by-owner/business.md') && item.csv?.includes('by-owner/business.csv')), 'real proof intake bundle should expose business owner operator files');
- assert(summary.realProofClosureWorkOrder?.markdown?.includes('real-proof-closure-work-order.md'), 'real proof closure work order report should be indexed');
- assert(summary.realProofClosureWorkOrder?.csv?.includes('real-proof-closure-work-order.csv'), 'real proof closure work order csv should be indexed');
- assert(summary.realProofClosureWorkOrder?.summary?.includes('real-proof-closure-work-order-summary.json'), 'real proof closure work order summary should be indexed');
- assert(summary.realProofClosureWorkOrder?.directCustomerProof === false, 'real proof closure work order must not be direct customer proof');
- assert(summary.realProofClosureWorkOrder?.proofLevel === 'not_business_proof', 'real proof closure work order should keep not-business-proof level');
- assert(summary.realProofClosureWorkOrder?.materialType === 'real_proof_closure_work_order', 'real proof closure work order should expose material type');
- assert(summary.realProofClosureWorkOrder?.complete === false, 'real proof closure work order should not claim completion');
- assert(summary.realProofClosureWorkOrder?.canCloseProofGap === false, 'real proof closure work order must not close proof gaps');
- assert(summary.realProofClosureWorkOrder?.workOrderCount >= 5, 'real proof closure work order should expose work orders');
- assert(summary.realProofClosureWorkOrder?.ownerGroupCount >= 1, 'real proof closure work order should expose owner groups');
- assert(summary.realProofClosureWorkOrder?.proofGapOpenCount >= 1, 'real proof closure work order should expose open proof gaps');
- assert(summary.realProofClosureWorkOrder?.intakeFailureCount >= 1, 'real proof closure work order should expose intake failures');
- assert(summary.realProofClosureWorkOrder?.realCandidateRows >= 0, 'real proof closure work order should expose real candidate rows');
- assert(Array.isArray(summary.realProofClosureWorkOrder?.ownerArtifacts) && summary.realProofClosureWorkOrder.ownerArtifacts.length === summary.realProofClosureWorkOrder.ownerGroupCount, 'real proof closure work order should expose owner artifacts');
- assert(summary.realProofClosureWorkOrder.ownerArtifacts.some(item => item.markdown?.includes('by-owner/business.md') && item.csv?.includes('by-owner/business.csv')), 'real proof closure work order should expose business owner files');
- assert(summary.realProofClosureWorkOrder.ownerArtifacts.some(item => item.markdown?.includes('by-owner/tech-ai.md') && item.csv?.includes('by-owner/tech-ai.csv')), 'real proof closure work order should expose tech/AI owner files');
- if (summary.realProofClosureWorkOrder.ownerArtifacts.some(item => item.owner === '商务/投放')) {
- assert(summary.realProofClosureWorkOrder.ownerArtifacts.some(item => item.markdown?.includes('by-owner/business-media.md') && item.csv?.includes('by-owner/business-media.csv')), 'real proof closure work order should expose business/media owner files when present');
- }
- assert(summary.localSeedToIntakeWorklist?.markdown?.includes('local-seed-to-intake-worklist.md'), 'seed-to-intake worklist report should be indexed');
- assert(summary.localSeedToIntakeWorklist?.csv?.includes('local-seed-to-intake-worklist.csv'), 'seed-to-intake worklist csv should be indexed');
- assert(summary.localSeedToIntakeWorklist?.summary?.includes('local-seed-to-intake-worklist-summary.json'), 'seed-to-intake worklist summary should be indexed');
- assert(summary.localSeedToIntakeWorklist?.historyDraft?.includes('history-intake-draft.csv'), 'seed-to-intake history draft should be indexed');
- assert(summary.localSeedToIntakeWorklist?.videoWorklist?.includes('video-resource-worklist.csv'), 'seed-to-intake video worklist should be indexed');
- assert(summary.localSeedToIntakeWorklist?.candidateWorklist?.includes('candidate-seed-worklist.csv'), 'seed-to-intake candidate worklist should be indexed');
- assert(summary.localSeedToIntakeWorklist?.directCustomerProof === false, 'seed-to-intake worklist must not be direct customer proof');
- assert(summary.localSeedToIntakeWorklist?.proofLevel === 'not_business_proof', 'seed-to-intake worklist should keep not-business-proof level');
- assert(summary.localSeedToIntakeWorklist?.materialType === 'seed_to_intake_worklist', 'seed-to-intake worklist should classify material type');
- assert(summary.localSeedToIntakeWorklist?.complete === false, 'seed-to-intake worklist should not claim completion');
- assert(summary.localSeedToIntakeWorklist?.canCloseProofGap === false, 'seed-to-intake worklist must not close proof gaps');
- assert(summary.localSeedToIntakeWorklist?.historyDraftRows >= 1, 'seed-to-intake worklist should expose history draft rows');
- assert(summary.localSeedToIntakeWorklist?.candidateSeedRows >= 1, 'seed-to-intake worklist should expose candidate seed rows');
- assert(summary.localSeedToIntakeWorklist?.videoWorklistRows >= 1, 'seed-to-intake worklist should expose video worklist rows');
- assert(summary.localSeedToIntakeWorklist?.videoCandidateNeedsResourceRows >= 1, 'seed-to-intake worklist should expose candidate videos needing resources');
- assert(summary.localSeedToIntakeWorklist?.missingProofRequirementCount >= 1, 'seed-to-intake worklist should expose missing proof requirements');
- assert(summary.localSeedToIntakeWorklist?.nextActionCount >= 1, 'seed-to-intake worklist should expose next actions');
- assert(summary.optimizationCompletion?.markdown?.includes('optimization-completion-report.md'), 'optimization completion report should be indexed');
- assert(summary.optimizationCompletion?.summary?.includes('optimization-completion-summary.json'), 'optimization completion summary should be indexed');
- assert(summary.optimizationCompletion?.directCustomerProof === false, 'optimization completion audit must not be direct customer proof');
- assert(summary.optimizationCompletion?.proofLevel === 'not_business_proof', 'optimization completion should keep not-business-proof level while not ready');
- assert(summary.optimizationCompletion?.readyForClaim === false, 'optimization completion should keep readyForClaim false while proof gaps remain');
- assert(summary.optimizationCompletion?.proofGapOpenCount >= 1, 'optimization completion should expose open proof gap count');
- assert(summary.optimizationCompletion?.blockingReasonCount >= 1, 'optimization completion should expose blocking reasons');
- assert(summary.optimizationCompletion?.blockingReasonsWithMissingProofRequirements >= 1, 'optimization completion should expose blockers with missing proof requirements');
- assert(summary.optimizationCompletion?.missingProofRequirementCount >= 1, 'optimization completion should expose missing proof requirement count');
- assert(summary.optimizationCompletion?.videoAbPreflightReadyForVideoAb === false, 'optimization completion should expose video A/B preflight readiness');
- assert(Number.isFinite(Number(summary.optimizationCompletion?.videoAbPreflightFailureCount)), 'optimization completion should expose video A/B preflight failure count');
- assert(summary.optimizationCompletion?.canClaim?.tihaoRateImproved === false, 'optimization completion must not allow tihao-rate claim while incomplete');
- assert(summary.optimizationCompletion?.canClaim?.customerEffectAchieved === false, 'optimization completion must not allow customer-effect claim while incomplete');
- assert(summary.optimizationCompletion?.canClaim?.manualSupplementReduced === false, 'optimization completion must not allow manual-supplement claim while incomplete');
- assert(summary.longRunReadiness?.report?.includes('long-run-readiness-report.md'), 'long-run readiness report should be indexed');
- assert(summary.longRunReadiness?.summary?.includes('long-run-readiness-summary.json'), 'long-run readiness summary should be indexed');
- assert(summary.longRunReadiness?.directCustomerProof === false, 'long-run readiness must not be treated as customer proof');
- assert(summary.longRunReadiness?.proofLevel === 'not_business_proof', 'long-run readiness should keep not-business-proof level while blocked');
- assert(summary.longRunReadiness?.ready === false, 'long-run readiness should expose ready=false while proof gaps remain');
- assert(summary.longRunReadiness?.failCount >= 1, 'long-run readiness should expose failing preflight checks');
- assert(summary.nextActions.actionCount >= 1, 'index should expose current action queue count');
- assert(summary.nextActions.complete === false, 'index should expose next action queue incomplete state');
- assert(summary.nextActions.proofOpenCount >= 1, 'index should expose next action proof gap open count');
- assert(summary.nextActions.ownerGroupCount >= 1, 'index should expose next action owner group count');
- assert(summary.nextActions.ownerArtifactCount >= summary.nextActions.ownerGroupCount, 'index should expose next action owner artifact count');
- assert(summary.nextActions.sourceState?.proofGapOpenCount >= 1, 'index should expose next action source proof gap open count');
- assert(nextActionSourceState.pipelineStale === true, 'index should expose stale pipeline state for current next actions');
- assert(Number(nextActionSourceState.pipelineNextActionCount || 0) === 0, 'index should expose zero current pipeline actions when stale');
- assert(Number(nextActionSourceState.pipelineRawNextActionCount || 0) >= 1, 'index should retain raw stale pipeline action count');
- assert(Number(nextActionSourceState.pipelineSuppressedNextActionCount || 0) === Number(nextActionSourceState.pipelineRawNextActionCount || 0), 'index should suppress every stale pipeline action');
- assert(String(nextActionSourceState.pipelineStaleReason || '').includes('stale'), 'index should expose stale pipeline reason');
- assert(Array.isArray(nextActionSourceState.pipelineStaleMissingProofRequirements) && nextActionSourceState.pipelineStaleMissingProofRequirements.includes('optimizationPipeline.readyForClaim=true'), 'index should expose stale pipeline missing proof requirements');
- assert(Array.isArray(summary.nextActions.topActions) && summary.nextActions.topActions.length >= Math.min(5, Number(summary.nextActions.actionCount || 0)), 'index should expose top next actions');
- assert(summary.nextActions.topActions.every(item => !String(item.source || '').includes('optimization-pipeline')), 'index should not expose stale optimization-pipeline top actions');
- assert(summary.nextActions.topActions.some(item => item.id === 'step-03' && item.command?.includes('history-data-template.csv')), 'index should expose top historical data action');
- assert(summary.nextActions.topActions.some(item => item.id === 'gap-video-ab-live-proof' && item.command?.includes('acceptance:video-ab')), 'index should expose top video A/B action');
- assert(summary.nextActions.ownerArtifacts.some(item => item.owner === '商务' && item.markdown?.includes('by-owner/business.md')), 'business owner markdown should be indexed');
- assert(summary.nextActions.ownerArtifacts.some(item => item.owner === '技术/AI' && item.csv?.includes('by-owner/tech-ai.csv')), 'tech owner csv should be indexed');
- assert(summary.nextActions.ownerArtifacts.some(item => item.owner === '商务' && item.repairArtifacts?.some(artifact => artifact.csv.includes('intake-readiness-repair-actions.csv'))), 'business owner repair artifact should be indexed');
- assert(summary.nextActions.ownerArtifacts.some(item => item.repairArtifacts?.some(artifact => artifact.csv.includes('homepage-evidence-repair-actions.csv'))) || summary.nextActions.ownerArtifacts.some(item => item.repairArtifacts?.some(artifact => artifact.csv.includes('video-resource-repair-actions.csv'))), 'owner repair artifacts should be indexed');
- assert(summary.repairActions?.dataIntake?.csv?.includes('intake-readiness-repair-actions.csv'), 'data intake repair actions csv should be indexed');
- assert(summary.repairActions.dataIntake.repairActionCount >= 1, 'data intake repair actions should expose action count');
- assert(summary.repairActions?.videoResource?.csv?.includes('video-resource-repair-actions.csv'), 'video resource repair actions csv should be indexed');
- assert(summary.repairActions.videoResource.repairActionCount >= 0, 'video resource repair actions should expose action count');
- assert(summary.repairActions?.homepageEvidence?.csv?.includes('homepage-evidence-repair-actions.csv'), 'homepage evidence repair actions csv should be indexed');
- assert(summary.repairActions.homepageEvidence.repairActionCount >= 1, 'homepage evidence repair actions should expose action count');
- assert(summary.repairActions.homepageEvidence.directCustomerProof === false, 'homepage evidence repair actions should not be direct customer proof');
- assert(summary.recommendedNextCommand.includes('round:refresh'), 'index should recommend round refresh');
- assert(report.includes('# 最新提号表单索引'), 'report should be Chinese');
- assert(report.includes('最新提号补证表单'), 'report should include proof gap form');
- assert(report.includes('最新软件端候选名单'), 'report should include client candidate list');
- assert(report.includes('最终重复组'), 'report should clarify final duplicate group count');
- assert(report.includes('源表去重丢弃'), 'report should clarify source duplicate rows removed');
- assert(report.includes('## 下一步行动队列摘要'), 'report should include next action queue summary');
- assert(report.includes(`actionCount:${nextActionCount}`), 'report should include next action count');
- assert(report.includes('pipelineStale:true'), 'report should include stale pipeline state');
- assert(report.includes(`pipelineSuppressedNextActionCount:${nextActionSourceState.pipelineSuppressedNextActionCount}`), 'report should include suppressed stale pipeline action count');
- assert(report.includes('pipelineStaleReason:'), 'report should include stale pipeline reason');
- assert(report.includes('step-03'), 'report should include top historical data action id');
- assert(report.includes('gap-video-ab-live-proof'), 'report should include top video A/B action id');
- assert(report.includes('acceptance:video-ab'), 'report should include top video A/B command');
- assert(report.includes('business-execution-index.md'), 'report should include business execution index');
- assert(report.includes('plan-execution-status.md'), 'report should include plan execution status');
- assert(report.includes('proof-gap-request-report.md'), 'report should include proof gap request report');
- assert(report.includes('真实证明缺口请求包'), 'report should include proof gap request title');
- assert(report.includes('proof-gap-closure-report.md'), 'report should include proof gap closure report');
- assert(report.includes('提号真实证明缺口关闭审计'), 'report should include proof gap closure title');
- assert(report.includes('businessOpenCount='), 'report should include business proof gap open count semantics');
- assert(report.includes('precheckOpenCount='), 'report should include precheck count separately');
- assert(report.includes('proof-gap-operator-pack.md'), 'report should include proof gap operator pack report');
- assert(report.includes('提号补证操作包'), 'report should include proof gap operator pack title');
- assert(report.includes('gapIds=historical-dataset'), 'report should include proof gap operator stable ids');
- assert(report.includes(`ownerArtifactCount=${operatorOwnerArtifactCount}`), 'report should include proof gap operator owner artifact count');
- assert(report.includes('## proof-gap 操作包负责人文件'), 'report should include proof gap operator owner files section');
- assert(report.includes('by-owner/business.csv'), 'report should include business owner csv');
- if (summary.proofGapOperatorPack.ownerArtifacts.some(item => item.owner === '商务/投放')) {
- assert(report.includes('by-owner/business-media.md'), 'report should include business/media owner markdown when present');
- }
- assert(report.includes('by-owner/tech-ai.csv'), 'report should include tech/AI owner csv');
- assert(report.includes('evidenceRowCount=5'), 'report should include proof gap operator evidence row count');
- assert(report.includes('nextActionCount=5'), 'report should include proof gap operator next action count');
- assert(report.includes('real-proof-intake-bundle.md'), 'report should include real proof intake bundle');
- assert(report.includes('真实验收材料收集总包'), 'report should include real proof intake bundle title');
- assert(report.includes('operatorPackEvidenceRowCount=5'), 'report should include real proof bundle operator evidence row count');
- assert(report.includes('operatorPackNextActionCount=5'), 'report should include real proof bundle operator next action count');
- assert(report.includes(`operatorPackOwnerArtifactCount=${operatorOwnerArtifactCount}`), 'report should include real proof bundle operator owner artifact count');
- assert(report.includes('## 真实验收总包操作包负责人附件'), 'report should include real proof bundle operator owner artifact section');
- assert(report.includes('by-owner/business.csv'), 'report should include real proof bundle business owner csv');
- assert(report.includes('real-proof-closure-work-order.md'), 'report should include real proof closure work order');
- assert(report.includes('真实证明闭环工单'), 'report should include real proof closure work order title');
- assert(report.includes(`workOrderCount=${workOrderCount}`), 'report should include real proof closure work order count');
- assert(report.includes('canCloseProofGap=false'), 'report should include real proof closure work order boundary');
- assert(report.includes('## 真实证明闭环工单负责人附件'), 'report should include real proof closure work order owner artifact section');
- if (summary.realProofClosureWorkOrder.ownerArtifacts.some(item => item.owner === '商务/投放')) {
- assert(report.includes('by-owner/business-media.csv'), 'report should include real proof closure work order business/media csv when present');
- }
- assert(report.includes('by-owner/tech-ai.md'), 'report should include real proof closure work order tech owner markdown');
- assert(report.includes('本地种子转 intake 补表 worklist'), 'report should include seed-to-intake worklist title');
- assert(report.includes('local-seed-to-intake-worklist.md'), 'report should include seed-to-intake worklist report');
- assert(report.includes('history-intake-draft.csv'), 'report should include seed-to-intake history draft');
- assert(report.includes('video-resource-worklist.csv'), 'report should include seed-to-intake video worklist');
- assert(report.includes('candidate-seed-worklist.csv'), 'report should include seed-to-intake candidate worklist');
- assert(report.includes('seed_to_intake_worklist'), 'report should include seed-to-intake material type');
- assert(report.includes('optimization-completion-report.md'), 'report should include optimization completion report');
- assert(report.includes('readyForClaim=false'), 'report should include optimization completion readyForClaim boundary');
- assert(report.includes('missingProofRequirementCount='), 'report should include optimization completion missing proof requirement count');
- assert(report.includes('videoAbPreflightReadyForVideoAb='), 'report should include optimization completion video A/B preflight readiness');
- assert(report.includes('videoAbPreflightFailureCount='), 'report should include optimization completion video A/B preflight failure count');
- assert(report.includes('proofGapOpenCount'), 'report should include optimization completion proof gap count');
- assert(report.includes('long-run-readiness-report.md'), 'report should include long-run readiness report');
- assert(report.includes('ready=false'), 'report should include long-run readiness ready=false boundary');
- assert(report.includes('长跑前置门禁'), 'report should include long-run readiness title');
- assert(report.includes('proofOpenCount'), 'report should show plan proof open count');
- assert(report.includes(`operatorPackOwnerArtifactCount=${operatorOwnerArtifactCount}`), 'report should show plan execution operator owner attachment count');
- assert(report.includes(`操作包负责人附件 ${operatorOwnerArtifactCount}`), 'report should show business execution operator owner attachment count');
- assert(report.includes('## 商务执行总表操作包负责人附件'), 'report should include business execution operator owner artifact section');
- assert(report.includes('字段负责人'), 'report should show business execution index field owner count');
- assert(report.includes('复验命令'), 'report should show business execution index recheck command count');
- assert(report.includes('修复附件'), 'report should include owner repair artifact column');
- assert(report.includes('## 修复清单入口'), 'report should include repair action section');
- assert(report.includes('intake-readiness-repair-actions.csv'), 'report should include data intake repair action csv');
- assert(report.includes('video-resource-repair-actions.csv'), 'report should include video resource repair action csv');
- assert(report.includes('homepage-evidence-repair-actions.csv'), 'report should include homepage evidence repair action csv');
- assert(report.includes('不能把 sample、smoke、模板'), 'report should include proof guardrail');
- assert(!/sk-[A-Za-z0-9_-]{10,}/.test(report), 'report should not contain model token patterns');
- assert(!/r:[A-Za-z0-9]{20,}/.test(report), 'report should not contain Parse sessionToken patterns');
- assert(!/Authorization/i.test(report), 'report should not expose Authorization text');
- assert(summary.supportDocs?.some(item => item.path?.includes('tihao-experience-optimization-plan.zh-CN.md')), 'Chinese optimization plan should be indexed');
- assert(summary.supportDocs?.some(item => item.path?.includes('tihao-experience-optimization-plan.md')), 'main optimization plan should be indexed');
- assert(summary.supportDocs?.some(item => item.path?.includes('business-proof-action-order.zh-CN.md')), 'Chinese proof action order should be indexed');
- assert(summary.supportDocs?.some(item => item.path?.includes('tihao-handoff-index.md')), 'task handoff index should be indexed');
- assert(summary.intakeFieldChecklist?.markdown?.includes('intake-field-checklist.md'), 'intake field checklist markdown should be indexed');
- assert(summary.intakeFieldChecklist?.csv?.includes('intake-field-checklist.csv'), 'intake field checklist csv should be indexed');
- assert(summary.intakeFieldChecklist?.directCustomerProof === false, 'intake field checklist must not be treated as customer proof');
- assert(summary.manualReviewLabelGuide?.markdown?.includes('manual-review-label-guide.md'), 'manual review label guide markdown should be indexed');
- assert(summary.manualReviewLabelGuide?.csv?.includes('manual-review-label-guide.csv'), 'manual review label guide csv should be indexed');
- assert(summary.manualReviewLabelGuide?.directCustomerProof === false, 'manual review label guide must not be treated as customer proof');
- assert(summary.manualReviewLabelGuide?.negativeLabelsRequireAttribution === true, 'manual review label guide should require negative attribution');
- assert(summary.manualReviewLabelGuide?.attributionTypeCount >= 8, 'manual review label guide should expose attribution types');
- assert(Array.isArray(summary.intakeFieldChecklist?.ownerGroups) && summary.intakeFieldChecklist.ownerGroups.length >= 1, 'intake field checklist owner groups should be indexed');
- assert(summary.intakeFieldChecklist.ownerGroups.some(item => item.owner === '商务' && item.files?.some(file => file.includes('history-data-template.csv'))), 'business history owner group should expose history template');
- assert(Array.isArray(summary.intakeFieldChecklist?.recheckCommands) && summary.intakeFieldChecklist.recheckCommands.length >= 1, 'intake field checklist recheck commands should be indexed');
- assert(summary.intakeFieldChecklist.recheckCommands.some(item => item.command.includes('intake:readiness')), 'intake readiness recheck command should be indexed');
- assert(summary.intakeFieldChecklist.recheckCommands.some(item => item.command.includes('acceptance:video-ab')), 'video A/B recheck command should be indexed');
- assert(summary.businessFillGuide?.directCustomerProof === false, 'business fill guide must not be treated as customer proof');
- assert(summary.businessFillGuide?.rowCount >= 3, 'business fill guide should expose owner fill rows');
- assert(summary.businessFillGuide.rows.some(item => item.owner === '商务' && item.section === 'history' && item.file.includes('history-data-template.csv')), 'business fill guide should expose history template row');
- assert(summary.businessFillGuide.rows.some(item => item.section === 'video' && item.recheckCommand.includes('video:resource-readiness')), 'business fill guide should expose video readiness recheck command');
- assert(summary.businessFillGuide.rows.every(item => String(item.boundary || '').includes('不证明客户效果')), 'business fill guide rows should keep proof boundary');
- assert(report.includes('## 中文 SOP 入口'), 'report should include Chinese SOP section');
- assert(report.includes('tihao-experience-optimization-plan.zh-CN.md'), 'report should include Chinese optimization plan');
- assert(report.includes('tihao-experience-optimization-plan.md'), 'report should include main optimization plan');
- assert(report.includes('business-proof-action-order.zh-CN.md'), 'report should include Chinese proof action order');
- assert(report.includes('tihao-handoff-index.md'), 'report should include task handoff index');
- assert(report.includes('intake-field-checklist.md'), 'report should include intake field checklist');
- assert(report.includes('manual-review-label-guide.md'), 'report should include manual review label guide');
- assert(report.includes('人工复核标签与归因指南'), 'report should include manual review label guide title');
- assert(report.includes('## 字段补齐负责人顺序'), 'report should include field checklist owner group section');
- assert(report.includes('history-data-template.csv'), 'report should include history template in owner group section');
- assert(report.includes('## 商务填表执行视图'), 'report should include business fill guide section');
- assert(report.includes('本视图只帮助商务按表补齐真实材料'), 'report should include business fill guide guardrail');
- assert(report.includes('## 补齐后复验命令'), 'report should include recheck command section');
- assert(report.includes('npm run intake:readiness'), 'report should include intake readiness recheck command');
- assert(report.includes('npm run acceptance:video-ab'), 'report should include video A/B recheck command');
- console.log(JSON.stringify({
- ok: true,
- outputDir,
- actionCount: summary.nextActions.actionCount,
- topActionCount: summary.nextActions.topActions.length,
- primaryForm: summary.primaryForm.csv
- }, null, 2));
- }
- function assert(condition, message) {
- if (!condition) throw new Error(message);
- }
- if (require.main === module) main();
|