test: establish WP5 continuous lineage gate
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 2m1s
Dada P0-A isolated Windows CI / validate-and-package (push) Failing after 2m1s
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
import { execFileSync } from 'node:child_process';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
|
||||
const tasks = [
|
||||
['TASK-WP5-03', 'origin/codex/wp5-03'],
|
||||
['TASK-WP5-04', 'origin/codex/wp5-04'],
|
||||
['TASK-WP5-05', 'origin/codex/wp5-05'],
|
||||
['TASK-WP5-06', 'origin/codex/wp5-06'],
|
||||
['TASK-WP5-07', 'origin/codex/wp5-07'],
|
||||
];
|
||||
|
||||
function sha(ref) {
|
||||
return execFileSync('git', ['rev-parse', ref], { encoding: 'utf8' }).trim();
|
||||
}
|
||||
|
||||
function isAncestor(ref) {
|
||||
try {
|
||||
execFileSync('git', ['merge-base', '--is-ancestor', ref, 'HEAD'], { stdio: 'ignore' });
|
||||
return true;
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
function run(command, args) {
|
||||
try {
|
||||
const executable = process.platform === 'win32' && command === 'pnpm' ? 'pnpm.cmd' : command;
|
||||
execFileSync(executable, args, { stdio: 'pipe', encoding: 'utf8', shell: process.platform === 'win32' });
|
||||
return { status: 'passed' };
|
||||
} catch (error) {
|
||||
return { status: 'failed', exit_code: error.status ?? 1 };
|
||||
}
|
||||
}
|
||||
|
||||
const checks = tasks.map(([task, ref]) => ({ task, ref, sha: sha(ref), ancestor: isAncestor(ref) }));
|
||||
const regression = {
|
||||
'TASK-WP5-06': run('pnpm', ['exec', 'vitest', 'run', 'tests/integration/wp5-06-sticker-cleanup.test.ts']),
|
||||
'TASK-WP5-07': run('pnpm', ['exec', 'vitest', 'run', 'tests/api/wp5-07-preview-grants.test.ts']),
|
||||
};
|
||||
const status = checks.every((check) => check.ancestor)
|
||||
&& Object.values(regression).every((check) => check.status === 'passed')
|
||||
? 'ready_for_wp4_07'
|
||||
: 'externally_blocked';
|
||||
|
||||
const output = {
|
||||
schema_version: '1.0',
|
||||
task: 'TASK-WP5-LINEAGE',
|
||||
status,
|
||||
checks,
|
||||
regression,
|
||||
note: 'This gate proves ancestry and targeted regressions only; it does not replace per-task UI/resource evidence.',
|
||||
};
|
||||
const runId = `wp5-lineage-${new Date().toISOString().replace(/[^0-9]/g, '')}`;
|
||||
const outputDirectory = path.join('artifacts', 'tdd', runId);
|
||||
fs.mkdirSync(outputDirectory, { recursive: true });
|
||||
fs.writeFileSync(path.join(outputDirectory, 'lineage.json'), `${JSON.stringify(output, null, 2)}\n`, 'utf8');
|
||||
console.log(JSON.stringify(output));
|
||||
process.exitCode = status === 'ready_for_wp4_07' ? 0 : 3;
|
||||
Reference in New Issue
Block a user