Commit b4e5a1e858

b4e5a1e85828d8846debec99c97cc1fa729f1d87

parent: 3a3cb747b0

Unsigned

cmc <hello@cleberg.net> · 2026-10-26 15:51 UTC

Gate pushes on both runtimes, and let a tier failure fail the gate (!55)

Widening the hook alone would have achieved nothing, because the script it
calls could not report a failure.

## The gate was inert

`run_tier` ended with:

```sh
    | grep -E '…' \
    || true

  return 0
```

`|| true` discarded the pipeline's status and `return 0` discarded the rest, so
the script exited 0 whatever happened — including when xcodebuild printed
`** TEST FAILED **`. The pre-push hook aborts only on a non-zero exit, so its
accessibility gate could not abort a push on **either** tier, not just the one
it skipped. That is how three enforced `dynamicType` failures on the Settings
root reached `main`.

`run_tier` now wraps the grep in a brace group, so matching nothing is not a
failure, and lets `pipefail` carry xcodebuild's own status out to the caller. A
failing tier prints what a failure means rather than only the verdict line.

## Verified both ways

Failure path — `settingsDestinationRows` carve-out disabled so
`testSettingsScreen` fails on iOS 27.0:

```
script exit=1
** TEST FAILED **
==> A tier failed. An enforced category reported a named finding, or the
    suite could not run.
```

The same scenario exited 0 before.

Pass path — real code, both tiers:

```
script exit=0
==> floor: iPhone 16 (iOS 18.6)       ** TEST SUCCEEDED **
==> current: iPhone Air (iOS 27.0)    ** TEST SUCCEEDED **
enforced FAIL lines: 0
```

The four pipeline cases (xcodebuild ok/fails × grep matches/does not) were also
checked in isolation.

## Both tiers

The hook now runs both. Coverage is not nested across OS versions, and there is
no CI, so a tier the hook skips is not run at all. The stale rationale in its
header — that CI covers the newest runtime — is replaced.

The cost is real: about twenty minutes against eight for the floor alone, and
the hook's own argument that a hook you learn to bypass is worse than no hook
now says so explicitly. The `~85s` figure quoted in the hook and in
`Docs/ACCESSIBILITY.txt` was stale by an order of magnitude; both now carry
measured numbers.

Ref #21

Layout: unified · split

