phase: 06_system_page_gpu_verdicts
All criteria verified and the project is fully green.
**Verified (final pass — all 3 phase-06 tasks were already in `complete/`)**
- `classify("gpu.busy_pct", 99)` / `gpu.mem_used_pct` → `None`; `THRESHOLDS` has no `gpu.*` row; `alerts.py`/`api.py` carry no GPU verdict; live browser: deskwork GPU at **91 %** and **98 %** renders `class="hero"`, `color=rgb(22,25,31)` (plain text), no bar, no `.sev-*`.
- GPU temp on the hero `.sub` from live agents: `Radeon 8060S Graphics · VRAM 165.1 MiB / 512.0 MiB · pool 78% · 48 °C`, R9700 `· 40 °C`, gateway prints none (no `n/a`, no `0 °C`).
- Charts collapsed by default: fresh load = 3 panels / 3 toggles / **0 open / 0 `<svg>`**; expand → 3 SVGs (510 px wide), repaints across polls (legend 3.3 %→5.6 %), collapsed siblings keep their own height (803 vs 358/339).
- `gpu.busy_pct@0` still answers from `/api/system/history` (345 points) — verdict gone, data intact.
**Tests / lint / coverage**
- `bash .agents/validate.sh` → **EXIT=0**; `uv run pytest --cov --cov-fail-under=94` → **550 passed, 8 skipped, 97.91 %**; `uv run ruff check src tests agent` → clean; `uv run pyright` → 0 errors; `node --check` all scripts clean; `uv pip list --outdated` empty.
- `uv run pytest -m live --live` → **8 passed** (real agents/engines/upsd); dev server restarted, `/api/health` all sources `ok`.
- New screenshots: `data/logs/phase06-final-collapsed-default.png`, `data/logs/phase06-final-expanded-gpu-busy-uncoloured.png`.
**Completion criteria:** classify→None ✅ · pytest+94 % gate ✅ · ruff+pyright ✅ · validate.sh ✅ · screenshots of the three behaviours on live data ✅ · AGENTS.md severity section claims no GPU rows ✅
**Docs:** fixed 3 items — (1) `AGENTS.md` pytest count stale (546 → 550); (2) `app.js` `severityFor` docstring still claimed "`page-ups.js` still calls it (phase 05 converts it)", contradicting the code/tests/AGENTS.md (comment-only); rest of README/AGENTS reviewed in full (env table vs `config.py`+`.env.example`, agent routes incl. `/schema`, alerts rules, page descriptions, contracts) — consistent.
**Notable:** fixed a real pre-existing defect in `scripts/dev-server.sh` — `stop` slept 1 s and deleted the pidfile without waiting for exit, so `restart` with a browser open overlapped two servers on one SQLite file, producing a `database is locked` store refusal that `/system` rendered as a red event. Now waits (bounded 20 s) then SIGKILLs; verified a restart with live polling logs no such error/event. No live infra config was changed.
**Next pending phase:** `.agents/phases/todo/07_llm_monitor_style_pages`
This commit is contained in:
@@ -248,12 +248,8 @@ def test_payloads_carry_a_severity_beside_every_rated_value(agent_snapshot) -> N
|
||||
assert payload["cpu"]["severity"]["temp_c"] == "ok" # 68 °C in the capture
|
||||
assert payload["memory"]["severity"]["used_pct"] == "ok" # 68 % of 128 GB
|
||||
assert payload["disks"]["severity"]["worst_used_pct"] == "ok" # 74.6 % worst mount
|
||||
gpu = payload["gpus"][0]
|
||||
assert gpu["severity"] == {
|
||||
"busy_pct": classify("gpu.busy_pct", gpu["busy_pct"]),
|
||||
"mem_used_pct": classify("gpu.mem_used_pct", gpu["mem_used_pct"]),
|
||||
}
|
||||
assert gpu["severity"]["busy_pct"] == "ok"
|
||||
# GPU rows carry no verdict at all (phase 06): busy is the job on an LLM server
|
||||
assert "severity" not in payload["gpus"][0]
|
||||
|
||||
|
||||
def test_severity_trips_on_the_ratified_boundaries(agent_snapshot) -> None:
|
||||
@@ -263,14 +259,14 @@ def test_severity_trips_on_the_ratified_boundaries(agent_snapshot) -> None:
|
||||
snap["cpu_temperature_celsius"] = 90.0 # cpu.temp_c danger
|
||||
for fs in snap["filesystems"]:
|
||||
fs["used_pct"] = 80.0 # disk.used_pct warn
|
||||
snap["gpus"][0]["busy_pct"] = 95.0 # gpu.busy_pct danger
|
||||
snap["gpus"][0]["gtt_used_bytes"] = 65e9 # whole-pool usage well past danger
|
||||
snap["gpus"][0]["busy_pct"] = 100.0 # no gpu.* row exists to trip, at any level
|
||||
snap["gpus"][0]["gtt_used_bytes"] = 65e9 # whole-pool usage well past the old bounds
|
||||
payload = parse_host_snapshot("driveripper", snap, make_collector(), now=1_000.0).payload
|
||||
assert payload["memory"]["severity"]["used_pct"] == "fail"
|
||||
assert payload["cpu"]["severity"]["temp_c"] == "fail"
|
||||
assert payload["disks"]["severity"]["worst_used_pct"] == "warn"
|
||||
assert payload["gpus"][0]["severity"]["busy_pct"] == "fail"
|
||||
assert payload["gpus"][0]["severity"]["mem_used_pct"] == "fail"
|
||||
assert payload["gpus"][0]["busy_pct"] == 100.0, "the numbers stay; only the verdict left"
|
||||
assert "severity" not in payload["gpus"][0], "a GPU verdict row came back"
|
||||
|
||||
|
||||
def test_a_value_the_agent_did_not_report_gets_no_colour(agent_snapshot) -> None:
|
||||
@@ -282,7 +278,7 @@ def test_a_value_the_agent_did_not_report_gets_no_colour(agent_snapshot) -> None
|
||||
payload = parse_host_snapshot("driveripper", snap, make_collector(), now=1_000.0).payload
|
||||
assert payload["cpu"]["severity"]["temp_c"] is None
|
||||
assert payload["cpu"]["severity"]["usage_pct"] is None, "one scrape is not a rate"
|
||||
assert payload["gpus"][0]["severity"]["busy_pct"] is None
|
||||
assert payload["gpus"][0]["busy_pct"] is None
|
||||
assert payload["disks"]["severity"]["worst_used_pct"] is None
|
||||
# the numbers themselves are unchanged by the verdict sitting next to them
|
||||
assert payload["memory"]["used_pct"] == pytest.approx(
|
||||
|
||||
Reference in New Issue
Block a user