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(ci): preserve isolated git identity [C7]

Corey Olson6f4c4734e573
diff --git a/bin/run-tests.js b/bin/run-tests.js
index 44a0387d..6d23d368 100644
--- a/bin/run-tests.js
+++ b/bin/run-tests.js
@@ -5,12 +5,17 @@
import { chmodSync, mkdirSync, mkdtempSync, rmSync, writeFileSync } from 'node:fs';
import { delimiter, join, resolve } from 'node:path';
import { fileURLToPath } from 'node:url';
-import { spawnSync } from 'node:child_process';
+import { execFileSync, spawnSync } from 'node:child_process';
import { tmpdir } from 'node:os';
import { AGENT_SHELL_MARKERS } from '../src/person.js';
const runner = fileURLToPath(import.meta.url);
+/** Quote a path for the private Git shim without interpreting shell metacharacters. */
+function shellWord(value) {
+ return `'${String(value).replaceAll("'", "'\\''")}'`;
+}
+
/**
* Build a private environment that makes local tests fail for the same missing Git and CLI setup as CI.
*
@@ -25,6 +30,10 @@ function testEnvironment(sandbox) {
const refusal = join(shims, 'pullboard');
writeFileSync(refusal, '#!/bin/sh\nprintf "pullboard is not installed; current test: %s\\n" "${PULLBOARD_TEST_FILE:-unknown}" >&2\nexit 1\n');
chmodSync(refusal, 0o755);
+ const realGit = execFileSync('which', ['git'], { encoding: 'utf8' }).trim().split(/\r?\n/u)[0];
+ const git = join(shims, 'git');
+ writeFileSync(git, `#!/bin/sh\nexec ${shellWord(realGit)} -c user.useConfigOnly=true "$@"\n`);
+ chmodSync(git, 0o755);
const env = { ...process.env };
for (const key of Object.keys(env)) {
diff --git a/test/row-decisions.test.js b/test/row-decisions.test.js
index fae12dec..d8de3192 100644
--- a/test/row-decisions.test.js
+++ b/test/row-decisions.test.js
@@ -1,4 +1,4 @@
-/** Person-authored row decisions stay on the board until a coordinator applies them [B26,S18,S19]. */
+/** Person-authored row decisions stay on the board until a coordinator applies them [B26,S18,S19,C7]. */
import assert from 'node:assert/strict';
import { execFileSync, spawn, spawnSync } from 'node:child_process';
import { chmodSync, existsSync, mkdirSync, mkdtempSync, readFileSync, realpathSync, rmSync, writeFileSync } from 'node:fs';
@@ -26,6 +26,14 @@ const BASE_DOCTRINE = `# Repo doctrine
## L · Local
- L1 [draft] Approve this doctrine row. | gate: true
`;
+const FIXTURE_GIT_ENV = {
+ GIT_CONFIG_GLOBAL: '/dev/null',
+ GIT_CONFIG_NOSYSTEM: '1',
+ GIT_AUTHOR_NAME: 'Row decision fixture',
+ GIT_AUTHOR_EMAIL: '[email protected]',
+ GIT_COMMITTER_NAME: 'Row decision fixture',
+ GIT_COMMITTER_EMAIL: '[email protected]',
+};
/** Remove each private fixture after child processes have been stopped. */
function cleanup() {
@@ -62,13 +70,8 @@ function sandbox() {
HOME: join(dir, 'home'),
PULLBOARD_HOME: join(dir, 'pullboard-home'),
PULLBOARD_MACHINE_HOME: join(dir, 'machine-home'),
- GIT_CONFIG_GLOBAL: '/dev/null',
- GIT_CONFIG_NOSYSTEM: '1',
- GIT_AUTHOR_NAME: 'Row decision fixture',
- GIT_AUTHOR_EMAIL: '[email protected]',
- GIT_COMMITTER_NAME: 'Row decision fixture',
- GIT_COMMITTER_EMAIL: '[email protected]',
});
+ Object.assign(env, FIXTURE_GIT_ENV);
/** Run Git with the fixture's private identity and configuration. */
function git(cwd, ...args) {
return execFileSync('git', args, { cwd, env, encoding: 'utf8', stdio: 'pipe' }).trim();
@@ -76,12 +79,29 @@ function sandbox() {
/** Run the real CLI with a clean person environment and optional explicit markers. */
function run(cwd, args, extraEnv = {}) {
return spawnSync(process.execPath, [BIN, ...args], {
- cwd, env: { ...personEnvironment(env), ...extraEnv }, encoding: 'utf8', timeout: 15_000,
+ cwd, env: { ...personEnvironment(env), ...FIXTURE_GIT_ENV, ...extraEnv }, encoding: 'utf8', timeout: 15_000,
});
}
return { dir, env, git, run };
}
+test('[C7] the private runner keeps Git identity detection disabled after fixtures strip GIT_* variables', () => {
+ const box = sandbox();
+ const root = join(box.dir, 'guard-repo');
+ mkdirSync(root);
+ box.git(root, 'init', '-q', '-b', 'main');
+ const env = {
+ ...personEnvironment(box.env),
+ HOME: join(box.dir, 'empty-home'),
+ GIT_CONFIG_GLOBAL: '/dev/null',
+ GIT_CONFIG_NOSYSTEM: '1',
+ };
+ delete env.EMAIL;
+ const result = spawnSync('git', ['var', 'GIT_AUTHOR_IDENT'], { cwd: root, env, encoding: 'utf8' });
+ assert.notEqual(result.status, 0, 'the runner shim refuses Git auto-detection with a new HOME and no inherited identity');
+ assert.match(result.stderr, /auto-detection is disabled/u);
+});
+
/** Initialize and commit a real repo with SPEC, DOCTRINE, an SQLite board and private lanes. */
function project({ spec = BASE_SPEC, doctrine = BASE_DOCTRINE } = {}) {
const box = sandbox();