Phase 1, PR 4: UI (Needs attention, incidents, known conditions) and the /covering API #8

Merged
jared merged 2 commits from ui into main 2026-11-26 13:47:14 -05:00
Owner

Fourth phase 1 PR from the plan on #1. This one changes the UI, so it waits for your look at the design before merging.

Screenshots: https://claude.ai/artifact/6UWjqPFf3a8JVDFJerkvQj (private to you). CI also uploads them as the ui-screenshots artifact on this PR's run. They show every page rendered with real replay data: desktop and phone in dark, plus a light desktop shot of each.

Pages (read-only; changes go through the MCP tools in PR 5)

  • Needs attention (/): one page of groups, shaped like Gandalf's dashboard, per your "fold it into one list" rule:
    • Incidents, with priority chips and "shadow (not sent)" while in shadow.
    • Thor itself: each source answering or blind, and when Thor is catching up.
    • On the timeline only: maintenance from Gandalf.
    • Known conditions seen again.
    • Unexplained in the last hour: symptoms nothing explains, never ticketed.
    • A "Last 7 days" table underneath.
  • Incident (/incident/<key>): facts and why this priority; what happened; what's filed under it; what Thor sent or would have sent (every action, with mode and status); and the exact ticket title and text.
  • Known conditions (/known).
  • Phone layout with a nav drawer. Design system web_template v1.2 (8286bb2, dash-free, the same copy Pulse uses), checked against upstream in CI.

API (for Gandalf and hwmonDaemon; contract in docs/contract.md)

  • GET /api/incidents/covering?host=X (or scope=cluster, scope=source:<name>), plus /api/incidents and /api/incident/<key>.
  • Machine keys like Gandalf's (gandalf#68): only the SHA-256 is configured, a key can be limited to source addresses, a wrong key gets a 401 even with identity headers, and only GET is allowed.
  • covered is true only when there's a ticket to comment on: an incident with a live ticket, or a known condition with a tracking ticket. While Thor is in shadow, its incidents are listed but don't cover, so Gandalf and hwmonDaemon keep opening their own tickets until Thor goes live. Errors and a 503 when the DB is away mean "fail open".
  • Old host names work (large1 maps to compute-storage-02).

Security

  • CSP with per-request nonces, plus nosniff, frame-deny and referrer headers.
  • Authelia's Remote-* headers are only displayed, and only believed from NPM (10.10.10.27); nothing in the UI changes state.
  • thor.lotusguild.org already sits behind Authelia two_factor, group admin (NPM host 60).

Also in this PR

  • Bug fix, found reviewing the screenshots: the kernel writes cpusets with systemd escaping (system-ceph\x2dosd.slice), so kills triggered from the Ceph OSD slice weren't recognised. Four of the 11-23 kills (05:32, 05:41, 05:50, 06:01) came from it. T1 now says "An OOM kill was triggered from a Ceph OSD: storage is affected."
  • scripts/ui_demo.py (serves the UI with replay data) and scripts/screenshots.py; a CI ui job renders every page in four variants, fails on any 4xx or 5xx, and uploads the screenshots.

Verification

  • 124 unit tests plus 6 MariaDB tests pass.
  • flake8, bandit, actionlint, zizmor and shellcheck are clean; the vendored design system matches upstream. No em or en dashes.

Next

PR 5: MCP v1. Read tools, plus known-condition and attach/detach writes. Then the Authelia OIDC client thor-mcp and the /mcp exemptions on NPM host 60.

🤖 Generated with Claude Code

