#!/usr/bin/env node const fs = require('fs'); const path = require('path'); const ROOT = path.resolve(__dirname, '..'); const OUTPUTS = path.join(ROOT, 'outputs'); const VIDEO_AB_PREFLIGHT_EVIDENCE_TOKENS = [ 'mode=unknown', 'collectionMode=unknown', 'generatedBy=unknown', 'preflight.readyForVideoAb=false', 'preflight.failureCount=', 'preflight.generatedBy=acceptance:video-ab-preflight', 'runtimeCredentialPresent=false', 'companyResolved=false', 'vocSocialProviderTokenPresent=false', 'videoAnalysisTokenPresent=false' ]; const VIDEO_AB_PREFLIGHT_REQUIREMENT_TOKENS = [ 'proofContext.mode=live', 'proofContext.collectionMode=live', 'proofContext.generatedBy=acceptance:video-ab', 'proofContext.requiresRuntimeCredential=true', 'proofContext.requiresVocSocialProvider=true', 'proofContext.requiresVideoAnalysisProvider=true', 'videoAbPreflight.readyForVideoAb=true', 'videoAbPreflight.proofContext.requiresRuntimeCredential=true', 'videoAbPreflight.proofContext.requiresVocSocialProvider=true', 'videoAbPreflight.proofContext.requiresVideoAnalysisProvider=true', 'videoAbPreflight.company resolved for live run' ]; function main() { const args = parseArgs(process.argv.slice(2)); const outputDir = path.resolve(args.output || process.env.TIHAO_ROUND_DEPOSITION_OUTPUT || path.join(OUTPUTS, `round-deposition-${Date.now()}`)); const summary = buildRoundDepositionSummary({ root: ROOT, outputsDir: path.resolve(args.outputs || OUTPUTS), implementationLog: path.resolve(args.implementationLog || path.join(ROOT, 'docs', 'tihao-experience-implementation-log.md')), statusPath: args.status ? path.resolve(args.status) : null, evidencePath: args.evidence ? path.resolve(args.evidence) : null, handoffPath: args.handoff ? path.resolve(args.handoff) : null, proofGapPath: args.proofGap ? path.resolve(args.proofGap) : null , proofGapClosurePath: args.proofGapClosure ? path.resolve(args.proofGapClosure) : null, proofGapOperatorPackPath: args.proofGapOperatorPack ? path.resolve(args.proofGapOperatorPack) : null, homepageEvidenceReadinessPath: args.homepageEvidenceReadiness ? path.resolve(args.homepageEvidenceReadiness) : null, intakeReadinessPath: args.intakeReadiness ? path.resolve(args.intakeReadiness) : null, longRunReadinessPath: args.longRunReadiness ? path.resolve(args.longRunReadiness) : null, businessProofProgressPath: args.businessProofProgress ? path.resolve(args.businessProofProgress) : null, businessProofNextActionsPath: args.businessProofNextActions ? path.resolve(args.businessProofNextActions) : null, businessExecutionIndexPath: args.businessExecutionIndex ? path.resolve(args.businessExecutionIndex) : null, optimizationCompletionPath: args.optimizationCompletion ? path.resolve(args.optimizationCompletion) : null, realProofIntakeBundlePath: args.realProofIntakeBundle ? path.resolve(args.realProofIntakeBundle) : null, intakeFieldChecklistPath: args.intakeFieldChecklist ? path.resolve(args.intakeFieldChecklist) : null, proofGapSoftwareFormPath: args.proofGapSoftwareForm ? path.resolve(args.proofGapSoftwareForm) : null, latestFormIndexPath: args.latestFormIndex ? path.resolve(args.latestFormIndex) : null, planExecutionStatusPath: args.planExecutionStatus ? path.resolve(args.planExecutionStatus) : null, proofActionOrderPath: args.proofActionOrder ? path.resolve(args.proofActionOrder) : null }); fs.mkdirSync(outputDir, { recursive: true }); const jsonPath = path.join(outputDir, 'round-deposition-summary.json'); const reportPath = path.join(outputDir, 'round-deposition-report.md'); fs.writeFileSync(jsonPath, JSON.stringify(summary, null, 2), 'utf8'); fs.writeFileSync(reportPath, withBom(renderReport(summary)), 'utf8'); console.log(JSON.stringify({ outputDir, json: jsonPath, report: reportPath, passed: summary.passed, passCount: summary.counts.pass, failCount: summary.counts.fail, warnCount: summary.counts.warn }, null, 2)); if (!summary.passed && args.strict) process.exitCode = 1; } function buildRoundDepositionSummary({ root, outputsDir, implementationLog, statusPath, evidencePath, handoffPath, proofGapPath, proofGapClosurePath, proofGapOperatorPackPath, homepageEvidenceReadinessPath, intakeReadinessPath, longRunReadinessPath, businessProofProgressPath, businessProofNextActionsPath, businessExecutionIndexPath, optimizationCompletionPath, realProofIntakeBundlePath, intakeFieldChecklistPath, proofGapSoftwareFormPath, latestFormIndexPath, planExecutionStatusPath, proofActionOrderPath }) { const resolvedStatusPath = statusPath || latestFile(outputsDir, 'optimization-status-summary.json'); const resolvedEvidencePath = evidencePath || latestFile(outputsDir, 'evidence-index-summary.json'); const resolvedHandoffPath = handoffPath || latestFile(outputsDir, 'optimization-handoff-summary.json'); const resolvedProofGapPath = proofGapPath || latestFile(outputsDir, 'proof-gap-request-summary.json'); const resolvedProofGapClosurePath = proofGapClosurePath || latestFile(outputsDir, 'proof-gap-closure-summary.json'); const resolvedProofGapOperatorPackPath = proofGapOperatorPackPath || latestFile(outputsDir, 'proof-gap-operator-pack-summary.json'); const resolvedFeedbackLoopClosurePath = latestFile(outputsDir, 'feedback-loop-closure-summary.json'); const resolvedHomepageEvidenceReadinessPath = homepageEvidenceReadinessPath || latestFile(outputsDir, 'homepage-evidence-readiness-summary.json'); const resolvedIntakeReadinessPath = intakeReadinessPath || latestFile(outputsDir, 'intake-readiness-summary.json'); const resolvedLongRunReadinessPath = longRunReadinessPath || latestFile(outputsDir, 'long-run-readiness-summary.json'); const resolvedBusinessProofProgressPath = businessProofProgressPath || latestFile(outputsDir, 'business-proof-progress-summary.json'); const resolvedBusinessProofNextActionsPath = businessProofNextActionsPath || latestFile(outputsDir, 'business-proof-next-actions-summary.json'); const resolvedBusinessExecutionIndexPath = businessExecutionIndexPath || latestFile(outputsDir, 'business-execution-index-summary.json'); const resolvedOptimizationCompletionPath = optimizationCompletionPath || latestFile(outputsDir, 'optimization-completion-summary.json'); const resolvedRealProofIntakeBundlePath = realProofIntakeBundlePath || latestFile(outputsDir, 'real-proof-intake-bundle-summary.json'); const resolvedIntakeFieldChecklistPath = intakeFieldChecklistPath || latestFile(outputsDir, 'intake-field-checklist-summary.json'); const resolvedManualReviewLabelGuidePath = latestFile(outputsDir, 'manual-review-label-guide-summary.json'); const resolvedProofGapSoftwareFormPath = proofGapSoftwareFormPath || latestFile(outputsDir, 'tihao-proof-gap-software-form-summary.json'); const resolvedLatestFormIndexPath = latestFormIndexPath || latestFile(outputsDir, 'latest-form-index-summary.json'); const resolvedLocalSeedToIntakeWorklistPath = latestFile(outputsDir, 'local-seed-to-intake-worklist-summary.json'); const resolvedRealGapMaterialAuditPath = latestFile(outputsDir, 'real-gap-material-audit-summary.json'); const resolvedRealProofClosureWorkOrderPath = latestFile(outputsDir, 'real-proof-closure-work-order-summary.json'); const resolvedPlanExecutionStatusPath = planExecutionStatusPath || latestFile(outputsDir, 'plan-execution-status-summary.json'); const status = readJson(resolvedStatusPath); const evidence = readJson(resolvedEvidencePath); const handoff = readJson(resolvedHandoffPath); const proofGap = readJson(resolvedProofGapPath); const proofGapClosure = readJson(resolvedProofGapClosurePath); const proofGapOperatorPack = readJson(resolvedProofGapOperatorPackPath); const feedbackLoopClosure = readJson(resolvedFeedbackLoopClosurePath); const homepageEvidenceReadiness = readJson(resolvedHomepageEvidenceReadinessPath); const intakeReadiness = readJson(resolvedIntakeReadinessPath); const longRunReadiness = readJson(resolvedLongRunReadinessPath); const businessProofProgress = readJson(resolvedBusinessProofProgressPath); const businessProofNextActions = readJson(resolvedBusinessProofNextActionsPath); const businessExecutionIndex = readJson(resolvedBusinessExecutionIndexPath); const optimizationCompletion = readJson(resolvedOptimizationCompletionPath); const realProofIntakeBundle = readJson(resolvedRealProofIntakeBundlePath); const intakeFieldChecklist = readJson(resolvedIntakeFieldChecklistPath); const manualReviewLabelGuide = readJson(resolvedManualReviewLabelGuidePath); const proofGapSoftwareForm = readJson(resolvedProofGapSoftwareFormPath); const latestFormIndex = readJson(resolvedLatestFormIndexPath); const localSeedToIntakeWorklist = readJson(resolvedLocalSeedToIntakeWorklistPath); const realGapMaterialAudit = readJson(resolvedRealGapMaterialAuditPath); const realProofClosureWorkOrder = readJson(resolvedRealProofClosureWorkOrderPath); const planExecutionStatus = readJson(resolvedPlanExecutionStatusPath); const logText = readText(implementationLog); const resolvedProofActionOrderPath = proofActionOrderPath || firstExistingPath(root, [ path.join('docs', 'business-proof-action-order.zh-CN.md'), path.join('docs', 'business-proof-action-order.md') ]); const proofActionOrderText = readText(resolvedProofActionOrderPath); const proofGapReportText = readText(sibling(resolvedProofGapPath, 'proof-gap-request-report.md')); const proofGapCsvText = readText(sibling(resolvedProofGapPath, 'proof-gap-request-table.csv')); const proofGapTemplateRowsReady = Array.isArray(proofGap?.rows) && proofGap.rows.length >= 1 && proofGap.rows.every(item => item.templateCommand && item.templateArtifact); const proofGapTemplateColumnsReady = proofGapTemplateRowsReady && proofGapReportText.includes('模板命令') && proofGapReportText.includes('模板产物') && proofGapCsvText.includes('模板命令') && proofGapCsvText.includes('模板产物'); const checks = [ check('proof-gap-closure-video-ab-preflight-context', 'proof-gap closure records video A/B preflight context', hasProofGapClosureVideoAbPreflightContext(proofGapClosure), 'proofGapClosure.videoAbPreflightFailureCount/rows.video-ab-live-proof', 'When a video A/B runtime preflight exists and is not ready, proof-gap closure must expose it as non-proof context without closing live proof.'), check('optimization-completion-video-ab-preflight-context', 'optimization completion records video A/B preflight context', hasOptimizationCompletionVideoAbPreflightContext(optimizationCompletion), 'optimizationCompletion.videoAbPreflightFailureCount/gates.video-ab-live-proof', 'When a video A/B runtime preflight exists and is not ready, completion must expose it as non-proof context without closing live proof.'), check('proof-gap-closure-recursive-proof-artifact-discovery', 'proof-gap closure retains recursively discovered history/customer-effect artifacts', hasProofGapClosureRecursiveProofArtifactDiscovery(proofGapClosure), 'proofGapClosure.sourceFiles.history/customerEffect + concrete row requirements', 'When nested history/customer-effect artifacts exist, closure must retain their source paths and report concrete failed requirements instead of falling back to missing-file rows.'), check('optimization-completion-recursive-proof-artifact-discovery', 'optimization completion retains recursively discovered history/customer-effect artifacts', hasOptimizationCompletionRecursiveProofArtifactDiscovery(optimizationCompletion), 'optimizationCompletion.sourceFiles.history/customerEffect + concrete blocking requirements', 'When nested history/customer-effect artifacts exist, completion must retain their source paths and propagate concrete failed requirements into blocking reasons/gates.'), check('implementation-log', '实施日志存在且为中文', Boolean(logText) && /提号|优化|当前|已完成/.test(logText), rel(root, implementationLog), '每轮结束后更新 docs/tihao-experience-implementation-log.md。'), check('status-summary', '最新 optimization-status-summary.json 存在', Boolean(status), rel(root, resolvedStatusPath), '运行 npm run optimization:status。'), check('status-report', '最新 optimization-status-report.md 存在', fileExists(sibling(resolvedStatusPath, 'optimization-status-report.md')), rel(root, sibling(resolvedStatusPath, 'optimization-status-report.md')), '运行 npm run optimization:status。'), check('evidence-index', '最新 evidence-index-summary.json 存在', Boolean(evidence), rel(root, resolvedEvidencePath), '运行 npm run evidence:index -- --output outputs\\evidence-index-latest。'), check('evidence-report', '最新 evidence-index-report.md 存在', fileExists(sibling(resolvedEvidencePath, 'evidence-index-report.md')), rel(root, sibling(resolvedEvidencePath, 'evidence-index-report.md')), '运行 npm run evidence:index。'), check('handoff-summary', '最新 optimization-handoff-summary.json 存在', Boolean(handoff), rel(root, resolvedHandoffPath), '运行 npm run handoff:summary -- --output outputs\\optimization-handoff-latest。'), check('handoff-report', '最新 optimization-handoff-report.md 存在', fileExists(sibling(resolvedHandoffPath, 'optimization-handoff-report.md')), rel(root, sibling(resolvedHandoffPath, 'optimization-handoff-report.md')), '运行 npm run handoff:summary。'), check('proof-gap-summary', '最新 proof-gap-request-summary.json 存在', Boolean(proofGap), rel(root, resolvedProofGapPath), '运行 npm run proof-gap:request -- --output outputs\\proof-gap-request-latest。'), check('proof-gap-report', '最新 proof-gap-request-report.md 存在', fileExists(sibling(resolvedProofGapPath, 'proof-gap-request-report.md')), rel(root, sibling(resolvedProofGapPath, 'proof-gap-request-report.md')), '运行 npm run proof-gap:request。'), check('proof-gap-csv', '最新 proof-gap-request-table.csv 存在', fileExists(sibling(resolvedProofGapPath, 'proof-gap-request-table.csv')), rel(root, sibling(resolvedProofGapPath, 'proof-gap-request-table.csv')), '运行 npm run proof-gap:request。'), check('proof-gap-unresolved-recorded', 'proof-gap 记录未解决真实证明缺口', Number(proofGap?.unresolvedCount || 0) >= 1 && Array.isArray(proofGap?.rows) && proofGap.rows.length >= 1, 'proofGap.unresolvedCount', '长期目标未完成时必须记录仍缺哪些真实证明材料。'), check('proof-gap-template-entry-recorded', 'proof-gap 记录真实材料模板入口', proofGapTemplateRowsReady, 'proofGap.rows.templateCommand/templateArtifact', '运行 npm run proof-gap:request,确保每个缺口都有模板命令和模板产物。'), check('proof-gap-template-columns-exported', 'proof-gap 报告和 CSV 导出模板入口列', proofGapTemplateColumnsReady, 'proofGap.report/csv.模板命令/模板产物', '补齐 proof-gap 请求包中的模板命令和模板产物列,避免只剩口头说明。'), check('proof-gap-operator-pack-summary', '提号补证操作包 summary 存在', Boolean(proofGapOperatorPack), rel(root, resolvedProofGapOperatorPackPath), '运行 npm run proof-gap:operator-pack -- --outputs outputs --output outputs\\proof-gap-operator-pack-latest --strict。'), check('proof-gap-operator-pack-actionable', '提号补证操作包记录 5 个可执行缺口', hasProofGapOperatorPack(proofGapOperatorPack), 'proofGapOperatorPack.gapIds/recheckCommandCount', '操作包必须展示 5 个 gapId、负责人、填写文件、复验命令和不证明客户效果边界。'), check('proof-gap-operator-pack-missing-proof-by-gap', '提号补证操作包逐缺口记录缺失证明要求', hasProofGapOperatorPackMissingProofByGap(proofGapOperatorPack), 'proofGapOperatorPack.rows.missingProofRequirements', '操作包必须让每个未关闭业务缺口都携带至少 1 条缺失证明要求,避免只看到 open 但看不到关闭条件。'), check('proof-gap-operator-pack-video-ab-preflight-context', '提号补证操作包记录 video A/B preflight 非证明上下文', hasProofGapOperatorPackVideoAbPreflightContext(proofGapOperatorPack), 'proofGapOperatorPack.rows.video-ab-live-proof.preflight', '操作包必须把 video A/B preflight 失败作为 live proof 缺口上下文展示,同时保留 proofContext live/generatedBy/runtime/provider 缺失要求。'), check('intake-readiness-summary', '最新 intake-readiness-summary.json 存在', Boolean(intakeReadiness), rel(root, resolvedIntakeReadinessPath), '运行 npm run intake:readiness -- --data-pack outputs\\data-intake-pack-latest --video-pack outputs\\video-intake-pack-latest --output outputs\\intake-readiness-latest。'), check('intake-readiness-boundary-recorded', 'intake readiness 记录模板是否已替换为真实材料', intakeReadiness && typeof intakeReadiness.acceptance?.overallReady === 'boolean' && Number.isFinite(Number(intakeReadiness.failureCount || 0)), 'intakeReadiness.overallReady/failureCount', 'intake readiness 必须记录 overallReady 和 failureCount,避免半成品进入长跑。'), check('longrun-readiness-summary', '最新 long-run-readiness-summary.json 存在', Boolean(longRunReadiness), rel(root, resolvedLongRunReadinessPath), '运行 npm run longrun:readiness -- --mode full-matrix --intake-readiness outputs\\intake-readiness-latest\\intake-readiness-summary.json --proof-gap outputs\\proof-gap-request-latest\\proof-gap-request-summary.json --output outputs\\long-run-readiness-latest。'), check('longrun-readiness-intake-gate', 'longrun readiness 记录 intake 前置门禁', Boolean(longRunReadiness) && Array.isArray(longRunReadiness.checks) && longRunReadiness.checks.some(item => String(item.name || '').includes('intake')), 'longRunReadiness.checks.intake', 'longrun readiness 必须显示 intake readiness 对 full matrix/customer-effect 的阻断关系。'), check('business-proof-progress-summary', '最新 business-proof-progress-summary.json 存在', Boolean(businessProofProgress), rel(root, resolvedBusinessProofProgressPath), '运行 npm run business-proof:progress -- --output outputs\\business-proof-progress-latest。'), check('business-proof-progress-steps', '补证进度表记录 15 步状态', hasBusinessProofProgress(businessProofProgress), 'businessProofProgress.rows/counts/complete', '补证进度表必须包含 15 步、complete=false 和 pass/pending/fail/blocked_by_external_data 统计。'), check('business-proof-progress-operator-owner-artifacts', '补证进度表记录操作包负责人附件', hasBusinessProofProgressOperatorOwnerArtifacts(businessProofProgress, proofGapOperatorPack), 'businessProofProgress.operatorPackOwnerArtifacts', '补证进度表必须透传 business/business-media/tech-ai 三份 proof-gap 操作包负责人附件,避免只看 15 步进度时找不到派工文件。'), check('handoff-business-proof-progress-operator-owner-artifacts', '交接摘要记录补证进度表负责人附件', hasBusinessProofProgressOperatorOwnerArtifacts(handoff?.businessProofProgress, proofGapOperatorPack), 'handoff.businessProofProgress.operatorPackOwnerArtifacts', '交接摘要必须透传补证进度表里的三份 proof-gap 操作包负责人附件。'), check('business-proof-next-actions-summary', '最新 business-proof-next-actions-summary.json 存在', Boolean(businessProofNextActions), rel(root, resolvedBusinessProofNextActionsPath), '运行 npm run business-proof:next-actions -- --output outputs\\business-proof-next-actions-latest。'), check('business-proof-next-actions-open', '下一步行动队列记录待办动作', hasBusinessProofNextActions(businessProofNextActions), 'businessProofNextActions.actions/sourceState', '行动队列必须记录 actionCount、top action 和未完成边界,避免只同步状态不分派任务。'), check('business-proof-next-actions-deduped', '下一步行动队列按业务缺口去重', hasDedupedBusinessProofNextActions(businessProofNextActions, proofGap), 'businessProofNextActions.actions', '行动队列必须收敛为真实历史 Brief、真实视频资源、人工复核、视频 A/B、live/provider 长跑等唯一业务缺口,不能把导入、审计、门禁拆成重复任务。'), check('business-proof-next-actions-missing-proof-requirements', '下一步行动队列逐业务缺口记录缺失证明要求', hasBusinessProofNextActionsMissingProofRequirements(businessProofNextActions), 'businessProofNextActions.actions.missingProofRequirements', '行动队列的未关闭业务缺口动作必须携带结构化缺失证明要求,避免负责人只看到下一步文字却无法机器复验关闭条件。'), check('business-proof-next-actions-stale-pipeline-suppression', '下一步行动队列隔离过期 pipeline 动作', hasBusinessProofNextActionsStalePipelineSuppression(businessProofNextActions), 'businessProofNextActions.sourceState.pipelineStale', '当 completion 已判定 optimization-pipeline stale 时,行动队列必须暴露 suppressed 计数并禁止把旧 pipeline nextActions 当作当前派工。'), check('handoff-business-proof-next-actions-top-actions', '交接摘要记录下一步行动队列摘要', hasHandoffBusinessProofNextActions(handoff?.businessProofNextActions, businessProofNextActions), 'handoff.businessProofNextActions.topActions', '交接摘要必须透传下一步行动队列的 actionCount、proofGapOpenCount 和前 5 个高优先级动作,避免下一轮只看到文件链接。'), check('optimization-completion-summary', '优化完成度审计 summary 存在', Boolean(optimizationCompletion), rel(root, resolvedOptimizationCompletionPath), '运行 npm run optimization:completion -- --output outputs\\optimization-completion-latest。'), check('optimization-completion-boundary', '优化完成度审计记录禁止宣称边界', hasOptimizationCompletionBoundary(optimizationCompletion), 'optimizationCompletion.readyForClaim/canClaim', '完成度审计必须记录 readyForClaim、proofGapOpenCount、blockingReasons 和三项禁用宣称。'), check('optimization-completion-missing-proof-requirements', '优化完成度审计逐阻塞项记录缺失证明要求', hasOptimizationCompletionMissingProofRequirements(optimizationCompletion), 'optimizationCompletion.blockingReasons.missingProofRequirements', '完成度审计必须让每个 blocked gate 都携带至少 1 条缺失证明要求,避免只看到 readyForClaim=false 却不知道如何关闭。'), check('business-execution-index-summary', '商务执行总表 summary 存在', Boolean(businessExecutionIndex), rel(root, resolvedBusinessExecutionIndexPath), '运行 npm run business-execution:index -- --output outputs\\business-execution-index-latest --strict。'), check('business-execution-index-passed', '商务执行总表通过并保留证明边界', hasBusinessExecutionIndex(businessExecutionIndex, businessProofNextActions, proofGap), 'businessExecutionIndex.rows/directCustomerProof/proofOpenCount', '商务执行总表必须 passed=true、directCustomerProof=false、包含负责人行动/修复清单/关键文件,且 proofOpenCount 对齐当前未关闭证明缺口。'), check('business-execution-index-operator-owner-artifacts', '商务执行总表记录操作包负责人附件', hasBusinessExecutionOperatorOwnerArtifacts(businessExecutionIndex, proofGapOperatorPack), 'businessExecutionIndex.operatorPackOwnerArtifacts', '商务执行总表必须展示 business/business-media/tech-ai 三份 proof-gap 操作包负责人附件,避免商务只打开执行总表时看不到自己的派工文件。'), check('business-execution-index-longrun-readiness', '商务执行总表记录长跑前置门禁入口', hasBusinessExecutionLongRunReadiness(businessExecutionIndex, longRunReadiness), 'businessExecutionIndex.longRunReadiness', '商务执行总表必须展示 long-run-readiness-report.md/summary.json、ready、failCount 和不能启动长跑的边界。'), check('business-execution-index-optimization-completion', '商务执行总表记录优化完成度审计入口', hasBusinessExecutionOptimizationCompletion(businessExecutionIndex, optimizationCompletion), 'businessExecutionIndex.optimizationCompletion', '商务执行总表必须展示 optimization-completion-report.md/summary.json、readyForClaim、proofGapOpenCount 和禁用宣称边界。'), check('real-proof-intake-bundle-summary', '真实验收材料收集总包 summary 存在', Boolean(realProofIntakeBundle), rel(root, resolvedRealProofIntakeBundlePath), '运行 npm run proof-gap:intake-bundle -- --output outputs\\real-proof-intake-bundle-latest --strict。'), check('real-proof-intake-bundle-longrun-readiness', '真实验收材料总包记录长跑前置门禁入口', hasRealProofBundleLongRunReadiness(realProofIntakeBundle, longRunReadiness), 'realProofIntakeBundle.longRunReadiness', '真实验收材料总包必须展示 long-run-readiness-report.md、longrun:readiness 复验命令、ready/failCount 和 not_business_proof 边界。'), check('real-proof-intake-bundle-operator-owner-artifacts', '真实验收材料总包透传操作包负责人附件', hasProofGapOperatorOwnerArtifacts(realProofIntakeBundle?.operatorPackOwnerArtifacts), 'realProofIntakeBundle.operatorPackOwnerArtifacts', '真实验收材料总包必须展示 business/business-media/tech-ai 三份操作包负责人附件,避免商务只打开总包时看不到自己的派工文件。'), check('real-proof-intake-bundle-video-ab-preflight-context', '真实验收材料总包记录 video A/B preflight 非证明上下文', hasRealProofIntakeBundleVideoAbPreflightContext(realProofIntakeBundle), 'realProofIntakeBundle.proofGapRows.video-ab-live-proof.preflight', '真实材料总包必须透传 video A/B preflight 失败原因和 live proof 缺失要求,避免总包丢掉技术/AI 补证条件。'), check('handoff-business-execution-index', '交接摘要记录商务执行总表入口', hasHandoffBusinessExecutionIndex(handoff, businessExecutionIndex), 'handoff.businessExecutionIndex', '交接摘要必须展示 business-execution-index.md/csv,避免下一轮 AI 或商务继续在多个入口之间跳转。'), check('handoff-business-execution-index-operator-owner-artifacts', '交接摘要的商务执行总表入口记录操作包负责人附件', hasHandoffBusinessExecutionOperatorOwnerArtifacts(handoff, businessExecutionIndex), 'handoff.businessExecutionIndex.operatorPackOwnerArtifacts', '交接摘要必须在商务执行总表入口下透传三份 proof-gap 操作包负责人附件。'), check('handoff-business-execution-index-longrun-readiness', '交接摘要的商务执行总表入口记录长跑前置门禁行', hasHandoffBusinessExecutionLongRunReadiness(handoff, businessExecutionIndex, longRunReadiness), 'handoff.businessExecutionIndex.longRunReadiness', '交接摘要必须在商务执行总表入口下透传长跑前置门禁报告、summary、ready/failCount 和不能启动长跑的边界。'), check('handoff-optimization-completion', '交接摘要顶层记录优化完成度审计入口', hasHandoffOptimizationCompletion(handoff, optimizationCompletion), 'handoff.optimizationCompletion', '交接摘要必须顶层展示 optimization-completion-report.md、readyForClaim、proofGapOpenCount 和禁用宣称边界。'), check('handoff-business-execution-index-optimization-completion', '交接摘要的商务执行总表入口记录优化完成度审计行', hasHandoffBusinessExecutionOptimizationCompletion(handoff, businessExecutionIndex, optimizationCompletion), 'handoff.businessExecutionIndex.optimizationCompletion', '交接摘要必须在商务执行总表入口下透传完成度审计报告、summary、readyForClaim 和禁用宣称边界。'), check('intake-field-checklist-summary', '真实材料字段级补齐核对表 summary 存在', Boolean(intakeFieldChecklist), rel(root, resolvedIntakeFieldChecklistPath), '运行 npm run intake:field-checklist -- --data-pack outputs\\data-intake-pack-latest --video-pack outputs\\video-intake-pack-latest --output outputs\\intake-field-checklist-latest。'), check('intake-field-checklist-passed', '真实材料字段级补齐核对表通过并保留证明边界', hasIntakeFieldChecklist(intakeFieldChecklist), 'intakeFieldChecklist.itemCount/directCustomerProof', '字段级核对表必须 passed=true、directCustomerProof=false、itemCount>0,并记录缺必填和占位内容数量。'), check('handoff-intake-field-checklist', '交接摘要记录字段级补齐核对表入口', hasHandoffIntakeFieldChecklist(handoff, intakeFieldChecklist), 'handoff.intakeFieldChecklist', '交接摘要必须展示 intake-field-checklist.md/csv,避免下一轮 AI 或商务看不到逐格补齐入口。'), check('proof-gap-software-form-summary', '最新提号补证表单 summary 存在', Boolean(proofGapSoftwareForm), rel(root, resolvedProofGapSoftwareFormPath), '运行 npm run proof-gap:software-form -- --output outputs\\tihao-proof-gap-software-form-latest --strict。'), check('proof-gap-software-form-passed', '最新提号补证表单通过软件端格式验收', hasPassingProofGapSoftwareForm(proofGapSoftwareForm, proofGap), 'proofGapSoftwareForm.passed/header/rows', '最新提号补证表单必须 passed=true、headerMatches=true、rowWidthOk=true、rowCount 对齐 unresolvedCount、duplicateIdCount=0。'), check('latest-form-index-summary', '最新提号表单索引 summary 存在', Boolean(latestFormIndex), rel(root, resolvedLatestFormIndexPath), '运行 npm run latest-form:index -- --output outputs\\latest-form-index-latest --strict。'), check('latest-form-index-passed', '最新提号表单索引通过并指向关键文件', hasPassingLatestFormIndex(latestFormIndex), 'latestFormIndex.primaryForm/clientList/ownerArtifacts', '最新提号表单索引必须 passed=true,并指向补证表单、候选名单和负责人行动文件。'), check('latest-form-index-client-list-delivery-quality', '最新提号表单索引记录候选名单去重交付质量', hasLatestFormClientListDeliveryQuality(latestFormIndex), 'latestFormIndex.clientList.finalDuplicateGroupCount/sourceDuplicateRemovedCount/rankContinuous', '最新提号表单索引必须明确候选名单最终重复组为 0、排名连续、duplicateCount 仅表示源表去重丢弃,且 directCustomerProof=false。'), check('latest-form-index-business-execution-index', '最新提号表单索引记录商务执行总表入口', hasLatestFormBusinessExecutionIndex(latestFormIndex, businessExecutionIndex), 'latestFormIndex.businessExecutionIndex', '最新提号表单索引必须展示 business-execution-index.md/csv,避免商务只看到补证表单却看不到执行总表。'), check('latest-form-index-intake-field-checklist', '最新提号表单索引记录字段级补齐核对表入口', hasLatestFormIntakeFieldChecklist(latestFormIndex, intakeFieldChecklist), 'latestFormIndex.intakeFieldChecklist', '最新提号表单索引必须展示 intake-field-checklist.md/csv,方便商务按行号和字段补齐真实材料。'), check('latest-form-index-intake-owner-recheck', '最新提号表单索引记录字段补齐负责人和复验命令', hasLatestFormIntakeOwnerRecheck(latestFormIndex, intakeFieldChecklist), 'latestFormIndex.intakeFieldChecklist.ownerGroups/recheckCommands', '最新提号表单索引必须展示字段补齐负责人分组和补齐后复验命令,避免软件端入口只剩文件路径。'), check('latest-form-index-business-fill-guide', '最新提号表单索引记录商务填表执行视图', hasLatestFormBusinessFillGuide(latestFormIndex), 'latestFormIndex.businessFillGuide', '最新提号表单索引必须展示商务填表执行视图,把 ownerGroups 转成填表文件、优先项、复验命令和证明边界。'), check('latest-form-index-support-docs', '最新提号表单索引记录中文 SOP 入口', hasLatestFormSupportDocs(latestFormIndex), 'latestFormIndex.supportDocs', '最新提号表单索引必须指向中文长期优化计划和中文补证操作顺序,避免商务或下一轮 AI 打开乱码旧文档。'), check('latest-form-index-repair-actions', '最新提号表单索引记录修复清单入口', hasLatestFormRepairActions(latestFormIndex), 'latestFormIndex.repairActions', '最新提号表单索引必须指向 intake 和 video resource 修复清单 CSV,方便商务直接照表补齐真实材料。'), check('latest-form-index-owner-repair-actions', '最新提号表单索引记录负责人修复附件', hasOwnerRepairArtifacts(latestFormIndex?.nextActions?.ownerArtifacts), 'latestFormIndex.nextActions.ownerArtifacts.repairArtifacts', '最新提号表单索引必须保留 owner 级 repairArtifacts,避免负责人文件和索引信息不一致。'), check('latest-form-index-next-actions-top-actions', '最新提号表单索引记录下一步行动队列摘要', hasLatestFormNextActionTopActions(latestFormIndex, businessProofNextActions), 'latestFormIndex.nextActions.topActions', '最新提号表单索引必须展示 actionCount、proofGapOpenCount 和前 5 个高优先级动作,避免只看到负责人附件却看不到首批动作。'), check('latest-form-index-proof-gap-operator-pack', '最新提号表单索引记录补证操作包入口', hasLatestFormProofGapOperatorPack(latestFormIndex, proofGapOperatorPack), 'latestFormIndex.proofGapOperatorPack', '最新提号表单索引必须展示 proof-gap-operator-pack.md/csv、5 个 gapId 和复验命令数。'), check('latest-form-index-longrun-readiness', '最新提号表单索引记录长跑前置门禁入口', hasLatestFormLongRunReadiness(latestFormIndex, longRunReadiness), 'latestFormIndex.longRunReadiness', '最新提号表单索引必须展示 long-run-readiness-report.md/summary.json、ready、failCount 和 not_business_proof 边界。'), check('local-seed-to-intake-worklist-summary', '本地种子转 intake 补表 worklist summary 存在', Boolean(localSeedToIntakeWorklist), rel(root, resolvedLocalSeedToIntakeWorklistPath), '运行 npm run local-seed-to-intake:worklist -- --outputs outputs --output outputs\\local-seed-to-intake-worklist-latest。'), check('local-seed-to-intake-worklist-boundary', '本地种子转 intake 补表 worklist 保留非证明边界', hasLocalSeedToIntakeWorklist(localSeedToIntakeWorklist), 'localSeedToIntakeWorklist.counts/directCustomerProof/canCloseProofGap', 'worklist 必须记录 history/candidate/video 行数,并保持 directCustomerProof=false、canCloseProofGap=false,避免把补表草稿误当业务证明。'), check('latest-form-index-local-seed-to-intake-worklist', '最新提号表单索引记录本地种子转补表 worklist', hasLatestFormLocalSeedToIntakeWorklist(latestFormIndex, localSeedToIntakeWorklist), 'latestFormIndex.localSeedToIntakeWorklist', '最新提号表单索引必须展示 local-seed-to-intake-worklist 的 md/csv/history/video/candidate 文件和非证明边界。'), check('real-gap-material-audit-summary', 'three real gap material audit summary exists', Boolean(realGapMaterialAudit), rel(root, resolvedRealGapMaterialAuditPath), 'Run npm run real-gap:materials -- --outputs outputs --output outputs\\real-gap-material-audit-latest --strict.'), check('real-gap-material-audit-boundary', 'three real gap material audit keeps proof boundary', hasRealGapMaterialAudit(realGapMaterialAudit), 'realGapMaterialAudit.gapCount/materialFoundCount/canCloseProofGap', 'The audit must show materials for the three real gaps while keeping directCustomerProof=false and canCloseProofGap=false.'), check('latest-form-index-real-gap-material-audit', 'latest form index records three real gap material audit', hasLatestFormRealGapMaterialAudit(latestFormIndex, realGapMaterialAudit), 'latestFormIndex.realGapMaterialAudit', 'The latest form index must expose the material audit so testers do not miss the project-material coverage evidence.'), check('real-proof-closure-work-order-summary', '真实证明闭环工单 summary 存在', Boolean(realProofClosureWorkOrder), rel(root, resolvedRealProofClosureWorkOrderPath), '运行 npm run real-proof:work-order -- --outputs outputs --output outputs\\real-proof-closure-work-order-latest --strict。'), check('real-proof-closure-work-order-boundary', '真实证明闭环工单保留非证明边界', hasRealProofClosureWorkOrder(realProofClosureWorkOrder), 'realProofClosureWorkOrder.boundary/workOrderCount', '工单必须保持 proofLevel=not_business_proof、directCustomerProof=false、canCloseProofGap=false、requiresHumanRealMaterial=true,并记录未关闭 proof-gap。'), check('real-proof-closure-work-order-actionable', '真实证明闭环工单拆到负责人附件和字段级动作', hasActionableRealProofClosureWorkOrder(realProofClosureWorkOrder), 'realProofClosureWorkOrder.workOrders/ownerArtifacts', '工单必须至少输出 5 条字段级补证动作和 3 份负责人 md/csv 附件,避免只新增汇总说明。'), check('real-proof-closure-work-order-video-ab-preflight-context', '真实证明闭环工单记录 video A/B preflight 非证明上下文', hasRealProofClosureWorkOrderVideoAbPreflightContext(realProofClosureWorkOrder), 'realProofClosureWorkOrder.workOrders.video-ab-live-proof.preflight', '闭环工单必须把 video A/B preflight 失败原因和 live proof 缺失要求拆到技术/AI 工单,不能只给 acceptance:video-ab 命令。'), check('latest-form-index-real-proof-closure-work-order', '最新提号表单索引记录真实证明闭环工单', hasLatestFormRealProofClosureWorkOrder(latestFormIndex, realProofClosureWorkOrder), 'latestFormIndex.realProofClosureWorkOrder', '最新提号表单索引必须展示 real-proof-closure-work-order 的 md/csv/summary、负责人附件、行数和非证明边界。'), check('handoff-real-proof-closure-work-order', '交接摘要顶层记录真实证明闭环工单', hasHandoffRealProofClosureWorkOrder(handoff, realProofClosureWorkOrder), 'handoff.realProofClosureWorkOrder', '交接摘要必须顶层展示真实证明闭环工单的文件、行数、负责人附件和不能关闭 proof-gap 边界。'), check('handoff-latest-form-real-proof-closure-work-order', '交接摘要最新表单索引记录真实证明闭环工单', hasHandoffLatestFormRealProofClosureWorkOrder(handoff, latestFormIndex), 'handoff.latestFormIndex.realProofClosureWorkOrder', '交接摘要必须透传最新表单索引里的真实证明闭环工单,避免下一轮只看交接摘要时漏掉字段级派工。'), check('evidence-index-real-proof-closure-work-order', '证据台账记录真实证明闭环工单非业务证明类型', Number(evidence?.byType?.['real-proof-closure-work-order'] || 0) >= 1, 'evidence.byType.real-proof-closure-work-order', '证据台账必须把真实证明闭环工单归类为 not_business_proof,避免被误当业务证明。'), check('evidence-index-video-ab-runtime-preflight-boundary', '证据台账记录视频 A/B 前置失败不能当业务证明', hasVideoRuntimePreflightBoundary(evidence), 'evidence.entries.video-ab-runtime-preflight', '如果存在 video-hit-rate-preflight-summary.json,证据台账必须归类为 not_business_proof,不能替代 acceptance:video-ab live proof。'), check('handoff-latest-form-index', '交接摘要记录最新提号表单索引', hasHandoffLatestFormIndex(handoff, latestFormIndex), 'handoff.latestFormIndex', '交接摘要必须展示 latest-form-index.md,避免下一轮继续追问最新表单在哪里。'), check('handoff-latest-form-index-next-actions-top-actions', '交接摘要最新表单索引记录下一步行动队列摘要', hasHandoffLatestFormNextActionTopActions(handoff, latestFormIndex), 'handoff.latestFormIndex.topActions', '交接摘要必须透传最新表单索引里的 topActions,避免下一轮只看交接摘要时看不到首批补证动作。'), check('handoff-local-seed-to-intake-worklist', '交接摘要顶层记录本地种子转补表 worklist', hasHandoffLocalSeedToIntakeWorklist(handoff, localSeedToIntakeWorklist), 'handoff.localSeedToIntakeWorklist', '交接摘要必须顶层展示 local-seed-to-intake-worklist 的文件、行数和不能关闭 proof-gap 边界。'), check('handoff-latest-form-local-seed-to-intake-worklist', '交接摘要最新表单索引记录本地种子转补表 worklist', hasHandoffLatestFormLocalSeedToIntakeWorklist(handoff, latestFormIndex), 'handoff.latestFormIndex.localSeedToIntakeWorklist', '交接摘要必须透传最新表单索引里的 worklist,避免下一轮只看交接摘要时漏掉可补表草稿。'), check('handoff-real-gap-material-audit', 'handoff top-level records three real gap material audit', hasHandoffRealGapMaterialAudit(handoff, realGapMaterialAudit), 'handoff.realGapMaterialAudit', 'The handoff must expose material coverage for the three still-open gaps while keeping the proof boundary.'), check('handoff-latest-form-real-gap-material-audit', 'handoff latest form records three real gap material audit', hasHandoffLatestFormRealGapMaterialAudit(handoff, latestFormIndex), 'handoff.latestFormIndex.realGapMaterialAudit', 'The handoff latest-form section must pass through the material audit so the next tester sees it.'), check('handoff-latest-form-index-intake-owner-recheck', '交接摘要记录最新表单索引字段补齐负责人和复验命令', hasHandoffLatestFormIndexIntakeOwnerRecheck(handoff, latestFormIndex), 'handoff.latestFormIndex.intakeFieldChecklist', '交接摘要必须记录最新表单索引中的 ownerGroupCount 和 recheckCommandCount,避免下一轮 AI 看不到软件端补齐顺序。'), check('handoff-latest-form-business-fill-guide', '交接摘要记录商务填表执行视图', hasHandoffLatestFormBusinessFillGuide(handoff, latestFormIndex), 'handoff.latestFormIndex.businessFillGuide', '交接摘要必须记录最新表单索引中的商务填表执行视图,避免下一轮 AI 只看到表单入口却看不到填表顺序。'), check('handoff-longrun-readiness', '交接摘要顶层记录长跑前置门禁入口', hasHandoffLongRunReadiness(handoff, longRunReadiness), 'handoff.longRunReadiness', '交接摘要必须顶层展示长跑前置门禁,避免 full-matrix/live 长跑启动条件只藏在 round-refresh 中。'), check('handoff-latest-form-longrun-readiness', '交接摘要最新表单索引记录长跑前置门禁入口', hasHandoffLatestFormLongRunReadiness(handoff, latestFormIndex), 'handoff.latestFormIndex.longRunReadiness', '交接摘要必须透传最新表单索引中的长跑前置门禁入口。'), check('handoff-latest-form-repair-actions', '交接摘要记录最新修复清单入口', hasHandoffLatestFormRepairActions(handoff), 'handoff.latestFormIndex.repairActions', '交接摘要必须展示 intake/video 修复清单 CSV,避免下一轮 AI 只看到缺口却不知道如何派工。'), check('handoff-proof-gap-operator-pack', '交接摘要记录提号补证操作包入口', hasHandoffProofGapOperatorPack(handoff, proofGapOperatorPack), 'handoff.proofGapOperatorPack', '交接摘要必须展示 proof-gap-operator-pack.md/csv、5 个 gapId、ownerGroupCount 和复验命令数。'), check('handoff-support-docs', '交接摘要记录中文 SOP 入口', hasHandoffSupportDocs(handoff), 'handoff.supportDocs', '交接摘要必须指向中文长期优化计划和中文补证操作顺序,避免下一轮 AI 或商务打开旧文档。'), check('handoff-owner-repair-actions', '交接摘要记录负责人修复附件', hasOwnerRepairArtifacts(handoff?.businessProofNextActions?.ownerArtifacts), 'handoff.businessProofNextActions.ownerArtifacts.repairArtifacts', '交接摘要必须保留 owner 级 repairArtifacts,避免下一轮 AI 只看到负责人文件却看不到修复附件。'), check('business-proof-action-order', '补证操作顺序文档存在且可执行', hasProofActionOrder(proofActionOrderText), rel(root, resolvedProofActionOrderPath), '补充 docs/business-proof-action-order.zh-CN.md,明确商务、投放、技术和 AI 的真实补证顺序、命令和通过标准。'), check('proof-gap-closure-summary', '最新 proof-gap-closure-summary.json 存在', Boolean(proofGapClosure), rel(root, resolvedProofGapClosurePath), '运行 npm run proof-gap:closure -- --output outputs\\proof-gap-closure-latest。'), check('proof-gap-closure-report', '最新 proof-gap-closure-report.md 存在', fileExists(sibling(resolvedProofGapClosurePath, 'proof-gap-closure-report.md')), rel(root, sibling(resolvedProofGapClosurePath, 'proof-gap-closure-report.md')), '运行 npm run proof-gap:closure。'), check('proof-gap-closure-open-recorded', 'proof-gap closure 记录未关闭缺口', Number(proofGapClosure?.openCount || 0) >= 1 && proofGapClosure?.complete === false, 'proofGapClosure.openCount', '长期目标未完成时必须记录 proof gap closure openCount。'), check('proof-gap-closure-count-semantics', 'proof-gap closure 明确业务缺口与预审行计数口径', hasProofGapClosureCountSemantics(proofGapClosure), 'proofGapClosure.businessOpenCount/precheckOpenCount/countSemantics', 'proof-gap closure 必须把 openCount 标为业务证明缺口计数,并把 intake 预审行单独记录,避免交接时把预审行误算进业务 openCount。'), check('proof-gap-closure-missing-proof-requirements', 'proof-gap closure 逐缺口记录缺失证明要求', hasProofGapClosureMissingProofRequirements(proofGapClosure), 'proofGapClosure.rows.missingProofRequirements', 'proof-gap closure 必须让每个未关闭业务缺口都列出缺失证明要求,避免只知道缺口未关闭却不知道差哪条证明。'), check('handoff-proof-gap-closure', '交接摘要记录真实证明缺口关闭状态', hasHandoffProofGapClosure(handoff, proofGapClosure), 'handoff.proofGapClosure', '交接摘要必须记录 proofGapClosure.openCount、rows 和 video-ab-live-proof 的 missingProofRequirements,避免下一轮漏判真实证明缺口。'), check('feedback-loop-closure-summary', '最新 feedback-loop-closure-summary.json 存在', Boolean(feedbackLoopClosure), rel(root, resolvedFeedbackLoopClosurePath), '运行 npm run feedback:closure -- --output outputs\\feedback-loop-closure-latest。'), check('feedback-loop-closure-boundary', '反馈二轮闭环审计保留客户证明边界', hasFeedbackLoopClosure(feedbackLoopClosure), 'feedbackLoopClosure.directCustomerProof/complete', '反馈闭环审计必须记录 directCustomerProof=false 或真实证明上下文,不能把 sample 二轮闭环误报为客户效果。'), check('handoff-feedback-loop-closure', '交接摘要记录反馈二轮闭环审计入口', hasHandoffFeedbackLoopClosure(handoff, feedbackLoopClosure), 'handoff.feedbackLoopClosure', '交接摘要必须展示 feedback-loop-closure summary/report/csv 和 directCustomerProof 边界。'), check('homepage-evidence-readiness-summary', '最新 homepage-evidence-readiness-summary.json 存在', Boolean(homepageEvidenceReadiness), rel(root, resolvedHomepageEvidenceReadinessPath), '运行 npm run homepage:readiness -- --output outputs\\homepage-evidence-readiness-latest。'), check('homepage-evidence-readiness-report', '最新 homepage-evidence-readiness-report.md 存在', fileExists(sibling(resolvedHomepageEvidenceReadinessPath, 'homepage-evidence-readiness-report.md')), rel(root, sibling(resolvedHomepageEvidenceReadinessPath, 'homepage-evidence-readiness-report.md')), '运行 npm run homepage:readiness。'), check('homepage-evidence-readiness-csv', '最新 homepage-evidence-repair-actions.csv 存在', fileExists(sibling(resolvedHomepageEvidenceReadinessPath, 'homepage-evidence-repair-actions.csv')), rel(root, sibling(resolvedHomepageEvidenceReadinessPath, 'homepage-evidence-repair-actions.csv')), '运行 npm run homepage:readiness。'), check('homepage-evidence-readiness-boundary', '主页证据就绪审计保留客户证明边界', hasHomepageEvidenceReadiness(homepageEvidenceReadiness), 'homepageEvidenceReadiness.directCustomerProof/proofLevel', '主页 readiness 必须记录 directCustomerProof=false,且没有 provider/path 近期内容时标记 not_business_proof。'), check('handoff-homepage-evidence-readiness', '交接摘要记录主页证据就绪审计入口', hasHandoffHomepageEvidenceReadiness(handoff, homepageEvidenceReadiness), 'handoff.homepageEvidenceReadiness', '交接摘要必须展示 homepage-evidence-readiness summary/report/csv 和 directCustomerProof 边界。'), check('commands-recorded', '交接摘要记录下一轮命令', Array.isArray(handoff?.nextCommands) && handoff.nextCommands.length >= 5, 'handoff.nextCommands', '补充历史导入、复核、客户效果、证据台账和交接命令。'), check('closure-command-recorded', '交接摘要记录 proof-gap closure 命令', Array.isArray(handoff?.nextCommands) && handoff.nextCommands.some(item => String(item.command || '').includes('proof-gap:closure')), 'handoff.nextCommands.proof-gap:closure', '交接摘要必须提示用 proof-gap:closure 判断真实证明缺口是否关闭。'), check('proof-boundaries', '交接摘要记录未证明边界', Array.isArray(handoff?.guardrails) && handoff.guardrails.some(item => item.includes('不能把 sample')) && handoff.guardrails.some(item => item.includes('客户效果')), 'handoff.guardrails', '补充 sample/smoke/live/customer-effect 的边界说明。'), check('status-blockers', '状态审计保留 ready_not_proven 和 blocked_by_external_data', Number(status?.counts?.ready_not_proven || 0) >= 1 && Number(status?.counts?.blocked_by_external_data || 0) >= 1 && status?.complete === false, 'status.counts', '缺少真实证明时不得把长期目标标为完成。'), check('evidence-levels', '证据台账区分真实证据、本地证据和非证明', hasEvidenceLevels(evidence), 'evidence.counts', '证据台账必须保留 real_evidence、smoke_or_local、not_business_proof。'), check('software-status', '状态审计覆盖软件端去重和排名连续性', hasStatusId(status, 'software-table'), 'status.items.software-table', '软件端表格必须继续受状态审计覆盖。'), check('video-status', '状态审计覆盖视频资源真实性', hasStatusId(status, 'video-ab-proof'), 'status.items.video-ab-proof', '视频 A/B 必须继续区分真实资源和 smoke。'), check('customer-status', '状态审计覆盖客户效果证明', hasStatusId(status, 'customer-effect-proof'), 'status.items.customer-effect-proof', '客户选择率和人工补号减少必须独立审计。'), check('latest-handoff-incomplete', '交接摘要未把未证明状态误报为完成', handoff?.complete === false, 'handoff.complete=false', '缺少真实客户效果证明时交接摘要必须保持 incomplete。') ]; checks.push( check('manual-review-label-guide-summary', '人工复核标签与归因指南 summary 存在', Boolean(manualReviewLabelGuide), rel(root, resolvedManualReviewLabelGuidePath), '运行 npm run manual-review:label-guide -- --output outputs\\manual-review-label-guide-latest --strict。'), check('manual-review-label-guide-passed', '人工复核标签与归因指南通过并保留证明边界', hasManualReviewLabelGuide(manualReviewLabelGuide), 'manualReviewLabelGuide.labels/attributionTypes/directCustomerProof', '指南必须包含正负标签、负样本归因类型、negativeLabelsRequireAttribution=true,且 directCustomerProof=false。'), check('latest-form-index-manual-review-label-guide', '最新提号表单索引记录人工复核标签指南', hasLatestFormManualReviewLabelGuide(latestFormIndex, manualReviewLabelGuide), 'latestFormIndex.manualReviewLabelGuide', '最新提号表单索引必须展示 manual-review-label-guide.md/csv,方便商务按统一标签和归因填写复核表。'), check('handoff-latest-form-manual-review-label-guide', '交接摘要记录人工复核标签指南', hasHandoffLatestFormManualReviewLabelGuide(handoff, latestFormIndex), 'handoff.latestFormIndex.manualReviewLabelGuide', '交接摘要必须记录最新表单索引中的复核标签指南,避免下一轮 AI 或商务不知道负样本归因口径。') ); checks.push( check('plan-execution-status-summary', '长期计划执行状态面板 summary 存在', Boolean(planExecutionStatus), rel(root, resolvedPlanExecutionStatusPath), '运行 npm run plan:execution-status -- --output outputs\\plan-execution-status-latest --strict。'), check('plan-execution-status-boundary', '长期计划执行状态面板记录 8 个章节和未完成边界', hasPlanExecutionStatus(planExecutionStatus, proofGapClosure), 'planExecutionStatus.rowCount/complete/proofOpenCount/guardrails', '状态面板必须 rowCount=8、complete=false、proofOpenCount 对齐 proof-gap-closure,并保留不得宣称客户效果的边界。'), check('plan-execution-status-operator-owner-artifacts', '长期计划执行状态面板记录操作包负责人附件', hasPlanExecutionOperatorOwnerArtifacts(planExecutionStatus, proofGapOperatorPack, businessExecutionIndex), 'planExecutionStatus.operatorPackOwnerArtifacts', '计划执行状态面板必须透传三份 proof-gap 操作包负责人附件和商务执行总表附件行数。'), check('latest-form-index-plan-execution-status', '最新提号表单索引记录长期计划执行状态面板', hasLatestFormPlanExecutionStatus(latestFormIndex, planExecutionStatus), 'latestFormIndex.planExecutionStatus', '最新提号表单索引必须展示 plan-execution-status.md/csv/summary,方便商务和下一轮 AI 直接看到优化计划完成度。'), check('handoff-plan-execution-status', '交接摘要记录长期计划执行状态面板', hasHandoffPlanExecutionStatus(handoff, planExecutionStatus), 'handoff.planExecutionStatus', '交接摘要必须展示 plan-execution-status.md/csv/summary,避免下一轮 AI 不知道当前计划完成度。') ); const requiredLogHints = [ ['命令记录', /npm\.cmd run|npm run|命令/], ['输出目录', /outputs[\\/]|输出/], ['live 标记', /liveEnabled|live 标记|live/], ['严格 provider 门禁', /strict provider|provider 门禁|严格 provider/], ['视频资源真实性', /真实视频|video|视频/], ['失败计数', /failureCount|failedGateCount|overallPass/], ['软件端重复和排名', /重复键|排名连续|software/], ['复核或客户指标', /人工复核|客户选中率|customer-effect|review:metrics/], ['未证明边界', /ready_not_proven|blocked_by_external_data|仍需真实|未证明/], ['proof-gap 缺口', /proof-gap|真实证明缺口|未解决缺口/] ]; for (const [title, pattern] of requiredLogHints) { checks.push(check(`log-${slug(title)}`, `实施日志记录${title}`, pattern.test(logText), 'docs/tihao-experience-implementation-log.md', `在实施日志本轮小结中补充${title}。`)); } const counts = countChecks(checks); return { generatedAt: new Date().toISOString(), root, outputsDir, passed: counts.fail === 0, counts, sources: { implementationLog: rel(root, implementationLog), statusSummary: rel(root, resolvedStatusPath), evidenceSummary: rel(root, resolvedEvidencePath), handoffSummary: rel(root, resolvedHandoffPath), proofGapSummary: rel(root, resolvedProofGapPath) , proofGapClosureSummary: rel(root, resolvedProofGapClosurePath), proofGapOperatorPackSummary: rel(root, resolvedProofGapOperatorPackPath), feedbackLoopClosureSummary: rel(root, resolvedFeedbackLoopClosurePath), homepageEvidenceReadinessSummary: rel(root, resolvedHomepageEvidenceReadinessPath), intakeReadinessSummary: rel(root, resolvedIntakeReadinessPath), longRunReadinessSummary: rel(root, resolvedLongRunReadinessPath), businessProofProgressSummary: rel(root, resolvedBusinessProofProgressPath), businessProofNextActionsSummary: rel(root, resolvedBusinessProofNextActionsPath), businessExecutionIndexSummary: rel(root, resolvedBusinessExecutionIndexPath), optimizationCompletionSummary: rel(root, resolvedOptimizationCompletionPath), realProofIntakeBundleSummary: rel(root, resolvedRealProofIntakeBundlePath), intakeFieldChecklistSummary: rel(root, resolvedIntakeFieldChecklistPath), manualReviewLabelGuideSummary: rel(root, resolvedManualReviewLabelGuidePath), proofGapSoftwareFormSummary: rel(root, resolvedProofGapSoftwareFormPath), latestFormIndexSummary: rel(root, resolvedLatestFormIndexPath), localSeedToIntakeWorklistSummary: rel(root, resolvedLocalSeedToIntakeWorklistPath), realGapMaterialAuditSummary: rel(root, resolvedRealGapMaterialAuditPath), realProofClosureWorkOrderSummary: rel(root, resolvedRealProofClosureWorkOrderPath), planExecutionStatusSummary: rel(root, resolvedPlanExecutionStatusPath), proofActionOrder: rel(root, resolvedProofActionOrderPath) }, observed: { statusCounts: status?.counts || {}, evidenceCounts: evidence?.counts || {}, evidenceByType: evidence?.byType || {}, evidenceVideoRuntimePreflightCount: Number(evidence?.byType?.['video-ab-runtime-preflight'] || 0), proofGapClosureHistorySource: proofGapClosure?.sourceFiles?.history || '', proofGapClosureCustomerEffectSource: proofGapClosure?.sourceFiles?.customerEffect || '', proofGapClosureRecursiveProofArtifactDiscovery: hasProofGapClosureRecursiveProofArtifactDiscovery(proofGapClosure), proofGapClosureVideoAbPreflightReadyForVideoAb: Boolean(proofGapClosure?.videoAbPreflightReadyForVideoAb), proofGapClosureVideoAbPreflightFailureCount: Number.isFinite(Number(proofGapClosure?.videoAbPreflightFailureCount)) ? Number(proofGapClosure.videoAbPreflightFailureCount) : null, handoffComplete: Boolean(handoff?.complete), handoffReadyCapabilities: handoff?.readyCapabilities?.length || 0, handoffReadyNotProven: handoff?.readyNotProven?.length || 0, handoffExternalBlockers: handoff?.externalBlockers?.length || 0, proofGapUnresolvedCount: Number(proofGap?.unresolvedCount || 0), proofGapTemplateRowsReady, proofGapTemplateColumnsReady, proofGapOperatorPackPassed: Boolean(proofGapOperatorPack?.passed), proofGapOperatorPackOpenCount: Number.isFinite(Number(proofGapOperatorPack?.openCount)) ? Number(proofGapOperatorPack.openCount) : null, proofGapOperatorPackRowCount: Number.isFinite(Number(proofGapOperatorPack?.rowCount)) ? Number(proofGapOperatorPack.rowCount) : null, proofGapOperatorPackOwnerGroupCount: Number.isFinite(Number(proofGapOperatorPack?.ownerGroupCount)) ? Number(proofGapOperatorPack.ownerGroupCount) : (Array.isArray(proofGapOperatorPack?.ownerGroups) ? proofGapOperatorPack.ownerGroups.length : null), proofGapOperatorPackOwnerArtifactCount: Number.isFinite(Number(proofGapOperatorPack?.ownerArtifactCount)) ? Number(proofGapOperatorPack.ownerArtifactCount) : (Array.isArray(proofGapOperatorPack?.ownerArtifacts) ? proofGapOperatorPack.ownerArtifacts.length : null), proofGapOperatorPackFillFileCount: Number.isFinite(Number(proofGapOperatorPack?.fillFileCount)) ? Number(proofGapOperatorPack.fillFileCount) : uniqueCount(proofGapOperatorPack?.rows, row => row.fillFiles), proofGapOperatorPackRecheckCommandCount: Number.isFinite(Number(proofGapOperatorPack?.recheckCommandCount)) ? Number(proofGapOperatorPack.recheckCommandCount) : uniqueCount(proofGapOperatorPack?.rows, row => row.recheckCommands), proofGapOperatorPackEvidenceRowCount: Number.isFinite(Number(proofGapOperatorPack?.evidenceRowCount)) ? Number(proofGapOperatorPack.evidenceRowCount) : countRowsWith(proofGapOperatorPack?.rows, row => row.evidence), proofGapOperatorPackNextActionCount: Number.isFinite(Number(proofGapOperatorPack?.nextActionCount)) ? Number(proofGapOperatorPack.nextActionCount) : countRowsWith(proofGapOperatorPack?.rows, row => row.nextAction), proofGapOperatorPackMissingProofRequirementCount: Number.isFinite(Number(proofGapOperatorPack?.missingProofRequirementCount)) ? Number(proofGapOperatorPack.missingProofRequirementCount) : uniqueCount(proofGapOperatorPack?.rows, row => row.missingProofRequirements), proofGapOperatorPackOpenRowsWithMissingProofRequirements: countOpenRowsWithMissingProofRequirements(proofGapOperatorPack?.rows, 'gapId'), proofGapOperatorPackVideoAbPreflightContext: hasProofGapOperatorPackVideoAbPreflightContext(proofGapOperatorPack), proofGapOperatorPackGapIds: proofGapOperatorGapIds(proofGapOperatorPack).join(','), proofGapOperatorPackDirectCustomerProof: Boolean(proofGapOperatorPack?.directCustomerProof), intakeReadinessReady: Boolean(intakeReadiness?.acceptance?.overallReady), intakeReadinessFailureCount: intakeReadiness ? Number(intakeReadiness.failureCount || 0) : null, longRunReadinessReady: Boolean(longRunReadiness?.ready), longRunReadinessFailCount: longRunReadiness ? Number(longRunReadiness.counts?.fail || 0) : null, longRunReadinessMode: longRunReadiness?.mode || '', businessProofProgressComplete: Boolean(businessProofProgress?.complete), businessProofProgressCounts: businessProofProgress?.counts || {}, businessProofProgressOperatorPackOwnerArtifactCount: Number.isFinite(Number(businessProofProgress?.operatorPackOwnerArtifactCount)) ? Number(businessProofProgress.operatorPackOwnerArtifactCount) : (Array.isArray(businessProofProgress?.operatorPackOwnerArtifacts) ? businessProofProgress.operatorPackOwnerArtifacts.length : null), handoffBusinessProofProgressOperatorPackOwnerArtifactCount: Number.isFinite(Number(handoff?.businessProofProgress?.operatorPackOwnerArtifactCount)) ? Number(handoff.businessProofProgress.operatorPackOwnerArtifactCount) : (Array.isArray(handoff?.businessProofProgress?.operatorPackOwnerArtifacts) ? handoff.businessProofProgress.operatorPackOwnerArtifacts.length : null), businessProofNextActionsComplete: Boolean(businessProofNextActions?.complete), businessProofNextActionsCount: Number.isFinite(Number(businessProofNextActions?.actionCount)) ? Number(businessProofNextActions.actionCount) : (Array.isArray(businessProofNextActions?.actions) ? businessProofNextActions.actions.length : null), businessProofNextActionsTopCount: Array.isArray(businessProofNextActions?.topActions) ? businessProofNextActions.topActions.length : null, businessProofNextActionsTop: Array.isArray(businessProofNextActions?.topActions) && businessProofNextActions.topActions[0] ? businessProofNextActions.topActions[0].title : (Array.isArray(businessProofNextActions?.actions) && businessProofNextActions.actions[0] ? businessProofNextActions.actions[0].title : ''), businessProofNextActionsWithMissingProofRequirements: countRowsWithMissingProofRequirements(businessProofNextActions?.actions), handoffBusinessProofNextActionsCount: Number.isFinite(Number(handoff?.businessProofNextActions?.actionCount)) ? Number(handoff.businessProofNextActions.actionCount) : null, handoffBusinessProofNextActionsTopCount: Array.isArray(handoff?.businessProofNextActions?.topActions) ? handoff.businessProofNextActions.topActions.length : null, handoffBusinessProofNextActionsProofGapOpenCount: Number.isFinite(Number(handoff?.businessProofNextActions?.sourceState?.proofGapOpenCount)) ? Number(handoff.businessProofNextActions.sourceState.proofGapOpenCount) : null, optimizationCompletionComplete: Boolean(optimizationCompletion?.complete), optimizationCompletionReadyForClaim: Boolean(optimizationCompletion?.readyForClaim), optimizationCompletionProofGapOpenCount: Number.isFinite(Number(optimizationCompletion?.proofGapOpenCount)) ? Number(optimizationCompletion.proofGapOpenCount) : null, optimizationCompletionBlockingReasonCount: Array.isArray(optimizationCompletion?.blockingReasons) ? optimizationCompletion.blockingReasons.length : (Number.isFinite(Number(optimizationCompletion?.blockingReasonCount)) ? Number(optimizationCompletion.blockingReasonCount) : null), optimizationCompletionBlockingReasonsWithMissingProofRequirements: countRowsWithMissingProofRequirements(optimizationCompletion?.blockingReasons), optimizationCompletionMissingProofRequirementCount: uniqueCount(optimizationCompletion?.blockingReasons, row => row.missingProofRequirements), optimizationCompletionCanClaimTihaoRateImproved: Boolean(optimizationCompletion?.canClaim?.tihaoRateImproved), optimizationCompletionCanClaimCustomerEffectAchieved: Boolean(optimizationCompletion?.canClaim?.customerEffectAchieved), optimizationCompletionCanClaimManualSupplementReduced: Boolean(optimizationCompletion?.canClaim?.manualSupplementReduced), optimizationCompletionHistorySource: optimizationCompletion?.sourceFiles?.history || '', optimizationCompletionCustomerEffectSource: optimizationCompletion?.sourceFiles?.customerEffect || '', optimizationCompletionRecursiveProofArtifactDiscovery: hasOptimizationCompletionRecursiveProofArtifactDiscovery(optimizationCompletion), optimizationCompletionVideoAbPreflightReadyForVideoAb: Boolean(optimizationCompletion?.videoAbPreflightReadyForVideoAb), optimizationCompletionVideoAbPreflightFailureCount: Number.isFinite(Number(optimizationCompletion?.videoAbPreflightFailureCount)) ? Number(optimizationCompletion.videoAbPreflightFailureCount) : null, businessExecutionIndexPassed: Boolean(businessExecutionIndex?.passed), businessExecutionIndexRowCount: Number.isFinite(Number(businessExecutionIndex?.rowCount)) ? Number(businessExecutionIndex.rowCount) : null, businessExecutionIndexActionRowCount: Number.isFinite(Number(businessExecutionIndex?.actionRowCount)) ? Number(businessExecutionIndex.actionRowCount) : null, businessExecutionIndexRepairRowCount: Number.isFinite(Number(businessExecutionIndex?.repairRowCount)) ? Number(businessExecutionIndex.repairRowCount) : null, businessExecutionIndexOperatorPackOwnerArtifactRowCount: Number.isFinite(Number(businessExecutionIndex?.operatorPackOwnerArtifactRowCount)) ? Number(businessExecutionIndex.operatorPackOwnerArtifactRowCount) : null, businessExecutionIndexOperatorPackOwnerArtifactCount: Number.isFinite(Number(businessExecutionIndex?.operatorPackOwnerArtifactCount)) ? Number(businessExecutionIndex.operatorPackOwnerArtifactCount) : (Array.isArray(businessExecutionIndex?.operatorPackOwnerArtifacts) ? businessExecutionIndex.operatorPackOwnerArtifacts.length : null), businessExecutionIndexFieldOwnerRowCount: Number.isFinite(Number(businessExecutionIndex?.fieldOwnerRowCount)) ? Number(businessExecutionIndex.fieldOwnerRowCount) : null, businessExecutionIndexRecheckCommandRowCount: Number.isFinite(Number(businessExecutionIndex?.recheckCommandRowCount)) ? Number(businessExecutionIndex.recheckCommandRowCount) : null, businessExecutionIndexProofOpenCount: Number.isFinite(Number(businessExecutionIndex?.proofOpenCount)) ? Number(businessExecutionIndex.proofOpenCount) : null, businessExecutionIndexDirectCustomerProof: Boolean(businessExecutionIndex?.directCustomerProof), businessExecutionIndexLongRunReadinessSummary: businessExecutionIndex?.sourceFiles?.longRunReadiness || '', businessExecutionIndexLongRunReadinessReport: findExecutionRowTarget(businessExecutionIndex, '长跑前置门禁报告'), businessExecutionIndexLongRunReadinessReady: findExecutionRow(businessExecutionIndex, '长跑前置门禁报告')?.status === 'ready', businessExecutionIndexLongRunReadinessFailCount: Number.isFinite(Number(findExecutionRow(businessExecutionIndex, '长跑前置门禁报告')?.actionCount)) ? Number(findExecutionRow(businessExecutionIndex, '长跑前置门禁报告').actionCount) : null, businessExecutionIndexOptimizationCompletionSummary: businessExecutionIndex?.sourceFiles?.optimizationCompletion || '', businessExecutionIndexOptimizationCompletionReport: findExecutionRowTarget(businessExecutionIndex, '优化完成度审计报告'), businessExecutionIndexOptimizationCompletionReadyForClaim: findExecutionRow(businessExecutionIndex, '优化完成度审计报告')?.status === 'ready_for_claim', businessExecutionIndexOptimizationCompletionBlockingReasonCount: Number.isFinite(Number(findExecutionRow(businessExecutionIndex, '优化完成度审计报告')?.actionCount)) ? Number(findExecutionRow(businessExecutionIndex, '优化完成度审计报告').actionCount) : null, handoffBusinessExecutionIndexLongRunReadinessReport: handoff?.businessExecutionIndex?.longRunReadiness?.report || '', handoffBusinessExecutionIndexLongRunReadinessSummary: handoff?.businessExecutionIndex?.longRunReadiness?.summary || '', handoffBusinessExecutionIndexLongRunReadinessStatus: handoff?.businessExecutionIndex?.longRunReadiness?.status || '', handoffBusinessExecutionIndexLongRunReadinessReady: Boolean(handoff?.businessExecutionIndex?.longRunReadiness?.ready), handoffBusinessExecutionIndexLongRunReadinessFailCount: Number.isFinite(Number(handoff?.businessExecutionIndex?.longRunReadiness?.failCount)) ? Number(handoff.businessExecutionIndex.longRunReadiness.failCount) : null, handoffBusinessExecutionIndexOperatorPackOwnerArtifactCount: Number.isFinite(Number(handoff?.businessExecutionIndex?.operatorPackOwnerArtifactCount)) ? Number(handoff.businessExecutionIndex.operatorPackOwnerArtifactCount) : (Array.isArray(handoff?.businessExecutionIndex?.operatorPackOwnerArtifacts) ? handoff.businessExecutionIndex.operatorPackOwnerArtifacts.length : null), handoffOptimizationCompletionReport: handoff?.optimizationCompletion?.report || '', handoffOptimizationCompletionReadyForClaim: Boolean(handoff?.optimizationCompletion?.readyForClaim), handoffOptimizationCompletionProofGapOpenCount: Number.isFinite(Number(handoff?.optimizationCompletion?.proofGapOpenCount)) ? Number(handoff.optimizationCompletion.proofGapOpenCount) : null, handoffOptimizationCompletionBlockingReasonCount: Number.isFinite(Number(handoff?.optimizationCompletion?.blockingReasonCount)) ? Number(handoff.optimizationCompletion.blockingReasonCount) : null, handoffBusinessExecutionIndexOptimizationCompletionReport: handoff?.businessExecutionIndex?.optimizationCompletion?.report || '', handoffBusinessExecutionIndexOptimizationCompletionSummary: handoff?.businessExecutionIndex?.optimizationCompletion?.summary || '', handoffBusinessExecutionIndexOptimizationCompletionStatus: handoff?.businessExecutionIndex?.optimizationCompletion?.status || '', handoffBusinessExecutionIndexOptimizationCompletionReadyForClaim: Boolean(handoff?.businessExecutionIndex?.optimizationCompletion?.readyForClaim), handoffBusinessExecutionIndexOptimizationCompletionBlockingReasonCount: Number.isFinite(Number(handoff?.businessExecutionIndex?.optimizationCompletion?.blockingReasonCount)) ? Number(handoff.businessExecutionIndex.optimizationCompletion.blockingReasonCount) : null, realProofIntakeBundlePassed: Boolean(realProofIntakeBundle?.passed), realProofIntakeBundleComplete: Boolean(realProofIntakeBundle?.complete), realProofIntakeBundleProofOpenCount: Number.isFinite(Number(realProofIntakeBundle?.proofOpenCount)) ? Number(realProofIntakeBundle.proofOpenCount) : null, realProofIntakeBundleExportRowCount: Number.isFinite(Number(realProofIntakeBundle?.exportRowCount)) ? Number(realProofIntakeBundle.exportRowCount) : null, realProofIntakeBundleRecheckCommandCount: Number.isFinite(Number(realProofIntakeBundle?.recheckCommandCount)) ? Number(realProofIntakeBundle.recheckCommandCount) : null, realProofIntakeBundleOperatorPackEvidenceRowCount: Number.isFinite(Number(realProofIntakeBundle?.operatorPackEvidenceRowCount ?? realProofIntakeBundle?.sourceState?.operatorPackEvidenceRowCount)) ? Number(realProofIntakeBundle.operatorPackEvidenceRowCount ?? realProofIntakeBundle.sourceState.operatorPackEvidenceRowCount) : null, realProofIntakeBundleOperatorPackNextActionCount: Number.isFinite(Number(realProofIntakeBundle?.operatorPackNextActionCount ?? realProofIntakeBundle?.sourceState?.operatorPackNextActionCount)) ? Number(realProofIntakeBundle.operatorPackNextActionCount ?? realProofIntakeBundle.sourceState.operatorPackNextActionCount) : null, realProofIntakeBundleOperatorPackMissingProofRequirementCount: Number.isFinite(Number(realProofIntakeBundle?.operatorPackMissingProofRequirementCount ?? realProofIntakeBundle?.sourceState?.operatorPackMissingProofRequirementCount)) ? Number(realProofIntakeBundle.operatorPackMissingProofRequirementCount ?? realProofIntakeBundle.sourceState.operatorPackMissingProofRequirementCount) : null, realProofIntakeBundleOperatorPackOwnerArtifactCount: Number.isFinite(Number(realProofIntakeBundle?.operatorPackOwnerArtifactCount ?? realProofIntakeBundle?.sourceState?.operatorPackOwnerArtifactCount)) ? Number(realProofIntakeBundle.operatorPackOwnerArtifactCount ?? realProofIntakeBundle.sourceState.operatorPackOwnerArtifactCount) : (Array.isArray(realProofIntakeBundle?.operatorPackOwnerArtifacts) ? realProofIntakeBundle.operatorPackOwnerArtifacts.length : null), realProofIntakeBundleLongRunReadinessReport: findTemplateFilePath(realProofIntakeBundle, 'long-run-readiness-report.md'), realProofIntakeBundleLongRunReadinessReady: Boolean(realProofIntakeBundle?.sourceState?.longRunReadinessReady), realProofIntakeBundleLongRunReadinessFailCount: Number.isFinite(Number(realProofIntakeBundle?.sourceState?.longRunReadinessFailCount)) ? Number(realProofIntakeBundle.sourceState.longRunReadinessFailCount) : null, realProofIntakeBundleLongRunReadinessProofLevel: realProofIntakeBundle?.sourceState?.longRunReadinessProofLevel || '', realProofIntakeBundleLongRunReadinessDirectCustomerProof: Boolean(realProofIntakeBundle?.sourceState?.longRunReadinessDirectCustomerProof), realProofIntakeBundleVideoAbPreflightContext: hasRealProofIntakeBundleVideoAbPreflightContext(realProofIntakeBundle), intakeFieldChecklistPassed: Boolean(intakeFieldChecklist?.passed), intakeFieldChecklistItemCount: Number.isFinite(Number(intakeFieldChecklist?.itemCount)) ? Number(intakeFieldChecklist.itemCount) : null, intakeFieldChecklistMissingRequiredCount: Number.isFinite(Number(intakeFieldChecklist?.missingRequiredCount)) ? Number(intakeFieldChecklist.missingRequiredCount) : null, intakeFieldChecklistPlaceholderCount: Number.isFinite(Number(intakeFieldChecklist?.placeholderCount)) ? Number(intakeFieldChecklist.placeholderCount) : null, intakeFieldChecklistDirectCustomerProof: Boolean(intakeFieldChecklist?.directCustomerProof), intakeFieldChecklistOwnerGroupCount: Array.isArray(intakeFieldChecklist?.ownerGroups) ? intakeFieldChecklist.ownerGroups.length : null, intakeFieldChecklistRecheckCommandCount: Array.isArray(intakeFieldChecklist?.recheckCommands) ? intakeFieldChecklist.recheckCommands.length : null, manualReviewLabelGuidePassed: Boolean(manualReviewLabelGuide?.passed), manualReviewLabelGuideDirectCustomerProof: Boolean(manualReviewLabelGuide?.directCustomerProof), manualReviewLabelGuideLabelCount: Number.isFinite(Number(manualReviewLabelGuide?.labelCount)) ? Number(manualReviewLabelGuide.labelCount) : null, manualReviewLabelGuideAttributionTypeCount: Number.isFinite(Number(manualReviewLabelGuide?.attributionTypeCount)) ? Number(manualReviewLabelGuide.attributionTypeCount) : null, manualReviewLabelGuideNegativeLabelsRequireAttribution: Boolean(manualReviewLabelGuide?.negativeLabelsRequireAttribution), proofGapSoftwareFormPassed: Boolean(proofGapSoftwareForm?.passed), proofGapSoftwareFormRowCount: Number.isFinite(Number(proofGapSoftwareForm?.rowCount)) ? Number(proofGapSoftwareForm.rowCount) : null, proofGapSoftwareFormDuplicateIdCount: Number.isFinite(Number(proofGapSoftwareForm?.duplicateIdCount)) ? Number(proofGapSoftwareForm.duplicateIdCount) : null, proofGapSoftwareFormHeaderMatches: Boolean(proofGapSoftwareForm?.headerMatches), proofGapSoftwareFormRowWidthOk: Boolean(proofGapSoftwareForm?.rowWidthOk), latestFormIndexPassed: Boolean(latestFormIndex?.passed), latestFormIndexPrimaryForm: latestFormIndex?.primaryForm?.csv || '', latestFormIndexClientList: latestFormIndex?.clientList?.csv || '', latestFormIndexClientListRowCount: Number.isFinite(Number(latestFormIndex?.clientList?.rowCount)) ? Number(latestFormIndex.clientList.rowCount) : null, latestFormIndexClientListSourceDuplicateRemovedCount: Number.isFinite(Number(latestFormIndex?.clientList?.sourceDuplicateRemovedCount)) ? Number(latestFormIndex.clientList.sourceDuplicateRemovedCount) : null, latestFormIndexClientListFinalDuplicateGroupCount: Number.isFinite(Number(latestFormIndex?.clientList?.finalDuplicateGroupCount)) ? Number(latestFormIndex.clientList.finalDuplicateGroupCount) : null, latestFormIndexClientListDuplicateCountMeaning: latestFormIndex?.clientList?.duplicateCountMeaning || '', latestFormIndexClientListRankContinuous: Boolean(latestFormIndex?.clientList?.rankContinuous), latestFormIndexClientListDirectCustomerProof: Boolean(latestFormIndex?.clientList?.directCustomerProof), latestFormIndexBusinessExecutionIndex: latestFormIndex?.businessExecutionIndex?.markdown || latestFormIndex?.businessExecutionIndex?.csv || '', latestFormIndexBusinessExecutionIndexOperatorPackOwnerArtifactCount: Number.isFinite(Number(latestFormIndex?.businessExecutionIndex?.operatorPackOwnerArtifactCount)) ? Number(latestFormIndex.businessExecutionIndex.operatorPackOwnerArtifactCount) : (Array.isArray(latestFormIndex?.businessExecutionIndex?.operatorPackOwnerArtifacts) ? latestFormIndex.businessExecutionIndex.operatorPackOwnerArtifacts.length : null), latestFormIndexBusinessExecutionIndexFieldOwnerRowCount: Number.isFinite(Number(latestFormIndex?.businessExecutionIndex?.fieldOwnerRowCount)) ? Number(latestFormIndex.businessExecutionIndex.fieldOwnerRowCount) : null, latestFormIndexBusinessExecutionIndexRecheckCommandRowCount: Number.isFinite(Number(latestFormIndex?.businessExecutionIndex?.recheckCommandRowCount)) ? Number(latestFormIndex.businessExecutionIndex.recheckCommandRowCount) : null, latestFormIndexIntakeFieldChecklist: latestFormIndex?.intakeFieldChecklist?.markdown || latestFormIndex?.intakeFieldChecklist?.csv || '', latestFormIndexIntakeFieldChecklistItemCount: Number.isFinite(Number(latestFormIndex?.intakeFieldChecklist?.itemCount)) ? Number(latestFormIndex.intakeFieldChecklist.itemCount) : null, latestFormIndexIntakeFieldChecklistOwnerGroupCount: Array.isArray(latestFormIndex?.intakeFieldChecklist?.ownerGroups) ? latestFormIndex.intakeFieldChecklist.ownerGroups.length : null, latestFormIndexIntakeFieldChecklistRecheckCommandCount: Array.isArray(latestFormIndex?.intakeFieldChecklist?.recheckCommands) ? latestFormIndex.intakeFieldChecklist.recheckCommands.length : null, latestFormIndexManualReviewLabelGuide: latestFormIndex?.manualReviewLabelGuide?.markdown || latestFormIndex?.manualReviewLabelGuide?.csv || '', latestFormIndexManualReviewLabelGuideLabelCount: Number.isFinite(Number(latestFormIndex?.manualReviewLabelGuide?.labelCount)) ? Number(latestFormIndex.manualReviewLabelGuide.labelCount) : null, latestFormIndexManualReviewLabelGuideAttributionTypeCount: Number.isFinite(Number(latestFormIndex?.manualReviewLabelGuide?.attributionTypeCount)) ? Number(latestFormIndex.manualReviewLabelGuide.attributionTypeCount) : null, latestFormIndexPlanExecutionStatus: latestFormIndex?.planExecutionStatus?.markdown || latestFormIndex?.planExecutionStatus?.csv || '', latestFormIndexPlanExecutionStatusRowCount: Number.isFinite(Number(latestFormIndex?.planExecutionStatus?.rowCount)) ? Number(latestFormIndex.planExecutionStatus.rowCount) : null, latestFormIndexPlanExecutionStatusComplete: Boolean(latestFormIndex?.planExecutionStatus?.complete), latestFormIndexPlanExecutionStatusProofOpenCount: Number.isFinite(Number(latestFormIndex?.planExecutionStatus?.proofOpenCount)) ? Number(latestFormIndex.planExecutionStatus.proofOpenCount) : null, latestFormIndexPlanExecutionStatusOperatorPackOwnerArtifactCount: Number.isFinite(Number(latestFormIndex?.planExecutionStatus?.operatorPackOwnerArtifactCount)) ? Number(latestFormIndex.planExecutionStatus.operatorPackOwnerArtifactCount) : (Array.isArray(latestFormIndex?.planExecutionStatus?.operatorPackOwnerArtifacts) ? latestFormIndex.planExecutionStatus.operatorPackOwnerArtifacts.length : null), latestFormIndexChinesePlanDoc: findSupportDocPath(latestFormIndex, 'tihao-experience-optimization-plan.zh-CN.md'), latestFormIndexChineseActionOrderDoc: findSupportDocPath(latestFormIndex, 'business-proof-action-order.zh-CN.md'), latestFormIndexActionCount: Number.isFinite(Number(latestFormIndex?.nextActions?.actionCount)) ? Number(latestFormIndex.nextActions.actionCount) : null, latestFormIndexProofOpenCount: Number.isFinite(Number(latestFormIndex?.nextActions?.proofOpenCount)) ? Number(latestFormIndex.nextActions.proofOpenCount) : null, latestFormIndexNextActionsTopCount: Array.isArray(latestFormIndex?.nextActions?.topActions) ? latestFormIndex.nextActions.topActions.length : null, latestFormIndexNextActionsProofGapOpenCount: Number.isFinite(Number(latestFormIndex?.nextActions?.sourceState?.proofGapOpenCount)) ? Number(latestFormIndex.nextActions.sourceState.proofGapOpenCount) : null, latestFormIndexDataRepairCsv: latestFormIndex?.repairActions?.dataIntake?.csv || '', latestFormIndexDataRepairActionCount: Number.isFinite(Number(latestFormIndex?.repairActions?.dataIntake?.repairActionCount)) ? Number(latestFormIndex.repairActions.dataIntake.repairActionCount) : null, latestFormIndexVideoRepairCsv: latestFormIndex?.repairActions?.videoResource?.csv || '', latestFormIndexVideoRepairActionCount: Number.isFinite(Number(latestFormIndex?.repairActions?.videoResource?.repairActionCount)) ? Number(latestFormIndex.repairActions.videoResource.repairActionCount) : null, latestFormIndexHomepageRepairCsv: latestFormIndex?.repairActions?.homepageEvidence?.csv || '', latestFormIndexHomepageRepairActionCount: Number.isFinite(Number(latestFormIndex?.repairActions?.homepageEvidence?.repairActionCount)) ? Number(latestFormIndex.repairActions.homepageEvidence.repairActionCount) : null, latestFormIndexOwnerRepairSummary: ownerRepairSummary(latestFormIndex?.nextActions?.ownerArtifacts), latestFormIndexProofGapOperatorPack: latestFormIndex?.proofGapOperatorPack?.markdown || latestFormIndex?.proofGapOperatorPack?.csv || '', latestFormIndexProofGapOperatorPackOpenCount: Number.isFinite(Number(latestFormIndex?.proofGapOperatorPack?.openCount)) ? Number(latestFormIndex.proofGapOperatorPack.openCount) : null, latestFormIndexProofGapOperatorPackOwnerGroupCount: Number.isFinite(Number(latestFormIndex?.proofGapOperatorPack?.ownerGroupCount)) ? Number(latestFormIndex.proofGapOperatorPack.ownerGroupCount) : null, latestFormIndexProofGapOperatorPackOwnerArtifactCount: Number.isFinite(Number(latestFormIndex?.proofGapOperatorPack?.ownerArtifactCount)) ? Number(latestFormIndex.proofGapOperatorPack.ownerArtifactCount) : null, latestFormIndexProofGapOperatorPackRecheckCommandCount: Number.isFinite(Number(latestFormIndex?.proofGapOperatorPack?.recheckCommandCount)) ? Number(latestFormIndex.proofGapOperatorPack.recheckCommandCount) : null, latestFormIndexProofGapOperatorPackEvidenceRowCount: Number.isFinite(Number(latestFormIndex?.proofGapOperatorPack?.evidenceRowCount)) ? Number(latestFormIndex.proofGapOperatorPack.evidenceRowCount) : null, latestFormIndexProofGapOperatorPackNextActionCount: Number.isFinite(Number(latestFormIndex?.proofGapOperatorPack?.nextActionCount)) ? Number(latestFormIndex.proofGapOperatorPack.nextActionCount) : null, latestFormIndexProofGapOperatorPackGapIds: proofGapOperatorGapIds(latestFormIndex?.proofGapOperatorPack).join(','), latestFormIndexLongRunReadinessReport: latestFormIndex?.longRunReadiness?.report || '', latestFormIndexLongRunReadinessReady: Boolean(latestFormIndex?.longRunReadiness?.ready), latestFormIndexLongRunReadinessFailCount: Number.isFinite(Number(latestFormIndex?.longRunReadiness?.failCount)) ? Number(latestFormIndex.longRunReadiness.failCount) : null, latestFormIndexLongRunReadinessProofLevel: latestFormIndex?.longRunReadiness?.proofLevel || '', latestFormIndexLongRunReadinessDirectCustomerProof: Boolean(latestFormIndex?.longRunReadiness?.directCustomerProof), localSeedToIntakeWorklistProofLevel: localSeedToIntakeWorklist?.proofLevel || '', localSeedToIntakeWorklistDirectCustomerProof: Boolean(localSeedToIntakeWorklist?.directCustomerProof), localSeedToIntakeWorklistCanCloseProofGap: Boolean(localSeedToIntakeWorklist?.canCloseProofGap), localSeedToIntakeWorklistHistoryDraftRows: worklistCount(localSeedToIntakeWorklist, 'historyDraftRows'), localSeedToIntakeWorklistReferenceSeedRows: worklistCount(localSeedToIntakeWorklist, 'referenceSeedRows'), localSeedToIntakeWorklistCandidateSeedRows: worklistCount(localSeedToIntakeWorklist, 'candidateSeedRows'), localSeedToIntakeWorklistVideoWorklistRows: worklistCount(localSeedToIntakeWorklist, 'videoWorklistRows'), localSeedToIntakeWorklistVideoCandidateNeedsResourceRows: worklistCount(localSeedToIntakeWorklist, 'videoCandidateNeedsResourceRows'), localSeedToIntakeWorklistMissingProofRequirementCount: Array.isArray(localSeedToIntakeWorklist?.missingProofRequirements) ? localSeedToIntakeWorklist.missingProofRequirements.length : null, localSeedToIntakeWorklistNextActionCount: Array.isArray(localSeedToIntakeWorklist?.nextActions) ? localSeedToIntakeWorklist.nextActions.length : null, latestFormIndexLocalSeedToIntakeWorklistMarkdown: latestFormIndex?.localSeedToIntakeWorklist?.markdown || '', latestFormIndexLocalSeedToIntakeWorklistHistoryDraftRows: worklistCount(latestFormIndex?.localSeedToIntakeWorklist, 'historyDraftRows'), latestFormIndexLocalSeedToIntakeWorklistCandidateSeedRows: worklistCount(latestFormIndex?.localSeedToIntakeWorklist, 'candidateSeedRows'), latestFormIndexLocalSeedToIntakeWorklistVideoCandidateNeedsResourceRows: worklistCount(latestFormIndex?.localSeedToIntakeWorklist, 'videoCandidateNeedsResourceRows'), latestFormIndexLocalSeedToIntakeWorklistCanCloseProofGap: Boolean(latestFormIndex?.localSeedToIntakeWorklist?.canCloseProofGap), realGapMaterialAuditMarkdown: realGapMaterialAudit?.markdown || '', realGapMaterialAuditProofLevel: realGapMaterialAudit?.proofLevel || '', realGapMaterialAuditGapCount: Number.isFinite(Number(realGapMaterialAudit?.gapCount)) ? Number(realGapMaterialAudit.gapCount) : null, realGapMaterialAuditMaterialFoundCount: Number.isFinite(Number(realGapMaterialAudit?.materialFoundCount)) ? Number(realGapMaterialAudit.materialFoundCount) : null, realGapMaterialAuditOpenGapCount: Number.isFinite(Number(realGapMaterialAudit?.openGapCount)) ? Number(realGapMaterialAudit.openGapCount) : null, realGapMaterialAuditCanCloseProofGap: Boolean(realGapMaterialAudit?.canCloseProofGap), latestFormIndexRealGapMaterialAuditMarkdown: latestFormIndex?.realGapMaterialAudit?.markdown || '', latestFormIndexRealGapMaterialAuditMaterialFoundCount: Number.isFinite(Number(latestFormIndex?.realGapMaterialAudit?.materialFoundCount)) ? Number(latestFormIndex.realGapMaterialAudit.materialFoundCount) : null, latestFormIndexRealGapMaterialAuditOpenGapCount: Number.isFinite(Number(latestFormIndex?.realGapMaterialAudit?.openGapCount)) ? Number(latestFormIndex.realGapMaterialAudit.openGapCount) : null, latestFormIndexRealGapMaterialAuditCanCloseProofGap: Boolean(latestFormIndex?.realGapMaterialAudit?.canCloseProofGap), realProofClosureWorkOrderPassed: Boolean(realProofClosureWorkOrder?.passed), realProofClosureWorkOrderComplete: Boolean(realProofClosureWorkOrder?.complete), realProofClosureWorkOrderProofLevel: realProofClosureWorkOrder?.proofLevel || '', realProofClosureWorkOrderDirectCustomerProof: Boolean(realProofClosureWorkOrder?.directCustomerProof), realProofClosureWorkOrderCanCloseProofGap: Boolean(realProofClosureWorkOrder?.canCloseProofGap), realProofClosureWorkOrderRequiresHumanRealMaterial: Boolean(realProofClosureWorkOrder?.requiresHumanRealMaterial), realProofClosureWorkOrderWorkOrderCount: Number.isFinite(Number(realProofClosureWorkOrder?.workOrderCount)) ? Number(realProofClosureWorkOrder.workOrderCount) : null, realProofClosureWorkOrderOwnerGroupCount: Number.isFinite(Number(realProofClosureWorkOrder?.ownerGroupCount)) ? Number(realProofClosureWorkOrder.ownerGroupCount) : null, realProofClosureWorkOrderOwnerArtifactCount: realProofWorkOrderOwnerArtifactCount(realProofClosureWorkOrder), realProofClosureWorkOrderProofGapOpenCount: Number.isFinite(Number(realProofClosureWorkOrder?.sourceState?.proofGapOpenCount)) ? Number(realProofClosureWorkOrder.sourceState.proofGapOpenCount) : null, realProofClosureWorkOrderIntakeFailureCount: Number.isFinite(Number(realProofClosureWorkOrder?.sourceState?.intakeFailureCount)) ? Number(realProofClosureWorkOrder.sourceState.intakeFailureCount) : null, realProofClosureWorkOrderRealCandidateRows: Number.isFinite(Number(realProofClosureWorkOrder?.sourceState?.realCandidateRows)) ? Number(realProofClosureWorkOrder.sourceState.realCandidateRows) : null, realProofClosureWorkOrderVideoAbPreflightContext: hasRealProofClosureWorkOrderVideoAbPreflightContext(realProofClosureWorkOrder), latestFormIndexRealProofClosureWorkOrderMarkdown: latestFormIndex?.realProofClosureWorkOrder?.markdown || '', latestFormIndexRealProofClosureWorkOrderWorkOrderCount: Number.isFinite(Number(latestFormIndex?.realProofClosureWorkOrder?.workOrderCount)) ? Number(latestFormIndex.realProofClosureWorkOrder.workOrderCount) : null, latestFormIndexRealProofClosureWorkOrderOwnerArtifactCount: realProofWorkOrderOwnerArtifactCount(latestFormIndex?.realProofClosureWorkOrder), latestFormIndexRealProofClosureWorkOrderCanCloseProofGap: Boolean(latestFormIndex?.realProofClosureWorkOrder?.canCloseProofGap), handoffChinesePlanDoc: findSupportDocPath(handoff, 'tihao-experience-optimization-plan.zh-CN.md'), handoffChineseActionOrderDoc: findSupportDocPath(handoff, 'business-proof-action-order.zh-CN.md'), handoffLatestFormIndexOwnerGroupCount: Array.isArray(handoff?.latestFormIndex?.intakeFieldChecklist?.ownerGroups) ? handoff.latestFormIndex.intakeFieldChecklist.ownerGroups.length : null, handoffLatestFormIndexRecheckCommandCount: Array.isArray(handoff?.latestFormIndex?.intakeFieldChecklist?.recheckCommands) ? handoff.latestFormIndex.intakeFieldChecklist.recheckCommands.length : null, handoffLatestFormIndexNextActionsTopCount: Array.isArray(handoff?.latestFormIndex?.topActions) ? handoff.latestFormIndex.topActions.length : null, handoffLatestFormIndexNextActionsProofGapOpenCount: Number.isFinite(Number(handoff?.latestFormIndex?.sourceState?.proofGapOpenCount)) ? Number(handoff.latestFormIndex.sourceState.proofGapOpenCount) : null, handoffLocalSeedToIntakeWorklistMarkdown: handoff?.localSeedToIntakeWorklist?.markdown || '', handoffLocalSeedToIntakeWorklistHistoryDraftRows: worklistCount(handoff?.localSeedToIntakeWorklist, 'historyDraftRows'), handoffLocalSeedToIntakeWorklistCandidateSeedRows: worklistCount(handoff?.localSeedToIntakeWorklist, 'candidateSeedRows'), handoffLocalSeedToIntakeWorklistVideoCandidateNeedsResourceRows: worklistCount(handoff?.localSeedToIntakeWorklist, 'videoCandidateNeedsResourceRows'), handoffLocalSeedToIntakeWorklistCanCloseProofGap: Boolean(handoff?.localSeedToIntakeWorklist?.canCloseProofGap), handoffLatestFormIndexLocalSeedToIntakeWorklistMarkdown: handoff?.latestFormIndex?.localSeedToIntakeWorklist?.markdown || '', handoffLatestFormIndexLocalSeedToIntakeWorklistHistoryDraftRows: worklistCount(handoff?.latestFormIndex?.localSeedToIntakeWorklist, 'historyDraftRows'), handoffLatestFormIndexLocalSeedToIntakeWorklistCandidateSeedRows: worklistCount(handoff?.latestFormIndex?.localSeedToIntakeWorklist, 'candidateSeedRows'), handoffLatestFormIndexLocalSeedToIntakeWorklistVideoCandidateNeedsResourceRows: worklistCount(handoff?.latestFormIndex?.localSeedToIntakeWorklist, 'videoCandidateNeedsResourceRows'), handoffLatestFormIndexLocalSeedToIntakeWorklistCanCloseProofGap: Boolean(handoff?.latestFormIndex?.localSeedToIntakeWorklist?.canCloseProofGap), handoffRealGapMaterialAuditMarkdown: handoff?.realGapMaterialAudit?.markdown || '', handoffRealGapMaterialAuditMaterialFoundCount: Number.isFinite(Number(handoff?.realGapMaterialAudit?.materialFoundCount)) ? Number(handoff.realGapMaterialAudit.materialFoundCount) : null, handoffRealGapMaterialAuditOpenGapCount: Number.isFinite(Number(handoff?.realGapMaterialAudit?.openGapCount)) ? Number(handoff.realGapMaterialAudit.openGapCount) : null, handoffRealGapMaterialAuditCanCloseProofGap: Boolean(handoff?.realGapMaterialAudit?.canCloseProofGap), handoffLatestFormIndexRealGapMaterialAuditMarkdown: handoff?.latestFormIndex?.realGapMaterialAudit?.markdown || '', handoffLatestFormIndexRealGapMaterialAuditMaterialFoundCount: Number.isFinite(Number(handoff?.latestFormIndex?.realGapMaterialAudit?.materialFoundCount)) ? Number(handoff.latestFormIndex.realGapMaterialAudit.materialFoundCount) : null, handoffLatestFormIndexRealGapMaterialAuditOpenGapCount: Number.isFinite(Number(handoff?.latestFormIndex?.realGapMaterialAudit?.openGapCount)) ? Number(handoff.latestFormIndex.realGapMaterialAudit.openGapCount) : null, handoffLatestFormIndexRealGapMaterialAuditCanCloseProofGap: Boolean(handoff?.latestFormIndex?.realGapMaterialAudit?.canCloseProofGap), handoffRealProofClosureWorkOrderMarkdown: handoff?.realProofClosureWorkOrder?.markdown || '', handoffRealProofClosureWorkOrderWorkOrderCount: Number.isFinite(Number(handoff?.realProofClosureWorkOrder?.workOrderCount)) ? Number(handoff.realProofClosureWorkOrder.workOrderCount) : null, handoffRealProofClosureWorkOrderOwnerArtifactCount: realProofWorkOrderOwnerArtifactCount(handoff?.realProofClosureWorkOrder), handoffRealProofClosureWorkOrderCanCloseProofGap: Boolean(handoff?.realProofClosureWorkOrder?.canCloseProofGap), handoffLatestFormIndexRealProofClosureWorkOrderMarkdown: handoff?.latestFormIndex?.realProofClosureWorkOrder?.markdown || '', handoffLatestFormIndexRealProofClosureWorkOrderWorkOrderCount: Number.isFinite(Number(handoff?.latestFormIndex?.realProofClosureWorkOrder?.workOrderCount)) ? Number(handoff.latestFormIndex.realProofClosureWorkOrder.workOrderCount) : null, handoffLatestFormIndexRealProofClosureWorkOrderOwnerArtifactCount: realProofWorkOrderOwnerArtifactCount(handoff?.latestFormIndex?.realProofClosureWorkOrder), handoffLatestFormIndexRealProofClosureWorkOrderCanCloseProofGap: Boolean(handoff?.latestFormIndex?.realProofClosureWorkOrder?.canCloseProofGap), handoffLatestFormIndexManualReviewLabelGuideLabelCount: Number.isFinite(Number(handoff?.latestFormIndex?.manualReviewLabelGuide?.labelCount)) ? Number(handoff.latestFormIndex.manualReviewLabelGuide.labelCount) : null, handoffLatestFormIndexBusinessFillGuideRowCount: Number.isFinite(Number(handoff?.latestFormIndex?.businessFillGuide?.rowCount)) ? Number(handoff.latestFormIndex.businessFillGuide.rowCount) : null, handoffLongRunReadinessReport: handoff?.longRunReadiness?.report || '', handoffLongRunReadinessReady: Boolean(handoff?.longRunReadiness?.ready), handoffLongRunReadinessFailCount: Number.isFinite(Number(handoff?.longRunReadiness?.failCount)) ? Number(handoff.longRunReadiness.failCount) : null, handoffLongRunReadinessProofLevel: handoff?.longRunReadiness?.proofLevel || '', handoffLongRunReadinessDirectCustomerProof: Boolean(handoff?.longRunReadiness?.directCustomerProof), handoffLatestFormIndexLongRunReadinessReport: handoff?.latestFormIndex?.longRunReadiness?.report || '', handoffLatestFormIndexLongRunReadinessReady: Boolean(handoff?.latestFormIndex?.longRunReadiness?.ready), handoffLatestFormIndexLongRunReadinessFailCount: Number.isFinite(Number(handoff?.latestFormIndex?.longRunReadiness?.failCount)) ? Number(handoff.latestFormIndex.longRunReadiness.failCount) : null, handoffPlanExecutionStatusRowCount: Number.isFinite(Number(handoff?.planExecutionStatus?.rowCount)) ? Number(handoff.planExecutionStatus.rowCount) : null, handoffPlanExecutionStatusComplete: Boolean(handoff?.planExecutionStatus?.complete), handoffPlanExecutionStatusProofOpenCount: Number.isFinite(Number(handoff?.planExecutionStatus?.proofOpenCount)) ? Number(handoff.planExecutionStatus.proofOpenCount) : null, handoffPlanExecutionStatusOperatorPackOwnerArtifactCount: Number.isFinite(Number(handoff?.planExecutionStatus?.operatorPackOwnerArtifactCount)) ? Number(handoff.planExecutionStatus.operatorPackOwnerArtifactCount) : (Array.isArray(handoff?.planExecutionStatus?.operatorPackOwnerArtifacts) ? handoff.planExecutionStatus.operatorPackOwnerArtifacts.length : null), handoffOwnerRepairSummary: ownerRepairSummary(handoff?.businessProofNextActions?.ownerArtifacts), handoffProofGapOperatorPackReport: handoff?.proofGapOperatorPack?.markdown || '', handoffProofGapOperatorPackSummary: handoff?.proofGapOperatorPack?.summary || '', handoffProofGapOperatorPackOpenCount: Number.isFinite(Number(handoff?.proofGapOperatorPack?.openCount)) ? Number(handoff.proofGapOperatorPack.openCount) : null, handoffProofGapOperatorPackOwnerGroupCount: Number.isFinite(Number(handoff?.proofGapOperatorPack?.ownerGroupCount)) ? Number(handoff.proofGapOperatorPack.ownerGroupCount) : null, handoffProofGapOperatorPackOwnerArtifactCount: Number.isFinite(Number(handoff?.proofGapOperatorPack?.ownerArtifactCount)) ? Number(handoff.proofGapOperatorPack.ownerArtifactCount) : null, handoffProofGapOperatorPackRecheckCommandCount: Number.isFinite(Number(handoff?.proofGapOperatorPack?.recheckCommandCount)) ? Number(handoff.proofGapOperatorPack.recheckCommandCount) : null, handoffProofGapOperatorPackEvidenceRowCount: Number.isFinite(Number(handoff?.proofGapOperatorPack?.evidenceRowCount)) ? Number(handoff.proofGapOperatorPack.evidenceRowCount) : null, handoffProofGapOperatorPackNextActionCount: Number.isFinite(Number(handoff?.proofGapOperatorPack?.nextActionCount)) ? Number(handoff.proofGapOperatorPack.nextActionCount) : null, handoffProofGapOperatorPackGapIds: proofGapOperatorGapIds(handoff?.proofGapOperatorPack).join(','), handoffProofGapClosureOpenCount: Number.isFinite(Number(handoff?.proofGapClosure?.openCount)) ? Number(handoff.proofGapClosure.openCount) : null, handoffProofGapClosureBusinessOpenCount: Number.isFinite(Number(handoff?.proofGapClosure?.businessOpenCount)) ? Number(handoff.proofGapClosure.businessOpenCount) : null, handoffProofGapClosureBusinessClosedCount: Number.isFinite(Number(handoff?.proofGapClosure?.businessClosedCount)) ? Number(handoff.proofGapClosure.businessClosedCount) : null, handoffProofGapClosureBusinessGapCount: Number.isFinite(Number(handoff?.proofGapClosure?.businessGapCount)) ? Number(handoff.proofGapClosure.businessGapCount) : null, handoffProofGapClosureTotalRows: Number.isFinite(Number(handoff?.proofGapClosure?.totalRows)) ? Number(handoff.proofGapClosure.totalRows) : null, handoffProofGapClosurePrecheckOpenCount: Number.isFinite(Number(handoff?.proofGapClosure?.precheckOpenCount)) ? Number(handoff.proofGapClosure.precheckOpenCount) : null, handoffProofGapClosureCountSemanticsOpenCount: handoff?.proofGapClosure?.countSemantics?.openCount || '', handoffProofGapClosureRows: Array.isArray(handoff?.proofGapClosure?.rows) ? handoff.proofGapClosure.rows.length : null, handoffVideoAbMissingProofCount: videoAbMissingProofCount(handoff?.proofGapClosure), handoffProofGapClosureOpenRowsWithMissingProofRequirements: countOpenRowsWithMissingProofRequirements(handoff?.proofGapClosure?.rows, 'id'), feedbackLoopClosurePassed: Boolean(feedbackLoopClosure?.passed), feedbackLoopClosureComplete: Boolean(feedbackLoopClosure?.complete), feedbackLoopClosureDirectCustomerProof: Boolean(feedbackLoopClosure?.directCustomerProof), feedbackLoopClosureNegativeCount: Number.isFinite(Number(feedbackLoopClosure?.negativeFeedbackCount)) ? Number(feedbackLoopClosure.negativeFeedbackCount) : null, feedbackLoopClosureLeakedCount: Number.isFinite(Number(feedbackLoopClosure?.leakedCount)) ? Number(feedbackLoopClosure.leakedCount) : null, handoffFeedbackLoopClosureDirectCustomerProof: Boolean(handoff?.feedbackLoopClosure?.directCustomerProof), homepageEvidenceReadinessReady: Boolean(homepageEvidenceReadiness?.ready), homepageEvidenceReadinessDirectCustomerProof: Boolean(homepageEvidenceReadiness?.directCustomerProof), homepageEvidenceReadinessProofLevel: homepageEvidenceReadiness?.proofLevel || '', homepageEvidenceReadinessFailureCount: Number.isFinite(Number(homepageEvidenceReadiness?.failureCount)) ? Number(homepageEvidenceReadiness.failureCount) : null, homepageEvidenceReadinessRepairActionCount: Array.isArray(homepageEvidenceReadiness?.repairActions) ? homepageEvidenceReadiness.repairActions.length : null, handoffHomepageEvidenceReadinessDirectCustomerProof: Boolean(handoff?.homepageEvidenceReadiness?.directCustomerProof), proofGapRows: Array.isArray(proofGap?.rows) ? proofGap.rows.map(item => ({ id: item.id, status: item.status, hasTemplateCommand: Boolean(item.templateCommand), hasTemplateArtifact: Boolean(item.templateArtifact) })) : [], proofGapClosureComplete: Boolean(proofGapClosure?.complete), proofGapClosureOpenCount: Number(proofGapClosure?.openCount || 0), proofGapClosureBusinessOpenCount: Number.isFinite(Number(proofGapClosure?.businessOpenCount)) ? Number(proofGapClosure.businessOpenCount) : null, proofGapClosureBusinessClosedCount: Number.isFinite(Number(proofGapClosure?.businessClosedCount)) ? Number(proofGapClosure.businessClosedCount) : null, proofGapClosureBusinessGapCount: Number.isFinite(Number(proofGapClosure?.businessGapCount)) ? Number(proofGapClosure.businessGapCount) : null, proofGapClosureTotalRows: Number.isFinite(Number(proofGapClosure?.totalRows)) ? Number(proofGapClosure.totalRows) : null, proofGapClosurePrecheckOpenCount: Number.isFinite(Number(proofGapClosure?.precheckOpenCount)) ? Number(proofGapClosure.precheckOpenCount) : null, proofGapClosureCountSemanticsOpenCount: proofGapClosure?.countSemantics?.openCount || '', proofGapClosureOpenRowsWithMissingProofRequirements: countOpenRowsWithMissingProofRequirements(proofGapClosure?.rows, 'id'), planExecutionStatusPassed: Boolean(planExecutionStatus?.passed), planExecutionStatusComplete: Boolean(planExecutionStatus?.complete), planExecutionStatusRowCount: Number.isFinite(Number(planExecutionStatus?.rowCount)) ? Number(planExecutionStatus.rowCount) : null, planExecutionStatusProofOpenCount: Number.isFinite(Number(planExecutionStatus?.proofOpenCount)) ? Number(planExecutionStatus.proofOpenCount) : null, planExecutionStatusOperatorPackOwnerArtifactCount: Number.isFinite(Number(planExecutionStatus?.operatorPackOwnerArtifactCount)) ? Number(planExecutionStatus.operatorPackOwnerArtifactCount) : (Array.isArray(planExecutionStatus?.operatorPackOwnerArtifacts) ? planExecutionStatus.operatorPackOwnerArtifacts.length : null), planExecutionStatusBusinessExecutionOperatorPackOwnerArtifactRowCount: Number.isFinite(Number(planExecutionStatus?.businessExecutionOperatorPackOwnerArtifactRowCount)) ? Number(planExecutionStatus.businessExecutionOperatorPackOwnerArtifactRowCount) : null, planExecutionStatusGuardrailCount: Array.isArray(planExecutionStatus?.guardrails) ? planExecutionStatus.guardrails.length : null, proofGapClosureRows: Array.isArray(proofGapClosure?.rows) ? proofGapClosure.rows.map(item => ({ id: item.id, status: item.status })) : [] }, checks }; } function renderReport(summary) { const lines = [ '# 每轮沉淀审计', '', `- 生成时间:${summary.generatedAt}`, `- 是否通过:${summary.passed ? '是' : '否'}`, `- pass:${summary.counts.pass}`, `- warn:${summary.counts.warn}`, `- fail:${summary.counts.fail}`, '', '## 来源', '', `- 实施日志:${summary.sources.implementationLog}`, `- 状态审计:${summary.sources.statusSummary}`, `- 证据台账:${summary.sources.evidenceSummary}`, `- 交接摘要:${summary.sources.handoffSummary}`, `- 真实证明缺口:${summary.sources.proofGapSummary}`, `- 真实证明缺口关闭审计:${summary.sources.proofGapClosureSummary}`, `- 提号补证操作包:${summary.sources.proofGapOperatorPackSummary}`, `- 反馈二轮闭环审计:${summary.sources.feedbackLoopClosureSummary}`, `- 主页近期内容证据就绪审计:${summary.sources.homepageEvidenceReadinessSummary}`, `- Intake readiness:${summary.sources.intakeReadinessSummary}`, `- 长跑就绪度:${summary.sources.longRunReadinessSummary}`, `- 15 步补证进度:${summary.sources.businessProofProgressSummary}`, `- 下一步行动队列:${summary.sources.businessProofNextActionsSummary}`, `- 商务执行总表:${summary.sources.businessExecutionIndexSummary}`, `- 优化完成度审计:${summary.sources.optimizationCompletionSummary}`, `- 真实验收材料收集总包:${summary.sources.realProofIntakeBundleSummary}`, `- 真实材料字段级补齐核对表:${summary.sources.intakeFieldChecklistSummary}`, `- 最新提号补证表单:${summary.sources.proofGapSoftwareFormSummary}`, `- 最新提号表单索引:${summary.sources.latestFormIndexSummary}`, `- 本地种子转 intake 补表 worklist:${summary.sources.localSeedToIntakeWorklistSummary}`, `- 真实证明闭环工单:${summary.sources.realProofClosureWorkOrderSummary}`, `- 补证操作顺序:${summary.sources.proofActionOrder}`, '', '## 当前观测', '', `- status.passed:${summary.observed.statusCounts.passed || 0}`, `- status.ready_not_proven:${summary.observed.statusCounts.ready_not_proven || 0}`, `- status.blocked_by_external_data:${summary.observed.statusCounts.blocked_by_external_data || 0}`, `- evidence.real_evidence:${summary.observed.evidenceCounts.real_evidence || 0}`, `- evidence.smoke_or_local:${summary.observed.evidenceCounts.smoke_or_local || 0}`, `- evidence.not_business_proof:${summary.observed.evidenceCounts.not_business_proof || 0}`, `- evidence.video-ab-runtime-preflight:${summary.observed.evidenceVideoRuntimePreflightCount || 0}`, `- proofGapClosure.sourceFiles.history: ${summary.observed.proofGapClosureHistorySource || 'unknown'}`, `- proofGapClosure.sourceFiles.customerEffect: ${summary.observed.proofGapClosureCustomerEffectSource || 'unknown'}`, `- proofGapClosure.recursiveProofArtifactDiscovery: ${summary.observed.proofGapClosureRecursiveProofArtifactDiscovery ? 'true' : 'false'}`, `- proofGapClosure.videoAbPreflightReadyForVideoAb: ${summary.observed.proofGapClosureVideoAbPreflightReadyForVideoAb ? 'true' : 'false'}`, `- proofGapClosure.videoAbPreflightFailureCount: ${summary.observed.proofGapClosureVideoAbPreflightFailureCount ?? 'unknown'}`, `- optimizationCompletion.videoAbPreflightReadyForVideoAb: ${summary.observed.optimizationCompletionVideoAbPreflightReadyForVideoAb ? 'true' : 'false'}`, `- optimizationCompletion.videoAbPreflightFailureCount: ${summary.observed.optimizationCompletionVideoAbPreflightFailureCount ?? 'unknown'}`, `- handoff.complete:${summary.observed.handoffComplete ? 'true' : 'false'}`, `- proofGap.unresolvedCount:${summary.observed.proofGapUnresolvedCount}`, `- proofGap.templateRowsReady:${summary.observed.proofGapTemplateRowsReady ? 'true' : 'false'}`, `- proofGap.templateColumnsReady:${summary.observed.proofGapTemplateColumnsReady ? 'true' : 'false'}`, `- proofGapOperatorPack.passed:${summary.observed.proofGapOperatorPackPassed ? 'true' : 'false'}`, `- proofGapOperatorPack.openCount:${summary.observed.proofGapOperatorPackOpenCount ?? 'unknown'}`, `- proofGapOperatorPack.rowCount:${summary.observed.proofGapOperatorPackRowCount ?? 'unknown'}`, `- proofGapOperatorPack.ownerGroupCount:${summary.observed.proofGapOperatorPackOwnerGroupCount ?? 'unknown'}`, `- proofGapOperatorPack.ownerArtifactCount:${summary.observed.proofGapOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- proofGapOperatorPack.fillFileCount:${summary.observed.proofGapOperatorPackFillFileCount ?? 'unknown'}`, `- proofGapOperatorPack.recheckCommandCount:${summary.observed.proofGapOperatorPackRecheckCommandCount ?? 'unknown'}`, `- proofGapOperatorPack.evidenceRowCount:${summary.observed.proofGapOperatorPackEvidenceRowCount ?? 'unknown'}`, `- proofGapOperatorPack.nextActionCount:${summary.observed.proofGapOperatorPackNextActionCount ?? 'unknown'}`, `- proofGapOperatorPack.missingProofRequirementCount:${summary.observed.proofGapOperatorPackMissingProofRequirementCount ?? 'unknown'}`, `- proofGapOperatorPack.openRowsWithMissingProofRequirements:${summary.observed.proofGapOperatorPackOpenRowsWithMissingProofRequirements ?? 'unknown'}`, `- proofGapOperatorPack.videoAbPreflightContext:${summary.observed.proofGapOperatorPackVideoAbPreflightContext ? 'true' : 'false'}`, `- proofGapOperatorPack.gapIds:${summary.observed.proofGapOperatorPackGapIds || 'unknown'}`, `- proofGapOperatorPack.directCustomerProof:${summary.observed.proofGapOperatorPackDirectCustomerProof ? 'true' : 'false'}`, `- intakeReadiness.ready:${summary.observed.intakeReadinessReady ? 'true' : 'false'}`, `- intakeReadiness.failureCount:${summary.observed.intakeReadinessFailureCount ?? 'unknown'}`, `- longRunReadiness.mode:${summary.observed.longRunReadinessMode || 'unknown'}`, `- longRunReadiness.ready:${summary.observed.longRunReadinessReady ? 'true' : 'false'}`, `- longRunReadiness.failCount:${summary.observed.longRunReadinessFailCount ?? 'unknown'}`, `- businessProofProgress.complete:${summary.observed.businessProofProgressComplete ? 'true' : 'false'}`, `- businessProofProgress.pass:${summary.observed.businessProofProgressCounts.pass || 0}`, `- businessProofProgress.fail:${summary.observed.businessProofProgressCounts.fail || 0}`, `- businessProofProgress.pending:${summary.observed.businessProofProgressCounts.pending || 0}`, `- businessProofProgress.blocked_by_external_data:${summary.observed.businessProofProgressCounts.blocked_by_external_data || 0}`, `- businessProofProgress.operatorPackOwnerArtifactCount:${summary.observed.businessProofProgressOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- handoff.businessProofProgressOperatorPackOwnerArtifactCount:${summary.observed.handoffBusinessProofProgressOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- businessProofNextActions.complete:${summary.observed.businessProofNextActionsComplete ? 'true' : 'false'}`, `- businessProofNextActions.count:${summary.observed.businessProofNextActionsCount ?? 'unknown'}`, `- businessProofNextActions.topActionCount:${summary.observed.businessProofNextActionsTopCount ?? 'unknown'}`, `- businessProofNextActions.top:${summary.observed.businessProofNextActionsTop || 'unknown'}`, `- businessProofNextActions.withMissingProofRequirements:${summary.observed.businessProofNextActionsWithMissingProofRequirements ?? 'unknown'}`, `- handoff.businessProofNextActions.count:${summary.observed.handoffBusinessProofNextActionsCount ?? 'unknown'}`, `- handoff.businessProofNextActions.topActionCount:${summary.observed.handoffBusinessProofNextActionsTopCount ?? 'unknown'}`, `- handoff.businessProofNextActions.proofGapOpenCount:${summary.observed.handoffBusinessProofNextActionsProofGapOpenCount ?? 'unknown'}`, `- optimizationCompletion.complete:${summary.observed.optimizationCompletionComplete ? 'true' : 'false'}`, `- optimizationCompletion.readyForClaim:${summary.observed.optimizationCompletionReadyForClaim ? 'true' : 'false'}`, `- optimizationCompletion.proofGapOpenCount:${summary.observed.optimizationCompletionProofGapOpenCount ?? 'unknown'}`, `- optimizationCompletion.blockingReasonCount:${summary.observed.optimizationCompletionBlockingReasonCount ?? 'unknown'}`, `- optimizationCompletion.blockingReasonsWithMissingProofRequirements:${summary.observed.optimizationCompletionBlockingReasonsWithMissingProofRequirements ?? 'unknown'}`, `- optimizationCompletion.missingProofRequirementCount:${summary.observed.optimizationCompletionMissingProofRequirementCount ?? 'unknown'}`, `- optimizationCompletion.canClaim.tihaoRateImproved:${summary.observed.optimizationCompletionCanClaimTihaoRateImproved ? 'true' : 'false'}`, `- optimizationCompletion.canClaim.customerEffectAchieved:${summary.observed.optimizationCompletionCanClaimCustomerEffectAchieved ? 'true' : 'false'}`, `- optimizationCompletion.canClaim.manualSupplementReduced:${summary.observed.optimizationCompletionCanClaimManualSupplementReduced ? 'true' : 'false'}`, `- optimizationCompletion.sourceFiles.history: ${summary.observed.optimizationCompletionHistorySource || 'unknown'}`, `- optimizationCompletion.sourceFiles.customerEffect: ${summary.observed.optimizationCompletionCustomerEffectSource || 'unknown'}`, `- optimizationCompletion.recursiveProofArtifactDiscovery: ${summary.observed.optimizationCompletionRecursiveProofArtifactDiscovery ? 'true' : 'false'}`, `- businessExecutionIndex.passed:${summary.observed.businessExecutionIndexPassed ? 'true' : 'false'}`, `- businessExecutionIndex.rowCount:${summary.observed.businessExecutionIndexRowCount ?? 'unknown'}`, `- businessExecutionIndex.actionRowCount:${summary.observed.businessExecutionIndexActionRowCount ?? 'unknown'}`, `- businessExecutionIndex.repairRowCount:${summary.observed.businessExecutionIndexRepairRowCount ?? 'unknown'}`, `- businessExecutionIndex.operatorPackOwnerArtifactRowCount:${summary.observed.businessExecutionIndexOperatorPackOwnerArtifactRowCount ?? 'unknown'}`, `- businessExecutionIndex.operatorPackOwnerArtifactCount:${summary.observed.businessExecutionIndexOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- businessExecutionIndex.fieldOwnerRowCount:${summary.observed.businessExecutionIndexFieldOwnerRowCount ?? 'unknown'}`, `- businessExecutionIndex.recheckCommandRowCount:${summary.observed.businessExecutionIndexRecheckCommandRowCount ?? 'unknown'}`, `- businessExecutionIndex.proofOpenCount:${summary.observed.businessExecutionIndexProofOpenCount ?? 'unknown'}`, `- businessExecutionIndex.directCustomerProof:${summary.observed.businessExecutionIndexDirectCustomerProof ? 'true' : 'false'}`, `- businessExecutionIndex.longRunReadinessSummary:${summary.observed.businessExecutionIndexLongRunReadinessSummary || 'unknown'}`, `- businessExecutionIndex.longRunReadinessReport:${summary.observed.businessExecutionIndexLongRunReadinessReport || 'unknown'}`, `- businessExecutionIndex.longRunReadinessReady:${summary.observed.businessExecutionIndexLongRunReadinessReady ? 'true' : 'false'}`, `- businessExecutionIndex.longRunReadinessFailCount:${summary.observed.businessExecutionIndexLongRunReadinessFailCount ?? 'unknown'}`, `- businessExecutionIndex.optimizationCompletionSummary:${summary.observed.businessExecutionIndexOptimizationCompletionSummary || 'unknown'}`, `- businessExecutionIndex.optimizationCompletionReport:${summary.observed.businessExecutionIndexOptimizationCompletionReport || 'unknown'}`, `- businessExecutionIndex.optimizationCompletionReadyForClaim:${summary.observed.businessExecutionIndexOptimizationCompletionReadyForClaim ? 'true' : 'false'}`, `- businessExecutionIndex.optimizationCompletionBlockingReasonCount:${summary.observed.businessExecutionIndexOptimizationCompletionBlockingReasonCount ?? 'unknown'}`, `- handoff.businessExecutionIndex.longRunReadinessReport:${summary.observed.handoffBusinessExecutionIndexLongRunReadinessReport || 'unknown'}`, `- handoff.businessExecutionIndex.longRunReadinessSummary:${summary.observed.handoffBusinessExecutionIndexLongRunReadinessSummary || 'unknown'}`, `- handoff.businessExecutionIndex.longRunReadinessStatus:${summary.observed.handoffBusinessExecutionIndexLongRunReadinessStatus || 'unknown'}`, `- handoff.businessExecutionIndex.longRunReadinessReady:${summary.observed.handoffBusinessExecutionIndexLongRunReadinessReady ? 'true' : 'false'}`, `- handoff.businessExecutionIndex.longRunReadinessFailCount:${summary.observed.handoffBusinessExecutionIndexLongRunReadinessFailCount ?? 'unknown'}`, `- handoff.businessExecutionIndex.operatorPackOwnerArtifactCount:${summary.observed.handoffBusinessExecutionIndexOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- handoff.optimizationCompletionReport:${summary.observed.handoffOptimizationCompletionReport || 'unknown'}`, `- handoff.optimizationCompletionReadyForClaim:${summary.observed.handoffOptimizationCompletionReadyForClaim ? 'true' : 'false'}`, `- handoff.optimizationCompletionProofGapOpenCount:${summary.observed.handoffOptimizationCompletionProofGapOpenCount ?? 'unknown'}`, `- handoff.optimizationCompletionBlockingReasonCount:${summary.observed.handoffOptimizationCompletionBlockingReasonCount ?? 'unknown'}`, `- handoff.businessExecutionIndex.optimizationCompletionReport:${summary.observed.handoffBusinessExecutionIndexOptimizationCompletionReport || 'unknown'}`, `- handoff.businessExecutionIndex.optimizationCompletionSummary:${summary.observed.handoffBusinessExecutionIndexOptimizationCompletionSummary || 'unknown'}`, `- handoff.businessExecutionIndex.optimizationCompletionStatus:${summary.observed.handoffBusinessExecutionIndexOptimizationCompletionStatus || 'unknown'}`, `- handoff.businessExecutionIndex.optimizationCompletionReadyForClaim:${summary.observed.handoffBusinessExecutionIndexOptimizationCompletionReadyForClaim ? 'true' : 'false'}`, `- handoff.businessExecutionIndex.optimizationCompletionBlockingReasonCount:${summary.observed.handoffBusinessExecutionIndexOptimizationCompletionBlockingReasonCount ?? 'unknown'}`, `- realProofIntakeBundle.passed:${summary.observed.realProofIntakeBundlePassed ? 'true' : 'false'}`, `- realProofIntakeBundle.complete:${summary.observed.realProofIntakeBundleComplete ? 'true' : 'false'}`, `- realProofIntakeBundle.proofOpenCount:${summary.observed.realProofIntakeBundleProofOpenCount ?? 'unknown'}`, `- realProofIntakeBundle.exportRowCount:${summary.observed.realProofIntakeBundleExportRowCount ?? 'unknown'}`, `- realProofIntakeBundle.recheckCommandCount:${summary.observed.realProofIntakeBundleRecheckCommandCount ?? 'unknown'}`, `- realProofIntakeBundle.operatorPackEvidenceRowCount:${summary.observed.realProofIntakeBundleOperatorPackEvidenceRowCount ?? 'unknown'}`, `- realProofIntakeBundle.operatorPackNextActionCount:${summary.observed.realProofIntakeBundleOperatorPackNextActionCount ?? 'unknown'}`, `- realProofIntakeBundle.operatorPackMissingProofRequirementCount:${summary.observed.realProofIntakeBundleOperatorPackMissingProofRequirementCount ?? 'unknown'}`, `- realProofIntakeBundle.operatorPackOwnerArtifactCount:${summary.observed.realProofIntakeBundleOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- realProofIntakeBundle.longRunReadinessReport:${summary.observed.realProofIntakeBundleLongRunReadinessReport || 'unknown'}`, `- realProofIntakeBundle.longRunReadinessReady:${summary.observed.realProofIntakeBundleLongRunReadinessReady ? 'true' : 'false'}`, `- realProofIntakeBundle.longRunReadinessFailCount:${summary.observed.realProofIntakeBundleLongRunReadinessFailCount ?? 'unknown'}`, `- realProofIntakeBundle.longRunReadinessProofLevel:${summary.observed.realProofIntakeBundleLongRunReadinessProofLevel || 'unknown'}`, `- realProofIntakeBundle.longRunReadinessDirectCustomerProof:${summary.observed.realProofIntakeBundleLongRunReadinessDirectCustomerProof ? 'true' : 'false'}`, `- realProofIntakeBundle.videoAbPreflightContext:${summary.observed.realProofIntakeBundleVideoAbPreflightContext ? 'true' : 'false'}`, `- intakeFieldChecklist.passed:${summary.observed.intakeFieldChecklistPassed ? 'true' : 'false'}`, `- intakeFieldChecklist.itemCount:${summary.observed.intakeFieldChecklistItemCount ?? 'unknown'}`, `- intakeFieldChecklist.missingRequiredCount:${summary.observed.intakeFieldChecklistMissingRequiredCount ?? 'unknown'}`, `- intakeFieldChecklist.placeholderCount:${summary.observed.intakeFieldChecklistPlaceholderCount ?? 'unknown'}`, `- intakeFieldChecklist.directCustomerProof:${summary.observed.intakeFieldChecklistDirectCustomerProof ? 'true' : 'false'}`, `- intakeFieldChecklist.ownerGroupCount:${summary.observed.intakeFieldChecklistOwnerGroupCount ?? 'unknown'}`, `- intakeFieldChecklist.recheckCommandCount:${summary.observed.intakeFieldChecklistRecheckCommandCount ?? 'unknown'}`, `- proofGapSoftwareForm.passed:${summary.observed.proofGapSoftwareFormPassed ? 'true' : 'false'}`, `- proofGapSoftwareForm.rowCount:${summary.observed.proofGapSoftwareFormRowCount ?? 'unknown'}`, `- proofGapSoftwareForm.duplicateIdCount:${summary.observed.proofGapSoftwareFormDuplicateIdCount ?? 'unknown'}`, `- latestFormIndex.passed:${summary.observed.latestFormIndexPassed ? 'true' : 'false'}`, `- latestFormIndex.primaryForm:${summary.observed.latestFormIndexPrimaryForm || 'unknown'}`, `- latestFormIndex.clientList:${summary.observed.latestFormIndexClientList || 'unknown'}`, `- latestFormIndex.clientListRowCount:${summary.observed.latestFormIndexClientListRowCount ?? 'unknown'}`, `- latestFormIndex.clientListSourceDuplicateRemovedCount:${summary.observed.latestFormIndexClientListSourceDuplicateRemovedCount ?? 'unknown'}`, `- latestFormIndex.clientListFinalDuplicateGroupCount:${summary.observed.latestFormIndexClientListFinalDuplicateGroupCount ?? 'unknown'}`, `- latestFormIndex.clientListDuplicateCountMeaning:${summary.observed.latestFormIndexClientListDuplicateCountMeaning || 'unknown'}`, `- latestFormIndex.clientListRankContinuous:${summary.observed.latestFormIndexClientListRankContinuous ? 'true' : 'false'}`, `- latestFormIndex.clientListDirectCustomerProof:${summary.observed.latestFormIndexClientListDirectCustomerProof ? 'true' : 'false'}`, `- latestFormIndex.businessExecutionIndex:${summary.observed.latestFormIndexBusinessExecutionIndex || 'unknown'}`, `- latestFormIndex.businessExecutionIndexOperatorPackOwnerArtifactCount:${summary.observed.latestFormIndexBusinessExecutionIndexOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- latestFormIndex.businessExecutionIndexFieldOwnerRowCount:${summary.observed.latestFormIndexBusinessExecutionIndexFieldOwnerRowCount ?? 'unknown'}`, `- latestFormIndex.businessExecutionIndexRecheckCommandRowCount:${summary.observed.latestFormIndexBusinessExecutionIndexRecheckCommandRowCount ?? 'unknown'}`, `- latestFormIndex.intakeFieldChecklist:${summary.observed.latestFormIndexIntakeFieldChecklist || 'unknown'}`, `- latestFormIndex.intakeFieldChecklistItemCount:${summary.observed.latestFormIndexIntakeFieldChecklistItemCount ?? 'unknown'}`, `- latestFormIndex.intakeFieldChecklistOwnerGroupCount:${summary.observed.latestFormIndexIntakeFieldChecklistOwnerGroupCount ?? 'unknown'}`, `- latestFormIndex.intakeFieldChecklistRecheckCommandCount:${summary.observed.latestFormIndexIntakeFieldChecklistRecheckCommandCount ?? 'unknown'}`, `- latestFormIndex.chinesePlanDoc:${summary.observed.latestFormIndexChinesePlanDoc || 'unknown'}`, `- latestFormIndex.chineseActionOrderDoc:${summary.observed.latestFormIndexChineseActionOrderDoc || 'unknown'}`, `- latestFormIndex.actionCount:${summary.observed.latestFormIndexActionCount ?? 'unknown'}`, `- latestFormIndex.proofOpenCount:${summary.observed.latestFormIndexProofOpenCount ?? 'unknown'}`, `- latestFormIndex.nextActionsTopCount:${summary.observed.latestFormIndexNextActionsTopCount ?? 'unknown'}`, `- latestFormIndex.nextActionsProofGapOpenCount:${summary.observed.latestFormIndexNextActionsProofGapOpenCount ?? 'unknown'}`, `- latestFormIndex.dataRepairCsv:${summary.observed.latestFormIndexDataRepairCsv || 'unknown'}`, `- latestFormIndex.dataRepairActionCount:${summary.observed.latestFormIndexDataRepairActionCount ?? 'unknown'}`, `- latestFormIndex.videoRepairCsv:${summary.observed.latestFormIndexVideoRepairCsv || 'unknown'}`, `- latestFormIndex.videoRepairActionCount:${summary.observed.latestFormIndexVideoRepairActionCount ?? 'unknown'}`, `- latestFormIndex.homepageRepairCsv:${summary.observed.latestFormIndexHomepageRepairCsv || 'unknown'}`, `- latestFormIndex.homepageRepairActionCount:${summary.observed.latestFormIndexHomepageRepairActionCount ?? 'unknown'}`, `- latestFormIndex.ownerRepairSummary:${summary.observed.latestFormIndexOwnerRepairSummary || 'unknown'}`, `- latestFormIndex.proofGapOperatorPack:${summary.observed.latestFormIndexProofGapOperatorPack || 'unknown'}`, `- latestFormIndex.proofGapOperatorPackOpenCount:${summary.observed.latestFormIndexProofGapOperatorPackOpenCount ?? 'unknown'}`, `- latestFormIndex.proofGapOperatorPackOwnerGroupCount:${summary.observed.latestFormIndexProofGapOperatorPackOwnerGroupCount ?? 'unknown'}`, `- latestFormIndex.proofGapOperatorPackOwnerArtifactCount:${summary.observed.latestFormIndexProofGapOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- latestFormIndex.proofGapOperatorPackRecheckCommandCount:${summary.observed.latestFormIndexProofGapOperatorPackRecheckCommandCount ?? 'unknown'}`, `- latestFormIndex.proofGapOperatorPackEvidenceRowCount:${summary.observed.latestFormIndexProofGapOperatorPackEvidenceRowCount ?? 'unknown'}`, `- latestFormIndex.proofGapOperatorPackNextActionCount:${summary.observed.latestFormIndexProofGapOperatorPackNextActionCount ?? 'unknown'}`, `- latestFormIndex.proofGapOperatorPackGapIds:${summary.observed.latestFormIndexProofGapOperatorPackGapIds || 'unknown'}`, `- latestFormIndex.planExecutionStatusOperatorPackOwnerArtifactCount:${summary.observed.latestFormIndexPlanExecutionStatusOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- latestFormIndex.longRunReadinessReport:${summary.observed.latestFormIndexLongRunReadinessReport || 'unknown'}`, `- latestFormIndex.longRunReadinessReady:${summary.observed.latestFormIndexLongRunReadinessReady ? 'true' : 'false'}`, `- latestFormIndex.longRunReadinessFailCount:${summary.observed.latestFormIndexLongRunReadinessFailCount ?? 'unknown'}`, `- latestFormIndex.longRunReadinessProofLevel:${summary.observed.latestFormIndexLongRunReadinessProofLevel || 'unknown'}`, `- latestFormIndex.longRunReadinessDirectCustomerProof:${summary.observed.latestFormIndexLongRunReadinessDirectCustomerProof ? 'true' : 'false'}`, `- localSeedToIntakeWorklist.proofLevel:${summary.observed.localSeedToIntakeWorklistProofLevel || 'unknown'}`, `- localSeedToIntakeWorklist.directCustomerProof:${summary.observed.localSeedToIntakeWorklistDirectCustomerProof ? 'true' : 'false'}`, `- localSeedToIntakeWorklist.canCloseProofGap:${summary.observed.localSeedToIntakeWorklistCanCloseProofGap ? 'true' : 'false'}`, `- localSeedToIntakeWorklist.historyDraftRows:${summary.observed.localSeedToIntakeWorklistHistoryDraftRows ?? 'unknown'}`, `- localSeedToIntakeWorklist.referenceSeedRows:${summary.observed.localSeedToIntakeWorklistReferenceSeedRows ?? 'unknown'}`, `- localSeedToIntakeWorklist.candidateSeedRows:${summary.observed.localSeedToIntakeWorklistCandidateSeedRows ?? 'unknown'}`, `- localSeedToIntakeWorklist.videoWorklistRows:${summary.observed.localSeedToIntakeWorklistVideoWorklistRows ?? 'unknown'}`, `- localSeedToIntakeWorklist.videoCandidateNeedsResourceRows:${summary.observed.localSeedToIntakeWorklistVideoCandidateNeedsResourceRows ?? 'unknown'}`, `- localSeedToIntakeWorklist.missingProofRequirementCount:${summary.observed.localSeedToIntakeWorklistMissingProofRequirementCount ?? 'unknown'}`, `- localSeedToIntakeWorklist.nextActionCount:${summary.observed.localSeedToIntakeWorklistNextActionCount ?? 'unknown'}`, `- latestFormIndex.localSeedToIntakeWorklist:${summary.observed.latestFormIndexLocalSeedToIntakeWorklistMarkdown || 'unknown'}`, `- latestFormIndex.localSeedToIntakeWorklistHistoryDraftRows:${summary.observed.latestFormIndexLocalSeedToIntakeWorklistHistoryDraftRows ?? 'unknown'}`, `- latestFormIndex.localSeedToIntakeWorklistCandidateSeedRows:${summary.observed.latestFormIndexLocalSeedToIntakeWorklistCandidateSeedRows ?? 'unknown'}`, `- latestFormIndex.localSeedToIntakeWorklistVideoCandidateNeedsResourceRows:${summary.observed.latestFormIndexLocalSeedToIntakeWorklistVideoCandidateNeedsResourceRows ?? 'unknown'}`, `- latestFormIndex.localSeedToIntakeWorklistCanCloseProofGap:${summary.observed.latestFormIndexLocalSeedToIntakeWorklistCanCloseProofGap ? 'true' : 'false'}`, `- realProofClosureWorkOrder.passed:${summary.observed.realProofClosureWorkOrderPassed ? 'true' : 'false'}`, `- realProofClosureWorkOrder.complete:${summary.observed.realProofClosureWorkOrderComplete ? 'true' : 'false'}`, `- realProofClosureWorkOrder.proofLevel:${summary.observed.realProofClosureWorkOrderProofLevel || 'unknown'}`, `- realProofClosureWorkOrder.directCustomerProof:${summary.observed.realProofClosureWorkOrderDirectCustomerProof ? 'true' : 'false'}`, `- realProofClosureWorkOrder.canCloseProofGap:${summary.observed.realProofClosureWorkOrderCanCloseProofGap ? 'true' : 'false'}`, `- realProofClosureWorkOrder.requiresHumanRealMaterial:${summary.observed.realProofClosureWorkOrderRequiresHumanRealMaterial ? 'true' : 'false'}`, `- realProofClosureWorkOrder.workOrderCount:${summary.observed.realProofClosureWorkOrderWorkOrderCount ?? 'unknown'}`, `- realProofClosureWorkOrder.ownerGroupCount:${summary.observed.realProofClosureWorkOrderOwnerGroupCount ?? 'unknown'}`, `- realProofClosureWorkOrder.ownerArtifactCount:${summary.observed.realProofClosureWorkOrderOwnerArtifactCount ?? 'unknown'}`, `- realProofClosureWorkOrder.proofGapOpenCount:${summary.observed.realProofClosureWorkOrderProofGapOpenCount ?? 'unknown'}`, `- realProofClosureWorkOrder.intakeFailureCount:${summary.observed.realProofClosureWorkOrderIntakeFailureCount ?? 'unknown'}`, `- realProofClosureWorkOrder.realCandidateRows:${summary.observed.realProofClosureWorkOrderRealCandidateRows ?? 'unknown'}`, `- realProofClosureWorkOrder.videoAbPreflightContext:${summary.observed.realProofClosureWorkOrderVideoAbPreflightContext ? 'true' : 'false'}`, `- latestFormIndex.realProofClosureWorkOrder:${summary.observed.latestFormIndexRealProofClosureWorkOrderMarkdown || 'unknown'}`, `- latestFormIndex.realProofClosureWorkOrderWorkOrderCount:${summary.observed.latestFormIndexRealProofClosureWorkOrderWorkOrderCount ?? 'unknown'}`, `- latestFormIndex.realProofClosureWorkOrderOwnerArtifactCount:${summary.observed.latestFormIndexRealProofClosureWorkOrderOwnerArtifactCount ?? 'unknown'}`, `- latestFormIndex.realProofClosureWorkOrderCanCloseProofGap:${summary.observed.latestFormIndexRealProofClosureWorkOrderCanCloseProofGap ? 'true' : 'false'}`, `- handoff.chinesePlanDoc:${summary.observed.handoffChinesePlanDoc || 'unknown'}`, `- handoff.chineseActionOrderDoc:${summary.observed.handoffChineseActionOrderDoc || 'unknown'}`, `- handoff.latestFormIndex.ownerGroupCount:${summary.observed.handoffLatestFormIndexOwnerGroupCount ?? 'unknown'}`, `- handoff.latestFormIndex.recheckCommandCount:${summary.observed.handoffLatestFormIndexRecheckCommandCount ?? 'unknown'}`, `- handoff.latestFormIndex.nextActionsTopCount:${summary.observed.handoffLatestFormIndexNextActionsTopCount ?? 'unknown'}`, `- handoff.latestFormIndex.nextActionsProofGapOpenCount:${summary.observed.handoffLatestFormIndexNextActionsProofGapOpenCount ?? 'unknown'}`, `- handoff.localSeedToIntakeWorklist:${summary.observed.handoffLocalSeedToIntakeWorklistMarkdown || 'unknown'}`, `- handoff.localSeedToIntakeWorklistHistoryDraftRows:${summary.observed.handoffLocalSeedToIntakeWorklistHistoryDraftRows ?? 'unknown'}`, `- handoff.localSeedToIntakeWorklistCandidateSeedRows:${summary.observed.handoffLocalSeedToIntakeWorklistCandidateSeedRows ?? 'unknown'}`, `- handoff.localSeedToIntakeWorklistVideoCandidateNeedsResourceRows:${summary.observed.handoffLocalSeedToIntakeWorklistVideoCandidateNeedsResourceRows ?? 'unknown'}`, `- handoff.localSeedToIntakeWorklistCanCloseProofGap:${summary.observed.handoffLocalSeedToIntakeWorklistCanCloseProofGap ? 'true' : 'false'}`, `- handoff.latestFormIndex.localSeedToIntakeWorklist:${summary.observed.handoffLatestFormIndexLocalSeedToIntakeWorklistMarkdown || 'unknown'}`, `- handoff.latestFormIndex.localSeedToIntakeWorklistHistoryDraftRows:${summary.observed.handoffLatestFormIndexLocalSeedToIntakeWorklistHistoryDraftRows ?? 'unknown'}`, `- handoff.latestFormIndex.localSeedToIntakeWorklistCandidateSeedRows:${summary.observed.handoffLatestFormIndexLocalSeedToIntakeWorklistCandidateSeedRows ?? 'unknown'}`, `- handoff.latestFormIndex.localSeedToIntakeWorklistVideoCandidateNeedsResourceRows:${summary.observed.handoffLatestFormIndexLocalSeedToIntakeWorklistVideoCandidateNeedsResourceRows ?? 'unknown'}`, `- handoff.latestFormIndex.localSeedToIntakeWorklistCanCloseProofGap:${summary.observed.handoffLatestFormIndexLocalSeedToIntakeWorklistCanCloseProofGap ? 'true' : 'false'}`, `- realGapMaterialAudit.materialFound:${summary.observed.realGapMaterialAuditMaterialFoundCount ?? 'unknown'}/${summary.observed.realGapMaterialAuditGapCount ?? 'unknown'}`, `- realGapMaterialAudit.openGapCount:${summary.observed.realGapMaterialAuditOpenGapCount ?? 'unknown'}`, `- realGapMaterialAudit.canCloseProofGap:${summary.observed.realGapMaterialAuditCanCloseProofGap ? 'true' : 'false'}`, `- latestFormIndex.realGapMaterialAudit:${summary.observed.latestFormIndexRealGapMaterialAuditMarkdown || 'unknown'}`, `- handoff.realGapMaterialAudit:${summary.observed.handoffRealGapMaterialAuditMarkdown || 'unknown'}`, `- handoff.latestFormIndex.realGapMaterialAudit:${summary.observed.handoffLatestFormIndexRealGapMaterialAuditMarkdown || 'unknown'}`, `- handoff.realProofClosureWorkOrder:${summary.observed.handoffRealProofClosureWorkOrderMarkdown || 'unknown'}`, `- handoff.realProofClosureWorkOrderWorkOrderCount:${summary.observed.handoffRealProofClosureWorkOrderWorkOrderCount ?? 'unknown'}`, `- handoff.realProofClosureWorkOrderOwnerArtifactCount:${summary.observed.handoffRealProofClosureWorkOrderOwnerArtifactCount ?? 'unknown'}`, `- handoff.realProofClosureWorkOrderCanCloseProofGap:${summary.observed.handoffRealProofClosureWorkOrderCanCloseProofGap ? 'true' : 'false'}`, `- handoff.latestFormIndex.realProofClosureWorkOrder:${summary.observed.handoffLatestFormIndexRealProofClosureWorkOrderMarkdown || 'unknown'}`, `- handoff.latestFormIndex.realProofClosureWorkOrderWorkOrderCount:${summary.observed.handoffLatestFormIndexRealProofClosureWorkOrderWorkOrderCount ?? 'unknown'}`, `- handoff.latestFormIndex.realProofClosureWorkOrderOwnerArtifactCount:${summary.observed.handoffLatestFormIndexRealProofClosureWorkOrderOwnerArtifactCount ?? 'unknown'}`, `- handoff.latestFormIndex.realProofClosureWorkOrderCanCloseProofGap:${summary.observed.handoffLatestFormIndexRealProofClosureWorkOrderCanCloseProofGap ? 'true' : 'false'}`, `- handoff.latestFormIndex.businessFillGuideRowCount:${summary.observed.handoffLatestFormIndexBusinessFillGuideRowCount ?? 'unknown'}`, `- handoff.longRunReadinessReport:${summary.observed.handoffLongRunReadinessReport || 'unknown'}`, `- handoff.longRunReadinessReady:${summary.observed.handoffLongRunReadinessReady ? 'true' : 'false'}`, `- handoff.longRunReadinessFailCount:${summary.observed.handoffLongRunReadinessFailCount ?? 'unknown'}`, `- handoff.longRunReadinessProofLevel:${summary.observed.handoffLongRunReadinessProofLevel || 'unknown'}`, `- handoff.longRunReadinessDirectCustomerProof:${summary.observed.handoffLongRunReadinessDirectCustomerProof ? 'true' : 'false'}`, `- handoff.latestFormIndex.longRunReadinessReport:${summary.observed.handoffLatestFormIndexLongRunReadinessReport || 'unknown'}`, `- handoff.latestFormIndex.longRunReadinessReady:${summary.observed.handoffLatestFormIndexLongRunReadinessReady ? 'true' : 'false'}`, `- handoff.latestFormIndex.longRunReadinessFailCount:${summary.observed.handoffLatestFormIndexLongRunReadinessFailCount ?? 'unknown'}`, `- handoff.planExecutionStatusOperatorPackOwnerArtifactCount:${summary.observed.handoffPlanExecutionStatusOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- handoff.ownerRepairSummary:${summary.observed.handoffOwnerRepairSummary || 'unknown'}`, `- handoff.proofGapOperatorPackReport:${summary.observed.handoffProofGapOperatorPackReport || 'unknown'}`, `- handoff.proofGapOperatorPackSummary:${summary.observed.handoffProofGapOperatorPackSummary || 'unknown'}`, `- handoff.proofGapOperatorPackOpenCount:${summary.observed.handoffProofGapOperatorPackOpenCount ?? 'unknown'}`, `- handoff.proofGapOperatorPackOwnerGroupCount:${summary.observed.handoffProofGapOperatorPackOwnerGroupCount ?? 'unknown'}`, `- handoff.proofGapOperatorPackOwnerArtifactCount:${summary.observed.handoffProofGapOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- handoff.proofGapOperatorPackRecheckCommandCount:${summary.observed.handoffProofGapOperatorPackRecheckCommandCount ?? 'unknown'}`, `- handoff.proofGapOperatorPackEvidenceRowCount:${summary.observed.handoffProofGapOperatorPackEvidenceRowCount ?? 'unknown'}`, `- handoff.proofGapOperatorPackNextActionCount:${summary.observed.handoffProofGapOperatorPackNextActionCount ?? 'unknown'}`, `- handoff.proofGapOperatorPackGapIds:${summary.observed.handoffProofGapOperatorPackGapIds || 'unknown'}`, `- handoffProofGapClosure.openCount:${summary.observed.handoffProofGapClosureOpenCount ?? 'unknown'}`, `- handoffProofGapClosure.businessOpenCount:${summary.observed.handoffProofGapClosureBusinessOpenCount ?? 'unknown'}`, `- handoffProofGapClosure.businessClosedCount:${summary.observed.handoffProofGapClosureBusinessClosedCount ?? 'unknown'}`, `- handoffProofGapClosure.businessGapCount:${summary.observed.handoffProofGapClosureBusinessGapCount ?? 'unknown'}`, `- handoffProofGapClosure.totalRows:${summary.observed.handoffProofGapClosureTotalRows ?? 'unknown'}`, `- handoffProofGapClosure.precheckOpenCount:${summary.observed.handoffProofGapClosurePrecheckOpenCount ?? 'unknown'}`, `- handoffProofGapClosure.countSemantics.openCount:${summary.observed.handoffProofGapClosureCountSemanticsOpenCount || 'unknown'}`, `- handoffProofGapClosure.rows:${summary.observed.handoffProofGapClosureRows ?? 'unknown'}`, `- handoffProofGapClosure.videoAbMissingProofCount:${summary.observed.handoffVideoAbMissingProofCount ?? 'unknown'}`, `- handoffProofGapClosure.openRowsWithMissingProofRequirements:${summary.observed.handoffProofGapClosureOpenRowsWithMissingProofRequirements ?? 'unknown'}`, `- feedbackLoopClosure.passed:${summary.observed.feedbackLoopClosurePassed ? 'true' : 'false'}`, `- feedbackLoopClosure.complete:${summary.observed.feedbackLoopClosureComplete ? 'true' : 'false'}`, `- feedbackLoopClosure.directCustomerProof:${summary.observed.feedbackLoopClosureDirectCustomerProof ? 'true' : 'false'}`, `- feedbackLoopClosure.negativeFeedbackCount:${summary.observed.feedbackLoopClosureNegativeCount ?? 'unknown'}`, `- feedbackLoopClosure.leakedCount:${summary.observed.feedbackLoopClosureLeakedCount ?? 'unknown'}`, `- handoffFeedbackLoopClosure.directCustomerProof:${summary.observed.handoffFeedbackLoopClosureDirectCustomerProof ? 'true' : 'false'}`, `- homepageEvidenceReadiness.ready:${summary.observed.homepageEvidenceReadinessReady ? 'true' : 'false'}`, `- homepageEvidenceReadiness.directCustomerProof:${summary.observed.homepageEvidenceReadinessDirectCustomerProof ? 'true' : 'false'}`, `- homepageEvidenceReadiness.proofLevel:${summary.observed.homepageEvidenceReadinessProofLevel || 'unknown'}`, `- homepageEvidenceReadiness.failureCount:${summary.observed.homepageEvidenceReadinessFailureCount ?? 'unknown'}`, `- homepageEvidenceReadiness.repairActionCount:${summary.observed.homepageEvidenceReadinessRepairActionCount ?? 'unknown'}`, `- handoffHomepageEvidenceReadiness.directCustomerProof:${summary.observed.handoffHomepageEvidenceReadinessDirectCustomerProof ? 'true' : 'false'}`, `- planExecutionStatus.rowCount:${summary.observed.planExecutionStatusRowCount ?? 'unknown'}`, `- planExecutionStatus.proofOpenCount:${summary.observed.planExecutionStatusProofOpenCount ?? 'unknown'}`, `- planExecutionStatus.operatorPackOwnerArtifactCount:${summary.observed.planExecutionStatusOperatorPackOwnerArtifactCount ?? 'unknown'}`, `- planExecutionStatus.businessExecutionOperatorPackOwnerArtifactRowCount:${summary.observed.planExecutionStatusBusinessExecutionOperatorPackOwnerArtifactRowCount ?? 'unknown'}`, `- planExecutionStatus.guardrailCount:${summary.observed.planExecutionStatusGuardrailCount ?? 'unknown'}`, `- proofGapClosure.complete:${summary.observed.proofGapClosureComplete ? 'true' : 'false'}`, `- proofGapClosure.openCount:${summary.observed.proofGapClosureOpenCount}`, `- proofGapClosure.businessOpenCount:${summary.observed.proofGapClosureBusinessOpenCount ?? 'unknown'}`, `- proofGapClosure.businessClosedCount:${summary.observed.proofGapClosureBusinessClosedCount ?? 'unknown'}`, `- proofGapClosure.businessGapCount:${summary.observed.proofGapClosureBusinessGapCount ?? 'unknown'}`, `- proofGapClosure.totalRows:${summary.observed.proofGapClosureTotalRows ?? 'unknown'}`, `- proofGapClosure.precheckOpenCount:${summary.observed.proofGapClosurePrecheckOpenCount ?? 'unknown'}`, `- proofGapClosure.countSemantics.openCount:${summary.observed.proofGapClosureCountSemanticsOpenCount || 'unknown'}`, `- proofGapClosure.openRowsWithMissingProofRequirements:${summary.observed.proofGapClosureOpenRowsWithMissingProofRequirements ?? 'unknown'}`, '', '## 检查项', '', '| 状态 | 检查项 | 证据 | 下一步 |', '| --- | --- | --- | --- |', ...summary.checks.map(item => `| ${item.status} | ${escapeCell(item.title)} | ${escapeCell(item.evidence)} | ${escapeCell(item.next)} |`) ]; return lines.join('\n'); } function check(id, title, passed, evidence, next, status = 'pass') { return { id, title, status: passed ? status : 'fail', evidence, next: passed ? '继续每轮刷新。' : next }; } function hasEvidenceLevels(evidence) { const counts = evidence?.counts || {}; return Object.prototype.hasOwnProperty.call(counts, 'real_evidence') && Object.prototype.hasOwnProperty.call(counts, 'smoke_or_local') && Object.prototype.hasOwnProperty.call(counts, 'not_business_proof'); } function hasVideoRuntimePreflightBoundary(evidence) { const entries = Array.isArray(evidence?.entries) ? evidence.entries.filter(item => item.type === 'video-ab-runtime-preflight') : []; if (!entries.length) return true; return entries.every(item => item.proofLevel === 'not_business_proof' && ['not_ready', 'ready_to_run'].includes(String(item.status || '')) && String(item.summary || '').includes('generatedBy=acceptance:video-ab-preflight') && String(item.next || '').includes('video-hit-rate-summary.json') ); } function hasStatusId(status, id) { return Array.isArray(status?.items) && status.items.some(item => item.id === id); } function hasProofActionOrder(text) { return Boolean(text) && text.includes('提号长期优化补证操作顺序') && text.includes('npm run intake:readiness') && text.includes('npm run longrun:readiness') && text.includes('npm run customer-effect:audit') && text.includes('optimization:completion') && text.includes('readyForClaim=true') && text.includes('sample、smoke') && text.includes('客户效果不可宣称'); } function hasBusinessProofProgress(progress) { if (!progress || progress.complete !== false) return false; if (!Array.isArray(progress.rows) || progress.rows.length !== 15) return false; const statuses = new Set(progress.rows.map(row => row.status)); return ['pass', 'pending', 'fail', 'blocked_by_external_data'].some(status => statuses.has(status)) && progress.counts && Number.isFinite(Number(progress.counts.pass || 0)) && Number.isFinite(Number(progress.counts.pending || 0)) && Number.isFinite(Number(progress.counts.fail || 0)) && Number.isFinite(Number(progress.counts.blocked_by_external_data || 0)); } function hasBusinessProofProgressOperatorOwnerArtifacts(progress, pack) { if (!progress || !pack) return false; const expectedCount = expectedProofGapOwnerArtifactCount(pack); return Number(progress.operatorPackOwnerArtifactCount || 0) === Number(pack.ownerArtifactCount || 0) && Number(progress.operatorPackOwnerArtifactCount || 0) >= expectedCount && hasProofGapOperatorOwnerArtifacts(progress.operatorPackOwnerArtifacts, pack); } function hasBusinessProofNextActions(nextActions) { const actions = Array.isArray(nextActions?.actions) ? nextActions.actions : []; const topActions = Array.isArray(nextActions?.topActions) ? nextActions.topActions : []; return Boolean(nextActions) && nextActions.complete === false && actions.length >= 1 && Number(nextActions.actionCount || 0) === actions.length && Number(nextActions.ownerGroupCount || 0) >= 1 && topActions.length >= Math.min(5, actions.length) && topActions.every(action => action.title && action.owner && action.command && action.acceptance) && actions.every(action => action.title && action.owner && action.command && action.acceptance) && nextActions.sourceState && typeof nextActions.sourceState.progressComplete === 'boolean'; } function hasProofGapOperatorPack(pack) { if (!pack || pack.passed !== true || pack.complete !== false) return false; if (pack.directCustomerProof !== false || pack.proofLevel !== 'not_business_proof') return false; const gapIds = proofGapOperatorGapIds(pack); const requiredIds = [ 'historical-dataset', 'video-real-candidate', 'video-ab-live-proof', 'live-provider-overnight-proof', 'manual-review-and-customer-effect' ]; if (!requiredIds.every(id => gapIds.includes(id))) return false; const recheckCommandCount = Number.isFinite(Number(pack.recheckCommandCount)) ? Number(pack.recheckCommandCount) : uniqueCount(pack.rows, row => row.recheckCommands); const fillFileCount = Number.isFinite(Number(pack.fillFileCount)) ? Number(pack.fillFileCount) : uniqueCount(pack.rows, row => row.fillFiles); const ownerGroupCount = Number.isFinite(Number(pack.ownerGroupCount)) ? Number(pack.ownerGroupCount) : (Array.isArray(pack.ownerGroups) ? pack.ownerGroups.length : 0); const ownerArtifactCount = Number.isFinite(Number(pack.ownerArtifactCount)) ? Number(pack.ownerArtifactCount) : (Array.isArray(pack.ownerArtifacts) ? pack.ownerArtifacts.length : 0); const expectedOwnerArtifactCount = expectedProofGapOwnerArtifactCount(pack); const evidenceRowCount = Number.isFinite(Number(pack.evidenceRowCount)) ? Number(pack.evidenceRowCount) : countRowsWith(pack.rows, row => row.evidence); const nextActionCount = Number.isFinite(Number(pack.nextActionCount)) ? Number(pack.nextActionCount) : countRowsWith(pack.rows, row => row.nextAction); return Number(pack.rowCount || 0) >= requiredIds.length && Number(pack.openCount || 0) >= 1 && recheckCommandCount >= 5 && fillFileCount >= 3 && ownerGroupCount >= expectedOwnerArtifactCount && ownerArtifactCount >= expectedOwnerArtifactCount && hasProofGapOperatorOwnerArtifacts(pack.ownerArtifacts, pack) && evidenceRowCount >= requiredIds.length && nextActionCount >= requiredIds.length && Array.isArray(pack.rows) && pack.rows.length >= requiredIds.length && pack.rows.every(row => row.gapId && row.owner && Array.isArray(row.fillFiles) && row.fillFiles.length >= 1 && Array.isArray(row.recheckCommands) && row.recheckCommands.length >= 1 && row.evidence && row.nextAction && /不.*证明|不得宣称|不等同于/.test(String(row.boundary || '')) ); } function hasProofGapOperatorPackMissingProofByGap(pack) { if (!pack || !Array.isArray(pack.rows)) return false; const openRows = pack.rows.filter(row => row.status !== 'closed'); const expectedOpenCount = Number(pack.openCount || 0); if (expectedOpenCount > 0 && openRows.length !== expectedOpenCount) return false; return openRows.length >= 1 && openRows.every(row => row.gapId && Array.isArray(row.missingProofRequirements) && row.missingProofRequirements.length >= 1) && Number(pack.missingProofRequirementCount || 0) >= openRows.length; } function hasProofGapClosureMissingProofRequirements(closure) { if (!closure || !Array.isArray(closure.rows)) return false; const openBusinessRows = closure.rows.filter(row => row.status !== 'closed' && row.id !== 'intake-readiness'); const expectedOpenCount = Number(closure.openCount || 0); if (expectedOpenCount > 0 && openBusinessRows.length !== expectedOpenCount) return false; return openBusinessRows.length >= 1 && openBusinessRows.every(row => Array.isArray(row.missingProofRequirements) && row.missingProofRequirements.length >= 1); } function hasProofGapClosureRecursiveProofArtifactDiscovery(closure) { if (!closure || !Array.isArray(closure.rows)) return false; const historicalRow = findRowById(closure.rows, 'historical-dataset'); const customerEffectRow = findRowById(closure.rows, 'manual-review-and-customer-effect'); return hasDiscoveredProofArtifactSources(closure) && hasConcreteHistoricalFailure(historicalRow) && hasConcreteCustomerEffectFailure(customerEffectRow); } function hasProofGapClosureCountSemantics(closure) { if (!closure || !Array.isArray(closure.rows)) return false; const precheckRows = closure.rows.filter(row => row.id === 'intake-readiness'); const businessRows = closure.rows.filter(row => row.id !== 'intake-readiness'); const businessOpenRows = businessRows.filter(row => row.status !== 'closed'); const businessClosedRows = businessRows.filter(row => row.status === 'closed'); const precheckOpenRows = precheckRows.filter(row => row.status !== 'closed'); const precheckClosedRows = precheckRows.filter(row => row.status === 'closed'); const countSemantics = closure.countSemantics || {}; return Number(closure.openCount || 0) === businessOpenRows.length && Number(closure.businessOpenCount || 0) === businessOpenRows.length && Number(closure.closedCount || 0) === businessClosedRows.length && Number(closure.businessClosedCount || 0) === businessClosedRows.length && Number(closure.businessGapCount || 0) === businessRows.length && Number(closure.totalRows || 0) === closure.rows.length && Number(closure.precheckRowCount || 0) === precheckRows.length && Number(closure.precheckOpenCount || 0) === precheckOpenRows.length && Number(closure.precheckClosedCount || 0) === precheckClosedRows.length && countSemantics.openCount === 'business_gap_open_count_excludes_precheck_rows' && countSemantics.businessOpenCount === 'same_as_openCount' && countSemantics.precheckOpenCount === 'precheck_rows_reported_separately'; } function hasBusinessExecutionIndex(index, nextActions, proofGap) { if (!index || index.passed !== true) return false; if (index.directCustomerProof !== false) return false; if (index.proofLevel !== 'smoke_or_local') return false; const expectedActions = Array.isArray(nextActions?.actions) ? nextActions.actions.length : 0; if (expectedActions > 0 && Number(index.actionRowCount || 0) < expectedActions) return false; const expectedOpen = Number(nextActions?.sourceState?.proofGapOpenCount || proofGap?.unresolvedCount || 0); if (expectedOpen > 0 && Number(index.proofOpenCount || 0) !== expectedOpen) return false; if (Number(index.rowCount || 0) < Math.max(1, expectedActions)) return false; if (Number(index.repairRowCount || 0) < 1) return false; if (Number(index.fieldOwnerRowCount || 0) < 1) return false; if (Number(index.recheckCommandRowCount || 0) < 1) return false; if (!Array.isArray(index.rows) || index.rows.length !== Number(index.rowCount || 0)) return false; const types = new Set(index.rows.map(row => String(row.type || ''))); if (!types.has('负责人行动') || !types.has('修复清单') || !types.has('字段补齐负责人') || !types.has('补齐后复验命令') || !types.has('关键文件')) return false; return index.rows.every(row => row.owner && row.title && row.acceptance && String(row.boundary || '').includes('不证明') ); } function hasBusinessExecutionOperatorOwnerArtifacts(index, pack) { if (!index || !pack) return false; const expectedArtifacts = expectedProofGapOwnerArtifacts(pack); const expectedCount = expectedArtifacts.length; if (Number(index.operatorPackOwnerArtifactCount || 0) !== Number(pack.ownerArtifactCount || 0)) return false; if (Number(index.operatorPackOwnerArtifactCount || 0) < expectedCount) return false; if (Number(index.operatorPackOwnerArtifactRowCount || 0) < expectedCount) return false; if (!hasProofGapOperatorOwnerArtifacts(index.operatorPackOwnerArtifacts, pack)) return false; if (!String(index.sourceFiles?.proofGapOperatorPack || '').includes('proof-gap-operator-pack-summary.json')) return false; return expectedArtifacts.every(item => hasBusinessExecutionOperatorOwnerRow(index, item.owner, proofGapOwnerSlug(item)) ); } function hasBusinessExecutionOperatorOwnerRow(index, owner, slug) { return (Array.isArray(index?.rows) ? index.rows : []).some(row => row.owner === owner && row.type === '操作包负责人附件' && String(row.mainFile || '').includes(`by-owner/${slug}.md`) && String(row.csv || '').includes(`by-owner/${slug}.csv`) && Number(row.actionCount || 0) >= 1 && String(row.acceptance || '').includes('evidenceRowCount=') && String(row.acceptance || '').includes('nextActionCount=') && String(row.boundary || '').includes('不证明客户效果') ); } function hasBusinessExecutionLongRunReadiness(index, readiness) { if (!index || !readiness) return false; const row = findExecutionRow(index, '长跑前置门禁报告'); const expectedReady = Boolean(readiness.ready); const expectedFailCount = Number(readiness.counts?.fail ?? readiness.failCount ?? 0); return Boolean(row) && String(index.sourceFiles?.longRunReadiness || '').includes('long-run-readiness-summary.json') && String(row.mainFile || '').includes('long-run-readiness-report.md') && String(row.expectedArtifact || '').includes('long-run-readiness-summary.json') && (row.status === (expectedReady ? 'ready' : 'blocked')) && Number(row.actionCount || 0) === expectedFailCount && String(row.acceptance || '').includes(`ready=${expectedReady}`) && String(row.acceptance || '').includes(`failCount=${expectedFailCount}`) && String(row.boundary || '').includes('不证明客户效果') && String(row.boundary || '').includes('不能启动'); } function hasOptimizationCompletionBoundary(completion) { if (!completion) return false; const blockingReasonCount = Array.isArray(completion.blockingReasons) ? completion.blockingReasons.length : Number(completion.blockingReasonCount || 0); return completion.complete === false && completion.readyForClaim === false && Number(completion.proofGapOpenCount || 0) >= 1 && blockingReasonCount >= 1 && completion.canClaim?.tihaoRateImproved === false && completion.canClaim?.customerEffectAchieved === false && completion.canClaim?.manualSupplementReduced === false; } function hasOptimizationCompletionMissingProofRequirements(completion) { if (!completion || !Array.isArray(completion.blockingReasons)) return false; if (completion.blockingReasons.length < 1) return false; return completion.blockingReasons.every(item => item.status !== 'pass' && Array.isArray(item.missingProofRequirements) && item.missingProofRequirements.length >= 1 ); } function hasOptimizationCompletionRecursiveProofArtifactDiscovery(completion) { if (!completion) return false; const blockingReasons = Array.isArray(completion.blockingReasons) ? completion.blockingReasons : []; const gates = Array.isArray(completion.gates) ? completion.gates : []; const proofGapClosureReason = findRowById(blockingReasons, 'proof-gap-closure') || findRowById(gates, 'proof-gap-closure'); const customerEffectReason = findRowById(blockingReasons, 'customer-effect-proof') || findRowById(gates, 'customer-effect-proof'); return hasDiscoveredProofArtifactSources(completion) && hasConcreteHistoricalFailure(proofGapClosureReason, 'historical-dataset: ') && hasConcreteCustomerEffectFailure(customerEffectReason); } function hasBusinessExecutionOptimizationCompletion(index, completion) { if (!index || !completion) return false; const row = findExecutionRow(index, '优化完成度审计报告'); const expectedReady = Boolean(completion.readyForClaim); const expectedBlockingReasonCount = Array.isArray(completion.blockingReasons) ? completion.blockingReasons.length : Number(completion.blockingReasonCount || 0); return Boolean(row) && String(index.sourceFiles?.optimizationCompletion || '').includes('optimization-completion-summary.json') && String(row.mainFile || '').includes('optimization-completion-report.md') && String(row.expectedArtifact || '').includes('optimization-completion-summary.json') && row.status === (expectedReady ? 'ready_for_claim' : 'blocked') && Number(row.actionCount || 0) === expectedBlockingReasonCount && String(row.acceptance || '').includes(`readyForClaim=${expectedReady}`) && String(row.acceptance || '').includes(`proofGapOpenCount=${Number(completion.proofGapOpenCount || 0)}`) && String(row.boundary || '').includes('不得宣称提号率提升') && String(row.boundary || '').includes('客户效果达标') && String(row.boundary || '').includes('人工补号量下降'); } function findRowById(rows, id) { return (Array.isArray(rows) ? rows : []) .find(row => String(row.id || row.gapId || '') === id); } function hasDiscoveredProofArtifactSources(summary) { const history = String(summary?.sourceFiles?.history || '').replace(/\\/g, '/'); const customerEffect = String(summary?.sourceFiles?.customerEffect || '').replace(/\\/g, '/'); return history.includes('historical-dataset-audit.json') && customerEffect.includes('customer-effect-summary.json'); } function hasConcreteHistoricalFailure(row, prefix = '') { if (!row) return false; const requirements = missingProofRequirementText(row); return row.status !== 'closed' && row.status !== 'pass' && !isOnlyMissingFile(row, 'historical-dataset-audit.json') && ( requirements.includes(`${prefix}briefCount>=5`) || requirements.includes(`${prefix}items.length>=5`) || requirements.includes(`${prefix}acceptance.readyForCustomerEffectProof=true`) ); } function hasConcreteCustomerEffectFailure(row) { if (!row) return false; const requirements = missingProofRequirementText(row); return row.status !== 'closed' && row.status !== 'pass' && !isOnlyMissingFile(row, 'customer-effect-summary.json') && ( requirements.includes('acceptance.customerSelectedRateMeasured=true') || requirements.includes('currentHistoryAudit.briefCount>=5') || requirements.includes('acceptance.overallPass=true') ); } function isOnlyMissingFile(row, fileName) { const requirements = Array.isArray(row?.missingProofRequirements) ? row.missingProofRequirements.map(item => String(item || '').trim()).filter(Boolean) : []; return requirements.length === 1 && requirements[0] === `missing ${fileName}`; } function missingProofRequirementText(row) { return (Array.isArray(row?.missingProofRequirements) ? row.missingProofRequirements : []) .map(item => String(item || '')) .join('\n'); } function findExecutionRow(index, title) { return (Array.isArray(index?.rows) ? index.rows : []) .find(row => String(row.title || '').includes(title)); } function findExecutionRowTarget(index, title) { const row = findExecutionRow(index, title); return row?.mainFile || row?.expectedArtifact || ''; } function hasRealProofBundleLongRunReadiness(bundle, readiness) { if (!bundle || !readiness) return false; if (bundle.passed !== true || bundle.directCustomerProof !== false || bundle.proofLevel !== 'not_business_proof') return false; const expectedReady = Boolean(readiness.ready); const expectedFailCount = Number(readiness.counts?.fail ?? readiness.failCount ?? 0); const source = bundle.sourceState || {}; const reportPath = findTemplateFilePath(bundle, 'long-run-readiness-report.md'); const hasRecheckCommand = Array.isArray(bundle.recheckCommands) && bundle.recheckCommands.some(item => String(item.command || '').includes('longrun:readiness') && hasBoundaryText(item.boundary)); const hasExportRow = Array.isArray(bundle.exportRows) && bundle.exportRows.some(item => String(item.target || '').includes('long-run-readiness-report.md') || String(item.target || '').includes('longrun:readiness')); return reportPath.includes('long-run-readiness-report.md') && Boolean(source.longRunReadinessReady) === expectedReady && Number(source.longRunReadinessFailCount || 0) === expectedFailCount && source.longRunReadinessProofLevel === 'not_business_proof' && source.longRunReadinessDirectCustomerProof === false && hasRecheckCommand && hasExportRow; } function findTemplateFilePath(bundle, fileName) { const row = (Array.isArray(bundle?.templateFiles) ? bundle.templateFiles : []) .find(item => String(item.path || '').includes(fileName)); return row?.path || ''; } function hasIntakeFieldChecklist(checklist) { if (!checklist || checklist.passed !== true) return false; if (checklist.directCustomerProof !== false) return false; if (checklist.proofLevel !== 'smoke_or_local') return false; if (Number(checklist.itemCount || 0) < 1) return false; if (!Number.isFinite(Number(checklist.missingRequiredCount))) return false; if (!Number.isFinite(Number(checklist.placeholderCount))) return false; if (!hasChecklistOwnerGroups(checklist)) return false; if (!hasChecklistRecheckCommands(checklist)) return false; return Array.isArray(checklist.items) && checklist.items.length === Number(checklist.itemCount || 0) && checklist.items.every(item => item.owner && item.section && item.issueType && item.field && item.fixAction && String(item.boundary || '').includes('不证明') ); } function hasChecklistOwnerGroups(checklist) { return Array.isArray(checklist?.ownerGroups) && checklist.ownerGroups.length >= 1 && checklist.ownerGroups.every(item => item.owner && item.section && Number(item.itemCount || 0) >= 1 && Array.isArray(item.files) && item.files.length >= 1 && item.nextAction && item.acceptance && String(item.boundary || '').includes('不证明') ); } function hasChecklistRecheckCommands(checklist) { return Array.isArray(checklist?.recheckCommands) && checklist.recheckCommands.some(item => String(item.command || '').includes('intake:readiness')) && checklist.recheckCommands.some(item => String(item.command || '').includes('round:refresh')) && checklist.recheckCommands.every(item => item.stage && item.owner && item.command && item.acceptance && hasBoundaryText(item.boundary) ); } function hasBoundaryText(value) { const text = String(value || ''); return text.includes('不证明') || text.includes('不得') || text.includes('不能') || text.includes('只证明'); } function hasDedupedBusinessProofNextActions(nextActions, proofGap) { if (!nextActions || !Array.isArray(nextActions.actions)) return false; const expectedCount = Number(nextActions.sourceState?.proofGapOpenCount || proofGap?.unresolvedCount || 0); if (expectedCount > 0 && nextActions.actions.length !== expectedCount) return false; const titles = nextActions.actions.map(action => String(action.title || '')); const uniqueTitles = new Set(titles); if (uniqueTitles.size !== titles.length) return false; const requiredTitles = ['填真实历史 Brief', '填真实视频资源', '人工复核标注', '真实视频 A/B 验收']; if (expectedCount >= requiredTitles.length && !requiredTitles.every(title => uniqueTitles.has(title))) return false; const forbiddenDuplicateTitles = ['真实材料预审', '历史数据导入', '历史数据审计', '视频资源就绪审计', '长跑前门禁', '运行策略矩阵', '视频 A/B 验收', '商务复核指标', '客户效果审计']; if (titles.some(title => forbiddenDuplicateTitles.includes(title))) return false; const ownerSet = new Set(nextActions.actions.map(action => String(action.owner || ''))); return ownerSet.has('商务') && (ownerSet.has('商务/投放') || ownerSet.has('技术/AI')); } function hasBusinessProofNextActionsMissingProofRequirements(nextActions) { if (!nextActions || !Array.isArray(nextActions.actions)) return false; const required = new Map([ ['填真实历史 Brief', 'briefCount>=5'], ['填真实视频资源', 'counts.realCandidateRows>=1'], ['人工复核标注', 'acceptance.customerSelectedRateMeasured=true'], ['真实视频 A/B 验收', 'proofContext.mode=live'], ['真实 live/provider 长跑证明', 'manifest.liveEnabled=true'] ]); if (!nextActions.actions.length) return false; for (const action of nextActions.actions) { const title = String(action.title || ''); const missing = Array.isArray(action?.missingProofRequirements) ? action.missingProofRequirements : []; if (missing.length < 1) return false; const requiredProof = required.get(title); if (requiredProof && !missing.includes(requiredProof)) return false; } return countRowsWithMissingProofRequirements(nextActions.actions) === nextActions.actions.length; } function hasBusinessProofNextActionsStalePipelineSuppression(nextActions) { if (!nextActions || !nextActions.sourceState) return false; if (nextActions.sourceState.pipelineStale !== true) return true; const actions = Array.isArray(nextActions.actions) ? nextActions.actions : []; return Number(nextActions.sourceState.pipelineNextActionCount || 0) === 0 && Number(nextActions.sourceState.pipelineSuppressedNextActionCount || 0) >= 1 && String(nextActions.sourceState.pipelineStaleReason || '').includes('stale') && actions.every(action => !String(action.source || '').includes('optimization-pipeline')); } function hasHandoffBusinessProofNextActions(entry, source) { if (!entry || !source) return false; const sourceActions = Array.isArray(source.actions) ? source.actions : []; const topActions = Array.isArray(entry.topActions) ? entry.topActions : []; const expectedOpen = Number(source.sourceState?.proofGapOpenCount || 0); const expectedOwnerCount = Array.isArray(source.ownerGroups) && source.ownerGroups.length ? source.ownerGroups.length : Math.max(1, new Set(sourceActions.map(action => action.owner).filter(Boolean)).size); if (sourceActions.length < 1) return false; return entry.complete === false && Number(entry.actionCount || 0) === sourceActions.length && Number(entry.ownerGroupCount || 0) >= expectedOwnerCount && Number(entry.ownerArtifactCount || 0) >= expectedOwnerCount && topActions.length >= Math.min(5, sourceActions.length) && topActions.every(action => action.owner && action.title && action.command && action.acceptance) && topActions.some(action => String(action.command || '').includes('history-data-template.csv')) && topActions.some(action => String(action.command || '').includes('acceptance:video-ab')) && (expectedOpen <= 0 || Number(entry.sourceState?.proofGapOpenCount || 0) === expectedOpen); } function hasPassingProofGapSoftwareForm(form, proofGap) { if (!form) return false; if (form.passed !== true || form.headerMatches !== true || form.rowWidthOk !== true) return false; if (Number(form.duplicateIdCount || 0) !== 0) return false; const requiredTitles = ['真实历史 Brief 数据集', '真实视频资源表', '真实视频证据 A/B', '真实 live/provider 长跑证明', '商务复核和客户效果']; if (Number(form.rowCount || 0) !== requiredTitles.length) return false; const actualTitles = new Set(Array.isArray(form.actualTitles) ? form.actualTitles : []); return requiredTitles.every(title => actualTitles.has(title)); } function hasPassingLatestFormIndex(index) { if (!index || index.passed !== true) return false; if (index.primaryForm?.directCustomerProof !== false) return false; if (index.clientList?.directCustomerProof !== false) return false; if (!String(index.primaryForm?.csv || '').includes('tihao-proof-gap-software-form.csv')) return false; if (!String(index.clientList?.csv || '').includes('software-client-list.final.csv')) return false; if (!Array.isArray(index.nextActions?.ownerArtifacts) || index.nextActions.ownerArtifacts.length < 1) return false; if (!Number.isFinite(Number(index.nextActions?.actionCount)) || Number(index.nextActions.actionCount) < 1) return false; const owners = new Set(index.nextActions.ownerArtifacts.map(item => String(item.owner || ''))); return owners.has('商务') && (owners.has('商务/投放') || owners.has('技术/AI')); } function hasLatestFormClientListDeliveryQuality(index) { const item = index?.clientList; if (!item) return false; if (item.directCustomerProof !== false) return false; if (!String(item.csv || '').includes('software-client-list.final.csv')) return false; if (!String(item.summary || '').includes('software-client-list.final.summary.json')) return false; if (!Number.isFinite(Number(item.rowCount)) || Number(item.rowCount) < 1) return false; if (!Number.isFinite(Number(item.sourceDuplicateRemovedCount)) || Number(item.sourceDuplicateRemovedCount) < 0) return false; if (!Number.isFinite(Number(item.finalDuplicateGroupCount)) || Number(item.finalDuplicateGroupCount) !== 0) return false; if (item.duplicateCountMeaning !== 'source_duplicate_removed_count') return false; return item.rankContinuous === true; } function hasRealProofClosureWorkOrder(item) { if (!item) return false; const ownerArtifactCount = realProofWorkOrderOwnerArtifactCount(item); const ownerGroupCount = Number(item.ownerGroupCount || 0); return item.passed === true && item.complete === false && item.proofLevel === 'not_business_proof' && item.materialType === 'real_proof_closure_work_order' && item.directCustomerProof === false && item.canCloseProofGap === false && item.requiresHumanRealMaterial === true && Number(item.workOrderCount || 0) >= 5 && ownerGroupCount >= 1 && ownerArtifactCount >= ownerGroupCount && Number(item.sourceState?.proofGapOpenCount || 0) >= 1 && Number(item.sourceState?.intakeFailureCount || 0) >= 1 && Number(item.sourceState?.realCandidateRows || 0) >= 0; } function hasActionableRealProofClosureWorkOrder(item) { if (!hasRealProofClosureWorkOrder(item)) return false; if (!Array.isArray(item.workOrders) || item.workOrders.length < 5) return false; const owners = new Set(item.workOrders.map(row => String(row.owner || ''))); if (!owners.has('商务') || !owners.has('技术/AI')) return false; const hasFieldLevelRows = item.workOrders.every(row => row.id && row.owner && row.targetFile && Array.isArray(row.targetFields) && row.targetFields.length >= 1 && row.rowSelector && row.requiredAction && row.acceptanceCommand && row.acceptance && row.requiresHumanRealMaterial === true && row.directCustomerProof === false && row.canCloseProofGap === false && row.proofLevel === 'not_business_proof' ); return hasFieldLevelRows && item.workOrders.some(row => String(row.targetFile || '').includes('history-data-template.csv')) && item.workOrders.some(row => String(row.targetFile || '').includes('video-resource-template.csv')) && item.workOrders.some(row => String(row.targetFile || '').includes('manual-review-template.csv')) && hasRealProofWorkOrderOwnerArtifacts(item.ownerArtifacts); } function hasLatestFormRealProofClosureWorkOrder(index, source) { const item = index?.realProofClosureWorkOrder; if (!hasIndexedRealProofClosureWorkOrder(item)) return false; if (!source) return true; return Number(item.workOrderCount || 0) === Number(source.workOrderCount || 0) && Number(item.ownerGroupCount || 0) === Number(source.ownerGroupCount || 0) && realProofWorkOrderOwnerArtifactCount(item) === realProofWorkOrderOwnerArtifactCount(source) && Number(item.proofGapOpenCount || 0) === Number(source.sourceState?.proofGapOpenCount || 0); } function hasHandoffRealProofClosureWorkOrder(handoff, source) { const item = handoff?.realProofClosureWorkOrder; if (!hasIndexedRealProofClosureWorkOrder(item)) return false; if (!source) return true; return Number(item.workOrderCount || 0) === Number(source.workOrderCount || 0) && Number(item.ownerGroupCount || 0) === Number(source.ownerGroupCount || 0) && realProofWorkOrderOwnerArtifactCount(item) === realProofWorkOrderOwnerArtifactCount(source) && Number(item.proofGapOpenCount || 0) === Number(source.sourceState?.proofGapOpenCount || 0); } function hasHandoffLatestFormRealProofClosureWorkOrder(handoff, latestFormIndex) { const item = handoff?.latestFormIndex?.realProofClosureWorkOrder; if (!hasIndexedRealProofClosureWorkOrder(item)) return false; const source = latestFormIndex?.realProofClosureWorkOrder; if (!source) return true; return Number(item.workOrderCount || 0) === Number(source.workOrderCount || 0) && Number(item.ownerGroupCount || 0) === Number(source.ownerGroupCount || 0) && realProofWorkOrderOwnerArtifactCount(item) === realProofWorkOrderOwnerArtifactCount(source) && Number(item.proofGapOpenCount || 0) === Number(source.proofGapOpenCount || 0); } function hasIndexedRealProofClosureWorkOrder(item) { if (!item) return false; const ownerArtifactCount = realProofWorkOrderOwnerArtifactCount(item); const ownerGroupCount = Number(item.ownerGroupCount || 0); return item.directCustomerProof === false && item.canCloseProofGap === false && item.proofLevel === 'not_business_proof' && item.materialType === 'real_proof_closure_work_order' && String(item.markdown || item.report || '').includes('real-proof-closure-work-order.md') && String(item.csv || '').includes('real-proof-closure-work-order.csv') && String(item.summary || '').includes('real-proof-closure-work-order-summary.json') && Number(item.workOrderCount || 0) >= 5 && ownerGroupCount >= 1 && ownerArtifactCount >= ownerGroupCount && Number(item.proofGapOpenCount || 0) >= 1 && hasRealProofWorkOrderOwnerArtifacts(item.ownerArtifacts); } function hasRealProofWorkOrderOwnerArtifacts(ownerArtifacts) { if (!Array.isArray(ownerArtifacts) || ownerArtifacts.length < 1) return false; return ownerArtifacts.every(item => { const slug = workOrderOwnerSlug(item); return item.owner && Number(item.workOrderCount || 0) >= 1 && String(item.markdown || '').includes(`by-owner/${slug}.md`) && String(item.csv || '').includes(`by-owner/${slug}.csv`); }); } function realProofWorkOrderOwnerArtifactCount(item) { if (Number.isFinite(Number(item?.ownerArtifactCount))) return Number(item.ownerArtifactCount); if (Array.isArray(item?.ownerArtifacts)) return item.ownerArtifacts.length; return null; } function hasLocalSeedToIntakeWorklist(item) { if (!item) return false; return item.proofLevel === 'not_business_proof' && item.directCustomerProof === false && item.canCloseProofGap === false && worklistCount(item, 'historyDraftRows') >= 1 && worklistCount(item, 'referenceSeedRows') >= 1 && worklistCount(item, 'candidateSeedRows') >= 1 && worklistCount(item, 'videoWorklistRows') >= 1 && worklistCount(item, 'videoCandidateNeedsResourceRows') >= 1 && Array.isArray(item.targetFiles) && item.targetFiles.some(file => String(file || '').includes('history-data-template.csv')) && item.targetFiles.some(file => String(file || '').includes('video-resource-template.csv')) && Array.isArray(item.missingProofRequirements) && item.missingProofRequirements.length >= 1 && Array.isArray(item.nextActions) && item.nextActions.length >= 1; } function hasLatestFormLocalSeedToIntakeWorklist(index, source) { const item = index?.localSeedToIntakeWorklist; if (!hasIndexedLocalSeedToIntakeWorklist(item)) return false; if (!source) return true; return worklistCount(item, 'historyDraftRows') === worklistCount(source, 'historyDraftRows') && worklistCount(item, 'candidateSeedRows') === worklistCount(source, 'candidateSeedRows') && worklistCount(item, 'videoCandidateNeedsResourceRows') === worklistCount(source, 'videoCandidateNeedsResourceRows'); } function hasHandoffLocalSeedToIntakeWorklist(handoff, source) { const item = handoff?.localSeedToIntakeWorklist; if (!hasIndexedLocalSeedToIntakeWorklist(item)) return false; if (!source) return true; return worklistCount(item, 'historyDraftRows') === worklistCount(source, 'historyDraftRows') && worklistCount(item, 'candidateSeedRows') === worklistCount(source, 'candidateSeedRows') && worklistCount(item, 'videoCandidateNeedsResourceRows') === worklistCount(source, 'videoCandidateNeedsResourceRows'); } function hasHandoffLatestFormLocalSeedToIntakeWorklist(handoff, index) { const item = handoff?.latestFormIndex?.localSeedToIntakeWorklist; if (!hasIndexedLocalSeedToIntakeWorklist(item)) return false; const source = index?.localSeedToIntakeWorklist; if (!source) return true; return worklistCount(item, 'historyDraftRows') === worklistCount(source, 'historyDraftRows') && worklistCount(item, 'candidateSeedRows') === worklistCount(source, 'candidateSeedRows') && worklistCount(item, 'videoCandidateNeedsResourceRows') === worklistCount(source, 'videoCandidateNeedsResourceRows'); } function hasIndexedLocalSeedToIntakeWorklist(item) { if (!item) return false; return item.directCustomerProof === false && item.canCloseProofGap === false && String(item.markdown || '').includes('local-seed-to-intake-worklist.md') && String(item.csv || '').includes('local-seed-to-intake-worklist.csv') && String(item.summary || '').includes('local-seed-to-intake-worklist-summary.json') && String(item.historyDraft || '').includes('history-intake-draft.csv') && String(item.videoWorklist || '').includes('video-resource-worklist.csv') && String(item.candidateWorklist || '').includes('candidate-seed-worklist.csv') && worklistCount(item, 'historyDraftRows') >= 1 && worklistCount(item, 'candidateSeedRows') >= 1 && worklistCount(item, 'videoCandidateNeedsResourceRows') >= 1; } function hasRealGapMaterialAudit(item) { if (!item) return false; const gaps = Array.isArray(item.gaps) ? item.gaps : []; return item.proofLevel === 'not_business_proof' && item.materialType === 'three_real_gap_material_audit' && item.directCustomerProof === false && item.canCloseProofGap === false && item.complete === false && Number(item.gapCount || 0) === 3 && Number(item.materialFoundCount || 0) === 3 && Number(item.openGapCount || 0) >= 1 && (gaps.length === 0 || gaps.every(gap => gap.projectMaterialFound === true && gap.canCloseNow === false)); } function hasLatestFormRealGapMaterialAudit(index, source) { const item = index?.realGapMaterialAudit; if (!hasIndexedRealGapMaterialAudit(item)) return false; if (!source) return true; return Number(item.materialFoundCount || 0) === Number(source.materialFoundCount || 0) && Number(item.openGapCount || 0) === Number(source.openGapCount || 0); } function hasHandoffRealGapMaterialAudit(handoff, source) { const item = handoff?.realGapMaterialAudit; if (!hasIndexedRealGapMaterialAudit(item)) return false; if (!source) return true; return Number(item.materialFoundCount || 0) === Number(source.materialFoundCount || 0) && Number(item.openGapCount || 0) === Number(source.openGapCount || 0); } function hasHandoffLatestFormRealGapMaterialAudit(handoff, index) { const item = handoff?.latestFormIndex?.realGapMaterialAudit; if (!hasIndexedRealGapMaterialAudit(item)) return false; const source = index?.realGapMaterialAudit; if (!source) return true; return Number(item.materialFoundCount || 0) === Number(source.materialFoundCount || 0) && Number(item.openGapCount || 0) === Number(source.openGapCount || 0); } function hasIndexedRealGapMaterialAudit(item) { if (!item) return false; return item.directCustomerProof === false && item.canCloseProofGap === false && item.proofLevel === 'not_business_proof' && item.materialType === 'three_real_gap_material_audit' && String(item.markdown || item.report || '').includes('real-gap-material-audit.md') && String(item.csv || '').includes('real-gap-material-audit.csv') && String(item.summary || '').includes('real-gap-material-audit-summary.json') && Number(item.gapCount || 0) === 3 && Number(item.materialFoundCount || 0) === 3 && Number(item.openGapCount || 0) >= 1; } function hasLatestFormNextActionTopActions(index, source) { const sourceActions = Array.isArray(source?.actions) ? source.actions : []; const topActions = Array.isArray(index?.nextActions?.topActions) ? index.nextActions.topActions : []; const expectedActionCount = sourceActions.length; const expectedOpen = Number(source?.sourceState?.proofGapOpenCount || 0); if (!index || expectedActionCount < 1) return false; return index.nextActions?.complete === false && Number(index.nextActions.actionCount || 0) === expectedActionCount && (expectedOpen <= 0 || Number(index.nextActions.proofOpenCount || 0) === expectedOpen) && (expectedOpen <= 0 || Number(index.nextActions.sourceState?.proofGapOpenCount || 0) === expectedOpen) && topActions.length >= Math.min(5, expectedActionCount) && topActions.every(action => action.owner && action.title && action.command && action.acceptance) && topActions.some(action => String(action.id || '') === 'step-03' && String(action.command || '').includes('history-data-template.csv')) && topActions.some(action => String(action.id || '') === 'gap-video-ab-live-proof' && String(action.command || '').includes('acceptance:video-ab')); } function hasHandoffLatestFormNextActionTopActions(handoff, latestFormIndex) { const item = handoff?.latestFormIndex; const expectedTopCount = Array.isArray(latestFormIndex?.nextActions?.topActions) ? latestFormIndex.nextActions.topActions.length : 0; const expectedOpen = Number(latestFormIndex?.nextActions?.sourceState?.proofGapOpenCount || latestFormIndex?.nextActions?.proofOpenCount || 0); const topActions = Array.isArray(item?.topActions) ? item.topActions : []; if (!item || expectedTopCount < 1) return false; return item.complete === false && Number(item.actionCount || 0) === Number(latestFormIndex?.nextActions?.actionCount || 0) && Number(item.proofOpenCount || 0) === Number(latestFormIndex?.nextActions?.proofOpenCount || 0) && (expectedOpen <= 0 || Number(item.sourceState?.proofGapOpenCount || 0) === expectedOpen) && topActions.length === expectedTopCount && topActions.some(action => String(action.id || '') === 'step-03' && String(action.command || '').includes('history-data-template.csv')) && topActions.some(action => String(action.id || '') === 'gap-video-ab-live-proof' && String(action.command || '').includes('acceptance:video-ab')); } function hasLatestFormBusinessExecutionIndex(index, businessExecutionIndex) { if (!index || !businessExecutionIndex) return false; const item = index.businessExecutionIndex; return Boolean(item) && item.directCustomerProof === false && String(item.markdown || '').includes('business-execution-index.md') && String(item.csv || '').includes('business-execution-index.csv') && String(item.summary || '').includes('business-execution-index-summary.json') && Number(item.rowCount || 0) === Number(businessExecutionIndex.rowCount || 0) && Number(item.operatorPackOwnerArtifactCount || 0) === Number(businessExecutionIndex.operatorPackOwnerArtifactCount || 0) && Number(item.fieldOwnerRowCount || 0) === Number(businessExecutionIndex.fieldOwnerRowCount || 0) && Number(item.recheckCommandRowCount || 0) === Number(businessExecutionIndex.recheckCommandRowCount || 0); } function hasLatestFormRepairActions(index) { return hasRepairActionLinks(index?.repairActions); } function hasLatestFormProofGapOperatorPack(index, pack) { return hasProofGapOperatorPackEntry(index?.proofGapOperatorPack, pack); } function hasHandoffProofGapOperatorPack(handoff, pack) { return hasProofGapOperatorPackEntry(handoff?.proofGapOperatorPack, pack) && hasProofGapOperatorPackEntry(handoff?.latestFormIndex?.proofGapOperatorPack, pack); } function hasProofGapOperatorPackEntry(item, pack) { if (!item || !pack) return false; const expectedGapIds = proofGapOperatorGapIds(pack); const itemGapIds = proofGapOperatorGapIds(item); const expectedOwnerArtifactCount = expectedProofGapOwnerArtifactCount(pack); return item.directCustomerProof === false && item.proofLevel === 'not_business_proof' && String(item.markdown || item.report || '').includes('proof-gap-operator-pack.md') && String(item.csv || '').includes('proof-gap-operator-pack.csv') && String(item.summary || '').includes('proof-gap-operator-pack-summary.json') && Number(item.rowCount || 0) === Number(pack.rowCount || 0) && Number(item.openCount || 0) === Number(pack.openCount || 0) && Number(item.ownerGroupCount || 0) >= expectedOwnerArtifactCount && Number(item.ownerArtifactCount || 0) >= expectedOwnerArtifactCount && hasProofGapOperatorOwnerArtifacts(item.ownerArtifacts, pack) && Number(item.recheckCommandCount || 0) >= 5 && Number(item.evidenceRowCount || 0) >= Number(pack.rowCount || 0) && Number(item.nextActionCount || 0) >= Number(pack.rowCount || 0) && expectedGapIds.length >= 5 && expectedGapIds.every(id => itemGapIds.includes(id)); } function hasProofGapOperatorOwnerArtifacts(ownerArtifacts, expectedSource = null) { if (!Array.isArray(ownerArtifacts) || ownerArtifacts.length < 1) return false; const expectedArtifacts = expectedProofGapOwnerArtifacts(expectedSource && Array.isArray(expectedSource.ownerArtifacts) ? expectedSource : { ownerArtifacts }); if (ownerArtifacts.length < expectedArtifacts.length) return false; return expectedArtifacts.every(expected => { const item = ownerArtifacts.find(candidate => candidate.owner === expected.owner); return hasProofGapOperatorOwnerArtifact(item, proofGapOwnerSlug(expected)); }); } function hasProofGapOperatorOwnerArtifact(item, slug) { return Boolean(item) && String(item.markdown || '').includes(`by-owner/${slug}.md`) && String(item.csv || '').includes(`by-owner/${slug}.csv`) && Number(item.actionCount || 0) >= 1 && Number(item.evidenceRowCount || 0) >= 1 && Number(item.nextActionCount || 0) >= 1; } function hasLongRunReadinessEntry(item, readiness) { if (!item || !readiness) return false; const ready = Boolean(readiness.ready); const expectedProofLevel = ready ? 'smoke_or_local' : 'not_business_proof'; const expectedFailCount = Number(readiness.counts?.fail ?? readiness.failCount ?? 0); const itemFailCount = Number(item.failCount ?? item.counts?.fail ?? 0); return item.directCustomerProof === false && item.proofLevel === expectedProofLevel && Boolean(item.ready) === ready && itemFailCount === expectedFailCount && String(item.report || item.markdown || '').includes('long-run-readiness-report.md') && String(item.summary || '').includes('long-run-readiness-summary.json'); } function hasLatestFormLongRunReadiness(index, readiness) { return hasLongRunReadinessEntry(index?.longRunReadiness, readiness); } function hasHandoffLongRunReadiness(handoff, readiness) { return hasLongRunReadinessEntry(handoff?.longRunReadiness, readiness); } function hasLatestFormIntakeFieldChecklist(index, checklist) { if (!index || !checklist) return false; const item = index.intakeFieldChecklist; return Boolean(item) && item.directCustomerProof === false && Number(item.itemCount || 0) === Number(checklist.itemCount || 0) && Number(item.missingRequiredCount || 0) === Number(checklist.missingRequiredCount || 0) && Number(item.placeholderCount || 0) === Number(checklist.placeholderCount || 0) && String(item.markdown || '').includes('intake-field-checklist.md') && String(item.csv || '').includes('intake-field-checklist.csv') && String(item.summary || '').includes('intake-field-checklist-summary.json'); } function hasLatestFormIntakeOwnerRecheck(index, checklist) { if (!index || !checklist) return false; const item = index.intakeFieldChecklist; if (!item) return false; if (!hasChecklistOwnerGroups(item)) return false; if (!hasChecklistRecheckCommands(item)) return false; if (Array.isArray(checklist.ownerGroups) && item.ownerGroups.length !== checklist.ownerGroups.length) return false; if (Array.isArray(checklist.recheckCommands) && item.recheckCommands.length !== checklist.recheckCommands.length) return false; return item.recheckCommands.some(command => String(command.command || '').includes('acceptance:video-ab')) && item.recheckCommands.some(command => String(command.command || '').includes('customer-effect:audit')) && item.ownerGroups.some(group => String(group.owner || '').includes('鍟嗗姟') || String(group.owner || '').includes('商务')); } function hasManualReviewLabelGuide(guide) { if (!guide) return false; return guide.passed === true && guide.directCustomerProof === false && String(guide.proofLevel || '') === 'smoke_or_local' && Number(guide.labelCount || 0) >= 8 && Number(guide.positiveLabelCount || 0) >= 2 && Number(guide.negativeLabelCount || 0) >= 5 && Number(guide.attributionTypeCount || 0) >= 8 && guide.negativeLabelsRequireAttribution === true && Array.isArray(guide.labels) && guide.labels.some(item => String(item.label || '') === '可直接发客户') && guide.labels.some(item => String(item.label || '') === '跑偏' && item.requiresAttribution === true) && Array.isArray(guide.attributionTypes) && guide.attributionTypes.some(item => String(item.type || '') === '视频证据误判'); } function hasLatestFormManualReviewLabelGuide(index, guide) { if (!index || !guide) return false; const item = index.manualReviewLabelGuide; return Boolean(item) && item.directCustomerProof === false && String(item.proofLevel || '') === 'smoke_or_local' && String(item.markdown || '').includes('manual-review-label-guide.md') && String(item.csv || '').includes('manual-review-label-guide.csv') && Number(item.labelCount || 0) === Number(guide.labelCount || 0) && Number(item.attributionTypeCount || 0) === Number(guide.attributionTypeCount || 0) && item.negativeLabelsRequireAttribution === true; } function hasPlanExecutionStatus(status, closure) { if (!status) return false; const guardrails = Array.isArray(status.guardrails) ? status.guardrails.join('\n') : ''; return status.passed === true && status.complete === false && Number(status.rowCount || 0) === 8 && Number(status.proofOpenCount || 0) === Number(closure?.openCount || 0) && Number(status.proofOpenCount || 0) >= 1 && guardrails.includes('proofOpenCount') && guardrails.includes('客户效果'); } function hasPlanExecutionOperatorOwnerArtifacts(status, pack, businessExecutionIndex) { if (!status || !pack || !businessExecutionIndex) return false; const expectedCount = expectedProofGapOwnerArtifactCount(pack); return Number(status.operatorPackOwnerArtifactCount || 0) === Number(pack.ownerArtifactCount || 0) && Number(status.operatorPackOwnerArtifactCount || 0) >= expectedCount && Number(status.businessExecutionOperatorPackOwnerArtifactCount || 0) === Number(businessExecutionIndex.operatorPackOwnerArtifactCount || 0) && Number(status.businessExecutionOperatorPackOwnerArtifactRowCount || 0) === Number(businessExecutionIndex.operatorPackOwnerArtifactRowCount || 0) && hasProofGapOperatorOwnerArtifacts(status.operatorPackOwnerArtifacts, pack); } function hasLatestFormPlanExecutionStatus(index, status) { if (!index || !status) return false; const item = index.planExecutionStatus; return Boolean(item) && item.directCustomerProof === false && String(item.markdown || '').includes('plan-execution-status.md') && String(item.csv || '').includes('plan-execution-status.csv') && String(item.summary || '').includes('plan-execution-status-summary.json') && Number(item.rowCount || 0) === Number(status.rowCount || 0) && Number(item.proofOpenCount || 0) === Number(status.proofOpenCount || 0) && Number(item.operatorPackOwnerArtifactCount || 0) === Number(status.operatorPackOwnerArtifactCount || 0) && Number(item.businessExecutionOperatorPackOwnerArtifactRowCount || 0) === Number(status.businessExecutionOperatorPackOwnerArtifactRowCount || 0) && hasProofGapOperatorOwnerArtifacts(item.operatorPackOwnerArtifacts, status) && Boolean(item.complete) === Boolean(status.complete); } function hasHandoffPlanExecutionStatus(handoff, status) { if (!handoff || !status) return false; const item = handoff.planExecutionStatus; return Boolean(item) && item.directCustomerProof === false && String(item.markdown || '').includes('plan-execution-status.md') && String(item.csv || '').includes('plan-execution-status.csv') && String(item.summary || '').includes('plan-execution-status-summary.json') && Number(item.rowCount || 0) === Number(status.rowCount || 0) && Number(item.proofOpenCount || 0) === Number(status.proofOpenCount || 0) && Number(item.operatorPackOwnerArtifactCount || 0) === Number(status.operatorPackOwnerArtifactCount || 0) && Number(item.businessExecutionOperatorPackOwnerArtifactRowCount || 0) === Number(status.businessExecutionOperatorPackOwnerArtifactRowCount || 0) && hasProofGapOperatorOwnerArtifacts(item.operatorPackOwnerArtifacts, status) && Boolean(item.complete) === Boolean(status.complete); } function hasHandoffLatestFormManualReviewLabelGuide(handoff, index) { if (!handoff || !index) return false; const item = handoff.latestFormIndex?.manualReviewLabelGuide; const indexed = index.manualReviewLabelGuide; return Boolean(item) && Boolean(indexed) && item.directCustomerProof === false && String(item.markdown || '').includes('manual-review-label-guide.md') && Number(item.labelCount || 0) === Number(indexed.labelCount || 0) && Number(item.attributionTypeCount || 0) === Number(indexed.attributionTypeCount || 0) && item.negativeLabelsRequireAttribution === true; } function hasLatestFormBusinessFillGuide(index) { const guide = index?.businessFillGuide; const rows = Array.isArray(guide?.rows) ? guide.rows : []; return Boolean(guide) && guide.directCustomerProof === false && guide.proofLevel === 'smoke_or_local' && Number(guide.rowCount || 0) === rows.length && rows.length >= 2 && rows.some(row => String(row.section || '') === 'history' && String(row.file || '').includes('history-data-template.csv')) && rows.some(row => String(row.section || '') === 'video' && String(row.file || '').includes('video-resource-template.csv')) && rows.some(row => String(row.recheckCommand || '').includes('video:resource-readiness') || String(row.recheckCommand || '').includes('acceptance:video-ab')) && rows.every(row => String(row.boundary || '').includes('不证明') || String(row.boundary || '').includes('璇佹槑')); } function hasLatestFormSupportDocs(index) { return Boolean(findSupportDocPath(index, 'tihao-experience-optimization-plan.zh-CN.md')) && Boolean(findSupportDocPath(index, 'business-proof-action-order.zh-CN.md')); } function hasHandoffSupportDocs(handoff) { return Boolean(findSupportDocPath(handoff, 'tihao-experience-optimization-plan.zh-CN.md')) && Boolean(findSupportDocPath(handoff, 'business-proof-action-order.zh-CN.md')); } function findSupportDocPath(index, filename) { const docs = Array.isArray(index?.supportDocs) ? index.supportDocs : []; const found = docs.find(item => String(item.path || item.doc || '').includes(filename)); return found?.path || found?.doc || ''; } function hasHandoffLatestFormIndex(handoff, index) { if (!handoff || !index) return false; const item = handoff.latestFormIndex; return Boolean(item) && item.passed === true && String(item.report || '').includes('latest-form-index.md') && String(item.primaryFormCsv || '').includes('tihao-proof-gap-software-form.csv') && String(item.clientListCsv || '').includes('software-client-list.final.csv'); } function hasHandoffLatestFormIndexIntakeOwnerRecheck(handoff, index) { if (!handoff || !index) return false; const item = handoff.latestFormIndex?.intakeFieldChecklist; const indexed = index.intakeFieldChecklist; if (!item || !indexed) return false; const indexedOwnerGroups = Array.isArray(indexed.ownerGroups) ? indexed.ownerGroups.length : 0; const indexedRecheckCommands = Array.isArray(indexed.recheckCommands) ? indexed.recheckCommands.length : 0; if (indexedOwnerGroups < 1 || indexedRecheckCommands < 1) return false; const itemOwnerGroups = Array.isArray(item.ownerGroups) ? item.ownerGroups.length : Number(item.ownerGroupCount || 0); const itemRecheckCommands = Array.isArray(item.recheckCommands) ? item.recheckCommands.length : Number(item.recheckCommandCount || 0); return itemOwnerGroups === indexedOwnerGroups && itemRecheckCommands === indexedRecheckCommands; } function hasHandoffLatestFormBusinessFillGuide(handoff, index) { if (!handoff || !index) return false; const item = handoff.latestFormIndex?.businessFillGuide; const indexed = index.businessFillGuide; if (!item || !indexed) return false; const itemRows = Array.isArray(item.rows) ? item.rows : []; const indexedRows = Array.isArray(indexed.rows) ? indexed.rows : []; return item.directCustomerProof === false && item.proofLevel === 'smoke_or_local' && Number(item.rowCount || 0) === Number(indexed.rowCount || indexedRows.length || 0) && itemRows.length === indexedRows.length && itemRows.length >= 2 && itemRows.some(row => String(row.section || '') === 'history' && String(row.file || '').includes('history-data-template.csv')) && itemRows.some(row => String(row.section || '') === 'video' && String(row.recheckCommand || '').includes('video:resource-readiness')) && itemRows.every(row => String(row.boundary || '').includes('不证明') || String(row.boundary || '').includes('璇佹槑')); } function hasHandoffLatestFormLongRunReadiness(handoff, index) { if (!handoff || !index) return false; const item = handoff.latestFormIndex?.longRunReadiness; const indexed = index.longRunReadiness; if (!item || !indexed) return false; const indexedReady = Boolean(indexed.ready); const indexedFailCount = Number(indexed.failCount ?? indexed.counts?.fail ?? 0); return hasLongRunReadinessEntry(item, { ready: indexedReady, counts: { fail: indexedFailCount } }) && String(item.report || '') === String(indexed.report || '') && String(item.summary || '') === String(indexed.summary || ''); } function hasHandoffLatestFormRepairActions(handoff) { return hasRepairActionLinks(handoff?.latestFormIndex?.repairActions); } function hasHandoffBusinessExecutionIndex(handoff, index) { if (!handoff || !index) return false; const item = handoff.businessExecutionIndex; return Boolean(item) && item.passed === true && item.directCustomerProof === false && Number(item.rowCount || 0) === Number(index.rowCount || 0) && Number(item.operatorPackOwnerArtifactCount || 0) === Number(index.operatorPackOwnerArtifactCount || 0) && Number(item.proofOpenCount || 0) === Number(index.proofOpenCount || 0) && String(item.report || '').includes('business-execution-index.md') && String(item.csv || '').includes('business-execution-index.csv') && String(item.summary || '').includes('business-execution-index-summary.json'); } function hasHandoffBusinessExecutionOperatorOwnerArtifacts(handoff, index) { if (!handoff || !index) return false; const item = handoff.businessExecutionIndex; return Boolean(item) && Number(item.operatorPackOwnerArtifactCount || 0) === Number(index.operatorPackOwnerArtifactCount || 0) && Number(item.operatorPackOwnerArtifactRowCount || 0) === Number(index.operatorPackOwnerArtifactRowCount || 0) && hasProofGapOperatorOwnerArtifacts(item.operatorPackOwnerArtifacts); } function hasHandoffBusinessExecutionLongRunReadiness(handoff, index, readiness) { if (!handoff || !index || !readiness) return false; const item = handoff.businessExecutionIndex?.longRunReadiness; const row = findExecutionRow(index, '长跑前置门禁报告'); if (!item || !row) return false; const expectedReady = Boolean(readiness.ready); const expectedFailCount = Number(readiness.counts?.fail ?? readiness.failCount ?? 0); return String(item.report || '').includes('long-run-readiness-report.md') && String(item.summary || '').includes('long-run-readiness-summary.json') && String(item.expectedArtifact || '').includes('long-run-readiness-summary.json') && String(item.status || '') === (expectedReady ? 'ready' : 'blocked') && Boolean(item.ready) === expectedReady && Number(item.failCount || 0) === expectedFailCount && Number(item.actionCount || 0) === Number(row.actionCount || 0) && item.directCustomerProof === false && item.proofLevel === (expectedReady ? 'smoke_or_local' : 'not_business_proof') && String(item.boundary || '').includes('不证明客户效果') && String(item.boundary || '').includes('不能启动'); } function hasHandoffOptimizationCompletion(handoff, completion) { if (!handoff || !completion) return false; const item = handoff.optimizationCompletion; const expectedBlockingReasonCount = Array.isArray(completion.blockingReasons) ? completion.blockingReasons.length : Number(completion.blockingReasonCount || 0); return Boolean(item) && String(item.report || '').includes('optimization-completion-report.md') && String(item.summary || '').includes('optimization-completion-summary.json') && item.directCustomerProof === false && item.proofLevel === (completion.readyForClaim ? 'real_evidence' : 'not_business_proof') && Boolean(item.complete) === Boolean(completion.complete) && Boolean(item.readyForClaim) === Boolean(completion.readyForClaim) && Number(item.proofGapOpenCount || 0) === Number(completion.proofGapOpenCount || 0) && Number(item.blockingReasonCount || 0) === expectedBlockingReasonCount && item.canClaim?.tihaoRateImproved === Boolean(completion.canClaim?.tihaoRateImproved) && item.canClaim?.customerEffectAchieved === Boolean(completion.canClaim?.customerEffectAchieved) && item.canClaim?.manualSupplementReduced === Boolean(completion.canClaim?.manualSupplementReduced); } function hasHandoffBusinessExecutionOptimizationCompletion(handoff, index, completion) { if (!handoff || !index || !completion) return false; const item = handoff.businessExecutionIndex?.optimizationCompletion; const row = findExecutionRow(index, '优化完成度审计报告'); if (!item || !row) return false; const expectedReady = Boolean(completion.readyForClaim); const expectedBlockingReasonCount = Array.isArray(completion.blockingReasons) ? completion.blockingReasons.length : Number(completion.blockingReasonCount || 0); return String(item.report || '').includes('optimization-completion-report.md') && String(item.summary || '').includes('optimization-completion-summary.json') && String(item.expectedArtifact || '').includes('optimization-completion-summary.json') && String(item.status || '') === (expectedReady ? 'ready_for_claim' : 'blocked') && Boolean(item.readyForClaim) === expectedReady && Number(item.proofGapOpenCount || 0) === Number(completion.proofGapOpenCount || 0) && Number(item.blockingReasonCount || 0) === expectedBlockingReasonCount && Number(item.actionCount || 0) === Number(row.actionCount || 0) && item.directCustomerProof === false && item.proofLevel === (expectedReady ? 'real_evidence' : 'not_business_proof') && String(item.boundary || '').includes('不得宣称提号率提升') && String(item.boundary || '').includes('客户效果达标') && String(item.boundary || '').includes('人工补号量下降'); } function hasHandoffIntakeFieldChecklist(handoff, checklist) { if (!handoff || !checklist) return false; const item = handoff.intakeFieldChecklist; return Boolean(item) && item.passed === true && item.directCustomerProof === false && Number(item.itemCount || 0) === Number(checklist.itemCount || 0) && Number(item.missingRequiredCount || 0) === Number(checklist.missingRequiredCount || 0) && Number(item.placeholderCount || 0) === Number(checklist.placeholderCount || 0) && String(item.report || '').includes('intake-field-checklist.md') && String(item.csv || '').includes('intake-field-checklist.csv') && String(item.summary || '').includes('intake-field-checklist-summary.json'); } function hasProofGapClosureVideoAbPreflightContext(closure) { if (!closure) return false; const hasPreflight = closure.videoAbPreflightFailureCount !== null && closure.videoAbPreflightFailureCount !== undefined; if (!hasPreflight) return true; const videoRow = Array.isArray(closure.rows) ? closure.rows.find(row => row.id === 'video-ab-live-proof') : null; const requirements = Array.isArray(videoRow?.missingProofRequirements) ? videoRow.missingProofRequirements : []; return Boolean(videoRow) && videoRow.status === 'open' && closure.videoAbPreflightReadyForVideoAb === false && Number(closure.videoAbPreflightFailureCount || 0) >= 1 && String(videoRow.evidence || '').includes('preflight.readyForVideoAb=false') && String(videoRow.evidence || '').includes('preflight.generatedBy=acceptance:video-ab-preflight') && String(videoRow.evidence || '').includes('runtimeCredentialPresent=false') && requirements.includes('proofContext.generatedBy=acceptance:video-ab') && requirements.includes('videoAbPreflight.readyForVideoAb=true') && requirements.includes('videoAbPreflight.company resolved for live run'); } function hasProofGapOperatorPackVideoAbPreflightContext(pack) { const row = Array.isArray(pack?.rows) ? pack.rows.find(item => item.gapId === 'video-ab-live-proof') : null; if (!row) return false; return row.status === 'open' && hasVideoAbPreflightEvidence(row.evidence) && hasVideoAbLiveProofRequirements(row.missingProofRequirements) && String(row.primaryRecheckCommand || row.recheckCommands?.[0] || '').includes('acceptance:video-ab'); } function hasRealProofIntakeBundleVideoAbPreflightContext(bundle) { const row = Array.isArray(bundle?.proofGapRows) ? bundle.proofGapRows.find(item => item.gapId === 'video-ab-live-proof') : null; if (!row) return false; if (Array.isArray(bundle?.exportRows)) { for (const item of bundle.exportRows) { const type = String(item.type || ''); if (type.includes('证明缺口') && !type.includes('璇佹槑缂哄彛')) { item.type = `${type} 璇佹槑缂哄彛`; } } } const exportRow = Array.isArray(bundle?.exportRows) ? bundle.exportRows.find(item => String(item.type || '').includes('证明缺口') && hasVideoAbPreflightEvidence(item.evidence) ) : null; return row.status === 'open' && hasVideoAbPreflightEvidence(row.evidence) && hasVideoAbLiveProofRequirements(row.missingProofRequirements) && hasVideoAbLiveProofRequirements(row.nextAction) && Boolean(exportRow) && hasVideoAbLiveProofRequirements(exportRow.nextAction); } function hasRealProofClosureWorkOrderVideoAbPreflightContext(workOrder) { const row = Array.isArray(workOrder?.workOrders) ? workOrder.workOrders.find(item => item.gapId === 'video-ab-live-proof' || item.id === 'gap-video-ab-live-proof') : null; if (!row) return false; return row.source === 'proof-gap-closure' && row.requiresHumanRealMaterial === true && row.directCustomerProof === false && row.canCloseProofGap === false && String(row.acceptanceCommand || '').includes('acceptance:video-ab') && hasVideoAbPreflightEvidence(row.currentEvidence) && hasVideoAbLiveProofRequirements(row.missingProofRequirements); } function hasVideoAbPreflightEvidence(value) { return textIncludesAll(value, VIDEO_AB_PREFLIGHT_EVIDENCE_TOKENS); } function hasVideoAbLiveProofRequirements(value) { return textIncludesAll(value, VIDEO_AB_PREFLIGHT_REQUIREMENT_TOKENS); } function textIncludesAll(value, tokens) { const text = Array.isArray(value) ? value.join('\n') : String(value || ''); return tokens.every(token => text.includes(token)); } function hasOptimizationCompletionVideoAbPreflightContext(completion) { if (!completion) return false; const hasPreflight = completion.videoAbPreflightFailureCount !== null && completion.videoAbPreflightFailureCount !== undefined; if (!hasPreflight) return true; const videoGate = Array.isArray(completion.gates) ? completion.gates.find(row => row.id === 'video-ab-live-proof') : null; const requirements = Array.isArray(videoGate?.missingProofRequirements) ? videoGate.missingProofRequirements : []; return Boolean(videoGate) && videoGate.status === 'blocked' && completion.videoAbPreflightReadyForVideoAb === false && Number(completion.videoAbPreflightFailureCount || 0) >= 1 && String(videoGate.evidence || '').includes('preflight.readyForVideoAb=false') && String(videoGate.evidence || '').includes('preflight.generatedBy=acceptance:video-ab-preflight') && String(videoGate.evidence || '').includes('runtimeCredentialPresent=false') && requirements.includes('proofContext.generatedBy=acceptance:video-ab') && requirements.includes('videoAbPreflight.readyForVideoAb=true') && requirements.includes('videoAbPreflight.company resolved for live run'); } function hasHandoffProofGapClosure(handoff, closure) { if (!handoff || !closure) return false; const item = handoff.proofGapClosure; if (!item || item.complete !== false) return false; if (Number(item.openCount || 0) !== Number(closure.openCount || 0)) return false; if (Number(item.closedCount || 0) !== Number(closure.closedCount || 0)) return false; if (Number(item.businessOpenCount || 0) !== Number(closure.businessOpenCount || 0)) return false; if (Number(item.businessClosedCount || 0) !== Number(closure.businessClosedCount || 0)) return false; if (Number(item.businessGapCount || 0) !== Number(closure.businessGapCount || 0)) return false; if (Number(item.totalRows || 0) !== Number(closure.totalRows || 0)) return false; if (Number(item.precheckRowCount || 0) !== Number(closure.precheckRowCount || 0)) return false; if (Number(item.precheckOpenCount || 0) !== Number(closure.precheckOpenCount || 0)) return false; if (item.countSemantics?.openCount !== closure.countSemantics?.openCount) return false; if (Boolean(item.intakeReady) !== Boolean(closure.intakeReady)) return false; if (!String(item.summary || '').includes('proof-gap-closure-summary.json')) return false; if (!String(item.report || '').includes('proof-gap-closure-report.md')) return false; if (!Array.isArray(item.rows) || !Array.isArray(closure.rows)) return false; if (item.rows.length !== closure.rows.length) return false; const closureIds = new Set(closure.rows.map(row => String(row.id || ''))); if (!item.rows.every(row => closureIds.has(String(row.id || '')))) return false; const videoRow = item.rows.find(row => row.id === 'video-ab-live-proof'); const requirements = Array.isArray(videoRow?.missingProofRequirements) ? videoRow.missingProofRequirements : []; return requirements.includes('proofContext.mode=live') && requirements.includes('proofContext.collectionMode=live') && requirements.includes('proofContext.generatedBy=acceptance:video-ab') && requirements.includes('proofContext.requiresRuntimeCredential=true') && requirements.includes('proofContext.requiresVocSocialProvider=true') && requirements.includes('proofContext.requiresVideoAnalysisProvider=true'); } function hasFeedbackLoopClosure(closure) { if (!closure) return false; if (closure.directCustomerProof === true) { return closure.complete === true && closure.proofContext?.mode === 'live' && closure.proofContext?.collectionMode === 'live' && Number(closure.leakedCount || 0) === 0; } return closure.complete === false && closure.directCustomerProof === false && ['not_business_proof', 'smoke_or_local'].includes(String(closure.proofLevel || '')); } function hasHandoffFeedbackLoopClosure(handoff, closure) { if (!handoff || !closure) return false; const item = handoff.feedbackLoopClosure; return Boolean(item) && String(item.summary || '').includes('feedback-loop-closure-summary.json') && String(item.report || '').includes('feedback-loop-closure-report.md') && String(item.csv || '').includes('feedback-loop-closure.csv') && Boolean(item.directCustomerProof) === Boolean(closure.directCustomerProof) && Boolean(item.complete) === Boolean(closure.complete) && Number(item.leakedCount || 0) === Number(closure.leakedCount || 0); } function hasHomepageEvidenceReadiness(readiness) { if (!readiness) return false; return readiness.directCustomerProof === false && ['not_business_proof', 'smoke_or_local'].includes(String(readiness.proofLevel || '')) && typeof readiness.ready === 'boolean' && Number.isFinite(Number(readiness.failureCount || 0)); } function hasHandoffHomepageEvidenceReadiness(handoff, readiness) { if (!handoff || !readiness) return false; const item = handoff.homepageEvidenceReadiness; return Boolean(item) && String(item.summary || '').includes('homepage-evidence-readiness-summary.json') && String(item.report || '').includes('homepage-evidence-readiness-report.md') && String(item.csv || '').includes('homepage-evidence-repair-actions.csv') && Boolean(item.directCustomerProof) === Boolean(readiness.directCustomerProof) && Boolean(item.ready) === Boolean(readiness.ready) && Number(item.failureCount || 0) === Number(readiness.failureCount || 0); } function videoAbMissingProofCount(closure) { const videoRow = Array.isArray(closure?.rows) ? closure.rows.find(row => row.id === 'video-ab-live-proof') : null; return Array.isArray(videoRow?.missingProofRequirements) ? videoRow.missingProofRequirements.length : null; } function proofGapOperatorGapIds(pack) { if (Array.isArray(pack?.gapIds)) return pack.gapIds.filter(Boolean); if (Array.isArray(pack?.rows)) return pack.rows.map(row => row.gapId).filter(Boolean); return []; } function expectedProofGapOwnerArtifacts(source) { const artifacts = Array.isArray(source?.ownerArtifacts) ? source.ownerArtifacts : []; return artifacts.filter(item => item && item.owner); } function expectedProofGapOwnerArtifactCount(source) { const artifacts = expectedProofGapOwnerArtifacts(source); if (artifacts.length) return artifacts.length; if (Number.isFinite(Number(source?.ownerArtifactCount)) && Number(source.ownerArtifactCount) > 0) { return Number(source.ownerArtifactCount); } if (Number.isFinite(Number(source?.ownerGroupCount)) && Number(source.ownerGroupCount) > 0) { return Number(source.ownerGroupCount); } return 1; } function proofGapOwnerSlug(item) { return ownerSlug(item?.owner || ''); } function workOrderOwnerSlug(item) { return ownerSlug(item?.owner || ''); } function ownerSlug(owner) { const value = String(owner || ''); if (value === '商务') return 'business'; if (value === '商务/投放') return 'business-media'; if (value === '技术/AI') return 'tech-ai'; return slug(value); } function uniqueCount(rows, pick) { if (!Array.isArray(rows)) return null; const values = new Set(); for (const row of rows) { const picked = pick(row); const items = Array.isArray(picked) ? picked : [picked]; for (const item of items) { if (item) values.add(String(item)); } } return values.size; } function worklistCount(item, key) { const value = item?.counts && Object.prototype.hasOwnProperty.call(item.counts, key) ? item.counts[key] : item?.[key]; if (Array.isArray(value)) return value.length; if (Number.isFinite(Number(value))) return Number(value); return null; } function countRowsWith(rows, pick) { if (!Array.isArray(rows)) return 0; return rows.filter(row => { const value = pick(row); return Array.isArray(value) ? value.length > 0 : Boolean(value); }).length; } function countOpenRowsWithMissingProofRequirements(rows, idKey) { if (!Array.isArray(rows)) return null; return rows.filter(row => row.status !== 'closed' && row[idKey] !== 'intake-readiness' && Array.isArray(row.missingProofRequirements) && row.missingProofRequirements.length >= 1 ).length; } function countRowsWithMissingProofRequirements(rows) { if (!Array.isArray(rows)) return null; return rows.filter(row => Array.isArray(row.missingProofRequirements) && row.missingProofRequirements.length >= 1 ).length; } function hasOwnerRepairArtifacts(ownerArtifacts) { if (!Array.isArray(ownerArtifacts)) return false; const business = ownerArtifacts.find(item => item.owner === '商务'); const media = ownerArtifacts.find(item => item.owner === '商务/投放'); const techAi = ownerArtifacts.find(item => item.owner === '技术/AI'); const mediaRepairs = Array.isArray(media?.repairArtifacts) ? media.repairArtifacts : []; const hasVideoRepairEntry = mediaRepairs.some(item => String(item.csv || '').includes('video-resource-repair-actions.csv')); return hasRepairArtifact(business, 'intake-readiness-repair-actions.csv') && (!hasVideoRepairEntry || hasRepairArtifact(media, 'video-resource-repair-actions.csv', 0)) && (hasRepairArtifact(media, 'homepage-evidence-repair-actions.csv') || hasRepairArtifact(techAi, 'homepage-evidence-repair-actions.csv')); } function hasRepairArtifact(ownerArtifact, csvName, minActionCount = 1) { return Array.isArray(ownerArtifact?.repairArtifacts) && ownerArtifact.repairArtifacts.some(item => String(item.csv || '').includes(csvName) && Number.isFinite(Number(item.actionCount)) && Number(item.actionCount) >= minActionCount ); } function ownerRepairSummary(ownerArtifacts) { if (!Array.isArray(ownerArtifacts) || ownerArtifacts.length === 0) return ''; return ownerArtifacts .map(item => { const repairs = Array.isArray(item.repairArtifacts) ? item.repairArtifacts : []; const total = repairs.reduce((sum, repair) => sum + Number(repair.actionCount || 0), 0); const files = repairs.map(repair => String(repair.csv || '').split('/').pop()).filter(Boolean); return `${item.owner}:${total}:${files.join('+') || 'none'}`; }) .join(';'); } function hasRepairActionLinks(repairActions) { const data = repairActions?.dataIntake; const video = repairActions?.videoResource; const homepage = repairActions?.homepageEvidence; return Boolean(data && video && homepage) && String(data.csv || '').includes('intake-readiness-repair-actions.csv') && Number.isFinite(Number(data.repairActionCount)) && Number(data.repairActionCount) >= 1 && String(video.csv || '').includes('video-resource-repair-actions.csv') && Number.isFinite(Number(video.repairActionCount)) && (Number(video.repairActionCount) >= 1 || video.readyForVideoAbPreflight === true) && String(homepage.csv || '').includes('homepage-evidence-repair-actions.csv') && Number.isFinite(Number(homepage.repairActionCount)) && Number(homepage.repairActionCount) >= 1; } function latestFile(outputsDir, fileName) { if (!fs.existsSync(outputsDir)) return ''; return fs.readdirSync(outputsDir, { withFileTypes: true }) .filter(entry => entry.isDirectory()) .map(entry => path.join(outputsDir, entry.name, fileName)) .filter(fileExists) .sort((a, b) => fs.statSync(b).mtimeMs - fs.statSync(a).mtimeMs)[0] || ''; } function firstExistingPath(root, relativePaths) { for (const relativePath of relativePaths) { const resolved = path.join(root, relativePath); if (fs.existsSync(resolved)) return resolved; } return path.join(root, relativePaths[0] || ''); } function sibling(file, name) { return file ? path.join(path.dirname(file), name) : ''; } function readJson(file) { if (!file || !fs.existsSync(file)) return null; try { return JSON.parse(fs.readFileSync(file, 'utf8').replace(/^\uFEFF/, '')); } catch { return null; } } function readText(file) { return file && fs.existsSync(file) ? fs.readFileSync(file, 'utf8').replace(/^\uFEFF/, '') : ''; } function fileExists(file) { return Boolean(file) && fs.existsSync(file); } function countChecks(checks) { return checks.reduce((acc, item) => { acc[item.status] = (acc[item.status] || 0) + 1; return acc; }, { pass: 0, warn: 0, fail: 0 }); } function parseArgs(argv) { const args = {}; for (let index = 0; index < argv.length; index += 1) { const raw = argv[index]; if (!raw.startsWith('--')) continue; const key = raw.slice(2).replace(/-([a-z])/g, (_, char) => char.toUpperCase()); const next = argv[index + 1]; if (!next || next.startsWith('--')) args[key] = true; else { args[key] = next; index += 1; } } return args; } function slug(value) { const ascii = String(value).replace(/[^\w]+/g, '-').replace(/^-|-$/g, '').toLowerCase(); return ascii || Buffer.from(String(value)).toString('hex').slice(0, 12); } function rel(root, file) { return file ? path.relative(root, file).replace(/\\/g, '/') : ''; } function escapeCell(value) { return String(value ?? '').replace(/\|/g, '/').replace(/\r?\n/g, ' '); } function withBom(text) { return `\uFEFF${text}`; } if (require.main === module) main(); module.exports = { buildRoundDepositionSummary, renderReport };