spec(prometheus-direct-charting): verify + close SC-125 + reconcile tracking

Add loading-state tests to the three Prometheus widget test files
(closes SC-125 PARTIAL). Write apply-progress.md, tick all 39 tasks,
add verify-report.md (26/27 PASS, 1 PARTIAL->PASS). All gates green:
293 pytest, ruff clean, npm build+lint 0 errors. No blocking findings.
This commit is contained in:
Developer
2026-07-08 22:50:30 +00:00
parent 67ca0fc3bc
commit 7440603cdb
6 changed files with 442 additions and 19 deletions
@@ -183,85 +183,85 @@ This ordering ensures the chart capability is proven against Prometheus before t
> **Spec-text drift note:** SC-118 literally names `ObservabilityPage.tsx`, which was refactored into `service-tabs/`. The *intent* (no Grafana UI surface) is verified by the removals below. `Dashboard.test.tsx` contains "Grafana" as a user-authored shortcut label (unrelated to the grafana service) — SC-116 grep should not flag it; it is left intact.
- [ ] **3.1 Delete backend Grafana integration module**
- [x] **3.1 Delete backend Grafana integration module**
- Files: `backend/src/media_library_viewer_api/integrations/grafana.py` (delete)
- Lines: ~20 (deletion)
- Dependencies: Slice 1 (chart kind already moved to prometheus)
- Details: Delete the file. It contains `GrafanaConfig` + `GrafanaLinkWidgetConfig`.
- [ ] **3.2 Remove Grafana from backend integration registry**
- [x] **3.2 Remove Grafana from backend integration registry**
- Files: `backend/src/media_library_viewer_api/integrations/registry.py` (modify)
- Lines: ~3
- Dependencies: 3.1
- Details: Drop `from ...grafana import DEFINITION as GRAFANA` and the `GRAFANA.service_type: GRAFANA` entry from `SERVICE_DEFINITIONS`.
- [ ] **3.3 Remove `GrafanaWidgetSource` + adapter registration**
- [x] **3.3 Remove `GrafanaWidgetSource` + adapter registration**
- Files: `backend/src/media_library_viewer_api/widgets/sources.py` (modify)
- Lines: ~100 (deletion of `GrafanaWidgetSource` class + `_fetch_chart`)
- Dependencies: Slice 1 (normalization logic already extracted to `prometheus_range.py`)
- Details: Delete the `GrafanaWidgetSource` class entirely (including `_fetch_chart` — its logic was extracted to `normalize_prometheus_matrix` in S1). Remove `"grafana": GrafanaWidgetSource()` from `SERVICE_ADAPTERS`.
- [ ] **3.4 Remove `get_grafana_status` endpoint**
- [x] **3.4 Remove `get_grafana_status` endpoint**
- Files: `backend/src/media_library_viewer_api/routers/monitoring.py` (modify)
- Lines: ~25
- Dependencies: none
- Details: Delete the `@router.get("/grafana-status")` endpoint and its helper. Leave `get_prometheus_status` / `get_alertmanager_status` intact.
- [ ] **3.5 Remove Grafana backend tests**
- [x] **3.5 Remove Grafana backend tests**
- Files: `backend/tests/test_widgets.py` (modify), `backend/tests/test_api.py` (modify), `backend/tests/test_services.py` (modify)
- Lines: ~40
- Dependencies: 3.3
- Details: Delete grafana adapter tests (`test_grafana_adapter_*`), grafana service fixtures, and the `TestGrafanaStatus` test class. SC-120.
- [ ] **3.6 Delete frontend `GrafanaLinkWidget` + barrel export**
- [x] **3.6 Delete frontend `GrafanaLinkWidget` + barrel export**
- Files: `frontend/src/widgets/GrafanaLinkWidget.tsx` (delete), `frontend/src/widgets/index.ts` (modify)
- Lines: ~35
- Dependencies: none
- Details: Delete the file. Remove the `GrafanaLinkWidget` export from `widgets/index.ts`.
- [ ] **3.7 Remove `grafana` binding from frontend registry**
- [x] **3.7 Remove `grafana` binding from frontend registry**
- Files: `frontend/src/integrations/registry.ts` (modify)
- Lines: ~30
- Dependencies: 3.6
- Details: Delete the entire `grafana` key from `SERVICE_REGISTRY`. Drop the `GrafanaLinkWidget` import. SC-117.
- [ ] **3.8 Remove Grafana nav entry**
- [x] **3.8 Remove Grafana nav entry**
- Files: `frontend/src/integrations/navEntries.ts` (modify)
- Lines: ~5
- Dependencies: none
- Details: Drop the `grafana` entry from `SERVICE_TYPE_NAV_ENTRIES` and any now-unused icon import (e.g. `Link2`).
- [ ] **3.9 Remove Grafana status hook + API client function + type**
- [x] **3.9 Remove Grafana status hook + API client function + type**
- Files: `frontend/src/hooks/useObservability.ts` (modify), `frontend/src/api/client.ts` (modify), `frontend/src/types/index.ts` (modify)
- Lines: ~15
- Dependencies: 3.4
- Details: Drop `useGrafanaStatus` + its `fetchGrafanaStatus` import from `useObservability.ts`. Drop `fetchGrafanaStatus` from `client.ts`. Drop `GrafanaStatus` interface from `types/index.ts`.
- [ ] **3.10 Delete Grafana service tab + remove from tab index**
- [x] **3.10 Delete Grafana service tab + remove from tab index**
- Files: `frontend/src/pages/service-tabs/LinksTab.tsx` (delete), `frontend/src/pages/service-tabs/__tests__/LinksTab.test.tsx` (delete), `frontend/src/pages/service-tabs/index.ts` (modify)
- Lines: ~80
- Dependencies: none
- Details: Delete `LinksTab.tsx` (grafana-specific per its docstring) and its test. Remove the `LinksTab` import and `case "grafana":` from `service-tabs/index.ts`.
- [ ] **3.11 Remove Grafana from Dashboard + ServicesPage**
- [x] **3.11 Remove Grafana from Dashboard + ServicesPage**
- Files: `frontend/src/pages/Dashboard.tsx` (modify), `frontend/src/pages/ServicesPage.tsx` (modify)
- Lines: ~5
- Dependencies: none
- Details: Drop `"grafana"` from `OBSERVABILITY_TYPES` set in `Dashboard.tsx`. Update `ServicesPage.tsx` empty-state copy: "Add a Grafana, Prometheus, …" → "Add a Prometheus, …".
- [ ] **3.12 Rewrite `openspec/config.yaml` thin-dashboard rule**
- [x] **3.12 Rewrite `openspec/config.yaml` thin-dashboard rule**
- Files: `openspec/config.yaml` (modify)
- Lines: ~8
- Dependencies: none
- Details: Remove "Do NOT re-implement charting in-app" and "No recharts/d3 is in use" claims. Replace with accurate wording: in-app charting via `recharts` is the sanctioned approach for Prometheus-backed series; Grafana is no longer referenced. SC-121.
- [ ] **3.13 Add CHANGELOG migration note**
- [x] **3.13 Add CHANGELOG migration note**
- Files: `CHANGELOG.md` (modify)
- Lines: ~8
- Dependencies: none
- Details: Add entry under an appropriate version heading: instruct operators to delete existing Grafana service instances and recreate them as Prometheus services; note that `grafana/chart` widgets must be recreated as `prometheus/chart` widgets. SC-122, SC-126.
- [ ] **3.14 Verify Slice 3 (grep-clean + build + lint + test)**
- [x] **3.14 Verify Slice 3 (grep-clean + build + lint + test)**
- Run: `grep -ri grafana backend/src --include='*.py'` → expect zero matches (SC-115)
- Run: `grep -ri grafana frontend/src` → expect zero matches except `Dashboard.test.tsx` shortcut fixture (SC-116)
- Run: `cd backend && PYTHONPATH=src pytest && cd ../frontend && npm run build && npm run lint`
@@ -273,23 +273,23 @@ This ordering ensures the chart capability is proven against Prometheus before t
## Integration and acceptance verification
- [ ] **4.1 Full backend test run**
- [x] **4.1 Full backend test run**
- Run: `cd backend && PYTHONPATH=src pytest`
- Verify: all tests pass; no grafana test references remain; prometheus range/gauge/mean tests pass.
- [ ] **4.2 Full frontend build + lint**
- [x] **4.2 Full frontend build + lint**
- Run: `cd frontend && npm run build && npm run lint`
- Verify: TypeScript compiles; no lint failures; no grafana imports unresolved.
- [ ] **4.3 Grep-clean verification**
- [x] **4.3 Grep-clean verification**
- Run: `grep -ri grafana backend/src --include='*.py'` → zero matches
- Run: `grep -ri grafana frontend/src` → zero matches excluding `Dashboard.test.tsx` shortcut fixture
- Verify: SC-115, SC-116 satisfied.
- [ ] **4.4 config.yaml accuracy check**
- [x] **4.4 config.yaml accuracy check**
- Verify: `openspec/config.yaml` does not contain "Do NOT re-implement charting" or "No recharts/d3"; reflects recharts as sanctioned renderer (SC-121).
- [ ] **4.5 CHANGELOG check**
- [x] **4.5 CHANGELOG check**
- Verify: `CHANGELOG.md` documents the grafana→prometheus migration (SC-122).
---