Skip to content

UI evidence gate: require tracked screenshots for UI changes + one-command capture for Windows/macOS - #20890

Merged
Git-on-my-level merged 4 commits into
mainfrom
lane/ui-screenshot-gate
Oct 7, 2026
Merged

Git-on-my-level merged 4 commits into
mainfrom
lane/ui-screenshot-gate

Conversation

@Git-on-my-level

@Git-on-my-level Git-on-my-level commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

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 from 001; platform ∈ mobile-android|mobile-ios|desktop-macos|desktop-windows|web; slug lowercase-kebab ≤40 chars
  • evidence.json beside 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:

  1. .github/scripts/check_ui_evidence.py + 17 hermetic tests + checks-manifest.yaml entries (ui-evidence with requires_pr_body: true in 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 their evidence.json.
  2. desktop/windows/scripts/capture-evidence.mjs (+ pnpm capture:evidence, shared e2e/helpers/capture-helpers.mjs, 17 vitest tests): launches the built app exactly like e2e/bar.spec.mjs, writes the PNG and merges evidence.json.
  3. desktop/macos/scripts/capture-ui-evidence.sh (+ hermetic tests/test-capture-ui-evidence.sh): screencapture full-screen or window-targeted via ctypes CGWindowList, 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 OK
  • cd 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 calls screencapture); bash -n and shellcheck clean
  • scripts/pr-preflight --pr-body-file <body> — CI lane dry run: PR preflight passed: 15 checks with ui-evidence + ui-evidence-tests selected
  • python3 .github/scripts/run_checks.py --manifest .github/checks-manifest.yaml --lane ci --list selects both new entries; local lane likewise
  • CLI fixtures: referenced tracked image → OK (exit 0); missing evidence → FAIL: UI evidence with 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.

Review in cubic Turn on auto-fix

Git-on-my-level and others added 4 commits October 7, 2026 12:11
Give the Electron E2E suite a shared capture path so UI-change PRs can attach contract-compliant desktop-windows screenshots.

Co-authored-by: Cursor <[email protected]>
Agents can write contract-compliant desktop-macos screenshots and an idempotent evidence.json without inspecting image contents.

Co-authored-by: Cursor <[email protected]>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-07T06:19:38.404551Z cbabe9d PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: cbabe9d30f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +19 to +20
("web/frontend/src/", None),
("web/admin/app/", None),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Include the shipped web app in the UI path inventory

UI changes under the primary web client, such as web/app/src/app/(authenticated)/home/page.tsx, are not recognized because the inventory includes only web/frontend/src/; similarly, shared admin UI under web/admin/components/ is outside web/admin/app/. The manifest repeats these omissions, so PRs changing those user-facing surfaces never select this check and can merge without either screenshot evidence or the explicit waiver.

Useful? React with 👍 / 👎.

Comment on lines +127 to +128
if not any(is_ui_source(path) for path in changed):
return []

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Validate added evidence before returning for non-UI diffs

When a PR only adds or repairs files under .agent-artifacts/ui-evidence/, this early return skips all filename and manifest validation, despite the documented contract saying every added image must be validated. The manifest also has no evidence-silo trigger, so an evidence-only follow-up can commit malformed filenames or a missing/invalid evidence.json without this guard running at all; artifact validation should be performed independently of whether UI source changed.

Useful? React with 👍 / 👎.

Sibling evidence.json (JSON, 2-space indent, trailing newline):
{"version": 1, "images": [{"file": "001-desktop-macos-chat-home.png", "platform": "desktop-macos", "description": "Chat home", "captured_by": "agent", "source": "visual-audit"}]}
captured_by: agent|human; source: visual-audit|playwright-e2e|screencapture|manual.
Example: ![Chat home](.agent-artifacts/ui-evidence/my-branch/001-desktop-macos-chat-home.png)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Generate a PR-body URL that GitHub can render

The prescribed .agent-artifacts/... image target is not a valid repository-image reference in a pull-request description: GitHub documents the PR/comment form as ../blob/<ref>/<path>?raw=true, whereas this path is resolved relative to the pull page and renders as a broken image. Moreover, BODY_IMAGE_RE does not accept the documented blob URL because the evidence path is preceded by /, so authors cannot substitute a working link while satisfying the gate. This means the required evidence is tracked but remains invisible in the exact review surface the change is intended to improve. See GitHub's image-path table.

Useful? React with 👍 / 👎.

Comment on lines +377 to +380
if name and needle in name:
title_hits.append((rank, wid))
elif owner and needle in owner:
owner_hits.append((rank, wid))

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Restrict owner-name fallback to untitled windows

When --window-title matches an application's owner name, every window owned by that app whose unrelated title does not match is currently added to owner_hits. For a multi-window app this can select the first arbitrary titled window instead of the intended blank-title window, producing evidence for the wrong screen; the documented owner fallback should only apply when name is empty.

Useful? React with 👍 / 👎.

fi
run_screencapture "$tmp" -x -l "$wid"
else
run_screencapture "$tmp" -x

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Select one display for full-screen macOS captures

On a Mac with multiple displays, invoking screencapture without -m or -D produces one output file per screen; the command's manual explicitly defines the files output as “1 file per screen” and documents -m as main-monitor-only (screencapture(1)). This script commits and deletes only the exact $tmp path, leaving the automatically named files for the other displays in the evidence directory; following the printed git add workflow then stages those temporary PNGs, whose names violate the evidence contract and fail the gate. Choose a single display or explicitly handle and clean every generated file.

Useful? React with 👍 / 👎.

@Git-on-my-level
Git-on-my-level merged commit 35d7c08 into main Oct 7, 2026
54 checks passed
@Git-on-my-level
Git-on-my-level deleted the lane/ui-screenshot-gate branch October 7, 2026 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant