Files
CatoandClaude fbe9cec233 feat(ui-audit): render three widths, because one was never a sample (#119)
The fleet's rendered-defect gate swept 1440x1000 and nothing else. That was
the hole it could not see through, and it cost substrata a header that was
broken at three widths for months while every gate stayed green.

substrata shipped a mobile menu whose panel was positioned against a button in
the middle of the header, so `right: 0` measured from there put 22rem of panel
off the LEFT edge of a 390px screen — the search field and every link label
painted where nobody could see them. Contract rules 1-6 all passed on it: the
links had boxes, cleared 44px, and marked the current page. They were simply
not on the screen, and nothing rendered the screen they were missing from. The
same header hid its entire nav between 768 and 1099px, so an iPad got a lone
"MENU" in an empty bar.

So: 390 / 834 / 1440, overridable with VIEWPORTS. Each is a different branch of
this fleet's CSS — below every breakpoint, in the gap where `md:` has fired and
`lg:` has not, and the desktop already covered.

Two new detectors, and they are contract rules 7 and 8 because the first sweep
found them live, not because they sounded right:

  surf-your-life  "Jetzt starten" crosses the right edge by 93px at 834
  vitareba        "ANMELDEN" crosses by 19px at 834
  kivvi           "Demo anfragen" crosses by 15px, page scrolls sideways 15px

Every one of those is clean at 1440. Rule 3 moves with width too: petvity is
clean at 390 and has three sub-44px targets at 834; datacat has three at 390
and seven at 834; botsmann is clean at both and has six at 1440.

CROSSING the edge is the defect, not being past it — a closed drawer parked at
translateX(-100%) is entirely outside the viewport and is how a drawer waits.
Requiring part on screen and part off separates the two with no list of
exceptions. The floor is 4px, because the sweep found loki's "Get started" one
pixel over, which is rounding and not a clipped button.

A panel is closed on arrival, so nothing measures it. DISCLOSE opens every
<details> in a nav or header by setting the property — no event fires, so
nothing can navigate — and main() clicks up to six button[aria-expanded=false]
with a URL guard, because a click in this fleet may do anything.

The off-viewport rule gets a WIDER root set than rules 1-4, and that is the
finding rather than a convenience: substrata's mobile menu is not inside a
<nav> at all. It is a <details> beside one in the header, which is where a menu
button usually lives. Scoped to <nav> it would have missed the exact defect it
was written for — the fixture caught that before the fleet did.

Findings merge across widths and print once, annotated with every width they
were seen at, so three renders do not treble a report a human reads. Keys
deliberately ignore absolute coordinates: the same crooked stack sits at a
different x at each width, and keying on edges printed one decision three
times.

Also: a site that could not be rendered at ANY width is no longer folded into
the closing check mark. This script's own header says a clean report from a
detector that never looked is worse than no report at all, and it was doing
exactly that.

SHARED.md: rules 7 and 8 with the evidence above; the enforcement paragraph
now describes what the sweep actually does; and the 2026-08-31 "open gap" note
is corrected — s-ink and substrata are in FLEET_SITES now, camille-boulangerie
and wild-spirit still are not.

Self-tests 20 -> 24, all passing: the off-left panel is caught, the anchored
fix stays silent, a closed drawer stays silent, DISCLOSE is pinned separately
so a regression there cannot masquerade as a clean fleet, and a malformed
VIEWPORTS throws instead of silently skipping.

Verified end to end against a live local site and against all 14 fleet sites.
Job timeout 20 -> 30 minutes; the three-width sweep ran in ~8.


Claude-Session: https://claude.ai/code/session_01NkjZ1jJPhHzxAPvbSSG3wH

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-21 00:46:09 -07:00

101 lines
3.6 KiB
YAML

# Defect classes that only exist once a page is painted, so no unit test,
# type check or lint rule in any repo can see them:
#
# - an interactive label below its WCAG AA contrast floor (an action nobody
# can find is a feature that does not exist)
# - a stack whose rows start at different x, or a wrapped line that does not
# align with the line above it
# - a nav or header control with part of itself off the screen, or a page
# that scrolls sideways (contract rules 7 and 8)
#
# The first two were reported by the operator in plain language — "i dont see
# it" and "this area looks bad. not aligned" — after every gate in the repo was
# green. The third needed a width this job did not render: it swept 1440 only
# until 2026-09-21, and three live sites were crossing the right edge at 834
# while reporting clean.
#
# A rule nothing enforces is a suggestion. This runs on a schedule and reports
# into the job summary, where a human actually looks.
name: UI defects
on:
schedule:
# Weekly. These defects arrive with design changes, not with every commit;
# a daily run would be noise nobody reads twice.
- cron: '41 6 * * 1'
workflow_dispatch:
inputs:
strict:
description: 'Fail the run when sites have defects'
type: boolean
default: false
sites:
description: 'Comma-separated URLs (default: discovered from the fleet footer)'
type: string
default: ''
viewports:
description: 'Comma-separated WIDTHxHEIGHT (default: 390x844,834x1112,1440x1000)'
type: string
default: ''
permissions:
contents: read
jobs:
audit:
runs-on: ubuntu-latest
# Three widths is three times the page loads it used to make, and each one
# holds a 4s settle. 14 sites x 3 widths ran in ~8 min locally.
timeout-minutes: 30
steps:
- uses: actions/checkout@v7
- uses: actions/setup-node@v7
with:
node-version: 22
# this repo has no package.json on purpose — it is not an npm project.
# Install the browser into a scratch directory and point the audit at it.
- name: Install playwright
run: |
mkdir -p "$RUNNER_TEMP/pw" && cd "$RUNNER_TEMP/pw"
npm init -y >/dev/null
npm i --no-audit --no-fund playwright >/dev/null
npx playwright install --with-deps chromium >/dev/null
- name: Self-test the detector
# Runs BEFORE the sweep, deliberately. A detector that has silently
# stopped catching anything reports a clean fleet, and a clean report
# from a broken detector is worse than no report at all — it is an
# absent check that produces a ✓. The fixtures pin both sides: the real
# defect is still caught, correct markup stays silent.
env:
PLAYWRIGHT_FROM: ${{ runner.temp }}/pw
run: node scripts/ci/test-ui-defect-audit.mjs
- name: Audit the fleet
env:
PLAYWRIGHT_FROM: ${{ runner.temp }}/pw
SITES: ${{ inputs.sites }}
VIEWPORTS: ${{ inputs.viewports }}
run: |
set -uo pipefail
flag=--warn-only
if [ "${{ inputs.strict }}" = "true" ]; then flag=""; fi
# Report goes to the job summary, not just the log: a finding nobody
# scrolls to is the same as no finding.
{
echo '## UI defects'
echo
echo '```'
} >> "$GITHUB_STEP_SUMMARY"
set +e
node scripts/ci/ui-defect-audit.mjs $flag 2>&1 | tee -a "$GITHUB_STEP_SUMMARY"
status=${PIPESTATUS[0]}
set -e
echo '```' >> "$GITHUB_STEP_SUMMARY"
exit "$status"