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.

fix(gate): the landing pin covers untracked file contents [C7,V4]

Corey Olson64bb6e14b400
diff --git a/docs/api.md b/docs/api.md
index d0c85772..b53c5df2 100644
--- a/docs/api.md
+++ b/docs/api.md
@@ -334,7 +334,7 @@ Row approval and decline first record the person's exact decision through the sa
The landing gate sets `PULLBOARD_LANDING_RUN=1` only for its test runner. In that mode, the runner requires process isolation and POSIX process identities; it stops scheduling files after the first test-file failure, interrupts files already running, and reports the failure, interrupted files, and selected files not run. Landing early-stop fails before starting tests on Windows because the runner cannot safely identify and drain owned worker descendants there. It uses Node's execution-ordered test completion events; ordinary focused runs and all non-landing gates keep normal scheduling. The runner clears this marker for test workers and nested commands. If a process-identity census stays unavailable, tests still determine the gate result; the runner reports cleanup as `UNVERIFIED` and does not signal processes whose identity it could not establish. A `UNVERIFIED` cleanup report means descendant cleanup was not confirmed.
-With `landingShards: N` in `pullboard.json` (a whole number from 1 to 64; absent or 1 keeps one run), the landing run of `bin/run-tests.js` splits the tracked test files into N shards. It balances them by each file's wall time from the last sharded landing, kept in the repository's `pullboard/landing-file-times.json`; with no times it balances by file count. The first shard uses the gate's own slot. Each other shard takes a landing-priority gate slot, locally or on a registered runner. The run is green only if every shard is green. The first red shard stops the others, which are reported as `stopped`. A shard whose runner fails mid-run prints `landing shard <i>/<n>: runner <host> failed mid-shard; rerunning shard <i>/<n> locally` and reruns on a local slot. Runner refusals are classed by code. `RUNNER_SETUP_REFUSED` and `RESOURCE_LEASE_LOST` rerun locally, with the code and host in the log. `RUNNER_CLEANUP_TIMEOUT` reruns locally and also quarantines that host for the rest of the landing, printing `landing runner <host> quarantined for the rest of this landing: <message>`. `RUNNER_SOURCE_CHANGED` and any unknown code fail the landing red as `refused`, with no retry. The landing pins its source (HEAD, tracked changes and untracked files) before the first shard. A local shard, first run or rerun, checks that source before and after it runs and refuses as `LANDING_SOURCE_CHANGED` if the checkout moved, so a result never comes from other code. Stopping a local shard first records every process it owns from the process census: its parent-tree descendants, including detached ones in their own group or session, and their group members. It then sends TERM so the shard's run-tests drains through its own custody, and signals whatever the census still finds. Processes that cannot be shown gone are named as `[LANDING_SHARD_CLEANUP_UNVERIFIED]` in the log and in `landingShards.unverified`, with an instruction to inspect them before another run. The merged log prints one `# landing shard <i>/<n> on <host>: <green|red|stopped> in <ms> ms` line per shard and one `# landing file <i>/<n> <host> <ms|-> <path>` line per file. It also names how the plan was balanced (`history`, `history and average` or `file count`) and, once history exists, the slowest recorded file as `# landing floor: <ms> ms <path>`, since no shard count can finish sooner. The gate profile carries the same fields as `landingShards.balance`, `landingShards.floor`, `landingShards.shards` and `landingShards.files`. Every shard takes any free gate slot, so a runner with two slots can run two shards, and each local shard needing Chrome still waits for the machine's `browserSlots`.
+With `landingShards: N` in `pullboard.json` (a whole number from 1 to 64; absent or 1 keeps one run), the landing run of `bin/run-tests.js` splits the tracked test files into N shards. It balances them by each file's wall time from the last sharded landing, kept in the repository's `pullboard/landing-file-times.json`; with no times it balances by file count. The first shard uses the gate's own slot. Each other shard takes a landing-priority gate slot, locally or on a registered runner. The run is green only if every shard is green. The first red shard stops the others, which are reported as `stopped`. A shard whose runner fails mid-run prints `landing shard <i>/<n>: runner <host> failed mid-shard; rerunning shard <i>/<n> locally` and reruns on a local slot. Runner refusals are classed by code. `RUNNER_SETUP_REFUSED` and `RESOURCE_LEASE_LOST` rerun locally, with the code and host in the log. `RUNNER_CLEANUP_TIMEOUT` reruns locally and also quarantines that host for the rest of the landing, printing `landing runner <host> quarantined for the rest of this landing: <message>`. `RUNNER_SOURCE_CHANGED` and any unknown code fail the landing red as `refused`, with no retry. The landing pins its source (HEAD, tracked changes, and the names and contents of untracked files) before the first shard. A local shard, first run or rerun, checks that source before and after it runs and refuses as `LANDING_SOURCE_CHANGED` if the checkout moved, so a result never comes from other code. Stopping a local shard first records every process it owns from the process census: its parent-tree descendants, including detached ones in their own group or session, and their group members. It then sends TERM so the shard's run-tests drains through its own custody, and signals whatever the census still finds. Processes that cannot be shown gone are named as `[LANDING_SHARD_CLEANUP_UNVERIFIED]` in the log and in `landingShards.unverified`, with an instruction to inspect them before another run. The merged log prints one `# landing shard <i>/<n> on <host>: <green|red|stopped> in <ms> ms` line per shard and one `# landing file <i>/<n> <host> <ms|-> <path>` line per file. It also names how the plan was balanced (`history`, `history and average` or `file count`) and, once history exists, the slowest recorded file as `# landing floor: <ms> ms <path>`, since no shard count can finish sooner. The gate profile carries the same fields as `landingShards.balance`, `landingShards.floor`, `landingShards.shards` and `landingShards.files`. Every shard takes any free gate slot, so a runner with two slots can run two shards, and each local shard needing Chrome still waits for the machine's `browserSlots`.
Only the person can run `pullboard land --waive <test> --until <date> --reason "why"`. A waiver retains every test in the full gate. The batch records its exact tree and each failing test with its covering live waiver; pre-push validates that distinct proof and creates no ordinary green stamp. Expired waivers cannot authorize a push. Existing gate-stamped pushes and `pullboard merged` remain available.
diff --git a/src/landing-shards.js b/src/landing-shards.js
index ebf49342..2b167432 100644
--- a/src/landing-shards.js
+++ b/src/landing-shards.js
@@ -4,7 +4,7 @@
* and a shard whose runner fails mid-run reruns locally.
*/
import { spawn, spawnSync } from 'node:child_process';
-import { existsSync, mkdirSync, readFileSync, renameSync, writeFileSync } from 'node:fs';
+import { existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, renameSync, writeFileSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { createHash, randomUUID } from 'node:crypto';
import { gitChildEnv, repoInfo } from './git.js';
@@ -234,7 +234,8 @@ async function runLocalShard({ root, runner, files, label, lease, stop }) {
/**
* A fingerprint of exactly what a local shard would run: HEAD, every tracked change against it and
- * the untracked files Git does not ignore. A landing pins it before its first shard.
+ * the names and contents of the untracked files Git does not ignore. A landing pins it before its
+ * first shard; a same-name replacement of an untracked file changes it too.
*
* @param {string} root
* @returns {{ commit: string, fingerprint: string }}
@@ -247,8 +248,16 @@ export function landingSource(root) {
};
const commit = git(['rev-parse', 'HEAD']).toString('utf8').trim();
const hash = createHash('sha256').update(commit).update('\0')
- .update(git(['diff', 'HEAD', '--binary', '--no-ext-diff'])).update('\0')
- .update(git(['ls-files', '--others', '--exclude-standard', '-z']));
+ .update(git(['diff', 'HEAD', '--binary', '--no-ext-diff'])).update('\0');
+ for (const path of git(['ls-files', '--others', '--exclude-standard', '-z']).toString('utf8').split('\0').filter(Boolean)) {
+ const full = join(root, path);
+ let content;
+ try {
+ const stat = lstatSync(full);
+ content = stat.isSymbolicLink() ? `link:${readlinkSync(full)}` : stat.isFile() ? readFileSync(full) : `kind:${stat.mode}`;
+ } catch { content = 'missing'; }
+ hash.update(path).update('\0').update(content).update('\0');
+ }
return { commit, fingerprint: hash.digest('hex') };
}
diff --git a/test/landing-shards.test.js b/test/landing-shards.test.js
index ede086b1..7d99ee3b 100644
--- a/test/landing-shards.test.js
+++ b/test/landing-shards.test.js
@@ -8,7 +8,7 @@ import { pathToFileURL } from 'node:url';
import { test } from 'node:test';
import { configProblems, defaults } from '../src/config.js';
import { landingShardCount } from '../src/gate.js';
-import { landingBalance, landingFloor, planLandingShards, shardFileTimes } from '../src/landing-shards.js';
+import { landingBalance, landingFloor, landingSource, planLandingShards, shardFileTimes } from '../src/landing-shards.js';
import { runFixtureChild } from './fixture-child.js';
const SOURCE = resolve(import.meta.dirname, '..');
@@ -320,6 +320,13 @@ test('a runner refusal in a sharded landing is handled by its class [C7,V4]', {
const box = fixture();
t.after(() => rmSync(box.dir, { recursive: true, force: true }));
scenario(box, 'green');
+ // The pin covers untracked contents, not only their names: a same-name replacement changes it.
+ const loose = join(box.repo, 'loose.txt');
+ writeFileSync(loose, 'first\n');
+ const before = landingSource(box.repo);
+ writeFileSync(loose, 'second\n');
+ assert.notEqual(landingSource(box.repo).fingerprint, before.fingerprint, 'an untracked file with new content changes the pin');
+ rmSync(loose);
const rerunLine = /^landing shard (\d\/\d): runner fixture-host failed mid-shard; rerunning shard \1 locally$/mu;
// 1. A lost host or transport reruns the shard locally, named.