Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,22 @@ concurrency:
# main-only job reads the probe. The 4-hourly `schedule` run is untouched: it
# is the full battery.

# ⭐ EVERY GIT TRANSFER IN THIS FILE IS BOUNDED BY ITS BYTE RATE (#34994).
# A git HTTP request that moves under 1000 bytes/s for 120 s is aborted by curl
# (exit 128, "curl 28 Operation too slow"), so the retry around it runs:
# actions/checkout's own fetch retry (3 attempts) and the "Fetch this commit's
# history" step's (scripts/ci/fetch-history.sh, 3 attempts). On 2026-11-16/17,
# 48 checkout or fetch steps here and in lint.yml ran to their 8-25 minute
# budget with no index-pack running: the server never started the pack, while
# its `remote:` progress kept the log moving, and siblings in the same run
# took 51-65 s. The slowest healthy wait for the pack is ~15 s and a healthy
# receive runs at MiB/s, so neither number cuts a slow transfer that moves.
# The step budgets stay the outer wall. Same block in lint.yml; the script
# sets the same defaults for a local run.
env:
GIT_HTTP_LOW_SPEED_LIMIT: '1000'
GIT_HTTP_LOW_SPEED_TIME: '120'

jobs:
queue-verdict:
name: Queue verdict
Expand Down Expand Up @@ -1105,6 +1121,11 @@ jobs:
# group and retried (#34561): on 2026-11-16/17 a stalled transfer held
# attempt 1 silent until this budget killed it, four times, so the retry
# never ran, while sibling shards fetched the same history in 47-96 s.
# That bound missed the next stalls: a server that never starts the pack
# keeps printing `remote:` progress, so the log never went silent. Each
# attempt is now also cut by its byte rate, under 1000 bytes/s for 120 s
# (the workflow `env:` block above, #34994), and the script prints each
# phase as it starts, so a step that still hits this budget names it.
# A fetch that keeps moving is never cut. The script's header has the
# reading; its self-test runs in lint.yml.
#
Expand Down
63 changes: 44 additions & 19 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,20 @@ concurrency:
# affected-package type check) carries its own note saying how.
# ─────────────────────────────────────────────────────────────────────────────

# ⭐ EVERY GIT TRANSFER IN THIS FILE IS BOUNDED BY ITS BYTE RATE (#34994).
# A git HTTP request that moves under 1000 bytes/s for 120 s is aborted by curl
# (exit 128, "curl 28 Operation too slow"), so actions/checkout's own fetch
# retry (3 attempts) runs instead of the CHECKOUT BUDGET expiring. On
# 2026-11-16/17, 20 of this file's full-history checkouts ran to that 20-25
# minute budget with no index-pack running: the server never started the pack.
# The slowest healthy wait for the pack is ~15 s (this fetch reuses the
# server's packs: ~4 s), and a healthy receive runs at MiB/s, so neither number
# cuts a slow transfer that moves. The CHECKOUT BUDGET stays the outer wall.
# ci.yml carries the same block and says more.
env:
GIT_HTTP_LOW_SPEED_LIMIT: '1000'
GIT_HTTP_LOW_SPEED_TIME: '120'

jobs:

schedule-gate:
Expand Down Expand Up @@ -311,10 +325,11 @@ jobs:
# header). What each lane repeats is the six setup steps, the gate-family
# selector where the lane carries a scoped step, and, since #23191, the
# `Lane verdict` step that ends it (it replaced the unmeasured-tail
# reporter pair). Every lane keeps the single job's full-history checkout:
# which of the ~190 gates read history was not re-derived for this split,
# and a gate that loses its history degrades to "not verified" rather than
# going red.
# reporter pair). Every lane but `lint-eslint` keeps the single job's
# full-history checkout: which of the ~190 gates read history was not
# re-derived for this split, and a gate that loses its history degrades to
# "not verified" rather than going red. `lint-eslint`'s three steps were
# re-derived (#34994): none reads history, so it checks out at depth 1.
#
# The lanes are independent. The only inter-step reads in the single job
# were `steps.gate-families.outputs.*` (nine `if:` lines, one step `id:`),
Expand Down Expand Up @@ -525,12 +540,11 @@ jobs:
# CHECKOUT BUDGET: `typecheck-source-gates` sizes it; the `lint` job
# above says why every lane carries it.
timeout-minutes: 25
with:
# The slot-lookup ratchet compares the baseline against its state at
# the merge base with main — the only way to see a file being ADDED
# to the grandfather list. A shallow clone has no merge base, and the
# check would degrade to "not verified" on every run.
fetch-depth: 0
# Depth 1, the default (#34994): nothing in this lane reads history.
# ESLint and the engine test-double gate read the working tree only,
# and the slot-lookup ratchet that once needed the merge base here
# runs in `lint-scoped-slot-corpus` since the lane split. The other
# lanes keep `fetch-depth: 0` for their own history readers.

