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
- 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>
52 lines
1.8 KiB
Python
52 lines
1.8 KiB
Python
#!/usr/bin/env python3
|
|
"""Serve Thor's UI with data from the replays, for screenshots and design review.
|
|
|
|
Usage: .venv/bin/python scripts/ui_demo.py [port] (default 8811, binds 127.0.0.1)
|
|
|
|
The store holds T1 stopped mid-incident (05:40, an open P1), the T2 maintenance timeline,
|
|
the DIMM known-condition note, and the T4 partition, all from tests/fixtures. The clock is
|
|
frozen at T1 05:40 so "ago" texts read as they would have that night.
|
|
"""
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(__file__).resolve().parent.parent
|
|
sys.path.insert(0, str(ROOT))
|
|
|
|
from tests.fakes import FakeStore # noqa: E402
|
|
from tests.replay import Replay # noqa: E402
|
|
from thor.config import Settings # noqa: E402
|
|
from thor.web.app import create_app # noqa: E402
|
|
|
|
T1_0540 = 1795412400.0
|
|
|
|
|
|
def demo_store() -> FakeStore:
|
|
merged = FakeStore()
|
|
runs = [Replay('t4').run(), Replay('dimm').run(), Replay('t2').run(), Replay('t1').run(until=T1_0540)]
|
|
for r in runs:
|
|
merged.incidents.update(r.store.incidents)
|
|
offset = len(merged.actions)
|
|
for a in r.store.actions:
|
|
merged.actions.append(dict(a, id=a['id'] + offset))
|
|
merged.observations.update(r.store.observations)
|
|
t1 = runs[-1].store
|
|
merged.state.update(t1.state)
|
|
merged.sources = t1.sources
|
|
merged.blind = t1.blind
|
|
# Show T2's maintenance as still active, as it was mid-window.
|
|
m = merged.incidents['maintenance:gandalf:2']
|
|
m.update(state='open', cleared_at=None, last_seen=T1_0540 - 600)
|
|
return merged
|
|
|
|
|
|
def build():
|
|
settings = Settings()
|
|
settings.public_url = ''
|
|
return create_app(settings, demo_store(), 'demo0000', clock=lambda: T1_0540)
|
|
|
|
|
|
if __name__ == '__main__':
|
|
port = int(sys.argv[1]) if len(sys.argv) > 1 else 8811
|
|
build().run(host='127.0.0.1', port=port)
|