Files
flynn/src/audit/phase0BaselineScriptWiring.test.ts
T
William Valentin 940402729b test(audit): lock drift reaction-threshold script wiring
Assert package drift and rolling commands keep reaction match/skip threshold flags in default cadence wiring. Architecture/protocol diagrams reviewed; no updates needed for test-only coverage.
2026-02-27 13:26:25 -08:00

51 lines
2.0 KiB
TypeScript

import { readFileSync } from 'node:fs';
import { resolve } from 'node:path';
import { describe, expect, it } from 'vitest';
interface PackageManifest {
scripts?: Record<string, string>;
}
function loadPackageScripts(): Record<string, string> {
const raw = readFileSync(resolve(process.cwd(), 'package.json'), 'utf8');
const manifest = JSON.parse(raw) as PackageManifest;
return manifest.scripts ?? {};
}
describe('phase0 baseline script wiring', () => {
it('keeps rolling script TAG override semantics', () => {
const scripts = loadPackageScripts();
const rolling = scripts['audit:phase0-baseline:live:refresh:drift:rolling'];
expect(rolling).toBeDefined();
expect(rolling).toContain('TAG=${TAG:-$(date -u +%F-%H%M%S)}');
expect(rolling).toContain('--tag "$TAG"');
expect(rolling).toContain('--report-tag "$TAG"');
});
it('keeps rolling prune script on shared overridable TAG', () => {
const scripts = loadPackageScripts();
const rollingPrune = scripts['audit:phase0-baseline:live:refresh:drift:rolling:prune'];
expect(rollingPrune).toBeDefined();
expect(rollingPrune).toContain('TAG=${TAG:-$(date -u +%F-%H%M%S)}');
expect(rollingPrune).not.toContain('TAG=$(date -u +%F-%H%M%S)');
expect(rollingPrune).toContain('pnpm audit:phase0-baseline:live:refresh:drift:rolling');
expect(rollingPrune).toContain('--report-tag "$TAG"');
});
it('keeps default drift thresholds for reaction match/skip deltas', () => {
const scripts = loadPackageScripts();
const drift = scripts['audit:phase0-baseline:live:drift'];
const rolling = scripts['audit:phase0-baseline:live:refresh:drift:rolling'];
expect(drift).toBeDefined();
expect(drift).toContain('--max-reaction-match-rate-drop-pp 50');
expect(drift).toContain('--max-reaction-skip-rate-increase-pp 50');
expect(rolling).toBeDefined();
expect(rolling).toContain('--max-reaction-match-rate-drop-pp 50');
expect(rolling).toContain('--max-reaction-skip-rate-increase-pp 50');
});
});