Skip to content

Commit 1638799

Browse files
committed
ci: lint.yml's scheduled run skips the battery when a green push run already covers the sha
A new first job, schedule-gate, runs on `schedule` only and asks the runs API for a completed `push` run of lint.yml on github.sha that concluded success; every lane needs it under `!cancelled()` and skips on skip=true, and the two aggregates skip with their lanes on a scheduled run only. Fails closed toward running the battery. Claude-Session: https://claude.ai/code/session_01QSeKYmhU5KEj1nukYhp1Tg Co-authored-by: Claude <noreply@anthropic.com>
1 parent f708cf2 commit 1638799

1 file changed

Lines changed: 109 additions & 5 deletions

File tree

‎.github/workflows/lint.yml‎

Lines changed: 109 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,25 @@ on:
2727
merge_group:
2828
# ── THE SCHEDULED FULL RUN (#16467), the half this file owns ─────────────
2929
# Every 4 hours since #25771 (maintainer ruling Q6 = C), the same cadence as
30-
# ci.yml's half and for the reason stated there; no step changed.
30+
# ci.yml's half and for the reason stated there.
31+
#
32+
# ⭐ IT SKIPS WHEN THE PUSH RUN ALREADY COVERED THE COMMIT (#26071, ruling
33+
# 6416984681, letter A (i)). A scheduled run tests `main`'s head, and the
34+
# push run of that same commit ran the same battery over the same tree: on
35+
# `push` the selector keeps every family and the workspace type check takes
36+
# the whole universe, exactly as on `schedule`. Measured on 2026-10-28: all 12
37+
# newest scheduled runs repeated a commit whose push run had already ended
38+
# `success`. So the `schedule-gate` job (first under `jobs:`) asks the runs
39+
# API for a completed `push` run of THIS workflow on `github.sha` that
40+
# concluded `success`; when there is one, every lane skips and the two
41+
# aggregates skip with them, and the run concludes `success` with one ran
42+
# job. ⛔ It fails CLOSED toward running: no answer, an error, a 403 or a
43+
# body it cannot read all mean "run the battery". Only `schedule` is gated:
44+
# on `push`, `pull_request`, `merge_group` and `workflow_dispatch` the gate
45+
# job is skipped, its output reads empty, and every lane runs as before.
46+
# ci.yml's scheduled run is NOT gated: there `push` tests the affected set
47+
# only, and the schedule is the full battery.
48+
#
3149
# The card's ruling is that the scheduled run covers BOTH required-context
3250
# files, not just ci.yml, and the reason is measured rather than symmetric:
3351
# the push-on-`main` run of THIS workflow is the only post-merge full-battery
@@ -42,7 +60,8 @@ on:
4260
#
4361
# The selector already treats every event that is neither `merge_group` nor
4462
# `pull_request` as "run every family", so this trigger alone restores the
45-
# full battery here — no step in this file changes.
63+
# full battery here — no step in this file changes. That same sentence is
64+
# why the gate above may skip it: the push run of the commit already ran it.
4665
#
4766
# ⛔ A NEW TRIGGER KEY, not a widening of `push:`; see ci.yml's `on:` block.
4867
schedule:
@@ -197,6 +216,61 @@ concurrency:
197216

198217
jobs:
199218

