Files
dashboards/pyproject.toml
T
ducoterra 569ca25fdb phase: 14_store_performance
**Phase 14 `store_performance` — final verification pass (all 4 tasks already in `complete/`)**

- Re-verified every task's work in the tree: read caches (`series_names`/`stats`), capped compound `pick_res_many`, `history_many` + `api._history_batch`, windowed `maintain()` + per-resolution prune + `PRAGMA optimize`/`automatic_analyze=0`/WAL pragmas, `store_perf.BUDGETS` (14 ceilings), probe, live watch.
- **Completion criteria:** baseline+after side by side in `data/logs/NOTES-store-perf.md` ✅ · budget tests green (`uv run pytest -m store_perf --store-perf` → **4 passed**, 14/14 inside) ✅ · 25-min dev-server watch re-run **independently** (74 passes, `scripts/watch-store-perf.py`): **0 `store-error`** (total still 190, newest 2026‑10‑18 06:33:30), WAL 7.77 MB ≤ 67.1 MB, medians 1.7–3.2 ms, p95 720/613 ms = the documented cold-cache window; a 3rd 27-pass watch on a freshly restarted server reproduced it (3.1/708, 1.8/572) ✅ · `maintain()` 5,368 ms → 2.7–6.8 ms and WAL bounded across two cycles (test + notes) ✅ · no behaviour change (all four history routes pinned against `query()`) ✅
- **Full gates:** `uv run pytest` → **1267 passed, 15 skipped**; `bash .agents/validate.sh` → **exit 0**, coverage **98.75%** (floor 94), `ruff check src tests agent` clean, `pyright` 0 errors, `node --check` ok, repo hygiene ok; `uv run pytest -m live --live` → **11 passed**; dev server up, 9/9 sources `ok`, pages 200 in 1.5–3.3 ms.
- **Docs fixed:** README/AGENTS still claimed a flat "20 s per pass" while `host_agent.py` (in this same uncommitted change) scales the budget to 5 s × disk count — corrected in both plus the two illustrative "20 s of wedged disk" sentences; broken bold (`` `driveripper** ``) repaired; stale gap-4 title + "tuning is its own phase" wording updated to say phase 14 ran; README's absolute "nothing … is answered by a whole-table scan" qualified to *per call* with the cold-window cost named; "third opt-in marker" → second; conftest `--store-perf` help named the real marker; **`data/logs/watch-store-perf.py` moved to `scripts/watch-store-perf.py`** (both docs told a clone to run a gitignored path) with root-anchored paths, `DASH_WATCH_OUT`, and dead code removed.
- **New finding recorded:** gap 9's "~10 s process-wide stall is still gap 4's / `14_store_performance`'s problem" is now closed — coincident >8 s `llm` + >12 s `ups` raw-stream gaps went 393 (00:00–12:00) and 198 (12:00–21:36) to **0** across 110+ min of the phase-14 store; written into AGENTS.md gaps 4 and 9 and the notes table.
- **Deviations:** did *not* pull either deferred cost knob (`STATS_CACHE_TTL_SECONDS`, warming caches from the maintenance tick) — AGENTS.md records that decision and its reasoning; `uv pip list --outdated` still reports certifi/fastapi/starlette/websockets (pre-existing advisory, no dependency touched this phase, gate treats it as advisory). Overwrote nothing: task 04's watch preserved as `store-perf-watch.task04.*`, my two runs as `.verify25.*` / `.current-code.*`.
- **Next pending phase:** `15_agent_mtls`, then `16_agent_smart_pass_budget` (owns the scaled-budget tests + its doc criterion, now partly pre-satisfied by this pass), `17_installer_device_filter`.
2026-10-19 23:44:35 -04:00

85 lines
2.8 KiB
TOML

[project]
name = "dashboards"
version = "0.1.0"
description = "Homelab dashboards on one domain: system resources, LLM engines, and UPS battery health"
readme = "README.md"
# 3.14 is what the Containerfile, the venv, and the fleet agent's tests run on. The floor
# is deliberately hard: 3.13 would resolve a different lock and CI would test a stack nobody
# deploys.
requires-python = ">=3.14"
# Deliberately small. Everything we collect is either our own agent's JSON (stdlib only,
# see agent/host_agent.py) or an upstream Prometheus exposition parsed by our own parser
# (src/dashboards/prom.py). No prometheus_client, no Grafana, no CDN, no bundler.
dependencies = [
"fastapi>=0.143.3",
"httpx>=0.28.1",
"uvicorn[standard]>=0.54.0",
"pydantic>=2.14.1",
"python-dotenv>=1.2.4",
]
[dependency-groups]
dev = [
"pytest>=9.1.1",
"pytest-cov>=7.1.0",
"pytest-asyncio>=1.4.0",
"ruff>=0.17.1",
"pyright>=1.1.414",
"debugpy>=1.8.22",
]
# Installed editable by `uv sync` (src layout), so `uv run dashboards` and
# `uv run uvicorn dashboards.app:app` both work without PYTHONPATH gymnastics.
[build-system]
requires = ["hatchling>=1.27"]
build-backend = "hatchling.build"
[project.scripts]
dashboards = "dashboards.__main__:main"
[tool.hatch.build.targets.wheel]
packages = ["src/dashboards"]
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "-q --strict-markers"
markers = [
# `-m live --live` runs them; without --live they SKIP, so `uv run pytest` stays
# network-free. See tests/test_live_fleet.py for the env vars each one needs.
"live: needs real hardware (fleet hosts, LLM engines, or upsd) — opt in with --live",
# `-m store_perf --store-perf` runs them: the phase-14 timing measurements over the seeded
# production-shaped store (tests/store_perf.py). The seed itself runs in the default suite;
# only the multi-minute measurement passes are behind this flag. Underscored because Python
# decorators cannot carry a hyphen; the CLI flag stays `--store-perf`.
"store_perf: measures the seeded store's hot paths — opt in with --store-perf",
]
# auto: async tests run without a decorator on every single one
asyncio_mode = "auto"
filterwarnings = ["error::DeprecationWarning"]
[tool.coverage.run]
source = ["src/dashboards"]
omit = ["tests/*"]
[tool.coverage.report]
show_missing = true
skip_covered = false
[tool.ruff]
line-length = 110
target-version = "py314"
src = ["src", "tests", "agent"]
[tool.ruff.lint]
select = ["E", "F", "W", "I", "UP", "B", "C4", "SIM", "RUF", "BLE", "PLC"]
ignore = ["E501"]
[tool.ruff.lint.per-file-ignores]
# FastAPI's dependency injection is a call in a default argument; that is the API, not a bug.
"src/dashboards/api.py" = ["B008"]
[tool.pyright]
include = ["src", "tests"]
pythonVersion = "3.14"
typeCheckingMode = "standard"