Skip to content

Commit 3e0826f

Browse files
committed
ci: read schedule runs for ui timings and document the borrowed push
Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QsR2jQztfi9hnsaBeBVcCU
1 parent 6b17322 commit 3e0826f

5 files changed

Lines changed: 32 additions & 7 deletions

File tree

‎.github/workflows/ci.yml‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ jobs:
231231
# re-reads the head commit's queue run. Do not rename it.
232232
name: Borrowed queue verdict
233233
needs: queue-verdict
234-
if: needs.queue-verdict.outputs.covered == 'true'
234+
if: ${{ success() && needs.queue-verdict.outputs.covered == 'true' }}
235235
runs-on: ubuntu-latest
236236
timeout-minutes: 10
237237
permissions:

‎AGENTS.md‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,9 @@ Even inside your own worktree, operate defensively:
510510
`Build & E2E UI`, `Live E2E UI` and `Dogfood Regression Gate`; a check outside those eleven is advisory
511511
([why that matters](docs/agents/multi-agent-discipline.md#advisory-checks-ride-through)). A required context is
512512
matched by check-run name, so a rename detaches its gate silently — treat those eleven names as contract.
513-
**Two speeds** — PR runs carry the fast set, queue runs add the dogfood shards; `main`'s scheduled and push runs
514-
carry the full battery ([detail](docs/agents/multi-agent-discipline.md#two-speeds-which-runs-carry-which-battery)).
513+
**Two speeds** — PR runs carry the fast set, queue runs add the dogfood shards; `main`'s scheduled runs carry the
514+
full battery, and a push run carries it by running the main-only jobs and borrowing the rest from the green queue
515+
runs of its commits ([detail](docs/agents/multi-agent-discipline.md#two-speeds-which-runs-carry-which-battery)).
515516
**Main-red:** a full-battery red is its lane's first work — triage files it under
516517
the main-red convention, the lane's next PR fixes it, and ⛔ no lane PR arms the queue meanwhile.
517518

‎scripts/ci/scheduled-full-run.mjs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1547,7 +1547,7 @@ export function borrowedRecordOf(jobs) {
15471547
// literal 'true', so an empty output (a probe that died) means the full
15481548
// battery; and no main-only job reads it at all.
15491549
export const QUEUE_VERDICT_IF = "github.event_name == 'push'";
1550-
export const BORROWED_VERDICT_IF = `needs.${QUEUE_VERDICT_JOB}.outputs.covered == 'true'`;
1550+
export const BORROWED_VERDICT_IF = `\${{ success() && needs.${QUEUE_VERDICT_JOB}.outputs.covered == 'true' }}`;
15511551
export const MAIN_ONLY_JOBS = Object.freeze(['temporal-conformance', 'dogfood-verify', 'ui-published-artifacts']);
15521552
export function borrowedVerdictWiring(ciYamlText) {
15531553
const findings = [];

‎ui/scripts/__tests__/test-file-timings.test.ts‎

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import FileTimingsReporter, {
1717
fileRecord,
1818
judgeRun,
1919
medianDurations,
20+
selectRuns,
2021
summarize,
2122
readRunReports,
2223
runDurations,
@@ -224,6 +225,24 @@ describe('the selector', () => {
224225
expect(judgeRun({ jobs: jobs(['success', 'success']), artifacts: artifacts(1), shards: 2 }).eligible).toBe(false);
225226
expect(judgeRun({ jobs: jobs(['success', 'success']), artifacts: [{ name: artifactName(1) }, { name: artifactName(2), expired: true }], shards: 2 }).eligible).toBe(false);
226227
});
228+
229+
it('lists schedule runs only, and takes no push run even when one is listed (objectstack#31519)', async () => {
230+
const routes: string[] = [];
231+
const fetchImpl = (async (url: string) => {
232+
const route = url.replace('https://api.test', '');
233+
routes.push(route);
234+
const body = route.includes('/actions/workflows/ci.yml/runs')
235+
? { workflow_runs: [{ id: 2, event: 'push', head_sha: 'b'.repeat(40), created_at: 'x' }, { id: 1, event: 'schedule', head_sha: 'a'.repeat(40), created_at: 'y' }] }
236+
: route.includes('/jobs')
237+
? { jobs: jobs(['success', 'success']) }
238+
: { artifacts: artifacts(2) };
239+
return { ok: true, status: 200, json: async () => body };
240+
}) as unknown as typeof fetch;
241+
const chosen = await selectRuns({ shards: 2, limit: 6, repository: 'o/r', token: '', apiUrl: 'https://api.test', fetchImpl });
242+
expect(routes[0]).toBe('/repos/o/r/actions/workflows/ci.yml/runs?branch=main&event=schedule&status=completed&per_page=50');
243+
expect(chosen.map((r) => r.id)).toEqual([1]);
244+
expect(routes.some((r) => r.startsWith('/repos/o/r/actions/runs/2/'))).toBe(false);
245+
});
227246
});
228247

229248
/** The weekly refresh that drives `select` and `merge`, at the monorepo root. */

‎ui/scripts/test-file-timings.mjs‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,16 +387,21 @@ export async function selectRuns({
387387
}) {
388388
if (!repository) throw new Error('GITHUB_REPOSITORY is not set');
389389
const io = { token, apiUrl, fetchImpl };
390-
const listing = await apiGet(`/repos/${repository}/actions/workflows/ci.yml/runs?branch=main&status=completed&per_page=50`, io);
390+
// `schedule` runs only (objectstack#31519): a `push` run whose commits the
391+
// merge queue already ran green borrows Test UI when the queue ran the whole
392+
// suite, so a push run is no longer the full battery by its event. The
393+
// 4-hourly schedule always runs every file on every shard, and it keeps its
394+
// timing artifacts 7 days, so the default `--limit 6` is about a day of it.
395+
const listing = await apiGet(`/repos/${repository}/actions/workflows/ci.yml/runs?branch=main&event=schedule&status=completed&per_page=50`, io);
391396
/** @type {Array<{ id: number, event: string, head_sha: string, created_at: string }>} */
392397
const chosen = [];
393398
// Two reads per run examined, on the repository's one shared `GITHUB_TOKEN`
394399
// budget: stop after a bounded number of candidates, eligible or not.
395400
let examined = 0;
396401
for (const run of listing?.workflow_runs ?? []) {
397402
if (chosen.length >= limit || examined >= limit * 5) break;
398-
// The full battery: a `push` that starts Test UI, and the 4-hourly `schedule`.
399-
if (run.event !== 'push' && run.event !== 'schedule') continue;
403+
// The full battery: the 4-hourly `schedule`, which the listing asks for.
404+
if (run.event !== 'schedule') continue;
400405
examined += 1;
401406
const jobs = (await apiGet(`/repos/${repository}/actions/runs/${run.id}/jobs?per_page=100&filter=latest`, io))?.jobs ?? [];
402407
const artifacts = (await apiGet(`/repos/${repository}/actions/runs/${run.id}/artifacts?per_page=100`, io))?.artifacts ?? [];

0 commit comments

Comments
 (0)