#!/usr/bin/env node /** * PG Session / session-broker affinity evidence (local unit + coverage; 9-instance prod N/A locally). */ import { spawnSync } from 'node:child_process'; import path from 'node:path'; import { fileURLToPath } from 'node:url'; const root = path.join(path.dirname(fileURLToPath(import.meta.url)), '..'); const skip = process.env.GOOSE_V149_AFFINITY_EVIDENCE_SKIP === '1'; function run(label, args) { const result = spawnSync(process.execPath, args, { cwd: root, encoding: 'utf8' }); if (result.status !== 0) { throw new Error(`${label}: ${result.stderr?.trim() || result.stdout?.trim()}`); } } async function main() { if (skip) { console.log('GOOSE_V149_AFFINITY_EVIDENCE_OK: skipped'); return; } run('session-broker-coverage', [path.join(root, 'scripts', 'check-session-broker-coverage.mjs')]); run('session-broker-unit', ['--test', 'session-broker.test.mjs']); run('goosed-resume', [path.join(root, 'scripts', 'check-goosed-v149-resume.mjs')]); console.log('GOOSE_V149_AFFINITY_EVIDENCE_OK:'); console.log(' coverage=check-session-broker-coverage.mjs'); console.log(' unit=session-broker.test.mjs'); console.log(' goosed=check-goosed-v149-resume.mjs (PG session restore)'); console.log(' note=9-instance prod affinity requires 103 soak; not simulated on loopback'); } main().catch((error) => { console.error(`GOOSE_V149_AFFINITY_EVIDENCE_FAIL: ${error.message}`); process.exit(1); });