219+
schedule-gate:
220+
# ── THE SCHEDULED RUN'S SKIP (#26071, ruling 6416984681, letter A (i)) ───
221+
# The why is the `on:` block's ⭐ note. This job runs on `schedule` only, and
222+
# every other job in this file needs it and carries the same `if:`:
223+
#
224+
# if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
225+
#
226+
# On every other event this job is SKIPPED, a skipped job's outputs read as
227+
# the empty string, and `!cancelled()` lets a job run past a skipped (or a
228+
# failed) need, so each lane runs exactly as it did before this job existed.
229+
# The two aggregates keep `always()` and add one schedule-only conjunct:
230+
# they skip only on a scheduled run whose lanes skipped, never on a PR or a
231+
# queue build, where a skipped required context would read as green.
232+
#
233+
# ⛔ FAIL CLOSED TOWARD RUNNING. Only a positive answer skips: a completed
234+
# `push` run of THIS workflow on `github.sha`, concluded `success`, read
235+
# from the runs API. A failed read, a 403, a body that does not parse, no
236+
# such run, or a push run still in progress all leave `skip=false`, and a
237+
# crash of this job leaves the output empty, which also runs the lanes.
238+
name: Schedule gate · skip when a green push run covers the commit
239+
if: github.event_name == 'schedule'
240+
runs-on: ubuntu-latest
241+
# The job-wall rule's floor (see the `lint` job): one API read, no checkout.
242+
timeout-minutes: 10
243+
permissions:
244+
actions: read
245+
outputs:
246+
skip: ${{ steps.probe.outputs.skip }}
247+
steps:
248+
- name: Look for a completed green push run on this commit
249+
id: probe
250+
env:
251+
GH_TOKEN: ${{ github.token }}
252+
OS_GATE_SHA: ${{ github.sha }}
253+
run: |
254+
set -uo pipefail
255+
skip=false
256+
reason="no completed push run of this workflow on $OS_GATE_SHA concluded success"
257+
if green=$(gh api "repos/$GITHUB_REPOSITORY/actions/workflows/lint.yml/runs?event=push&branch=main&head_sha=$OS_GATE_SHA&status=completed&per_page=10" \
258+
--jq '.workflow_runs[] | select(.event == "push" and .status == "completed" and .conclusion == "success") | "\(.head_sha) \(.id)"' \
259+
2> "$RUNNER_TEMP/schedule-gate.err"); then
260+
while read -r sha id; do
261+
if [ -n "$sha" ] && [ "$sha" = "$OS_GATE_SHA" ]; then
262+
skip=true
263+
reason="push run $id on $OS_GATE_SHA concluded success: $GITHUB_SERVER_URL/$GITHUB_REPOSITORY/actions/runs/$id"
264+
break
265+
fi
266+
done <<< "$green"
267+
else
268+
reason="the runs API did not answer ($(head -c 300 "$RUNNER_TEMP/schedule-gate.err" | tr '\n' ' ')), so the battery runs"
269+
fi
270+
echo "skip=$skip" >> "$GITHUB_OUTPUT"
271+
echo "schedule-gate: skip=$skip -- $reason"
272+
echo "schedule-gate: skip=$skip -- $reason" >> "$GITHUB_STEP_SUMMARY"
273+
200274
lint:
201275
# ⚠️ This `name:` IS the required-status-check context in repository
202276
# Settings → Rulesets (a job's check-run name is its `name:`), so it is
@@ -300,7 +374,12 @@ jobs:
300374
# skipped required context is an absence, which reads as green in every
301375
# checks list and never blocks the queue. The `typecheck` job carries the
302376
# same contract and says so at length.
303-
if: always()
377+
# The one conjunct after it is the scheduled run's skip (`schedule-gate`):
378+
# on `schedule` alone, lanes that skipped mean the gate found a green push
379+
# run on the commit, and this aggregate skips with them rather than reding
380+
# over lanes that were told not to run. On every other event the
381+
# conjunct is true and `always()` alone decides, as before.
382+
if: ${{ always() && !(github.event_name == 'schedule' && contains(needs.*.result, 'skipped')) }}
304383
runs-on: ubuntu-latest
305384
# ⭐ JOB WALL — measured, and the rule for every job in this file. No step in
306385
# this workflow runs under `scripts/run-with-stall-guard.mjs` (if one ever
@@ -429,6 +508,8 @@ jobs:
429508
# test-double contract gate, the two heaviest always-on gates, side by
430509
# side.
431510
name: Lint · ESLint
511+
needs: [schedule-gate]
512+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
432513
runs-on: ubuntu-latest
433514
# JOB WALL = CHECKOUT BUDGET (20, on the checkout step) + BODY BUDGET, the
434515
# scheme `typecheck-source-gates` argues for a full-history checkout. Body
@@ -511,6 +592,8 @@ jobs:
511592
# shared-module self-tests, the PM tooling self-tests, the Claude hook
512593
# guards, the docs authoring gates and both censuses.
513594
name: Lint · repo & tooling gates
595+
needs: [schedule-gate]
596+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
514597
runs-on: ubuntu-latest
515598
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
516599
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -1934,6 +2017,8 @@ jobs:
19342017
# symbol anchors, and the product-code guards (CLI, error codes, routes,
19352018
# logging, the objectui pin).
19362019
name: Lint · docs & code guards
2020+
needs: [schedule-gate]
2021+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
19372022
runs-on: ubuntu-latest
19382023
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
19392024
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -2953,6 +3038,8 @@ jobs:
29533038
# them), the engine and packaging gates, and the issue-citation gate,
29543039
# which is why this lane alone reads issues and pull requests.
29553040
name: Lint · CI, release & engine gates
3041+
needs: [schedule-gate]
3042+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
29563043
runs-on: ubuntu-latest
29573044
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
29583045
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -4090,6 +4177,8 @@ jobs:
40904177
# argument is in this lane) and pays its setup even when the selector
40914178
# skips everything in it: about a minute of runner, not of wall.
40924179
name: Lint · scoped · query-options erasure
4180+
needs: [schedule-gate]
4181+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
40934182
runs-on: ubuntu-latest
40944183
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
40954184
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -4246,6 +4335,8 @@ jobs:
42464335
# entry-guard sweep and the comment-mask corpus walk. The slot-lookup
42474336
# ratchet is the gate the checkout step's `fetch-depth: 0` note names.
42484337
name: Lint · scoped · slot lookup & corpus
4338+
needs: [schedule-gate]
4339+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
42494340
runs-on: ubuntu-latest
42504341
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
42514342
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -4390,6 +4481,8 @@ jobs:
43904481
# self-test, the self-test workflow-command gate and the verify-lock
43914482
# entry-point self-test.
43924483
name: Lint · scoped · tooling self-tests
4484+
needs: [schedule-gate]
4485+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
43934486
runs-on: ubuntu-latest
43944487
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
43954488
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -4576,6 +4669,8 @@ jobs:
45764669
# `schedule` and `push` both tiers, the slow tier's daily home under the
45774670
# ruling (`scripts/pm/check-dispatch-gates.mjs` decides, from the event).
45784671
name: Lint · PM dispatch-gates
4672+
needs: [schedule-gate]
4673+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
45794674
runs-on: ubuntu-latest
45804675
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET, `typecheck-source-gates`'
45814676
# scheme. Body after the checkout, rebuilt per run from the 70 runs the
@@ -4722,6 +4817,8 @@ jobs:
47224817
# missing or stale one. Build-dependent gates belong in the lanes below.
47234818
typecheck-source-gates:
47244819
name: Type Check · source gates
4820+
needs: [schedule-gate]
4821+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
47254822
runs-on: ubuntu-latest
47264823
# JOB WALL — why every job here has one and the rule (about 2× the measured
47274824
# maximum, a 5-minute grain, never below 10, never above the queue's
@@ -5411,6 +5508,8 @@ jobs:
54115508
# runs the `typecheck` task family and so the only one that can seed it.
54125509
typecheck-workspace:
54135510
name: Type Check · workspace
5511+
needs: [schedule-gate]
5512+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
54145513
runs-on: ubuntu-latest
54155514
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET; the split, its window, the
54165515
# checkout numbers and what the aggregate reads: `typecheck-source-gates`.
@@ -5656,6 +5755,8 @@ jobs:
56565755
# semantics are untouched: same script, same flags, same command.
56575756
typecheck-debt:
56585757
name: Type Check · debt ledger
5758+
needs: [schedule-gate]
5759+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
56595760
runs-on: ubuntu-latest
56605761
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET; the split, its window, the
56615762
# checkout numbers and what the aggregate reads: `typecheck-source-gates`.
@@ -5858,6 +5959,8 @@ jobs:
58585959
# api-surface family, the skill/docs example compilers and the i18n gates.
58595960
typecheck-consumers:
58605961
name: Type Check · consumer gates
5962+
needs: [schedule-gate]
5963+
if: ${{ !cancelled() && needs.schedule-gate.outputs.skip != 'true' }}
58615964
runs-on: ubuntu-latest
58625965
# JOB WALL = CHECKOUT BUDGET (20) + BODY BUDGET; the split, its window, the
58635966
# checkout numbers and what the aggregate reads: `typecheck-source-gates`.
@@ -6387,8 +6490,9 @@ jobs:
63876490
# required context is not a red — it is an absence, which reads as green in
63886491
# every checks list and never blocks the queue. The same contract
63896492
# ci.yml's `test-gate` documents. With `always()` the job runs on every
6390-
# outcome and the verdict below is what decides.
6391-
if: always()
6493+
# outcome and the verdict below is what decides. Its one schedule-only
6494+
# conjunct is the `lint` job's, for the reason stated there.
6495+
if: ${{ always() && !(github.event_name == 'schedule' && contains(needs.*.result, 'skipped')) }}
63926496
runs-on: ubuntu-latest
63936497
timeout-minutes: 10
63946498
permissions:

0 commit comments

Comments
 (0)