Skip to content

Autonomous development for real products. Governed agents build from specs you approve, follow the rules you set, and nothing merges until another agent proves it. Your decisions, judgement and taste are the bar that work must clear. Declare your vision and let agents build it.

test(core): strip SSH markers from person fixtures [C7,B26]

Corey Olson1f615e3cb265
diff --git a/bin/run-tests.js b/bin/run-tests.js
index 6d23d368..dbe5482d 100644
--- a/bin/run-tests.js
+++ b/bin/run-tests.js
@@ -7,7 +7,7 @@ import { delimiter, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
import { execFileSync, spawnSync } from 'node:child_process';
import { tmpdir } from 'node:os';
-import { AGENT_SHELL_MARKERS } from '../src/person.js';
+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
const runner = fileURLToPath(import.meta.url);
@@ -41,6 +41,7 @@ function testEnvironment(sandbox) {
}
// Model a plain user terminal; person-boundary tests inject agent markers explicitly.
for (const key of AGENT_SHELL_MARKERS) delete env[key];
+ for (const key of SSH_SHELL_MARKERS) delete env[key];
env.HOME = home;
env.USERPROFILE = home;
env.PULLBOARD_HOME = home;
diff --git a/src/person.js b/src/person.js
index 878580eb..bc5f1de8 100644
--- a/src/person.js
+++ b/src/person.js
@@ -7,6 +7,9 @@ export const AGENT_SHELL_MARKERS = Object.freeze([
'CODEX_THREAD_ID', 'CODEX_SESSION_ID', 'CODEX_CI', 'CODEX_SHELL',
]);
+/** SSH transport markers removed from test child environments that act as the person. */
+export const SSH_SHELL_MARKERS = Object.freeze(['SSH_CONNECTION', 'SSH_CLIENT', 'SSH_TTY']);
+
/** Refuse terminal person actions in an agent shell; only the authenticated view adapter supplies view. */
export function requirePersonChannel(channel = 'terminal', environment = process.env) {
if (!['terminal', 'view'].includes(channel)) {
diff --git a/test/api.test.js b/test/api.test.js
index 4687cd9d..f083a02d 100644
--- a/test/api.test.js
+++ b/test/api.test.js
@@ -20,6 +20,7 @@ import { resultCommands } from '../src/cli.js';
import { allShouts, closeBoard, EVENT_LOG_VERSION, openBoard } from '../src/board.js';
import { presentationShout, relayPresentation } from '../src/relay-presentation.js';
import { JSON_SHAPES } from '../src/json.js';
+import { SSH_SHELL_MARKERS } from '../src/person.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const TEMP_DIRS = [];
@@ -64,6 +65,7 @@ function sandbox() {
GIT_COMMITTER_EMAIL: '[email protected]',
PULLBOARD_HOME: join(dir, 'home'),
};
+ for (const marker of SSH_SHELL_MARKERS) delete env[marker];
const git = (cwd, ...args) => execFileSync('git', args, { cwd, env, encoding: 'utf8', stdio: 'pipe' }).trim();
const run = (cwd, ...args) => spawnSync(process.execPath, [BIN, ...args], { cwd, env, encoding: 'utf8' });
return { dir, env, git, run };
diff --git a/test/approved-row-changes.test.js b/test/approved-row-changes.test.js
index 4de71167..1d93e21b 100644
--- a/test/approved-row-changes.test.js
+++ b/test/approved-row-changes.test.js
@@ -5,7 +5,7 @@ import { chmodSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync
import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { after, test } from 'node:test';
-import { AGENT_SHELL_MARKERS } from '../src/person.js';
+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const TEMP_DIRS = [];
@@ -28,7 +28,7 @@ after(cleanup);
function isolatedEnvironment(source) {
const env = { ...source };
for (const name of Object.keys(env)) {
- if (name.startsWith('GIT_') || AGENT_SHELL_MARKERS.includes(name)) delete env[name];
+ if (name.startsWith('GIT_') || AGENT_SHELL_MARKERS.includes(name) || SSH_SHELL_MARKERS.includes(name)) delete env[name];
}
return env;
}
diff --git a/test/e2e.test.js b/test/e2e.test.js
index 1326e10d..a5ac9bfa 100644
--- a/test/e2e.test.js
+++ b/test/e2e.test.js
@@ -22,6 +22,7 @@ import { after, test } from 'node:test';
import { parseSpec } from '../src/spec.js';
import { checkAtCommit } from '../src/trusted-policy.js';
import * as store from '../src/board.js';
+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const cockpitSource = () => readFileSync(resolve(import.meta.dirname, '../src/cockpit.js'), 'utf8');
@@ -54,6 +55,7 @@ function sandbox() {
PULLBOARD_HOME: join(dir, 'pullboard-home'),
PULLBOARD_MACHINE_HOME: join(dir, 'machine-home'),
};
+ for (const marker of [...AGENT_SHELL_MARKERS, ...SSH_SHELL_MARKERS]) delete env[marker];
delete env.PULLBOARD_RELAY_TOKEN;
const git = (cwd, ...args) => execFileSync('git', args, { cwd, env, encoding: 'utf8', stdio: 'pipe' }).trim();
const tryGit = (cwd, ...args) => spawnSync('git', args, { cwd, env, encoding: 'utf8' });
diff --git a/test/person.test.js b/test/person.test.js
index c5894e5a..8f7cac37 100644
--- a/test/person.test.js
+++ b/test/person.test.js
@@ -7,6 +7,7 @@ import { join, resolve } from 'node:path';
import { DatabaseSync } from 'node:sqlite';
import { once } from 'node:events';
import { test } from 'node:test';
+import { SSH_SHELL_MARKERS } from '../src/person.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const MARKERS = {
@@ -29,8 +30,7 @@ const TEMP_DIRS = [];
function cleanEnvironment(source) {
const env = { ...source };
for (const key of Object.keys(MARKERS)) delete env[key];
- delete env.SSH_CONNECTION;
- delete env.SSH_TTY;
+ for (const key of SSH_SHELL_MARKERS) delete env[key];
return env;
}
diff --git a/test/row-decisions.test.js b/test/row-decisions.test.js
index da03eccf..376710cc 100644
--- a/test/row-decisions.test.js
+++ b/test/row-decisions.test.js
@@ -7,7 +7,7 @@ import { join, resolve } from 'node:path';
import { DatabaseSync } from 'node:sqlite';
import { after, test } from 'node:test';
import { parseSpec } from '../src/spec.js';
-import { AGENT_SHELL_MARKERS } from '../src/person.js';
+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const SPEC_FILE = 'SPEC.md';
@@ -45,7 +45,7 @@ after(cleanup);
function personEnvironment(source) {
const env = { ...source };
for (const key of Object.keys(env)) {
- if (key.startsWith('GIT_') || AGENT_SHELL_MARKERS.includes(key)) delete env[key];
+ if (key.startsWith('GIT_') || AGENT_SHELL_MARKERS.includes(key) || SSH_SHELL_MARKERS.includes(key)) delete env[key];
}
return env;
}
diff --git a/test/spec.test.js b/test/spec.test.js
index 784bb7a4..5420f13d 100644
--- a/test/spec.test.js
+++ b/test/spec.test.js
@@ -8,7 +8,7 @@ import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { test } from 'node:test';
import { standardDoctrine } from '../src/doctrine.js';
-import { AGENT_SHELL_MARKERS } from '../src/person.js';
+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
import {
citedIds,
deletedIds,
@@ -286,7 +286,7 @@ function specBox(t, { specName = 'SPEC.md', practiceName = 'PRACTICE.md', practi
};
delete env.PULLBOARD_RELAY_TOKEN;
// These isolated signoff fixtures model the same person terminal as the suite runner.
- for (const marker of AGENT_SHELL_MARKERS) delete env[marker];
+ for (const marker of [...AGENT_SHELL_MARKERS, ...SSH_SHELL_MARKERS]) delete env[marker];
const git = (...args) => execFileSync('git', args, { cwd: root, env, stdio: 'pipe', encoding: 'utf8' });
const command = (...args) => spawnSync(process.execPath, [resolve(import.meta.dirname, '../bin/pullboard.js'), ...args], { cwd: root, env, encoding: 'utf8' });
const run = (...args) => command('spec', ...args);
diff --git a/test/stale-frozen-items.test.js b/test/stale-frozen-items.test.js
index 56f607d9..da011ee8 100644
--- a/test/stale-frozen-items.test.js
+++ b/test/stale-frozen-items.test.js
@@ -6,7 +6,7 @@ import { tmpdir } from 'node:os';
import { join, resolve } from 'node:path';
import { after, test } from 'node:test';
import { DatabaseSync } from 'node:sqlite';
-import { AGENT_SHELL_MARKERS } from '../src/person.js';
+import { AGENT_SHELL_MARKERS, SSH_SHELL_MARKERS } from '../src/person.js';
const BIN = resolve(import.meta.dirname, '../bin/pullboard.js');
const TEMP_DIRS = [];
@@ -43,7 +43,7 @@ function project(t) {
writeFileSync(join(bin, 'pullboard'), `#!/bin/sh\nexec ${shellWord(process.execPath)} ${shellWord(BIN)} "$@"\n`);
chmodSync(join(bin, 'pullboard'), 0o755);
const env = { ...process.env };
- for (const name of Object.keys(env)) if (name.startsWith('GIT_') || AGENT_SHELL_MARKERS.includes(name)) delete env[name];
+ for (const name of Object.keys(env)) if (name.startsWith('GIT_') || AGENT_SHELL_MARKERS.includes(name) || SSH_SHELL_MARKERS.includes(name)) delete env[name];
Object.assign(env, {
PATH: `${bin}:${process.env.PATH}`,
HOME: join(dir, 'home'),
diff --git a/test/test-runner.test.js b/test/test-runner.test.js
index 101b048f..028252c7 100644
--- a/test/test-runner.test.js
+++ b/test/test-runner.test.js
@@ -17,6 +17,9 @@ test('tests run without inherited Git identity or config and refuse ambient pull
assert.equal(process.env.GIT_AUTHOR_EMAIL, undefined);
assert.equal(process.env.GIT_COMMITTER_NAME, undefined);
assert.equal(process.env.GIT_COMMITTER_EMAIL, undefined);
+ assert.equal(process.env.SSH_CONNECTION, undefined);
+ assert.equal(process.env.SSH_CLIENT, undefined);
+ assert.equal(process.env.SSH_TTY, undefined);
assert.equal(process.env.HOME, process.env.PULLBOARD_HOME);
assert.ok(process.env.PULLBOARD_TEST_FILE.endsWith('test/test-runner.test.js'));
@@ -53,15 +56,22 @@ test('runner removes its private home after test workers exit [C7, S13]', (t) =>
const report = join(scratch, 'sandbox-path');
writeFileSync(probe, `import { test } from 'node:test';
import { writeFileSync } from 'node:fs';
-test('reports its sandbox', () => writeFileSync(${JSON.stringify(report)}, process.env.TMPDIR));
+test('reports its sandbox and person-terminal markers', () => writeFileSync(${JSON.stringify(report)}, JSON.stringify({ sandbox: process.env.TMPDIR, ssh: [process.env.SSH_CONNECTION, process.env.SSH_CLIENT, process.env.SSH_TTY] })));
`);
const runner = fileURLToPath(new URL('../bin/run-tests.js', import.meta.url));
const launchEnv = { ...process.env };
+ Object.assign(launchEnv, {
+ SSH_CONNECTION: '192.0.2.1 1234 192.0.2.2 22',
+ SSH_CLIENT: '192.0.2.1 1234 22',
+ SSH_TTY: '/dev/pts/4',
+ });
delete launchEnv.NODE_TEST_CONTEXT;
const result = spawnSync(process.execPath, [runner, probe], { encoding: 'utf8', env: launchEnv });
assert.equal(result.status, 0, `${result.stdout}${result.stderr}`);
assert.ok(existsSync(report), `${result.stdout}${result.stderr}`);
- const sandbox = readFileSync(report, 'utf8');
+ const resultEnv = JSON.parse(readFileSync(report, 'utf8'));
+ const sandbox = resultEnv.sandbox;
+ assert.deepEqual(resultEnv.ssh, [null, null, null], 'the runner removes every SSH transport marker before test workers act as the person');
assert.equal(existsSync(sandbox), false, 'the private sandbox is removed after Node exits');
const failingProbe = join(scratch, 'runner-failure.test.js');