- name: Setup workspace
uses: ./.github/actions/setup-workspace
Expand Down Expand Up @@ -610,7 +624,12 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# Gates in this lane and the scoped lanes below compare against the
# merge base with main — the slot-lookup ratchet, for one, sees a
# file being ADDED to its grandfather list only that way. A shallow
# clone has no merge base, and such a check degrades to "not
# verified" on every run. (This note stood on `lint-eslint`'s
# checkout until that lane, which reads no history, went to depth 1.)
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -1956,7 +1975,7 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# `fetch-depth: 0`: same reason as the `lint-repo-tooling` checkout above.
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -3008,7 +3027,7 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# `fetch-depth: 0`: same reason as the `lint-repo-tooling` checkout above.
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -4158,7 +4177,7 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# `fetch-depth: 0`: same reason as the `lint-repo-tooling` checkout above.
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -4318,7 +4337,7 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# `fetch-depth: 0`: same reason as the `lint-repo-tooling` checkout above.
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -4464,7 +4483,7 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# `fetch-depth: 0`: same reason as the `lint-repo-tooling` checkout above.
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -4654,7 +4673,7 @@ jobs:
# above says why every lane carries it.
timeout-minutes: 25
with:
# `fetch-depth: 0`: same reason as the `lint-eslint` checkout above.
# `fetch-depth: 0`: same reason as the `lint-repo-tooling` checkout above.
fetch-depth: 0

- name: Setup workspace
Expand Down Expand Up @@ -4816,6 +4835,11 @@ jobs:
# one retry inside the same total gains nothing (the hazard is flat).
# Healthy runs pay nothing for it: max 435 s over 3,576 checkouts of this
# workflow after the incident. The queries are in #29980's dev report.
# That flat hazard is a SLOW transfer's. A STALLED one (the server never
# starts the pack, 2026-11-16/17) is cut inside git by the workflow `env:`
# block above, and actions/checkout retries it within this budget (#34994),
# so the budget only binds a transfer that moves. `lint-eslint` checks out
# at depth 1 since then and keeps the same budget, unchanged.
# The one exception is `typecheck-workspace`: its body budget is 35, and
# 35 + 20 = 55 is already the cap the `lint` job argues, so that lane
# keeps 20 until its body is faster or the fetch is narrowed (#22034).
Expand Down Expand Up @@ -4855,8 +4879,9 @@ jobs:
# touches no spec file at all) go red for "deleting"
# ui/BulkActionDef:requiredPermissions — a key main had just ADDED.
#
# Same line as the ESLint job above, opposite failure mode, and that
# is why it is spelled out here rather than cross-referenced: shallow
# Same line as the `lint-repo-tooling` checkout above, opposite
# failure mode, and that is why it is spelled out here rather than
# cross-referenced: shallow
# degrades the slot-lookup ratchet to "not verified" (a false GREEN),
# and degrades this gate to a false RED on an innocent PR.
fetch-depth: 0
Expand Down
63 changes: 60 additions & 3 deletions scripts/ci/fetch-history.selftest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
#
# The property under test is the one the four 2026-11-16/17 step timeouts
# broke: an attempt that STALLS is ended and retried, while an attempt that
# keeps moving is left alone. A real stalled transfer cannot be ordered on
# keeps moving is left alone. Since #34994 a stall is also one that keeps
# PRINTING server progress while no pack arrives: curl's low-speed abort ends
# it (exit 128, "curl 28"), so the cases pin that the script hands git that
# bound and retries what it ends, and that each phase prints as it starts. A real stalled transfer cannot be ordered on
# demand, so a stub `git` on PATH plays `fetch` per attempt (healthy, silent
# hang, hang after some progress, slow but moving, fast failure) and hands
# every other git command to the real git. A healthy `fetch` IS the real one,
Expand All @@ -17,8 +20,10 @@
# Each case pins the exit status, the attempt count, the `fetch` arguments, the
# ::warning:: / ::error:: lines, and for a hang that the stub's child process
# (standing in for git-remote-https) is gone afterwards -- the process-group
# kill. The last section reads ci.yml and pins that all five jobs call the
# script and no inline copy of the old loop is left.
# kill. The last sections read ci.yml and lint.yml: all five ci.yml jobs call
# the script and no inline copy of the old loop is left; both workflows carry
# the same low-speed bound as the script's defaults; `lint-eslint` checks out
# at depth 1.
#
# Offline; ~40 s (the stall bound is 2 s here, 60 s in CI). Every fixture path
# is under a mktemp directory; none is spelled as a repo path
Expand All @@ -28,6 +33,7 @@ cd "$(git rev-parse --show-toplevel)" || exit 1

