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 | 6 | # Enable once per clone: |
| 7 | 7 | # git config core.hooksPath .githooks |
| 8 | 8 | # |
| 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. |
| 13 | 13 | # |
| 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. |
| 18 | 18 | # |
| 19 | 19 | # Why the hook runs qlty at all: nothing else does. This repository's origin is |
| 20 | 20 | # gitbay, which has no build configured, so the smell gates in .qlty/qlty.toml |
| @@ -101,14 +101,14 @@ print(sum( |
| 101 | 101 | fi |
| 102 | 102 | fi |
| 103 | 103 | |
| 104 | | echo "pre-push: running accessibility audit on the floor runtime (~85s)" |
| 104 | echo "pre-push: running accessibility audit on both runtimes (~20 min)" |
| 105 | 105 | echo " skip with 'git push --no-verify'" |
| 106 | 106 | |
| 107 | | if ! ./Scripts/audit-a11y.sh floor; then |
| 107 | if ! ./Scripts/audit-a11y.sh; then |
| 108 | 108 | 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 |
| 112 | 112 | exit 1 |
| 113 | 113 | fi |
| 114 | 114 | |
Docs/ACCESSIBILITY.txt
+20 −9
| @@ -410,7 +410,7 @@ no single number is correct on both. |
| 410 | 410 | |
| 411 | 411 | The audit therefore runs locally, across both ends, via |
| 412 | 412 | `Scripts/audit-a11y.sh` — on a machine that actually has an 18.x runtime |
| 413 | | installed. It is wired to the pre-push hook in `.githooks/`. |
| 413 | installed. The pre-push hook in `.githooks/` runs both of them. |
| 414 | 414 | |
| 415 | 415 | There is no CI job. The GitHub Actions workflow that used to run this suite on |
| 416 | 416 | the 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 | 424 | ## Running it |
| 425 | 425 | |
| 426 | 426 | ```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) |
| 430 | 430 | ``` |
| 431 | 431 | |
| 432 | It exits non-zero when a tier fails — an enforced category reporting a named |
| 433 | finding, or the suite not running at all — so it can be used as a gate. Findings |
| 434 | in unenforced categories are printed and do not affect the exit code. |
| 435 | |
| 432 | 436 | The script reads the deployment target from the project rather than hard-coding |
| 433 | 437 | it, and selects the oldest installed runtime **at or above** it — a runtime |
| 434 | 438 | below 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. |
| 441 | 445 | git config core.hooksPath .githooks |
| 442 | 446 | ``` |
| 443 | 447 | |
| 444 | | Runs the floor audit before a push, and only when Swift, asset, or project files |
| 445 | | changed. Bypass with `git push --no-verify`. |
| 448 | Runs the complexity ratchet, then the audit on **both** runtimes, before a push, |
| 449 | and only when Swift, asset, or project files changed. Bypass with |
| 450 | `git push --no-verify`. |
| 451 | |
| 452 | Both tiers rather than the floor alone because coverage is not nested across OS |
| 453 | versions (below) and there is no CI, so a tier the hook does not run is not run |
| 454 | at all. The cost is real: about twenty minutes, against roughly eight for the |
| 455 | floor alone. |
| 446 | 456 | |
| 447 | | Pre-push rather than pre-commit deliberately: the suite takes ~85s, and at |
| 448 | | pre-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. |
| 457 | Pre-push rather than pre-commit deliberately: at pre-commit that blocks every |
| 458 | commit. A hook routinely bypassed with `--no-verify` is worse than no hook, |
| 459 | because it trains you to ignore it — which is the standing argument against |
| 460 | letting this get any slower. |
| 450 | 461 | |
| 451 | 462 | ## Layout gotchas found the hard way |
| 452 | 463 | |
Scripts/audit-a11y.sh
+12 −3
| @@ -69,16 +69,22 @@ run_tier() { |
| 69 | 69 | fi |
| 70 | 70 | |
| 71 | 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 | 78 | set -o pipefail |
| 73 | 79 | xcodebuild test \ |
| 74 | 80 | -project "$PROJECT" \ |
| 75 | 81 | -scheme "$SCHEME" \ |
| 76 | 82 | -destination "id=$udid" \ |
| 77 | 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)' \ |
| 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=$? |
| 80 | 86 | |
| 81 | | return 0 |
| 87 | return "$code" |
| 82 | 88 | } |
| 83 | 89 | |
| 84 | 90 | status=0 |
| @@ -94,5 +100,8 @@ if [[ "$status" -eq 0 ]]; then |
| 94 | 100 | echo "==> Done. Findings above are the burndown list for issue #21." |
| 95 | 101 | echo " They are reported, not enforced — widen" |
| 96 | 102 | echo " AccessibilityAuditHarness.enforcedAuditTypes as each phase lands." |
| 103 | else |
| 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 |
| 97 | 106 | fi |
| 98 | 107 | exit "$status" |