.githooks/pre-push +13 −13
@@ -6,15 +6,15 @@
6# Enable once per clone: 6# Enable once per clone:
7# git config core.hooksPath .githooks 7# git config core.hooksPath .githooks
8# 8#
9# Why pre-push and not pre-commit: the suite takes ~85s. At pre-commit that 9# Why pre-push and not pre-commit: the suite takes around ten minutes per
10# blocks every commit, and a hook you routinely bypass with --no-verify is worse 10# runtime. At pre-commit that blocks every commit, and a hook you routinely
11# than no hook, because it trains you to ignore it. Pushes are far less frequent 11# bypass with --no-verify is worse than no hook, because it trains you to ignore
12# and map to the unit of work that actually reaches CI. 12# it. Pushes are far less frequent and map to the unit of work.
13# 13#
14# Why only the floor tier: CI already audits the newest runtime on a clean 14# Why both tiers: audit coverage is not nested across OS versions — each runtime
15# checkout. The GitHub image has no old runtimes, so the floor is the one thing 15# reports findings the others miss, in both directions, which
16# CI structurally cannot cover — and it is the one this machine can. Running 16# Docs/ACCESSIBILITY.txt records per screen. There is no CI, so a tier this does
17# both here would just double the wait to re-check what CI already does. 17# not run is not run at all, and an enforced failure on it reaches main.
18# 18#
19# Why the hook runs qlty at all: nothing else does. This repository's origin is 19# Why the hook runs qlty at all: nothing else does. This repository's origin is
20# gitbay, which has no build configured, so the smell gates in .qlty/qlty.toml 20# gitbay, which has no build configured, so the smell gates in .qlty/qlty.toml
@@ -101,14 +101,14 @@ print(sum(
101 fi 101 fi
102fi 102fi
103 103
104echo "pre-push: running accessibility audit on the floor runtime (~85s)" 104echo "pre-push: running accessibility audit on both runtimes (~20 min)"
105echo " skip with 'git push --no-verify'" 105echo " skip with 'git push --no-verify'"
106 106
107if ! ./Scripts/audit-a11y.sh floor; then 107if ! ./Scripts/audit-a11y.sh; then
108 echo 108 echo
109 echo "pre-push: audit could not run. Push aborted." >&2 109 echo "pre-push: accessibility audit failed. Push aborted." >&2
110 echo " Re-run with './Scripts/audit-a11y.sh floor' to see why," >&2 110 echo " Re-run with './Scripts/audit-a11y.sh' to see which tier and" >&2
111 echo " or bypass with 'git push --no-verify'." >&2 111 echo " which screen, or bypass with 'git push --no-verify'." >&2
112 exit 1 112 exit 1
113fi 113fi
114 114
Docs/ACCESSIBILITY.txt +20 −9
@@ -410,7 +410,7 @@ no single number is correct on both.
410 410
411The audit therefore runs locally, across both ends, via 411The audit therefore runs locally, across both ends, via
412`Scripts/audit-a11y.sh` — on a machine that actually has an 18.x runtime 412`Scripts/audit-a11y.sh` — on a machine that actually has an 18.x runtime
413installed. It is wired to the pre-push hook in `.githooks/`. 413installed. The pre-push hook in `.githooks/` runs both of them.
414 414
415There is no CI job. The GitHub Actions workflow that used to run this suite on 415There is no CI job. The GitHub Actions workflow that used to run this suite on
416the newest runtime has been removed, and with it the one check that no local run 416the newest runtime has been removed, and with it the one check that no local run
@@ -424,11 +424,15 @@ by hand before a release.
424## Running it 424## Running it
425 425
426```sh 426```sh
427./Scripts/audit-a11y.sh # floor + current 427./Scripts/audit-a11y.sh # floor + current (~20 min)
428./Scripts/audit-a11y.sh floor # oldest supported only (~85s) 428./Scripts/audit-a11y.sh floor # oldest supported only (~8 min)
429./Scripts/audit-a11y.sh current # newest installed only 429./Scripts/audit-a11y.sh current # newest installed only (~10 min)
430``` 430```
431 431
432It exits non-zero when a tier fails — an enforced category reporting a named
433finding, or the suite not running at all — so it can be used as a gate. Findings
434in unenforced categories are printed and do not affect the exit code.
435
432The script reads the deployment target from the project rather than hard-coding 436The script reads the deployment target from the project rather than hard-coding
433it, and selects the oldest installed runtime **at or above** it — a runtime 437it, and selects the oldest installed runtime **at or above** it — a runtime
434below the deployment target is useless, because the app cannot install there. 438below the deployment target is useless, because the app cannot install there.
@@ -441,12 +445,19 @@ so rather than implying floor coverage it does not have.
441git config core.hooksPath .githooks 445git config core.hooksPath .githooks
442``` 446```
443 447
444Runs the floor audit before a push, and only when Swift, asset, or project files 448Runs the complexity ratchet, then the audit on **both** runtimes, before a push,
445changed. Bypass with `git push --no-verify`. 449and only when Swift, asset, or project files changed. Bypass with
450`git push --no-verify`.
451
452Both tiers rather than the floor alone because coverage is not nested across OS
453versions (below) and there is no CI, so a tier the hook does not run is not run
454at all. The cost is real: about twenty minutes, against roughly eight for the
455floor alone.
446 456
447Pre-push rather than pre-commit deliberately: the suite takes ~85s, and at 457Pre-push rather than pre-commit deliberately: at pre-commit that blocks every
448pre-commit that blocks every commit. A hook routinely bypassed with 458commit. A hook routinely bypassed with `--no-verify` is worse than no hook,
449`--no-verify` is worse than no hook, because it trains you to ignore it. 459because it trains you to ignore it — which is the standing argument against
460letting this get any slower.
450 461
451## Layout gotchas found the hard way 462## Layout gotchas found the hard way
452 463
Scripts/audit-a11y.sh +12 −3
@@ -69,16 +69,22 @@ run_tier() {
69 fi 69 fi
70 70
71 # Findings are printed by the suite itself; surface them plus the verdict. 71 # Findings are printed by the suite itself; surface them plus the verdict.
72 #
73 # The grep is wrapped in a brace group so that matching nothing does not read
74 # as a failure. With pipefail the pipeline then carries xcodebuild's own
75 # status, so an enforced audit failure reaches the caller — and the pre-push
76 # gate can act on it — rather than being reported and exited 0.
77 local code=0
72 set -o pipefail 78 set -o pipefail
73 xcodebuild test \ 79 xcodebuild test \
74 -project "$PROJECT" \ 80 -project "$PROJECT" \
75 -scheme "$SCHEME" \ 81 -scheme "$SCHEME" \
76 -destination "id=$udid" \ 82 -destination "id=$udid" \
77 CODE_SIGNING_ALLOWED=NO 2>&1 \ 83 CODE_SIGNING_ALLOWED=NO 2>&1 \
78 | grep -E 'finding\(s\)|no accessibility findings|^ • |did not complete in time|Executed [0-9]+ test|\*\* TEST (SUCCEEDED|FAILED)' \ 84 | { grep -E 'finding\(s\)|no accessibility findings|^ • |did not complete in time|Executed [0-9]+ test|\*\* TEST (SUCCEEDED|FAILED)' || true; } \
79 || true 85 || code=$?
80 86
81 return 0 87 return "$code"
82} 88}
83 89
84status=0 90status=0
@@ -94,5 +100,8 @@ if [[ "$status" -eq 0 ]]; then
94 echo "==> Done. Findings above are the burndown list for issue #21." 100 echo "==> Done. Findings above are the burndown list for issue #21."
95 echo " They are reported, not enforced — widen" 101 echo " They are reported, not enforced — widen"
96 echo " AccessibilityAuditHarness.enforcedAuditTypes as each phase lands." 102 echo " AccessibilityAuditHarness.enforcedAuditTypes as each phase lands."
103else
104 echo "==> A tier failed. An enforced category reported a named finding, or the" >&2
105 echo " suite could not run. Read the verdict line for each tier above." >&2
97fi 106fi
98exit "$status" 107exit "$status"