/simplify over a97efb6..HEAD (the plan_version 1.9 / trial-4 delivery). - coordinator-contract: engine names come from engine-findings ENGINES; one markedMajorCodeReview predicate under both lowering checks; isEngineFinding everywhere; the unreachable branch (c) of illegalBriefLowering folded into (e). - armB workflow: RULE_KEYS = Object.keys(RULE_TIERS); the engine map is a literal pinned equal to ENGINES by the workflow test. - plan-schema: usesFilesGrammar() is the one 1.9 check (validator, sweep, testFirstFiles, stepTestsOnlyFromFields); opensEntry built on opensChunk. - plan-validator: one issue builder for the Files and Test first grammar. - plan-scope-sweep: the 1.9 and the 6.2.0 reader are one if/else. - artifact-commit: TRAILER_RE/trailerProblem no longer exported (no importer); the order comment says the CLI finds the repo root first. - tests: the lock drivers in session-id-isolation (d) run side by side per mode (~100 s -> ~30 s); a shared artifact-repo helper; severityRank and extractFindingsBlock reused; childEnv(env) without a spread; one copy of the PLAN_VERSION_CURRENT check. Plan readers: validator errors/warnings, plannedPaths, fieldPaths, testFirstFiles and stepTestsOnlyFromFields compared byte for byte against HEAD over 510 plans / 1692 steps plus 210 synthetic 1.7-1.9 cases: same. Suite 2384 (2382/0/2). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
41 lines
1.8 KiB
JavaScript
41 lines
1.8 KiB
JavaScript
// tests/helpers/artifact-repo.mjs
|
|
// A throwaway target repo for the artifact-commit tests
|
|
// (tests/lib/artifact-commit.test.mjs, tests/lib/artifact-commit-trailer.test.mjs):
|
|
// one commit, no git hooks, a project folder holding brief.md and, unless
|
|
// `withLog` is false, an approval-log entry for it.
|
|
|
|
import { spawnSync } from 'node:child_process';
|
|
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs';
|
|
import { tmpdir } from 'node:os';
|
|
import { dirname, join } from 'node:path';
|
|
import { fileURLToPath } from 'node:url';
|
|
import { childEnv } from './child-env.mjs';
|
|
|
|
const LOG = join(dirname(fileURLToPath(import.meta.url)), '..', '..', 'lib', 'util', 'approval-log.mjs');
|
|
const H1 = 'c'.repeat(64);
|
|
|
|
export function git(cwd, ...args) {
|
|
return spawnSync('git', args, { cwd, encoding: 'utf8', env: childEnv() });
|
|
}
|
|
|
|
/** @returns {{ d: string, brief: string }} the repo and its brief.md */
|
|
export function artifactRepo({ prefix = 'artifact-commit-', project = '2026-10-06-toggle', withLog = true } = {}) {
|
|
const d = mkdtempSync(join(tmpdir(), prefix));
|
|
git(d, 'init', '-q');
|
|
git(d, 'config', 'user.name', 'Test');
|
|
git(d, 'config', 'user.email', 'test@example.invalid');
|
|
git(d, 'config', 'commit.gpgsign', 'false');
|
|
mkdirSync(join(d, '.hooks-none'));
|
|
git(d, 'config', 'core.hooksPath', '.hooks-none');
|
|
writeFileSync(join(d, 'README.md'), 'x\n');
|
|
git(d, 'add', 'README.md');
|
|
git(d, 'commit', '-q', '-m', 'init');
|
|
const proj = join(d, '.claude', 'projects', project);
|
|
mkdirSync(proj, { recursive: true });
|
|
writeFileSync(join(proj, 'brief.md'), '# brief\n');
|
|
if (withLog) {
|
|
spawnSync(process.execPath, [LOG, 'append', '--kind', 'intent', '--subject', join(proj, 'brief.md'), '--sha256', H1],
|
|
{ cwd: d, env: childEnv() });
|
|
}
|
|
return { d, brief: join(proj, 'brief.md') };
|
|
}
|