diff --git a/package.json b/package.json index 95067ca..1b139fd 100644 --- a/package.json +++ b/package.json @@ -97,6 +97,8 @@ "test:wp5-04:red": "node scripts/run-wp5-04-validation.mjs --phase red", "test:wp5-05": "node scripts/run-wp5-05-validation.mjs", "test:wp5-05:red": "node scripts/run-wp5-05-validation.mjs --phase red", + "test:wp5-06": "node scripts/run-wp5-06-validation.mjs", + "test:wp5-07": "node scripts/run-wp5-07-validation.mjs", "test:wp5-lineage": "node scripts/run-wp5-lineage-validation.mjs" }, "devDependencies": { diff --git a/scripts/run-wp5-06-validation.mjs b/scripts/run-wp5-06-validation.mjs new file mode 100644 index 0000000..aaea14c --- /dev/null +++ b/scripts/run-wp5-06-validation.mjs @@ -0,0 +1,22 @@ +import { execFileSync, spawnSync } from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; + +const runId = process.env.DADA_TDD_RUN_ID ?? `wp5-06-green-${new Date().toISOString().replace(/[^0-9]/g, '')}`; +const testId = 'TDD-WP5-06-CLEAN-001-sticker-history'; +const runDirectory = path.resolve('artifacts', 'tdd', runId, 'cases', testId); +fs.mkdirSync(runDirectory, { recursive: true }); +const command = ['exec', 'vitest', 'run', 'tests/integration/wp5-06-sticker-cleanup.test.ts']; +const executable = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'; +const result = spawnSync(executable, command, { encoding: 'utf8', shell: process.platform === 'win32' }); +const status = result.status === 0 ? 'passed' : 'failed'; +const evidence = { + schema_version: '1.0', task_id: 'TASK-WP5-06', test_id: testId, run_id: runId, + phase: 'green', status, command: 'pnpm exec vitest run tests/integration/wp5-06-sticker-cleanup.test.ts', + commit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(), + exit_code: result.status ?? 1, + redaction: 'stdout/stderr intentionally excluded', +}; +fs.writeFileSync(path.join(runDirectory, 'evidence.json'), `${JSON.stringify(evidence, null, 2)}\n`); +console.log(JSON.stringify(evidence)); +process.exitCode = status === 'passed' ? 0 : 1; diff --git a/scripts/run-wp5-07-validation.mjs b/scripts/run-wp5-07-validation.mjs new file mode 100644 index 0000000..73dfe39 --- /dev/null +++ b/scripts/run-wp5-07-validation.mjs @@ -0,0 +1,22 @@ +import { execFileSync, spawnSync } from 'node:child_process'; +import fs from 'node:fs'; +import path from 'node:path'; + +const runId = process.env.DADA_TDD_RUN_ID ?? `wp5-07-green-${new Date().toISOString().replace(/[^0-9]/g, '')}`; +const testId = 'TDD-WP5-07-PREVIEW-001-grant-lifecycle'; +const runDirectory = path.resolve('artifacts', 'tdd', runId, 'cases', testId); +fs.mkdirSync(runDirectory, { recursive: true }); +const command = ['exec', 'vitest', 'run', 'tests/api/wp5-07-preview-grants.test.ts']; +const executable = process.platform === 'win32' ? 'pnpm.cmd' : 'pnpm'; +const result = spawnSync(executable, command, { encoding: 'utf8', shell: process.platform === 'win32' }); +const status = result.status === 0 ? 'passed' : 'failed'; +const evidence = { + schema_version: '1.0', task_id: 'TASK-WP5-07', test_id: testId, run_id: runId, + phase: 'green', status, command: 'pnpm exec vitest run tests/api/wp5-07-preview-grants.test.ts', + commit: execFileSync('git', ['rev-parse', 'HEAD'], { encoding: 'utf8' }).trim(), + exit_code: result.status ?? 1, + redaction: 'stdout/stderr intentionally excluded', +}; +fs.writeFileSync(path.join(runDirectory, 'evidence.json'), `${JSON.stringify(evidence, null, 2)}\n`); +console.log(JSON.stringify(evidence)); +process.exitCode = status === 'passed' ? 0 : 1; diff --git a/scripts/run-wp5-lineage-validation.mjs b/scripts/run-wp5-lineage-validation.mjs index 3a429ca..2b67b8e 100644 --- a/scripts/run-wp5-lineage-validation.mjs +++ b/scripts/run-wp5-lineage-validation.mjs @@ -35,8 +35,8 @@ function run(command, args) { 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']), + 'TASK-WP5-06': run('node', ['scripts/run-wp5-06-validation.mjs']), + 'TASK-WP5-07': run('node', ['scripts/run-wp5-07-validation.mjs']), }; const status = checks.every((check) => check.ancestor) && Object.values(regression).every((check) => check.status === 'passed')