Files
jaredandClaude Opus 5.5 ab4b20d15f
CI / Lint (flake8, house style) (pull_request) Successful in 56s
CI / Test (pytest) (pull_request) Successful in 53s
CI / Security (bandit, pip-audit) (pull_request) Successful in 1m8s
CI / Integration (MariaDB) (pull_request) Successful in 1m49s
CI / UI (screenshots) (pull_request) Failing after 1m7s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m58s
CI / Deploy (pull_request) Skipped
UI and API: Needs attention, incident pages, known conditions, /covering for Gandalf and hwmonDaemon
- thor/web/api.py: /api/incidents/covering (thor#1 pre-check), /api/incidents, /api/incident/<key>,
  machine keys by SHA-256 with optional source CIDRs, like Gandalf's (gandalf#68); 503 when the
  database is away so callers fail open. covered=true only when there is a ticket to comment on;
  shadow incidents are listed but never cover.
- thor/web/ui.py + templates: Needs attention (incidents, Thor itself, timeline-only, known
  conditions seen again, unexplained symptoms), incident page (what happened, also seen, what
  Thor sent or would have sent, ticket text), known conditions. Read-only; CSP with nonces;
  Authelia identity shown only when it comes from NPM. Mobile nav drawer.
- web_template v1.2 (8286bb2) vendored and checked against upstream in CI.
- docs/contract.md: the /covering contract for the Gandalf and hwmonDaemon sessions.
- scripts/ui_demo.py + scripts/screenshots.py, and a CI job that renders every page with replay
  data (desktop, mobile, dark, light) and uploads the screenshots.
- Fix: systemd-escaped cpusets (system-ceph\x2dosd.slice) were not recognised as Ceph; four of
  the 11-23 kills came from the OSD slice. Found while reviewing the screenshots.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-25 23:23:43 -05:00

49 lines
1.9 KiB
Python

#!/usr/bin/env python3
"""Screenshot Thor's pages (desktop and mobile) for UI review in pull requests.
Usage: python scripts/screenshots.py <base-url> <out-dir>
Needs Playwright with Chromium (pip install playwright; playwright install chromium).
Pair it with scripts/ui_demo.py to show the pages with replay data.
"""
import sys
from pathlib import Path
from playwright.sync_api import sync_playwright
PAGES = {
'needs-attention': '/',
'incident-oom-t1': '/incident/host:compute-storage-01:oom',
'incident-partition-t4': '/incident/cluster:corosync:partition',
'incident-maintenance-t2': '/incident/maintenance:gandalf:2',
'known-conditions': '/known',
}
VIEWPORTS = {'desktop': {'width': 1440, 'height': 900}, 'mobile': {'width': 390, 'height': 844}}
# The design system follows the browser's preference; the terminal look is the dark one.
SCHEMES = ('dark', 'light')
def main(base: str, out: str) -> None:
out_dir = Path(out)
out_dir.mkdir(parents=True, exist_ok=True)
with sync_playwright() as p:
browser = p.chromium.launch()
count = 0
for scheme in SCHEMES:
for vp_name, vp in VIEWPORTS.items():
if scheme == 'light' and vp_name == 'mobile':
continue
page = browser.new_page(viewport=vp, color_scheme=scheme)
for name, path in PAGES.items():
resp = page.goto(base.rstrip('/') + path, wait_until='networkidle')
if resp is None or resp.status >= 400:
raise SystemExit(f'{path} answered {resp.status if resp else "nothing"}')
page.screenshot(path=str(out_dir / f'{name}-{vp_name}-{scheme}.png'), full_page=True)
count += 1
page.close()
browser.close()
print(f'wrote {count} screenshots to {out_dir}')
if __name__ == '__main__':
main(sys.argv[1], sys.argv[2])