Skip to content

Commit a5bebdb

Browse files
committed
Merge origin/main (picks up #39763) into claude/issue-39335-wip
Claude-Session: https://claude.ai/code/session_016WV4cwiNRyb9B38wT2fjYj
2 parents d8739ec + 64b295c commit a5bebdb

1 file changed

Lines changed: 47 additions & 12 deletions

File tree

‎scripts/ci/snapshot-next.mjs‎

Lines changed: 47 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,23 +1932,36 @@ export async function selfTest() {
19321932
const laneEnv = { GITHUB_REPOSITORY: 'o/r', GITHUB_RUN_ID: '200', GITHUB_TOKEN: 't' };
19331933
const walk = [{ versionCommit: C1, version: '18.4.0', tips: [C1, C2] }];
19341934
const current = { event: 'schedule', status: 'in_progress', jobs: [{ name: 'Snapshot next preflight', status: 'in_progress' }] };
1935-
const lane = (s) => stableLane({ workflow: 'release.yml', env: laneEnv, http: s.http, sleep: async () => {}, versionCommits: walk });
1936-
await t('⭐ live: a stable prompt the waiting filter OMITS is still found through the version commit\'s push run (the sweep\'s second reading) and refuses', async () => {
1935+
// Hermetic in time: every lane case passes LANE_NOW, so the readers' bounds
1936+
// (the waiting read-back's WAITING_READ_BACK_DAYS, the walk's RUN_WALK_DAYS)
1937+
// are judged against the fixtures' own dates (`laneHttp` dates its runs
1938+
// 2026-11-05 and its walk rows 2026-11-14), never against the wall clock.
1939+
// Each case is registered through `laneT`, and the pin after the last one
1940+
// re-runs them all with the wall clock at 2030: a case reading `Date.now()`
1941+
// sees every fixture date expired there, and the pin names it.
1942+
const LANE_NOW = Date.parse('2026-11-15T00:00:00Z');
1943+
const laneCases = [];
1944+
const laneT = (label, fn) => {
1945+
laneCases.push([label, fn]);
1946+
return t(label, fn);
1947+
};
1948+
const lane = (s) => stableLane({ workflow: 'release.yml', env: laneEnv, http: s.http, sleep: async () => {}, versionCommits: walk, now: LANE_NOW });
1949+
await laneT('⭐ live: a stable prompt the waiting filter OMITS is still found through the version commit\'s push run (the sweep\'s second reading) and refuses', async () => {
19371950
const s = laneHttp({ inProgress: [200], pushes: { [C1]: [100] }, runs: { 100: { event: 'push', status: 'waiting', jobs: [publishJob('waiting')], environments: ['release'] }, 200: current } });
19381951
const r = await lane(s);
19391952
return r.refusals.length === 1 && r.refusals[0].kind === 'stable-lane' && r.unread.length === 0 && s.seen.every((x) => x.method === 'GET');
19401953
});
1941-
await t('live: a stable publish in progress is found through the in_progress filter and refuses; the calling run is passed over', async () => {
1954+
await laneT('live: a stable publish in progress is found through the in_progress filter and refuses; the calling run is passed over', async () => {
19421955
const s = laneHttp({ inProgress: [150, 200], runs: { 150: { event: 'push', status: 'in_progress', jobs: [publishJob('in_progress')] }, 200: current } });
19431956
const r = await lane(s);
19441957
return r.refusals.length === 1 && /running/.test(r.refusals[0].text) && r.read.runs.some((x) => x.id === '150');
19451958
});
1946-
await t('live: nothing waiting and nothing running is a pass (no refusal, nothing unread)', async () => {
1959+
await laneT('live: nothing waiting and nothing running is a pass (no refusal, nothing unread)', async () => {
19471960
const s = laneHttp({ inProgress: [200], runs: { 200: current } });
19481961
const r = await lane(s);
19491962
return r.refusals.length === 0 && r.unread.length === 0;
19501963
});
1951-
await t('⛔ live: a listing still answering 5xx after the retries THROWS (NOT MEASURED) -- never "clear"', async () => {
1964+
await laneT('⛔ live: a listing still answering 5xx after the retries THROWS (NOT MEASURED) -- never "clear"', async () => {
19521965
const s = laneHttp({ inProgress: [200], runs: { 200: current }, fail: /status=waiting/ });
19531966
try {
19541967
await lane(s);
@@ -1959,7 +1972,7 @@ export async function selfTest() {
19591972
});
19601973
// Run 42938356503 at 01:24Z: `?status=in_progress` counted 2 over a page
19611974
// listing the calling run alone, the only release.yml run in progress.
1962-
await t('⭐ live: the 01:24Z reading -- the in_progress count above a page listing the calling run alone, whole on the re-read -> a pass, read twice', async () => {
1975+
await laneT('⭐ live: the 01:24Z reading -- the in_progress count above a page listing the calling run alone, whole on the re-read -> a pass, read twice', async () => {
19631976
const s = laneHttp({ inProgress: [200], counts: { in_progress: [2, 1] }, runs: { 200: current } });
19641977
const r = await lane(s);
19651978
return r.refusals.length === 0 && r.unread.length === 0 && s.reads.in_progress === 2;
@@ -1968,19 +1981,19 @@ export async function selfTest() {
19681981
// calling run alone through every re-read, while no other release.yml run
19691982
// was alive. The walk behind the short page is what tells the two apart.
19701983
const walked = (s) => s.seen.filter((x) => /[?&]page=\d/.test(x.path)).length;
1971-
await t('⭐ live: the 11-14 reading -- a count still above the calling run alone after every re-read, and a walk listing no other run in progress -> a pass, with the proof on the readings line', async () => {
1984+
await laneT('⭐ live: the 11-14 reading -- a count still above the calling run alone after every re-read, and a walk listing no other run in progress -> a pass, with the proof on the readings line', async () => {
19721985
const s = laneHttp({ inProgress: [200], counts: { in_progress: [2] }, runs: { 200: current, 90: { event: 'push', status: 'completed' } }, walkRows: [{ id: 200, status: 'in_progress' }, { id: 90, status: 'completed' }] });
19731986
const r = await lane(s);
19741987
return r.refusals.length === 0 && r.unread.length === 0 && s.reads.in_progress === 3 && walked(s) === 1 &&
19751988
/count 2 over page 1 names no run: the walk of 2 runs back to \S+ \(the start of history, 1 page\) found none other/.test(r.read.readings);
19761989
});
1977-
await t('⛔ live: a count above the page whose walk finds a run in progress the rows left out -> that run is read with its jobs, and its stable publish refuses', async () => {
1990+
await laneT('⛔ live: a count above the page whose walk finds a run in progress the rows left out -> that run is read with its jobs, and its stable publish refuses', async () => {
19781991
const s = laneHttp({ inProgress: [200], counts: { in_progress: [2] }, runs: { 200: current, 160: { event: 'workflow_dispatch', status: 'in_progress', jobs: [publishJob('in_progress')] } }, walkRows: [{ id: 160, status: 'in_progress' }, { id: 200, status: 'in_progress' }] });
19791992
const r = await lane(s);
19801993
return r.refusals.length === 1 && /stable publish is running/.test(r.refusals[0].text) && r.refusals[0].text.includes('run 160') &&
19811994
s.seen.some((x) => /\/runs\/160\/jobs/.test(x.path)) && /found 1 more in in_progress \[160\], whose row lagged the filter/.test(r.read.readings);
19821995
});
1983-
await t('⛔ live: a count above the page whose walk cannot be read THROWS (NOT MEASURED) -- never "clear"', async () => {
1996+
await laneT('⛔ live: a count above the page whose walk cannot be read THROWS (NOT MEASURED) -- never "clear"', async () => {
19841997
const s = laneHttp({ inProgress: [200], counts: { in_progress: [2] }, runs: { 200: current }, fail: /[?&]page=1(&|$)/ });
19851998
try {
19861999
await lane(s);
@@ -1989,15 +2002,15 @@ export async function selfTest() {
19892002
return s.reads.in_progress === 3 && /the walk of the unfiltered run list, page 1/.test(err.message);
19902003
}
19912004
});
1992-
await t('⛔ live: an older version commit\'s push run in flight, found by the waiting reader alone -> its jobs are read here, and its stable publish refuses (never merged as a run holding no job)', async () => {
2005+
await laneT('⛔ live: an older version commit\'s push run in flight, found by the waiting reader alone -> its jobs are read here, and its stable publish refuses (never merged as a run holding no job)', async () => {
19932006
const C3 = 'c'.repeat(40);
19942007
const older = [...walk, { versionCommit: C3, version: '18.3.0', tips: [C3] }];
19952008
const s = laneHttp({ inProgress: [200], pushes: { [C3]: [140] }, runs: { 200: current, 140: { event: 'push', status: 'in_progress', jobs: [publishJob('in_progress', '18.3.0')] } } });
1996-
const r = await stableLane({ workflow: 'release.yml', env: laneEnv, http: s.http, sleep: async () => {}, versionCommits: older });
2009+
const r = await stableLane({ workflow: 'release.yml', env: laneEnv, http: s.http, sleep: async () => {}, versionCommits: older, now: LANE_NOW });
19972010
return r.refusals.length === 1 && /stable publish is running/.test(r.refusals[0].text) && r.refusals[0].text.includes('18.3.0') &&
19982011
s.seen.filter((x) => /\/runs\/140\/jobs/.test(x.path)).length === 1 && /jobs read for the waiting reader's in-flight run\(s\) 140/.test(r.read.readings);
19992012
});
2000-
await t('⛔ live: a total_count that is no number THROWS (NOT MEASURED) on the first read, never re-read', async () => {
2013+
await laneT('⛔ live: a total_count that is no number THROWS (NOT MEASURED) on the first read, never re-read', async () => {
20012014
const s = laneHttp({ inProgress: [200], counts: { in_progress: ['1'] }, runs: { 200: current } });
20022015
try {
20032016
await lane(s);
@@ -2007,6 +2020,28 @@ export async function selfTest() {
20072020
}
20082021
});
20092022

2023+
await t(`⛔ every live lane case (${laneCases.length}) holds with the wall clock at 2030: no case reads Date.now(), so no fixture date can expire`, async () => {
2024+
const realNow = Date.now;
2025+
const skew = Date.parse('2030-01-01T00:00:00Z') - realNow();
2026+
const red = [];
2027+
Date.now = () => realNow() + skew;
2028+
try {
2029+
for (const [label, fn] of laneCases) {
2030+
let ok = false;
2031+
try {
2032+
ok = (await fn()) === true;
2033+
} catch {
2034+
ok = false;
2035+
}
2036+
if (!ok) red.push(label);
2037+
}
2038+
} finally {
2039+
Date.now = realNow;
2040+
}
2041+
if (red.length > 0) throw new Error(`red at 2030: ${red.join(' | ')}`);
2042+
return laneCases.length > 0;
2043+
});
2044+
20102045
battery('the quiet skip: each expected kind skips on the schedule and refuses loudly on a dispatch; the unexpected stay red');
20112046
const kinds = [...SNAPSHOT_EXPECTED_REFUSALS];
20122047
await t('the five expected kinds are the ruled five, and no unexpected kind is among them', () => kinds.sort().join() === ['same-commit', 'rc-cycle', 'debut', 'no-green-commit', 'stable-lane'].sort().join() && UNEXPECTED_REFUSALS.every((k) => !kinds.includes(k)));

0 commit comments

Comments
 (0)