| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- #!/usr/bin/env node
- const { buildReadiness } = require('./long-run-readiness-audit');
- function main() {
- const passingPreflight = {
- readyForLiveAcceptance: true,
- readyForVideoAb: true,
- live: { tokenPresent: true, companyResolved: true, parseUserResolved: true },
- providers: { videoModel: 'doubao-seed-2-0-pro' }
- };
- const passingHistory = {
- acceptance: {
- readyForLongRun: true,
- readyForCustomerEffectProof: true,
- minBriefsMet: true,
- allHaveCustomerDecision: true,
- allHaveFeedbackReason: true,
- allHaveManualSupplementBaseline: true
- }
- };
- const passingVideoReadiness = {
- acceptance: { readyForVideoAbPreflight: true },
- counts: { realReferenceRows: 1, realCandidateRows: 1, videoUrlRows: 2 }
- };
- const passingIntakeReadiness = {
- acceptance: { overallReady: true, historyReady: true, videoReady: true, reviewMetricsReady: true, customerEffectReady: true },
- failureCount: 0
- };
- const failingIntakeReadiness = {
- acceptance: { overallReady: false, historyReady: false, videoReady: false, reviewMetricsReady: false, customerEffectReady: false },
- failureCount: 9
- };
- const noProofGaps = { unresolvedCount: 0 };
- const unresolvedProofGaps = { unresolvedCount: 5 };
- const closedProofGapClosure = { complete: true, openCount: 0 };
- const openProofGapClosure = { complete: false, openCount: 5 };
- const fullMatrix = buildReadiness({
- mode: 'full-matrix',
- preflight: passingPreflight,
- history: passingHistory,
- intakeReadiness: passingIntakeReadiness,
- proofGap: noProofGaps,
- proofGapClosure: closedProofGapClosure
- });
- assert(fullMatrix.ready, 'full matrix should be ready with passing preflight/history and no unresolved proof gaps');
- assert(fullMatrix.nextCommands.some(item => item.includes('proof-gap:closure')), 'full matrix next commands should include proof-gap closure audit');
- const fullMatrixWithBadIntake = buildReadiness({
- mode: 'full-matrix',
- preflight: passingPreflight,
- history: passingHistory,
- intakeReadiness: failingIntakeReadiness,
- proofGap: noProofGaps,
- proofGapClosure: closedProofGapClosure
- });
- assert(!fullMatrixWithBadIntake.ready, 'failing intake readiness should block full matrix readiness when provided');
- assert(fullMatrixWithBadIntake.checks.some(item => item.name === 'intake-readiness-overall-ready' && item.status === 'fail'), 'intake readiness failure should be explicit');
- const fullMatrixWithGaps = buildReadiness({
- mode: 'full-matrix',
- preflight: passingPreflight,
- history: passingHistory,
- proofGap: unresolvedProofGaps,
- proofGapClosure: null
- });
- assert(!fullMatrixWithGaps.ready, 'unresolved proof gaps should block full matrix readiness');
- assert(fullMatrixWithGaps.checks.some(item => item.name === 'proof-gap-unresolved-zero' && item.status === 'fail'), 'proof gap check should fail when unresolved gaps remain');
- const fullMatrixWithStaleRequestButClosedClosure = buildReadiness({
- mode: 'full-matrix',
- preflight: passingPreflight,
- history: passingHistory,
- intakeReadiness: passingIntakeReadiness,
- proofGap: unresolvedProofGaps,
- proofGapClosure: closedProofGapClosure
- });
- assert(fullMatrixWithStaleRequestButClosedClosure.ready, 'current proof-gap closure should supersede stale proof-gap request unresolved count');
- const fullMatrixWithOpenClosure = buildReadiness({
- mode: 'full-matrix',
- preflight: passingPreflight,
- history: passingHistory,
- intakeReadiness: passingIntakeReadiness,
- proofGap: noProofGaps,
- proofGapClosure: openProofGapClosure
- });
- assert(!fullMatrixWithOpenClosure.ready, 'open proof-gap closure should block full matrix readiness even when proof-gap request has no unresolved items');
- assert(fullMatrixWithOpenClosure.checks.some(item => item.name === 'proof-gap-closure-complete' && item.status === 'fail'), 'open proof-gap closure should fail explicitly');
- assert(fullMatrixWithOpenClosure.boundaries.some(item => item.includes('proof-gap:closure')), 'open proof-gap closure should add an explicit boundary');
- const videoAb = buildReadiness({
- mode: 'video-ab',
- preflight: passingPreflight,
- history: null,
- intakeReadiness: passingIntakeReadiness,
- videoReadiness: passingVideoReadiness
- });
- assert(videoAb.ready, 'video A/B should be ready with passing video preflight and video resource readiness');
- const missingVideoReadiness = buildReadiness({
- mode: 'video-ab',
- preflight: passingPreflight,
- history: null,
- videoReadiness: null
- });
- assert(!missingVideoReadiness.ready, 'video A/B should require video resource readiness summary');
- assert(missingVideoReadiness.checks.some(item => item.name === 'video-resource-readiness-present' && item.status === 'fail'), 'missing video readiness should fail');
- const missingCandidateVideo = buildReadiness({
- mode: 'video-ab',
- preflight: passingPreflight,
- history: null,
- videoReadiness: {
- acceptance: { readyForVideoAbPreflight: false },
- counts: { realReferenceRows: 1, realCandidateRows: 0, videoUrlRows: 1 }
- }
- });
- assert(!missingCandidateVideo.ready, 'missing real candidate video should block video A/B readiness');
- assert(missingCandidateVideo.checks.some(item => item.name === 'video-real-candidate-present' && item.status === 'fail'), 'missing real candidate video should be explicit');
- const currentVideoReadinessShape = buildReadiness({
- mode: 'video-ab',
- preflight: passingPreflight,
- history: null,
- videoReadiness: {
- readyForVideoAbPreflight: true,
- counts: { realReferenceRows: 1, realCandidateRows: 1, videoUrlRows: 2 }
- }
- });
- assert(currentVideoReadinessShape.ready, 'video A/B readiness should accept current top-level readyForVideoAbPreflight summary shape');
- const missingHistory = buildReadiness({
- mode: 'customer-effect',
- preflight: passingPreflight,
- history: null,
- proofGap: noProofGaps,
- proofGapClosure: closedProofGapClosure
- });
- assert(!missingHistory.ready, 'customer effect proof should require history audit');
- assert(missingHistory.checks.some(item => item.name === 'history-audit-present' && item.status === 'fail'), 'missing history should fail');
- const badVideo = buildReadiness({
- mode: 'video-ab',
- preflight: { ...passingPreflight, readyForVideoAb: false, providers: { videoModel: 'other-model' } },
- history: null,
- videoReadiness: passingVideoReadiness
- });
- assert(!badVideo.ready, 'bad video model should block video A/B readiness');
- console.log(JSON.stringify({ ok: true }, null, 2));
- }
- function assert(condition, message) {
- if (!condition) throw new Error(message);
- }
- if (require.main === module) main();
|