fix(tests): the suite no longer hands the session id to the lock CLI

npm test now preloads tests/helpers/no-session-id.mjs, which deletes CLAUDE_CODE_SESSION_ID before any test file loads, and the 18 files that spread process.env into a child use childEnv() instead (23 sites). A live session's stop guard is no longer pointed at a temp-repo lock (S133).

engines stays >=18: --import exists from Node 18.18/20.6, and the quoted test glob already needs Node 21 (criteria-runner NODE_GLOB_MAJOR), so the real floor does not move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kjell Tore Guttormsen 2026-10-12 14:09:14 +02:00
commit d8527976ef
Signed by: ktg
SSH key fingerprint: SHA256:JakMjO6FTBBzN0Bhfj9saOoEjaFxlSdYuZQQpM/lF9Q
22 changed files with 285 additions and 24 deletions

View file

@ -15,6 +15,7 @@ import { writeFileSync, mkdirSync, realpathSync } from 'node:fs';
import { join } from 'node:path';
import { runHook } from '../helpers/hook-helper.mjs';
import { ROOT, scriptsFor, makeRepo, parseJsonOut } from './guard-helpers.mjs';
import { childEnv } from '../helpers/child-env.mjs';
const CLI = join(ROOT, 'lib', 'util', 'test-lock.mjs');
const PRE_WRITE = join(ROOT, 'hooks', 'scripts', 'pre-write-executor.mjs');
@ -31,7 +32,7 @@ function lockedRepo({ session = SESS_A, step = 2 } = {}) {
writeFileSync(join(repo, 'tests', 'free.test.js'), 'y\n');
writeFileSync(join(repo, 'nb.ipynb'), '{}\n');
const r = spawnSync(process.execPath, [CLI, 'lock', '--files', 'tests/locked.test.js,nb.ipynb', '--step', String(step)], {
cwd: repo, encoding: 'utf8', env: { ...process.env, CLAUDE_CODE_SESSION_ID: session },
cwd: repo, encoding: 'utf8', env: childEnv({ CLAUDE_CODE_SESSION_ID: session }),
});
assert.equal(r.status, 0, `lock failed: ${r.stderr}`);
return repo;