()
| 46 | } |
| 47 | |
| 48 | function report() { |
| 49 | const current = snapshot(); |
| 50 | let baseline = null; |
| 51 | if (fs.existsSync(baselinePath)) { |
| 52 | baseline = JSON.parse(fs.readFileSync(baselinePath, 'utf8')); |
| 53 | } |
| 54 | |
| 55 | const delta = baseline ? { |
| 56 | hookTiming: current.hookTiming - baseline.hookTiming, |
| 57 | audit: current.audit - baseline.audit, |
| 58 | hookErrors: current.hookErrors - baseline.hookErrors, |
| 59 | hookTrace: current.hookTrace - baseline.hookTrace, |
| 60 | hookErrorsBytes: current.hookErrorsBytes - baseline.hookErrorsBytes, |
| 61 | } : null; |
| 62 | |
| 63 | const result = { |
| 64 | baseline, |
| 65 | current, |
| 66 | delta, |
| 67 | }; |
| 68 | |
| 69 | console.log(JSON.stringify(result, null, 2)); |
| 70 | |
| 71 | if (!baseline) { |
| 72 | console.log('\nNo baseline found. Run `node scripts/codex-live-verify.js baseline` before the live probe.'); |
| 73 | return; |
| 74 | } |
| 75 | |
| 76 | if (delta.hookTrace <= 0) { |
| 77 | console.log('\nHOOK DISPATCH: FAIL'); |
| 78 | console.log('No new codex-hook-trace entries. Codex likely did not execute the configured hooks.'); |
| 79 | return; |
| 80 | } |
| 81 | |
| 82 | if (delta.audit <= 0 && delta.hookTiming <= 0) { |
| 83 | console.log('\nHOOK DISPATCH: PASS'); |
| 84 | console.log('Telemetry write-path still failed after hook dispatch. Inspect the underlying hook scripts.'); |
| 85 | return; |
| 86 | } |
| 87 | |
| 88 | console.log('\nHOOK HEALTH: PASS'); |
| 89 | console.log('Codex dispatched hooks and Citadel telemetry advanced.'); |
| 90 | } |
| 91 | |
| 92 | const mode = process.argv[2]; |
| 93 | if (mode === 'baseline') { |
no test coverage detected