test(audit): lock phase0 rolling script TAG wiring

Add regression tests that verify rolling and rolling:prune scripts keep shared overridable TAG semantics and tagged prune reports. No architecture/protocol flow changes; diagram files reviewed and no updates were needed.
This commit is contained in:
William Valentin
2026-02-27 12:21:18 -08:00
parent 2610b6973d
commit 487e5c2930
2 changed files with 47 additions and 0 deletions
@@ -0,0 +1,36 @@
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"');
});
});