fix: close the six defects an independent review found in the trial fixes
Independent read-only review of c56f852..2d29966 (2026-10-08), each defect reproduced by the reviewer; each new test fails on that code. - test-lock green ran ANY allowlisted command: `green --cmd "git status"` marked a red step green and the stop guard let it stop. The lock now stores the step's test command (`lock --cmd`); `green` runs only that one (a different --cmd, or a lock without one, exits 2). trekexecute D1 calls `green` with no command, which also removes the quoting hazard. - plan-gate --accept-open worked at round 1 and passed the gate; it now refuses while rounds are left. - findings-schema --repo-root swallowed a following flag, or took a root that does not exist, and silently skipped the line check: exit 2. - brief-review-stamp hashed only the body, so a changed `framing` or `research_topics` stayed "current"; it now covers the reviewed frontmatter too (only the post-review stamps are left out). - red-proof red_kind read an assertion message naming SyntaxError as a load error; the signatures are now specific. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2d29966f51
commit
5f9faeed4a
12 changed files with 192 additions and 35 deletions
|
|
@ -22,6 +22,7 @@ const CLI = join(ROOT, 'lib', 'util', 'test-lock.mjs');
|
|||
const STOP = join(ROOT, 'hooks', 'scripts', 'stop-test-lock.mjs');
|
||||
const PRE_WRITE = join(ROOT, 'hooks', 'scripts', 'pre-write-executor.mjs');
|
||||
const SESS = `sess-green-${process.pid}-${Date.now()}`;
|
||||
const CMD = 'node --test tests/step.test.mjs';
|
||||
|
||||
function cli(repo, args) {
|
||||
const r = spawnSync(process.execPath, [CLI, ...args], { cwd: repo, encoding: 'utf8', env: { ...process.env, CLAUDE_CODE_SESSION_ID: SESS } });
|
||||
|
|
@ -37,11 +38,9 @@ function lockedRepo(testBody) {
|
|||
`test('step', () => { ${testBody} });`,
|
||||
'',
|
||||
].join('\n'));
|
||||
assert.equal(cli(repo, ['lock', '--files', 'tests/step.test.mjs', '--step', '3']).code, 0);
|
||||
assert.equal(cli(repo, ['lock', '--files', 'tests/step.test.mjs', '--step', '3', '--cmd', CMD]).code, 0);
|
||||
return repo;
|
||||
}
|
||||
|
||||
const CMD = 'node --test tests/step.test.mjs';
|
||||
const stop = (repo) => ({ hook_event_name: 'Stop', session_id: SESS, cwd: repo, stop_hook_active: false });
|
||||
const edit = (file_path) => ({ hook_event_name: 'PreToolUse', tool_name: 'Edit', tool_input: { file_path, old_string: 'x', new_string: 'z' } });
|
||||
|
||||
|
|
@ -62,7 +61,7 @@ test('green: the test fails -> exit 1, no mark, Stop is still refused', async ()
|
|||
assert.equal(parseJsonOut((await runHook(STOP, stop(repo))).stdout)?.decision, 'block');
|
||||
});
|
||||
|
||||
test('green: a command outside the test-runner allowlist is never run -> exit 2, no mark', () => {
|
||||
test('green: a --cmd that is not the stored test command is never run -> exit 2, no mark', () => {
|
||||
const repo = lockedRepo('assert.equal(1, 1);');
|
||||
const g = cli(repo, ['green', '--cmd', 'echo ok']);
|
||||
assert.equal(g.code, 2, g.stderr);
|
||||
|
|
@ -85,12 +84,13 @@ test('pending: a fix round clears the mark, and Stop is refused again', async ()
|
|||
test('re-lock of the same step starts without a mark', () => {
|
||||
const repo = lockedRepo('assert.equal(1, 1);');
|
||||
assert.equal(cli(repo, ['green', '--cmd', CMD]).code, 0);
|
||||
assert.equal(cli(repo, ['lock', '--files', 'tests/step.test.mjs', '--step', '3']).code, 0);
|
||||
assert.equal(cli(repo, ['lock', '--files', 'tests/step.test.mjs', '--step', '3', '--cmd', CMD]).code, 0);
|
||||
assert.equal(JSON.parse(cli(repo, ['status']).stdout).green_at, null);
|
||||
});
|
||||
|
||||
test('trekexecute: D1 marks the lock green through the command, a fix round marks it pending', () => {
|
||||
const md = readFileSync(join(ROOT, 'commands', 'trekexecute.md'), 'utf8');
|
||||
assert.match(md, /test-lock\.mjs green --cmd "\{Verify command\}"/);
|
||||
assert.match(md, /test-lock\.mjs green\n/);
|
||||
assert.match(md, /test-lock\.mjs lock --files \{test files\} --step \{N\} --cmd "\{Verify command\}"/);
|
||||
assert.match(md, /test-lock\.mjs pending/);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue