A land that waits on an earlier CI run decides on what that run did, and main's reuse skips cancelled runs (GST-3634) (#4763)

A land that waits on an earlier CI run now goes by that run's real
result, and main's Free Tests run skips a cancelled run when it looks
for a land's run.

Why: a green run rerun at the moment land picked it up could have its
red result ignored, and a cancelled run made main rerun the whole suite.

Nothing to do.

Co-authored-by: capy-ai[bot] <230910855+capy-ai[bot]@users.noreply.github.com>
This commit is contained in:
Garry Tanandcapy-ai[bot] authored and GitHub committed 2026-11-24 03:31:21 +00:00
1 parent 6ef3861302
commit 7c321fff5d
6 files changed
+25 -8

No files matched your search

+5
View File
@@ -101,6 +101,11 @@ describe('findReuse: candidate discovery for a main push', () => {
expect(rerunOlder).toMatchObject({ reused: false, reason: 'no_verified_run', detail: expect.stringContaining('land run 301 on gstack-land/42 reason=run_not_success') });
});
test('a cancelled land run is passed over, as land itself passes it over: the older green run on the same tree is reused', () => {
const LAND2 = '7'.repeat(40);
expect(find(stale([landRun(), landRun({ id: 301, head: LAND2, conclusion: 'cancelled', started: '2026-10-30T10:40:00Z' })], { [LAND2]: TREE }))).toMatchObject({ reused: true, run_id: 300 });
});
test('a land run that tested another tree (main moved before the merge) is refused, and the suite runs', () => {
const v = find(stale([landRun({ record: { tree: OTHER } })], { [LAND]: OTHER }));
expect(v).toMatchObject({ reused: false, reason: 'tree_mismatch' });
+11
View File
@@ -178,6 +178,17 @@ describe('land.merged_ci reuses an earlier run on the merged tree (GST-3634)', (
expect(calls.at(-1)).toBe('remove gstack-land/42');
});
test('a green run that is rerun between listing and polling decides on what land polled: red refuses as red and a timeout names it, never a fresh dispatch', () => {
const listed = earlier({});
const rerun = { ...listed, run_attempt: 2, status: 'in_progress', conclusion: null };
const red = fake({ earlier: [listed], runs: [[rerun], [{ ...rerun, status: 'completed', conclusion: 'failure' }]], verify: provesOld });
expect(run(red.deps)).toMatchObject({ ok: false, red: true, run: 9 });
expect(red.calls.some(c => c.startsWith('push ') || c.startsWith('dispatch '))).toBe(false);
const slow = fake({ earlier: [listed], runs: [[rerun]], verify: provesOld });
expect(run(slow.deps, 60_000)).toMatchObject({ ok: false, red: false, run: 9 });
expect(slow.calls.some(c => c.startsWith('push ') || c.startsWith('dispatch '))).toBe(false);
});
test('a timed-out wait names the run the next land adopts, and that land adopts it after the scratch branch was deleted', () => {
const going: ApiRun = { ...queued, id: 77, head_branch: 'gstack-land/42', head_commit: { tree_id: TREE } };
const first = fake({ runs: [[going]] });