SCRIPT_REL='scripts/ci/fetch-history.sh'
WORKFLOW_REL='.github/workflows/ci.yml'
LINT_WORKFLOW_REL='.github/workflows/lint.yml'
SCRIPT="$PWD/$SCRIPT_REL"
REAL_GIT="$(command -v git)"
FIX=$(mktemp -d "${TMPDIR:-/tmp}/os-fetch-history-selftest.XXXXXX") || exit 1
Expand Down Expand Up @@ -58,6 +64,7 @@ if [ "${1:-}" != fetch ]; then exec "$STUB_REAL_GIT" "$@"; fi
n=$(( $(cat "$STUB_DIR/attempts" 2> /dev/null || echo 0) + 1 ))
echo "$n" > "$STUB_DIR/attempts"
echo "$*" >> "$STUB_DIR/argv"
echo "${GIT_HTTP_LOW_SPEED_LIMIT-unset} ${GIT_HTTP_LOW_SPEED_TIME-unset}" >> "$STUB_DIR/env"
step=$(echo "$STUB_PLAN" | cut -d, -f"$n")
case "$step" in
ok) exec "$STUB_REAL_GIT" "$@" ;;
Expand All @@ -69,6 +76,14 @@ case "$step" in
wait
exit 1
;;
talk-then-curl28)
# The 2026-11-17 shape: no pack, but server progress every second, longer
# than the stall bound, then curl's low-speed abort as git reports it.
for i in 1 2 3 4 5; do printf 'remote: Counting objects: %d0%% (%d/10)\r' "$i" "$i" >&2; sleep 1; done
echo "error: RPC failed; curl 28 Operation too slow. Less than 1000 bytes/sec transferred the last 120 seconds" >&2
echo "fatal: expected 'packfile'" >&2
exit 128
;;
slow)
for i in 1 2 3 4 5; do printf 'Receiving objects: %d0%% (%d/10)\r' "$i" "$i" >&2; sleep 1; done
exec "$STUB_REAL_GIT" "$@"
Expand All @@ -90,8 +105,13 @@ run_case() {
fi
local start end
start=$(date +%s)
local low=()
if [ -n "${CASE_LOW_SPEED:-}" ]; then
low=(GIT_HTTP_LOW_SPEED_LIMIT="${CASE_LOW_SPEED% *}" GIT_HTTP_LOW_SPEED_TIME="${CASE_LOW_SPEED#* }")
fi
(
cd "$case_dir/ws" &&
env -u GIT_HTTP_LOW_SPEED_LIMIT -u GIT_HTTP_LOW_SPEED_TIME ${low[@]+"${low[@]}"} \
PATH="$bin:$PATH" STUB_REAL_GIT="$REAL_GIT" STUB_DIR="$case_dir/stub" STUB_PLAN="$plan" \
FETCH_HISTORY_STALL_SECONDS=2 FETCH_HISTORY_RETRY_SLEEP=0 PR_BASE_REF="$base" RUNNER_TEMP="$case_dir" \
bash "$SCRIPT" > "$case_dir/out" 2>&1
Expand All @@ -102,6 +122,7 @@ run_case() {
attempts=$(cat "$case_dir/stub/attempts" 2> /dev/null || echo 0)
out=$(cat "$case_dir/out")
argv1=$(head -n 1 "$case_dir/stub/argv" 2> /dev/null)
env1=$(head -n 1 "$case_dir/stub/env" 2> /dev/null)
ws="$case_dir/ws"
}
children_gone() {
Expand All @@ -124,6 +145,13 @@ check "healthy clone has all 5 commits" '[ "$("$REAL_GIT" -C "$ws" rev-list --co
check "healthy fetched no tag" '[ -z "$("$REAL_GIT" -C "$ws" tag)" ]'
check "healthy prints the History line" 'grep -q "^History: 5 commit(s) behind HEAD, shallow=false, no tags" <<< "$out"'
check "healthy prints no warning" '! grep -q "::warning::" <<< "$out"'
check "healthy hands git the low-speed defaults (1000 B/s for 120 s)" '[ "$env1" = "1000 120" ]'
check "healthy names the bound once" '[ "$(grep -c "^Each attempt ends when it moves under 1000 bytes/s for 120s (curl) or writes nothing for 2s, and is retried.$" <<< "$out")" = 1 ]'

echo "-- #34994: a bound the workflow already set is kept, not overwritten"
CASE_LOW_SPEED="5 7" run_case preset ok
check "preset exits 0" '[ "$rc" = 0 ]'
check "preset hands git the workflow's values" '[ "$env1" = "5 7" ]'

echo "-- a PR into another branch fetches that branch too; a PR into main does not repeat main"
run_case pr-release ok shallow release-x
Expand Down Expand Up @@ -160,6 +188,17 @@ check "slow takes one attempt" '[ "$attempts" = 1 ]'
check "slow ran longer than the stall bound" '[ "$elapsed" -ge 4 ]'
check "slow prints no warning" '! grep -q "::warning::" <<< "$out"'
check "slow prints one line for its progress phase" '[ "$(grep -c "^Receiving objects:" <<< "$out")" = 1 ]'
check "slow names its phase live, once" '[ "$(grep -cE "^fetch-history: \+[0-9]+s Receiving objects$" <<< "$out")" = 1 ]'

echo "-- #34994: a fetch that keeps printing server progress but gets no pack is ended by curl and retried"
run_case talk-then-ok talk-then-curl28,ok
check "talk-then-ok exits 0" '[ "$rc" = 0 ]'
check "talk-then-ok takes two attempts" '[ "$attempts" = 2 ]'
check "talk-then-ok: the silence bound did not fire (it cannot: the log kept growing)" '! grep -q "::warning::git fetch wrote nothing" <<< "$out"'
check "talk-then-ok: both attempts ran under the low-speed bound" '[ "$(grep -c "^1000 120$" "$case_dir/stub/env")" = 2 ]'
check "talk-then-ok shows curl's abort" 'grep -q "curl 28 Operation too slow" <<< "$out"'
check "talk-then-ok names the server phase it stood in, live" 'grep -qE "^fetch-history: \+[0-9]+s remote: Counting objects$" <<< "$out"'
check "talk-then-ok ends unshallowed" '[ "$("$REAL_GIT" -C "$ws" rev-parse --is-shallow-repository)" = false ]'

echo "-- three fast failures end red, named"
run_case fail3 fail,fail,fail
Expand Down Expand Up @@ -188,6 +227,24 @@ check "each fetch step's run line is the script" '[ "$(grep -A4 "^ - name:
check "each fetch step passes PR_BASE_REF" '[ "$(grep -A4 "^ - name: Fetch this commit'"'"'s history and the base branch$" "$wf" | grep -c "PR_BASE_REF: \${{ github.event.pull_request.base.ref }}")" = 5 ]'
check "no inline fetch loop is left in ci.yml" '! grep -q "git fetch --no-tags \"\${deepen\[@\]}\"" "$wf"'

echo "-- #34994: both workflows set the script's low-speed bound for every job"
lint_wf="$PWD/$LINT_WORKFLOW_REL"
script_limit=$(sed -n 's/^export GIT_HTTP_LOW_SPEED_LIMIT="\${GIT_HTTP_LOW_SPEED_LIMIT:-\([0-9]*\)}"$/\1/p' "$SCRIPT")
script_time=$(sed -n 's/^export GIT_HTTP_LOW_SPEED_TIME="\${GIT_HTTP_LOW_SPEED_TIME:-\([0-9]*\)}"$/\1/p' "$SCRIPT")
check "the script's defaults read as 1000 and 120" '[ "$script_limit" = 1000 ] && [ "$script_time" = 120 ]'
for f in "$wf" "$lint_wf"; do
name=$(basename "$f")
block=$(awk '/^env:$/ { on = 1; next } on && /^[^ ]/ { on = 0 } on' "$f")
check "$name has one workflow-level env: block" '[ "$(grep -c "^env:$" "$f")" = 1 ]'
check "$name's env: sets GIT_HTTP_LOW_SPEED_LIMIT to the script's default" 'grep -qx " GIT_HTTP_LOW_SPEED_LIMIT: '"'"'$script_limit'"'"'" <<< "$block"'
check "$name's env: sets GIT_HTTP_LOW_SPEED_TIME to the script's default" 'grep -qx " GIT_HTTP_LOW_SPEED_TIME: '"'"'$script_time'"'"'" <<< "$block"'
done

echo "-- #34994: lint-eslint reads no history, so it checks out at depth 1"
eslint_job=$(awk '/^ lint-eslint:$/ { on = 1; next } on && /^ [a-z0-9_-]+:$/ { on = 0 } on' "$lint_wf")
check "lint.yml has the lint-eslint job" '[ -n "$eslint_job" ] && grep -q "uses: actions/checkout@" <<< "$eslint_job"'
check "lint-eslint's checkout sets no fetch-depth" '! grep -qE "^ +fetch-depth:" <<< "$eslint_job"'

echo ""
if [ "$fails" -gt 0 ]; then
echo "fetch-history self-test: $fails check(s) FAILED"
Expand Down
Loading
Loading