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 @@
66# Enable once per clone:
77# git config core.hooksPath .githooks
88#
9# Why pre-push and not pre-commit: the suite takes ~85s. At pre-commit that
10# blocks every commit, and a hook you routinely bypass with --no-verify is worse
11# than no hook, because it trains you to ignore it. Pushes are far less frequent
12# and map to the unit of work that actually reaches CI.
9# Why pre-push and not pre-commit: the suite takes around ten minutes per
10# runtime. At pre-commit that blocks every commit, and a hook you routinely
11# bypass with --no-verify is worse than no hook, because it trains you to ignore
12# it. Pushes are far less frequent and map to the unit of work.
1313#
14# Why only the floor tier: CI already audits the newest runtime on a clean
15# checkout. The GitHub image has no old runtimes, so the floor is the one thing
16# CI structurally cannot cover — and it is the one this machine can. Running
17# both here would just double the wait to re-check what CI already does.
14# Why both tiers: audit coverage is not nested across OS versions — each runtime
15# reports findings the others miss, in both directions, which
16# Docs/ACCESSIBILITY.txt records per screen. There is no CI, so a tier this does
17# not run is not run at all, and an enforced failure on it reaches main.
1818#
1919# Why the hook runs qlty at all: nothing else does. This repository's origin is
2020# gitbay, which has no build configured, so the smell gates in .qlty/qlty.toml
@@ -101,14 +101,14 @@ print(sum(
101101 fi
102102fi
103103
104echo "pre-push: running accessibility audit on the floor runtime (~85s)"
104echo "pre-push: running accessibility audit on both runtimes (~20 min)"
105105echo " skip with 'git push --no-verify'"
106106
107if ! ./Scripts/audit-a11y.sh floor; then
107if ! ./Scripts/audit-a11y.sh; then
108108 echo
109 echo "pre-push: audit could not run. Push aborted." >&2
110 echo " Re-run with './Scripts/audit-a11y.sh floor' to see why," >&2
111 echo " or bypass with 'git push --no-verify'." >&2
109 echo "pre-push: accessibility audit failed. Push aborted." >&2
110 echo " Re-run with './Scripts/audit-a11y.sh' to see which tier and" >&2
111 echo " which screen, or bypass with 'git push --no-verify'." >&2
112112 exit 1
113113fi
114114
Docs/ACCESSIBILITY.txt +20 −9
@@ -410,7 +410,7 @@ no single number is correct on both.
410410
411411The audit therefore runs locally, across both ends, via
412412`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.
414414
415415There is no CI job. The GitHub Actions workflow that used to run this suite on
416416the newest runtime has been removed, and with it the one check that no local run
@@ -424,11 +424,15 @@ by hand before a release.
424424## Running it
425425
426426```sh
427./Scripts/audit-a11y.sh # floor + current
428./Scripts/audit-a11y.sh floor # oldest supported only (~85s)
429./Scripts/audit-a11y.sh current # newest installed only
427./Scripts/audit-a11y.sh # floor + current (~20 min)
428./Scripts/audit-a11y.sh floor # oldest supported only (~8 min)
429./Scripts/audit-a11y.sh current # newest installed only (~10 min)
430430```
431431
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
432436The script reads the deployment target from the project rather than hard-coding
433437it, and selects the oldest installed runtime **at or above** it — a runtime
434438below 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.
441445git config core.hooksPath .githooks
442446```
443447
444Runs the floor audit before a push, and only when Swift, asset, or project files
445changed. Bypass with `git push --no-verify`.
448Runs the complexity ratchet, then the audit on **both** runtimes, before a push,
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.
446456
447Pre-push rather than pre-commit deliberately: the suite takes ~85s, and at
448pre-commit that blocks every commit. A hook routinely bypassed with
449`--no-verify` is worse than no hook, because it trains you to ignore it.
457Pre-push rather than pre-commit deliberately: at pre-commit that blocks every
458commit. A hook routinely bypassed with `--no-verify` is worse than no hook,
459because it trains you to ignore it — which is the standing argument against
460letting this get any slower.
450461
451462## Layout gotchas found the hard way
452463
Scripts/audit-a11y.sh +12 −3
@@ -69,16 +69,22 @@ run_tier() {
6969 fi
7070
7171 # 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
7278 set -o pipefail
7379 xcodebuild test \
7480 -project "$PROJECT" \
7581 -scheme "$SCHEME" \
7682 -destination "id=$udid" \
7783 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)' \
79 || true
84 | { grep -E 'finding\(s\)|no accessibility findings|^ • |did not complete in time|Executed [0-9]+ test|\*\* TEST (SUCCEEDED|FAILED)' || true; } \
85 || code=$?
8086
81 return 0
87 return "$code"
8288}
8389
8490status=0
@@ -94,5 +100,8 @@ if [[ "$status" -eq 0 ]]; then
94100 echo "==> Done. Findings above are the burndown list for issue #21."
95101 echo " They are reported, not enforced — widen"
96102 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
97106fi
98107exit "$status"