UI evidence gate: require tracked screenshots for UI changes + one-command capture for Windows/macOS
What changed and why
UI-change PRs now require at least one tracked screenshot, enforced by the standard checks-manifest so it runs in both the local pre-push gate and CI Hygiene. Screenshots are siloed under .agent-artifacts/ui-evidence/<pr-or-branch>/ with a strict contract (<NNN>-<platform>-<slug>.png + evidence.json), and two new one-command capture tools produce contract-compliant evidence for the Windows (Playwright E2E) and macOS (screencapture) desktop apps.
Motivation: agents (and humans) landing UI changes had no enforced way to attach visual evidence, so reviewers reviewed rendered behavior blind. Requiring the artifact — without inspecting its content — makes visual review cheap and gives future agents in-repo context for the screens they touch.
Contract (frozen across all three pieces):
- Silo:
.agent-artifacts/ui-evidence/<pr-number-or-branch-slug>/ - Filename:
<NNN>-<platform>-<slug>.png— NNN zero-padded 3-digit ordinal from001; platform ∈mobile-android|mobile-ios|desktop-macos|desktop-windows|web; slug lowercase-kebab ≤40 chars evidence.jsonbeside the images:{"version":1,"images":[{"file","platform","description","captured_by","source"}]}(2-space indent, trailing newline)- Gate passes when the PR body references ≥1 tracked silo image, or carries the exact line
UI-Evidence: none(optional-- reason) - Pre-PR bootstrap works like the Failure-Class gate:
OMI_PR_BODY_FILE=/tmp/pr-body.md git push
Pieces:
.github/scripts/check_ui_evidence.py+ 17 hermetic tests +checks-manifest.yamlentries (ui-evidencewithrequires_pr_body: truein both lanes,ui-evidence-tests) + PR-template section. Trigger globs:app/lib/**/*.dart,desktop/macos/Desktop/Sources/**/*.swift,desktop/windows/src/**/*.{ts,tsx},web/frontend/src/**,web/admin/app/**. Deleted-only UI diffs don't trigger; added images under the silo are validated against the contract and theirevidence.json.desktop/windows/scripts/capture-evidence.mjs(+pnpm capture:evidence, sharede2e/helpers/capture-helpers.mjs, 17 vitest tests): launches the built app exactly likee2e/bar.spec.mjs, writes the PNG and mergesevidence.json.desktop/macos/scripts/capture-ui-evidence.sh(+ hermetictests/test-capture-ui-evidence.sh):screencapturefull-screen or window-targeted viactypesCGWindowList, Screen-Recording TCC remediation on failure, same contract write.
Product invariants affected
- none
How it was verified
All commands run on this branch (and re-run independently by the reviewer and coordinator):
python3 .github/scripts/test_check_ui_evidence.py— 17 tests OKcd desktop/windows && npx pnpm@10 exec vitest run scripts/capture-evidence.test.mjs— 17/17 passed (hermetic, no Electron launch)bash desktop/macos/tests/test-capture-ui-evidence.sh— pass (hermetic; never callsscreencapture);bash -nandshellcheckcleanscripts/pr-preflight --pr-body-file <body>— CI lane dry run:PR preflight passed: 15 checkswithui-evidence+ui-evidence-testsselectedpython3 .github/scripts/run_checks.py --manifest .github/checks-manifest.yaml --lane ci --listselects both new entries; local lane likewise- CLI fixtures: referenced tracked image →
OK(exit 0); missing evidence →FAIL: UI evidencewith full contract + remediation (exit 1)
Real-path caveat, stated plainly: the two capture tools were validated hermetically plus launch-env parity review; no Electron app launch or real screen capture was performed in this lane (no Windows host / TCC prompt here). First real capture exercises the remaining path.
Tests
- Gate:
.github/scripts/test_check_ui_evidence.py(17 cases: trigger classification incl. deleted-only, escape-line negatives, tracked-at-HEAD incl. directory/symlink rejection, filename/manifest validation, glob parity) - Windows:
desktop/windows/scripts/capture-evidence.test.mjs(17 cases: filename validator, ordinal allocation, evidence.json merge/replace/v1 enforcement) - macOS:
desktop/macos/tests/test-capture-ui-evidence.sh(bad platform/slug, NNN padding, merge preserves entries, replace-by-filename, contract write from fake PNG)
Failure class (fixes)
Failure-Class: none
New guards (only when adding a check or ratchet)
This check would have forced visual evidence onto recent UI PRs that landed without any in-repo artifact for reviewers: #20802 (flag-gated "Setting up your Omi" onboarding page) and #20744 (knowledge-graph rebuild UI fix). Not-a-shared-primitive answer: the checker IS the shared primitive — one contract + one validator consumed by both capture tools and both lanes; per-platform capture scripts are thin producers over the same frozen contract rather than N independent guard implementations.
UI evidence
UI-Evidence: none -- tooling-only change; the diff touches no product UI source (check/tests/manifest/template/capture scripts only), so there is no product screen to screenshot.