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(flakes): preserve ambiguous CI identities [C7,H16]

Corey Olson98aa941fb94e
diff --cc docs/formats.md
index fabf5b1e,daad8e82..eacfcf4f
--- a/docs/formats.md
+++ b/docs/formats.md
@@@ -113,7 -113,7 +113,7 @@@ The board file is in the repository's G
| `row grammar` | `1` | `SPEC_GRAMMAR_VERSION` in `src/spec.js`; optional `<!-- pullboard-grammar N -->` line in either file (absence means the current grammar) | Both files share the version. A declared version must match; an incompatible grammar change requires a coordinated version bump and compatible files. No automatic conversion occurs. |
| `board schema` | `2` | `SCHEMA_VERSION` in `src/board.js`, persisted as `PRAGMA user_version` | Create missing tables and indexes, add missing columns in place with declared defaults, restore missing or changed triggers, and remove stale machine triggers without replacing rows. |
| `event log` | `1` | `EVENT_LOG_VERSION` in `src/board.js`, persisted in `board_meta` as `event_log_version` | Older event-log versions upgrade in place; newer versions are refused with `EVENT_LOG_VERSION`. Preserve event rows when the board schema changes. |
- | `move engine` | `62` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
-| `move engine` | `63` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
++| `move engine` | `65` | `ENGINE_VERSION` in `src/machine.js`, carried as `engine` in every sealed executable move | Bump when a move's meaning changes, independently of the event log and sealed envelope. A newer engine is refused with `ENGINE_VERSION`, naming both versions and asking you to upgrade Pullboard. |
<!-- format-versions:end -->
Relay transport capability `apiVersion: 2` is independent of these versions and
@@@ -176,6 -176,8 +176,8 @@@ Engine 61 (`NATIVE_FLAKE_ENGINE`) adds
Engine 62 (`HEALTH_CAP_ENGINE`; engine 61 is #887's) caps what one recorded health run shouts. A run sends at most ten notices one by one, resolved first; when it has more, one more notice to the coordinator says how many it held back, and every finding still records its own health event. An idle seat alone hears that it is idle. A recorded run at an older engine replays with its original notices.
-Engine 63 (`CI_FLAKE_ENGINE`) records flake observations imported from CI with `pullboard flakes import <folder>`. Such an observation has kind `ci`, a `ci` record (provider, run id, the failed attempt and its rerun attempt, job, runner and Node version) and a `load` of null, because a hosted runner reports no host load. A failed attempt whose rerun at the same commit passes the test is a flake; one whose TAP names no test by file stays unclassified. Observations of the other kinds replay as at engine 61.
++Engine 65 (`CI_FLAKE_ENGINE`) records flake observations imported from CI with `pullboard flakes import <folder>`. Such an observation has kind `ci`, a `ci` record (provider, run id, the failed attempt and its rerun attempt, job, runner and Node version) and a `load` of null, because a hosted runner reports no host load. A failed attempt whose rerun at the same commit passes the test is a flake; one whose TAP names no test by file stays unclassified. Observations of the other kinds replay as at engine 61.
+
The CLI declares its engine in every relay request's `X-Pullboard-Engine` header.
A linked board requires at least engine 48 after issuing any agent token or machine credential, including
revoked or expired ones; before engine 48 these minimums were 3 and 6. The minimum survives reopening the auth database;
diff --cc src/ci-flakes.js
index 00000000,ddc2e092..3cd68861
mode 000000,100644..100644
--- a/src/ci-flakes.js
+++ b/src/ci-flakes.js
@@@ -1,0 -1,145 +1,159 @@@
+ /**
+ * Import CI results into the flake ledger (#918). A CI job that fails and passes on its rerun at the same commit is
+ * the same evidence #887 records for local gates: one red original and one green pair. The importer reads local
+ * per-attempt manifests (ci-result.json beside its TAP file), so it needs no network and no CI credentials.
+ */
+ import { createHash } from 'node:crypto';
+ import { existsSync } from 'node:fs';
+ import { mkdirSync } from 'node:fs';
+ import { readFileSync } from 'node:fs';
+ import { readdirSync } from 'node:fs';
+ import { statSync } from 'node:fs';
+ import { writeFileSync } from 'node:fs';
+ import { basename } from 'node:path';
+ import { dirname } from 'node:path';
+ import { join } from 'node:path';
+ import { posix } from 'node:path';
+ import { tryGit } from './git.js';
+ import { Refused } from './refused.js';
+
+ const SHA = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/u;
+ const MANIFEST = 'ci-result.json';
+
+ /** The SHA-256 of a text, as hex. */
+ function digest(text) {
+ return createHash('sha256').update(text).digest('hex');
+ }
+
+ /**
+ * Read and check one attempt's manifest: which run, attempt and job it was, where it ran, at which commit, and the
+ * TAP file beside it. Anything malformed is refused by its file, never guessed.
+ */
+ function readAttempt(file) {
+ let value;
+ try { value = JSON.parse(readFileSync(file, 'utf8')); } catch { value = null; }
+ const text = (entry, limit) => typeof entry === 'string' && entry.length > 0 && entry.length <= limit && !/[\r\n\0]/u.test(entry);
+ if (!value || value.provider !== 'github' || !/^\d{1,20}$/u.test(String(value.run ?? '')) || !Number.isSafeInteger(value.attempt)
+ || value.attempt < 1 || !text(value.job, 200) || !text(value.runner, 200) || !/^v\d+\.\d+\.\d+$/u.test(value.node ?? '')
+ || !SHA.test(value.commit ?? '') || !text(value.root, 4096) || !posix.isAbsolute(value.root)
+ || !['success', 'failure'].includes(value.conclusion) || !Number.isFinite(Date.parse(value.at))
+ || !text(value.tap, 200) || basename(value.tap) !== value.tap) {
+ throw new Refused('CI_RESULT', `${file} is not a CI result: it needs provider github, run, attempt, job, runner, node, commit, root, conclusion, at and the tap file beside it`);
+ }
+ const tap = join(dirname(file), value.tap);
+ return { ...value, run: String(value.run), tapFile: tap, output: readFileSync(tap, 'utf8') };
+ }
+
+ /**
+ * The top-level test results a CI TAP report names, with each test's file relative to the CI checkout. A result
- * without a location inside that checkout keeps file null, so it can only stay unclassified.
++ * without a location inside that checkout keeps file null. Skipped rows stay visible for ambiguity checks.
+ */
+ function ciTests(output, root) {
+ const rows = [];
+ let active = null;
+ for (const raw of output.split('\n')) {
+ const match = /^(not ok|ok)\s+\d+\s+-\s+(.*)$/u.exec(raw);
+ if (match) {
- active = { name: match[2], passed: match[1] === 'ok', file: null, skip: /\s+#\s*(?:SKIP|TODO)\b/iu.test(match[2]) };
++ const directive = /\s+#\s*(?:SKIP|TODO)\b/iu.exec(match[2]);
++ active = { name: directive ? match[2].slice(0, directive.index).trimEnd() : match[2], passed: match[1] === 'ok', file: null, skip: directive !== null };
+ rows.push(active);
+ continue;
+ }
+ if (/^\S/u.test(raw)) active = null;
+ const location = active && /^ {2}location:\s*['"]?(.*?)['"]?\s*$/u.exec(raw);
+ if (!location) continue;
+ const file = posix.relative(root, location[1].replace(/:\d+(?::\d+)?$/u, ''));
+ if (file && !file.startsWith('../') && !posix.isAbsolute(file)) active.file = file;
+ }
- return rows.filter(row => !row.skip);
++ return rows;
++}
++
++/**
++ * Match a rerun to one actual failed test. A located row identifies its own file first. A locationless row can
++ * stand for a test only when its title occurs once in each report; a skip or another same-title file proves no pass.
++ */
++function rerunTest(target, before, after) {
++ if (target.file === null) return undefined;
++ const exact = after.filter(row => row.name === target.name && row.file === target.file);
++ if (exact.length) return exact.length === 1 && !exact[0].skip ? exact[0] : undefined;
++ const sameTitle = after.filter(row => row.name === target.name);
++ if (sameTitle.length !== 1 || sameTitle[0].file !== null || sameTitle[0].skip
++ || before.filter(row => row.name === target.name).length !== 1) return undefined;
++ return sameTitle[0];
+ }
+
+ /**
+ * Keep one attempt's TAP under the board's flake evidence, by digest, and describe it as a receipt. Kept evidence is
+ * never replaced: a re-import whose report differs is refused before anything is written (#918 review).
+ */
+ function keepReceipt(evidence, id, label, attempt) {
+ const folder = join(evidence, id);
+ const file = join(folder, label + '.log');
+ if (existsSync(file)) {
+ if (digest(readFileSync(file, 'utf8')) !== digest(attempt.output)) {
+ throw new Refused('FLAKE_OBSERVATION_CHANGED', `the kept ${label} report for ${id} differs from this CI result; the original evidence stays as recorded`);
+ }
+ } else {
+ mkdirSync(folder, { recursive: true, mode: 0o700 });
+ writeFileSync(file, attempt.output, { flag: 'wx', mode: 0o600 });
+ }
+ return { green: attempt.conclusion === 'success', sha256: digest(attempt.output), bytes: statSync(file).size,
+ artifact: `flake-evidence/${id}/${label}.log`, profileSha256: null };
+ }
+
+ /**
+ * The flake observations a folder of CI results holds. Each failed attempt is paired with the next attempt of the
+ * same run and job at the same commit. A failing test that passes there is a flake, one that fails again is
+ * stable-red, and a failure the TAP does not name by file stays unclassified. The original red is always kept.
+ *
+ * @param {string} root this checkout, which must hold each commit so its tree can be pinned
+ * @param {string} folder the downloaded CI results
+ * @returns {object[]} observations for recordFlakeObservation
+ */
+ export function ciObservations(root, folder) {
+ const files = readdirSync(folder, { recursive: true }).map(String).filter(path => basename(path) === MANIFEST).sort();
+ if (!files.length) throw new Refused('CI_RESULT', `${folder} holds no ${MANIFEST}; save each CI attempt's manifest beside its TAP file`);
+ const jobs = new Map();
+ for (const attempt of files.map(path => readAttempt(join(folder, path)))) {
+ const key = `${attempt.run}\0${attempt.job}`;
+ if (!jobs.has(key)) jobs.set(key, []);
+ jobs.get(key).push(attempt);
+ }
+ const common = tryGit(root, ['rev-parse', '--path-format=absolute', '--git-common-dir']);
+ if (common.status !== 0) throw new Refused('NOT_A_REPO', 'run pullboard flakes import inside the board repository');
+ const evidence = join(common.stdout.trim(), 'pullboard', 'flake-evidence');
+ const observations = [];
+ for (const attempts of jobs.values()) {
+ attempts.sort((left, right) => left.attempt - right.attempt);
+ for (const [index, red] of attempts.entries()) {
+ if (red.conclusion !== 'failure') continue;
+ const rerun = attempts.slice(index + 1).find(next => next.commit === red.commit);
+ if (!rerun) continue;
+ const tree = tryGit(root, ['rev-parse', '--verify', '--quiet', `${red.commit}^{tree}`]);
+ if (tree.status !== 0) throw new Refused('CI_COMMIT_UNKNOWN', `this checkout lacks CI commit ${red.commit}, so its tree cannot be pinned`, `git fetch origin ${red.commit}, then run pullboard flakes import again`);
+ const after = ciTests(rerun.output, rerun.root);
- const failed = ciTests(red.output, red.root).filter(row => !row.passed);
++ const before = ciTests(red.output, red.root);
++ const failed = before.filter(row => !row.passed && !row.skip);
+ const named = failed.filter(row => row.file !== null);
+ const targets = named.length ? named : [{ file: null, name: null }];
+ for (const target of targets) {
+ const id = `ci-${red.run}-${red.attempt}-${digest(JSON.stringify([red.job, target.file, target.name])).slice(0, 16)}`;
- // Node's TAP names a passing test without its location, so a rerun row matches by name alone when exactly one does.
- const same = target.file === null ? [] : after.filter(row => row.name === target.name && (row.file === target.file || row.file === null));
- const again = same.length === 1 ? same[0] : undefined;
++ const again = rerunTest(target, before, after);
+ // A flake needs a green pair: a rerun that passed this test but failed elsewhere proves nothing either way.
+ const classification = again === undefined ? 'unclassified' : !again.passed ? 'stable-red' : rerun.conclusion === 'success' ? 'flake' : 'unclassified';
+ const reason = classification === 'flake' ? `GitHub run ${red.run} failed this test in attempt ${red.attempt} and passed it in attempt ${rerun.attempt} at the same commit; original red retained.`
+ : classification === 'stable-red' ? `GitHub run ${red.run} failed this test again in attempt ${rerun.attempt} at the same commit; original red retained.`
+ : target.file === null ? `GitHub run ${red.run} attempt ${red.attempt} failed with no test named by file in its TAP; it remains unclassified.`
- : again === undefined ? `GitHub run ${red.run} attempt ${rerun.attempt} did not report this test; it remains unclassified.`
++ : again === undefined ? `GitHub run ${red.run} attempt ${rerun.attempt} did not unambiguously identify this test; it remains unclassified.`
+ : `GitHub run ${red.run} attempt ${rerun.attempt} passed this test but failed elsewhere; it remains unclassified.`;
+ observations.push({
+ id, file: target.file, name: target.name, head: red.commit, tree: tree.stdout.trim(), main: red.commit, kind: 'ci', classification,
+ commandSha256: digest(`ci:github:${red.job}`), reason, at: new Date(red.at).toISOString(), diagnosticMs: 0, load: null,
+ ci: { provider: 'github', run: red.run, attempt: red.attempt, rerunAttempt: rerun.attempt, job: red.job, runner: red.runner, node: red.node },
+ original: keepReceipt(evidence, id, 'original', red), paired: keepReceipt(evidence, id, 'paired', rerun), mainReceipt: null,
+ });
+ }
+ }
+ }
+ return observations;
+ }
diff --cc src/flake-engine.js
index 40497f64,ff2add94..4f162b96
--- a/src/flake-engine.js
+++ b/src/flake-engine.js
@@@ -1,6 -1,9 +1,9 @@@
/** Coordinator allocation17419: typed Native flake observations start here [H16]. */
export const NATIVE_FLAKE_ENGINE = 61;
+ /** A flake observation imported from CI, with its run, job, runner and Node version and no host load, starts here (#918). */
-export const CI_FLAKE_ENGINE = 63;
++export const CI_FLAKE_ENGINE = 65;
+
/** Recognize new landing receipt relationships without interpreting malformed batch input. */
export function carriesFlakeDiagnostics(batch) {
return Boolean(batch && (Object.hasOwn(batch, 'flakeDiagnostics')
diff --cc test/flakes.test.js
index d2e4cfa9,9b5b5dee..cdec7864
--- a/test/flakes.test.js
+++ b/test/flakes.test.js
@@@ -487,3 -487,73 +487,139 @@@ test('a ledger recording failure canno
assert.equal(Object.hasOwn(manifest, 'recording-error.addendum.json'), false, 'the original manifest remains immutable');
assert.equal(JSON.parse(readFileSync(join(directory, 'recording-error.addendum.json'), 'utf8')).code, 'SYNTHETIC_LEDGER_UNAVAILABLE');
});
+
+ /** Save one CI attempt as the importer reads it: a manifest beside its TAP report. */
+ function ciAttempt(folder, name, manifest, tap) {
+ const directory = join(folder, name);
+ mkdirSync(directory, { recursive: true });
+ writeFileSync(join(directory, 'run.tap'), tap);
+ writeFileSync(join(directory, 'ci-result.json'), JSON.stringify({ provider: 'github', root: '/home/runner/work/repo/repo', tap: 'run.tap', ...manifest }));
+ }
+
+ test('a CI job red then green on its rerun is one flake, and a CI failure with no test names stays unclassified [C7,H16]', t => {
+ const box = flakyProject(t);
+ const commit = box.git('rev-parse', 'HEAD').trim();
+ const ci = join(box.scratch, 'ci-results');
+ const location = " location: '/home/runner/work/repo/repo/test/alternating.test.mjs:3:1'\n";
+ const job = { job: 'linux (22.13.1) 1/2', runner: 'ubuntu-24.04', node: 'v22.13.1', commit, at: '2026-10-20T10:00:00.000Z' };
+ ciAttempt(ci, 'run-111-1', { ...job, run: '111', attempt: 1, conclusion: 'failure' }, `TAP version 13\nnot ok 1 - ${TITLE}\n ---\n${location} ...\n1..1\n`);
+ ciAttempt(ci, 'run-111-2', { ...job, run: '111', attempt: 2, conclusion: 'success' }, `TAP version 13\nok 1 - ${TITLE}\n ---\n${location} ...\n1..1\n`);
+ const crash = { job: 'macos (22.13.1) 2/2', runner: 'macos-15', node: 'v22.13.1', commit, at: '2026-10-20T11:00:00.000Z' };
+ ciAttempt(ci, 'run-222-1', { ...crash, run: '222', attempt: 1, conclusion: 'failure' }, 'TAP version 13\nnot ok 1 - the shard stopped before its tests reported\n1..1\n');
+ ciAttempt(ci, 'run-222-2', { ...crash, run: '222', attempt: 2, conclusion: 'success' }, 'TAP version 13\n1..0\n');
+
+ const imported = box.cli('flakes', 'import', ci);
+ assert.equal(imported.code, 0, JSON.stringify(imported.document));
+ assert.equal(imported.document.imported.length, 2);
+ const listed = box.cli('flakes').document;
+ assert.equal(listed.flakes.length, 1, 'the red-then-green CI pair is one flake');
+ const flake = listed.flakes[0].observations[0];
+ assert.equal(listed.flakes[0].file, 'test/alternating.test.mjs', 'the CI location resolves inside the CI checkout');
+ assert.equal(listed.flakes[0].name, TITLE);
+ assert.equal(flake.kind, 'ci');
+ assert.deepEqual(flake.ci, { provider: 'github', run: '111', attempt: 1, rerunAttempt: 2, job: job.job, runner: job.runner, node: job.node });
+ assert.equal(flake.head, commit);
+ assert.equal(flake.original.green, false, 'the original CI red is kept');
+ assert.equal(flake.paired.green, true);
+ assert.equal(flake.load, null, 'a hosted runner reports no host load, and none is invented');
+ assertReceipts(box, flake);
+ const unnamed = listed.unclassified.flatMap(row => row.observations).find(entry => entry.ci?.run === '222');
+ assert.ok(unnamed, 'the CI failure with no test named by file is recorded');
+ assert.equal(unnamed.file, null);
+ assert.equal(unnamed.classification, 'unclassified');
+ assert.match(unnamed.reason, /no test named by file/u);
+
+ const again = box.cli('flakes', 'import', ci);
+ assert.equal(again.code, 0);
+ assert.ok(again.document.imported.every(entry => entry.duplicate), 'importing the same CI results again records nothing new');
+ assert.equal(box.cli('flakes').document.flakes[0].count, 1);
+ });
+
+ test('a CI rerun that names its passing test without a location still pairs, and kept CI evidence is never replaced [C7,H16]', t => {
+ const box = flakyProject(t);
+ const commit = box.git('rev-parse', 'HEAD').trim();
+ const ci = join(box.scratch, 'ci-results');
+ const job = { job: 'linux (24) 2/2', runner: 'ubuntu-24.04', node: 'v24.11.0', commit, run: '444', at: '2026-10-20T12:00:00.000Z' };
+ const red = `TAP version 13\nnot ok 1 - ${TITLE}\n ---\n location: '/home/runner/work/repo/repo/test/alternating.test.mjs:3:1'\n ...\n1..1\n`;
+ ciAttempt(ci, 'run-444-1', { ...job, attempt: 1, conclusion: 'failure' }, red);
+ // As Node's TAP reporter writes it: a passing test carries no location.
+ ciAttempt(ci, 'run-444-2', { ...job, attempt: 2, conclusion: 'success' }, `TAP version 13\nok 1 - ${TITLE}\n ---\n duration_ms: 1.2\n ...\n1..1\n`);
+ assert.equal(box.cli('flakes', 'import', ci).code, 0);
+ const flake = box.cli('flakes').document.flakes[0]?.observations[0];
+ assert.equal(flake?.classification, 'flake', 'the rerun row matches by its name when it carries no location');
+ const kept = join(box.root, '.git/pullboard', flake.original.artifact);
+ const before = readFileSync(kept);
+ // The downloaded red report changes by one comment line; the ledger refuses it, and the kept original is untouched.
+ writeFileSync(join(ci, 'run-444-1', 'run.tap'), red + '# re-downloaded\n');
+ const changed = box.cli('flakes', 'import', ci);
+ assert.equal(changed.code, 1);
+ assert.equal(changed.document.error.code, 'FLAKE_OBSERVATION_CHANGED');
+ assert.deepEqual(readFileSync(kept), before, 'the original red evidence keeps its recorded bytes');
+ assertReceipts(box, flake);
+ });
++
++
++test('a CI passing title cannot prove two files when the other rerun skips [C7,H16]', t => {
++ const box = flakyProject(t);
++ for (const suffix of ['a', 'b']) {
++ writeFileSync(join(box.root, `test/ci-${suffix}.test.mjs`), `import assert from 'node:assert/strict';
++import { test } from 'node:test';
++test('the shared title [C7]', { skip: process.env.CI_DUPLICATE_MODE === 'rerun' && ${suffix === 'b'} }, () => {
++ assert.equal(process.env.CI_DUPLICATE_MODE, 'rerun');
++});\n`);
++ }
++ box.git('add', 'test/ci-a.test.mjs', 'test/ci-b.test.mjs');
++ box.git('commit', '-q', '-m', 'test: prepare fixed duplicate-title CI source');
++ const commit = box.git('rev-parse', 'HEAD');
++ const command = ['--test', '--test-reporter=tap', 'test/ci-a.test.mjs', 'test/ci-b.test.mjs'];
++ const red = runFixtureChild(process.execPath, command, { cwd: box.root, env: { ...box.env, CI_DUPLICATE_MODE: 'red' }, encoding: 'utf8' });
++ const rerun = runFixtureChild(process.execPath, command, { cwd: box.root, env: { ...box.env, CI_DUPLICATE_MODE: 'rerun' }, encoding: 'utf8' });
++ t.diagnostic(JSON.stringify({ commit, node: process.version, red: red.stdout, rerun: rerun.stdout }));
++ assert.equal(red.status, 1, red.failure);
++ assert.equal(rerun.status, 0, rerun.failure);
++ assert.match(red.stdout, /^# fail 2$/mu);
++ assert.match(rerun.stdout, /^# pass 1$/mu);
++ assert.match(rerun.stdout, /^# skipped 1$/mu);
++ assert.equal(box.git('rev-parse', 'HEAD'), commit);
++ assert.equal(box.git('status', '--porcelain'), '', 'the two attempts use identical committed source');
++ const ci = join(box.scratch, 'ci-results');
++ const job = { job: 'duplicate titles', runner: 'private-node-fixture', node: process.version, commit, root: box.root, run: '555', at: '2026-10-20T12:00:00.000Z' };
++ ciAttempt(ci, 'red', { ...job, attempt: 1, conclusion: 'failure' }, red.stdout);
++ ciAttempt(ci, 'rerun', { ...job, attempt: 2, conclusion: 'success' }, rerun.stdout);
++ const imported = box.cli('flakes', 'import', ci);
++ assert.equal(imported.code, 0, JSON.stringify(imported.document));
++ const listed = box.cli('flakes').document;
++ assert.equal(listed.flakes.length, 0, 'one anonymous pass cannot prove either of two same-title files green');
++ assert.deepEqual(listed.unclassified.map(row => row.file).sort(), ['test/ci-a.test.mjs', 'test/ci-b.test.mjs']);
++ for (const row of listed.unclassified) assertReceipts(box, row.observations[0]);
++});
++
++test('a CI rerun matches an explicit file before considering anonymous same-title rows [C7,H16]', t => {
++ const box = flakyProject(t);
++ const commit = box.git('rev-parse', 'HEAD');
++ const ci = join(box.scratch, 'ci-results');
++ const job = { job: 'explicit and anonymous', runner: 'private-tap-fixture', node: process.version, commit, run: '666', at: '2026-10-20T12:00:00.000Z' };
++ const row = (status, number, file) => `${status} ${number} - shared title [C7]\n ---\n${file ? ` location: '/home/runner/work/repo/repo/${file}:3:1'\n` : ''} ...\n`;
++ ciAttempt(ci, 'red', { ...job, attempt: 1, conclusion: 'failure' }, `TAP version 13\n${row('not ok', 1, 'test/a.test.mjs')}${row('not ok', 2, 'test/b.test.mjs')}1..2\n`);
++ ciAttempt(ci, 'rerun', { ...job, attempt: 2, conclusion: 'success' }, `TAP version 13\n${row('ok', 1, 'test/a.test.mjs')}${row('ok', 2, null)}1..2\n`);
++ const imported = box.cli('flakes', 'import', ci);
++ assert.equal(imported.code, 0, JSON.stringify(imported.document));
++ const listed = box.cli('flakes').document;
++ assert.deepEqual(listed.flakes.map(entry => entry.file), ['test/a.test.mjs'], 'the explicitly located passing row proves its own file');
++ assert.deepEqual(listed.unclassified.map(entry => entry.file), ['test/b.test.mjs'], 'the anonymous row remains ambiguous');
++});
++
++
++test('a same-title skipped original does not lend its identity to an anonymous CI pass [C7,H16]', t => {
++ const box = flakyProject(t);
++ const commit = box.git('rev-parse', 'HEAD');
++ const ci = join(box.scratch, 'ci-results');
++ const job = { job: 'original ambiguity', runner: 'private-tap-fixture', node: process.version, commit, run: '777', at: '2026-10-20T12:00:00.000Z' };
++ ciAttempt(ci, 'red', { ...job, attempt: 1, conclusion: 'failure' }, "TAP version 13\nnot ok 1 - shared title [C7]\n ---\n location: '/home/runner/work/repo/repo/test/a.test.mjs:3:1'\n ...\nok 2 - shared title [C7] # SKIP\n1..2\n");
++ ciAttempt(ci, 'rerun', { ...job, attempt: 2, conclusion: 'success' }, 'TAP version 13\nok 1 - shared title [C7]\n1..1\n');
++ const imported = box.cli('flakes', 'import', ci);
++ assert.equal(imported.code, 0, JSON.stringify(imported.document));
++ const listed = box.cli('flakes').document;
++ assert.equal(listed.flakes.length, 0, 'the anonymous pass could be the other original test');
++ assert.deepEqual(listed.unclassified.map(entry => entry.file), ['test/a.test.mjs'], 'the skipped original is not itself recorded as a failure');
++});