Skip to content

Commit 1531b5a

Browse files
LavonTMCQclaude
andcommitted
ci: let the changed-files lane report quarantined files without blocking
A touched test file that is already red on unmodified main (listed in tests/integration-quarantine.json, #6761) failed the changed-files lane, so any change that edited such a file could not merge. That lane now reads the quarantine as committed at the merge base: a listed file still runs and prints "baseline red" or "now green", and every other red file fails the job as before. Reading the base copy means a change cannot exempt a file by adding it to the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
1 parent 06d3d7d commit 1531b5a

6 files changed

Lines changed: 55 additions & 10 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,12 @@ jobs:
375375
- if: needs.reuse.outputs.reuse != 'true' && steps.select.outputs.count != '0'
376376
run: npm run test:integration -- ${{ steps.select.outputs.files }}
377377
env:
378-
O8_INTEGRATION_BASELINE: tests/integration-linux-baseline.json
378+
# A touched file already red on unmodified main (#6761) still runs and
379+
# reports "baseline red" or "now green" without blocking. The list is
380+
# read from the base commit, so a change cannot add itself to it. Any
381+
# other red file fails the job.
382+
O8_INTEGRATION_BASELINE: tests/integration-quarantine.json
383+
O8_INTEGRATION_BASELINE_REF: ${{ github.event.merge_group.base_sha || github.event.pull_request.base.sha || github.event.before }}
379384

380385
# Main pushes and the weekly full suite use six contiguous slices of the
381386
# manifest file list (O8_INTEGRATION_SHARD=k/6).
@@ -430,8 +435,7 @@ jobs:
430435
- run: npm run test:integration
431436
env:
432437
O8_INTEGRATION_SHARD: ${{ matrix.shard }}/6
433-
# Files red on unmodified main, each with its reason (#6761). The
434-
# per-pull-request lane keeps the empty baseline above.
438+
# Files red on unmodified main, each with its reason (#6761).
435439
O8_INTEGRATION_BASELINE: tests/integration-quarantine.json
436440

437441
integration-weekly-report:

‎scripts/integration-test-gate.mjs‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,8 +479,10 @@ try {
479479
const failures = results.filter((result) => result.code !== 0 || result.signal);
480480
// O8_INTEGRATION_BASELINE names files already red on the CI runner (#2391).
481481
// They still run; their failures are reported but do not fail the gate.
482+
// O8_INTEGRATION_BASELINE_REF reads the list as committed at that commit (the
483+
// merge base), so a change cannot exempt a file by adding it to the list.
482484
const baselinePath = process.env.O8_INTEGRATION_BASELINE;
483-
const baseline = loadRedBaseline(baselinePath);
485+
const baseline = loadRedBaseline(baselinePath, process.env.O8_INTEGRATION_BASELINE_REF || undefined);
484486
if (baselinePath && !baseline) {
485487
console.error(`[integration-gate] baseline ${baselinePath} unavailable; every failure counts`);
486488
}

‎scripts/lib/red-baseline.d.mts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Types for red-baseline.mjs (allowJs is off repo-wide).
2-
export declare function loadRedBaseline(path: string | undefined): Set<string> | null;
2+
export declare function loadRedBaseline(path: string | undefined, ref?: string, cwd?: string): Set<string> | null;
33
export declare function classifyAgainstBaseline(
44
results: Array<{ file: string; failed: boolean }>,
55
baseline: Set<string> | null,

‎scripts/lib/red-baseline.mjs‎

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,31 @@
1+
import { spawnSync } from 'node:child_process';
12
import { existsSync, readFileSync } from 'node:fs';
23

34
/**
45
* Reads the exempted red-file baseline for the integration gate (#2391).
56
* Returns a Set of manifest paths, or null when the file is absent or
6-
* unreadable, which keeps the gate strict.
7+
* unreadable, which keeps the gate strict. With `ref`, the list is read as
8+
* committed at that commit instead of from the working tree.
79
*/
8-
export function loadRedBaseline(path) {
9-
if (!path || !existsSync(path)) return null;
10+
export function loadRedBaseline(path, ref, cwd = process.cwd()) {
11+
if (!path) return null;
1012
try {
11-
const parsed = JSON.parse(readFileSync(path, 'utf8'));
13+
const text = ref ? committedText(ref, path, cwd) : existsSync(path) ? readFileSync(path, 'utf8') : null;
14+
if (text === null) return null;
15+
const parsed = JSON.parse(text);
1216
if (!Array.isArray(parsed?.files)) return null;
1317
return new Set(parsed.files.map((entry) => entry?.path).filter((entry) => typeof entry === 'string'));
1418
} catch {
1519
return null;
1620
}
1721
}
1822

23+
/** The list as committed at `ref`, so a change under test cannot add itself to it. */
24+
function committedText(ref, path, cwd) {
25+
const result = spawnSync('git', ['show', `${ref}:${path}`], { cwd, encoding: 'utf8' });
26+
return result.status === 0 ? result.stdout : null;
27+
}
28+
1929
/**
2030
* Splits per-file gate results against the baseline. A result is
2131
* `{ file, failed: boolean }`. Without a baseline every failure is new red.

‎tests/integration-quarantine.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"note": "Files red on unmodified main in the full integration run 45536677599 (2026-11-25). Only the full-suite lane reads this list: a listed file still runs and its failure is reported, not gating. The per-pull-request lane does not read it. Remove a file when it passes; tracked in #6761.",
2+
"note": "Files red on unmodified main in the full integration run 45536677599 (2026-11-25). A listed file still runs and its failure is reported, not gating. The full-suite lane reads this file; the changed-files lane reads it as committed at the merge base, so a change cannot add itself. Remove a file when it passes; tracked in #6761.",
33
"sourceRun": 45536677599,
44
"issue": 6761,
55
"count": 126,

‎tests/linux-red-baseline.test.ts‎

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import { execFileSync } from 'node:child_process';
2+
import { mkdtempSync, mkdirSync, rmSync, writeFileSync } from 'node:fs';
3+
import { tmpdir } from 'node:os';
14
import { join } from 'node:path';
25
import { describe, expect, it } from 'vitest';
36
import { classifyAgainstBaseline, loadRedBaseline } from '../scripts/lib/red-baseline.mjs';
@@ -37,6 +40,32 @@ describe('integration gate red baseline', () => {
3740
expect(loadRedBaseline(undefined)).toBeNull();
3841
});
3942

43+
it('reads the list as committed at the base, so a change cannot exempt itself', () => {
44+
const repo = mkdtempSync(join(tmpdir(), 'o8-red-baseline-'));
45+
try {
46+
const git = (...args: string[]) => execFileSync('git', args, { cwd: repo, stdio: 'pipe' });
47+
const list = (paths: string[]) => JSON.stringify({ files: paths.map((path) => ({ path })) });
48+
git('init', '-q');
49+
mkdirSync(join(repo, 'tests'));
50+
writeFileSync(join(repo, 'tests/quarantine.json'), list(['tests/known-red-real-path.test.ts']));
51+
git('add', '.');
52+
git('-c', 'user.name=fixture', '-c', 'user.email=fixture@example.invalid', 'commit', '-q', '-m', 'base');
53+
// The change under test adds its own broken file to the list.
54+
writeFileSync(join(repo, 'tests/quarantine.json'), list(['tests/known-red-real-path.test.ts', 'tests/new-break-real-path.test.ts']));
55+
const committed = loadRedBaseline('tests/quarantine.json', 'HEAD', repo);
56+
expect([...(committed ?? [])]).toEqual(['tests/known-red-real-path.test.ts']);
57+
const outcome = classifyAgainstBaseline([
58+
{ file: 'tests/known-red-real-path.test.ts', failed: true },
59+
{ file: 'tests/new-break-real-path.test.ts', failed: true },
60+
], committed);
61+
expect(outcome.baselineRed).toEqual(['tests/known-red-real-path.test.ts']);
62+
expect(outcome.newRed).toEqual(['tests/new-break-real-path.test.ts']);
63+
expect(loadRedBaseline('tests/quarantine.json', 'no-such-ref', repo)).toBeNull();
64+
} finally {
65+
rmSync(repo, { recursive: true, force: true });
66+
}
67+
});
68+
4069
it('loads the recorded Linux baseline, which lists only resource-owning files', async () => {
4170
const recorded = loadRedBaseline(join(__dirname, 'integration-linux-baseline.json'));
4271
expect(recorded?.size).toBe(0);

0 commit comments

Comments
 (0)