Fourth phase 1 PR from the plan on #1. **This one changes the UI, so it waits for your look at the design before merging.** **Screenshots:** https://claude.ai/artifact/6UWjqPFf3a8JVDFJerkvQj (private to you). CI also uploads them as the `ui-screenshots` artifact on this PR's run. They show every page rendered with real replay data: desktop and phone in dark, plus a light desktop shot of each. ## Pages (read-only; changes go through the MCP tools in PR 5) - **Needs attention** (`/`): one page of groups, shaped like Gandalf's dashboard, per your "fold it into one list" rule: - Incidents, with priority chips and "shadow (not sent)" while in shadow. - **Thor itself**: each source answering or blind, and when Thor is catching up. - **On the timeline only**: maintenance from Gandalf. - **Known conditions seen again**. - **Unexplained in the last hour**: symptoms nothing explains, never ticketed. - A "Last 7 days" table underneath. - **Incident** (`/incident/<key>`): facts and why this priority; what happened; what's filed under it; what Thor sent or would have sent (every action, with mode and status); and the exact ticket title and text. - **Known conditions** (`/known`). - Phone layout with a nav drawer. Design system web_template v1.2 (`8286bb2`, dash-free, the same copy Pulse uses), checked against upstream in CI. ## API (for Gandalf and hwmonDaemon; contract in `docs/contract.md`) - `GET /api/incidents/covering?host=X` (or `scope=cluster`, `scope=source:<name>`), plus `/api/incidents` and `/api/incident/<key>`. - **Machine keys** like Gandalf's (gandalf#68): only the SHA-256 is configured, a key can be limited to source addresses, a wrong key gets a 401 even with identity headers, and only GET is allowed. - **`covered` is true only when there's a ticket to comment on**: an incident with a live ticket, or a known condition with a tracking ticket. While Thor is in shadow, its incidents are listed but **don't** cover, so Gandalf and hwmonDaemon keep opening their own tickets until Thor goes live. Errors and a 503 when the DB is away mean "fail open". - Old host names work (`large1` maps to compute-storage-02). ## Security - CSP with per-request nonces, plus nosniff, frame-deny and referrer headers. - Authelia's `Remote-*` headers are only displayed, and only believed from NPM (10.10.10.27); nothing in the UI changes state. - `thor.lotusguild.org` already sits behind Authelia `two_factor`, group admin (NPM host 60). ## Also in this PR - **Bug fix, found reviewing the screenshots:** the kernel writes cpusets with systemd escaping (`system-ceph\x2dosd.slice`), so kills triggered from the Ceph OSD slice weren't recognised. Four of the 11-23 kills (05:32, 05:41, 05:50, 06:01) came from it. T1 now says "An OOM kill was triggered from a Ceph OSD: storage is affected." - `scripts/ui_demo.py` (serves the UI with replay data) and `scripts/screenshots.py`; a CI `ui` job renders every page in four variants, fails on any 4xx or 5xx, and uploads the screenshots. ## Verification - 124 unit tests plus 6 MariaDB tests pass. - flake8, bandit, actionlint, zizmor and shellcheck are clean; the vendored design system matches upstream. No em or en dashes. ## Next PR 5: MCP v1. Read tools, plus known-condition and attach/detach writes. Then the Authelia OIDC client `thor-mcp` and the `/mcp` exemptions on NPM host 60. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jared added 1 commit 2026-11-25 23:24:49 -05:00
UI and API: Needs attention, incident pages, known conditions, /covering for Gandalf and hwmonDaemon
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
ab4b20d15f
- 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>
jared added 1 commit 2026-11-26 13:07:26 -05:00
CI: run the UI screenshot job in the Node-based Playwright image
CI / Lint (flake8, house style) (pull_request) Successful in 1m26s
CI / Test (pytest) (pull_request) Successful in 1m28s
CI / Scan (secrets, workflows, shell, patterns) (pull_request) Successful in 1m31s
CI / Integration (MariaDB) (pull_request) Successful in 2m1s
CI / UI (screenshots) (pull_request) Successful in 3m2s
CI / Security (bandit, pip-audit) (pull_request) Successful in 1m13s
CI / Deploy (pull_request) Skipped
2f7623840c
actions/checkout needs Node, which the Python-only image lacks. Use mcr.microsoft.com/playwright
(same browser build as the pip pin) and add Python in a venv; wait for the demo server with
Python instead of curl.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Author
Owner

CI fix pushed (2f76238): the UI screenshot job now runs in the Node-based Playwright image, because actions/checkout needs Node and the Python-only image has none. Python goes into a venv in the job. Run 4029 is green on every job: lint, test, integration, security, scan and UI (screenshots). The ui-screenshots artifact on that run has every page in desktop dark/light and mobile dark.

Waiting for your design review of the screenshots (https://claude.ai/artifact/6UWjqPFf3a8JVDFJerkvQj) before merging. #9 (MCP) is stacked on this one.

Also done meanwhile, so Thor is watched as agreed in thor#1 Area 1:

  • Uptime Kuma monitor 55 "Thor (web + monitor)" on http://10.10.10.86/health, 60 s, 2 retries, notifying the Spam and Stuff Room, same as Gandalf's monitor 52. Up.
  • Prometheus scrapes 10.10.10.86/metrics (job thor; jared/pve-infra 9390dc8, checked with promtool on CT 118, loaded with SIGHUP).
  • Grafana "Thor Stale" (Infrastructure / Monitoring, critical): fires when the last good cycle is older than 10 min, or the heartbeat is gone, for 5 min. Normal.
CI fix pushed (`2f76238`): the UI screenshot job now runs in the Node-based Playwright image, because `actions/checkout` needs Node and the Python-only image has none. Python goes into a venv in the job. Run 4029 is green on every job: lint, test, integration, security, scan and **UI (screenshots)**. The `ui-screenshots` artifact on that run has every page in desktop dark/light and mobile dark. **Waiting for your design review** of the screenshots (https://claude.ai/artifact/6UWjqPFf3a8JVDFJerkvQj) before merging. #9 (MCP) is stacked on this one. Also done meanwhile, so Thor is watched as agreed in thor#1 Area 1: - **Uptime Kuma monitor 55** "Thor (web + monitor)" on `http://10.10.10.86/health`, 60 s, 2 retries, notifying the Spam and Stuff Room, same as Gandalf's monitor 52. Up. - **Prometheus** scrapes `10.10.10.86/metrics` (job `thor`; jared/pve-infra `9390dc8`, checked with promtool on CT 118, loaded with SIGHUP). - **Grafana "Thor Stale"** (Infrastructure / Monitoring, critical): fires when the last good cycle is older than 10 min, or the heartbeat is gone, for 5 min. Normal.
jared merged commit 51afe4b69f into main 2026-11-26 13:47:14 -05:00
Author
Owner

Deploy verified on CT 173: prod HEAD 51afe4b, thor and thor-monitor active, /health 200, deploy log deployed 51afe4b...: healthy at 18:51:50 UTC, no tracebacks in the last 30 min.

Deploy verified on CT 173: prod HEAD `51afe4b`, `thor` and `thor-monitor` active, `/health` 200, deploy log `deployed 51afe4b...: healthy` at 18:51:50 UTC, no tracebacks in the last 30 min.
Sign in to join this conversation.
No Reviewers
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/thor#8