test(r8): move the live tests out of the round files
R8 of cleanup R-a (plan .claude/projects/2026-11-07-cleanup-r-a, appendix A). The live tests of the round files move into the test named after their source; each moved test was seen red under a mutation of its source. New: tests/lib/lib-imports.test.mjs, tests/lib/timing.test.mjs (from timing-under-load). The [#1] --gates rule and shim-line pins move into tests/lib/autonomy-gate.test.mjs. Removed: the round test files (retterunde, retterunde-prose-pins, trial-mechanical-fixes, trial2-fixes, trial2-minor, trial2-minor-prose-pins, fix-round-4-5a-prose, fix-round-4-5b2-b-prose, timing-under-load), the 8 R8 e2e scripts, and seven round test files on the R-a removal list that pinned them (fix-round-4-5b-prose, fix-round-4-5b-part-2/3/4-scripts, fix-round-4-5b-part-4-prose, fix-round-4-5b2-b/c-scripts). The diff-mode e2e pin (test 24) and the red-script round-wrapper cases go too. tests/synthetic/plan-run-C.md becomes tests/fixtures/plan-run-c.md, regenerated from buildPlan({ version: '1.9' }). The red judge, reporter and judge test headers now name the shared red script. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
fa0d4f036c
commit
651be3468b
60 changed files with 1755 additions and 7965 deletions
|
|
@ -1,6 +1,6 @@
|
|||
// tests/hooks/bash-guard-reader-pins.test.mjs
|
||||
// Fix round 4.5b, part 4 (decision 90): part 3's five fix-round reader cases
|
||||
// (tests/e2e-fix-round-4-5b-part-3.sh:277-305) as pins under npm test, so a
|
||||
// (from part 3's end-to-end script, since removed) as pins under npm test, so a
|
||||
// later edit of the args-heredoc guard in hooks/scripts/pre-bash-executor.mjs
|
||||
// cannot drop them unseen. Untagged: they pass at 591f3c4, and no red
|
||||
// wrapper lists this file.
|
||||
|
|
|
|||
|
|
@ -9,10 +9,13 @@
|
|||
|
||||
import { test } from 'node:test';
|
||||
import { strict as assert } from 'node:assert';
|
||||
import { readFileSync } from 'node:fs';
|
||||
import { mkdtempSync, readFileSync, rmSync } from 'node:fs';
|
||||
import { tmpdir } from 'node:os';
|
||||
import { dirname, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { spawnSync } from 'node:child_process';
|
||||
import { runHook } from '../helpers/hook-helper.mjs';
|
||||
import { childEnv } from '../helpers/child-env.mjs';
|
||||
|
||||
const HERE = dirname(fileURLToPath(import.meta.url));
|
||||
const ROOT = join(HERE, '..', '..');
|
||||
|
|
@ -418,6 +421,33 @@ test('[ARG] every shipped parser heredoc block passes the guard', async () => {
|
|||
}
|
||||
});
|
||||
|
||||
/** The /trekreview Phase 1 parser block as Claude Code runs it, with `args` in place of $ARGUMENTS. */
|
||||
function trekreviewParserBlock(args) {
|
||||
const blocks = sectionBashBlocks('commands/trekreview.md', '## Phase 1 ').filter((b) => b.includes(`<<'${ARGS_DELIM}'`));
|
||||
assert.equal(blocks.length, 1, `commands/trekreview.md ## Phase 1 must hold one parser heredoc block; found ${blocks.length}`);
|
||||
return `${blocks[0].split('${CLAUDE_PLUGIN_ROOT}').join(ROOT).split('$ARGUMENTS').join(args)}\n`;
|
||||
}
|
||||
|
||||
test('[ARG] the shipped trekreview Phase 1 block passes the guard, and /bin/bash runs it to JSON that keeps a value closed on its own line', async () => {
|
||||
// A quoted value closed on its own line: the typed text holds a line break.
|
||||
const command = trekreviewParserBlock('--project "notes\n" --since HEAD');
|
||||
await expectArgsAllowed(command);
|
||||
const cwd = mkdtempSync(join(tmpdir(), 'bash-guard-shipped-'));
|
||||
try {
|
||||
const r = spawnSync('/bin/bash', ['-c', command], { cwd, encoding: 'utf8', env: childEnv() });
|
||||
assert.equal(r.status, 0, `the block exited ${r.status}: ${r.stdout}${r.stderr}`);
|
||||
const j = JSON.parse(r.stdout);
|
||||
assert.equal(j.flags['--project'], 'notes\n', `--project is not notes + line break: ${r.stdout}`);
|
||||
assert.equal(j.flags['--since'], 'HEAD', `--since is not HEAD: ${r.stdout}`);
|
||||
assert.deepEqual(j.positional, []);
|
||||
} finally { rmSync(cwd, { recursive: true, force: true }); }
|
||||
});
|
||||
|
||||
test('[ARG] a typed argument holding << passes the guard: the parser heredoc form and the shipped trekreview Phase 1 block', async () => {
|
||||
await expectArgsAllowed(`${PARSER_LINE} <<'${ARGS_DELIM}'\nfix "<<" handling\n${ARGS_DELIM}`);
|
||||
await expectArgsAllowed(trekreviewParserBlock('fix "<<" handling'));
|
||||
});
|
||||
|
||||
// HDG (fix round 4.5b, part 2) -- bash reads a heredoc body only from the
|
||||
// lines after the opener's line. A command that only mentions the opener, with
|
||||
// no non-blank line after it, has nothing that can close early and nothing to
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue