Phase 29 completion pass is done. Final state:
**Verification (all re-run this pass, no task files touched)**
- `uv run pytest` → **1746 passed, 16 skipped**; `uv run pytest --cov` → **99.05 %** (gate 94 %); `bash .agents/validate.sh` → **rc=0** (ruff clean, pyright `0 errors, 0 warnings`, `node --check` clean); `uv run pytest -m live --live` → **12 passed**.
- Live, read-only: dev server **10/10 sources `ok`** (incl. `gateway`); `data/logs/29-task06-live.cjs` → **49 PASS / 0 FAIL** with per-port inbound counts reconciled against a direct `/proc/net/tcp{,6}` read (divergence 0); `data/logs/verify-29-task06-predates.py` → 0 failed (1.1.0 arm renders `WHY_PREDATES`, no pipes, every tally `n/a`, job still `ok`); phase-27 mobile audit re-run over all nine served pages → **371 PASS / 0 FAIL / 0 FINDING** (`data/logs/29-final-mobile-audit.out`).
- Criteria: (1) unconfigured `GATEWAY_HOST` → `404 {configured:false}` with dial spies + `#gate-empty` sentence ✅; (2) 1.1.0/`--no-proxy` → `supported:false`, no `0`s, never red ✅; (3) live gateway 1.2.0 → pipes animate, totals reconcile ✅; (4) no `severity`/verdict colour anywhere, validate green ✅; (5) docs updated + gap 13 logged ✅; (6) the five existing dashboards, jobs and `/api/summary` unchanged (live control leg) ✅.
**Docs (consistency pass, incl. pre-existing drift)**
- `README.md`: architecture diagram now lists `sources/gateway.py`, the 30 s gateway job and the third `/snapshot` reader; `GATEWAY_HOST` row says *a name, never a URL*; the `POLL_MS_*` row states `/gateway`'s fixed 15 s browser poll; "nine pollers" → per-source cadences; phase-28 "until phase 29" wording → current state; new Testing paragraph for `tests/test_gateway_source.py` (join pinned from the captures, reconciliation identity, `getaddrinfo` spy).
- `AGENTS.md`: phase-28 stop-point wording replaced with the shipped phase-29 state; suite/coverage figures → 1746 / 16 skipped / 99.08 %→99.05 % band and `~99 %`; window-chips paragraph records that `/gateway` has **no** chips (fixed 24 h); new testing-policy bullet for the join; stale page counts fixed (seven → eight tabbed pages / `MARKUP_PAGES`, clock-order and badge-count transcripts annotated); gap 12 now records the phase-29 nine-page audit re-run.
- `tests/test_api.py`: comment/docstring-only fixes for the "seven pages" wording that phase 29 made eight.
**Deviations / notes**
- Nothing implemented: all six task files were already in `complete/`, so this run was the final verification + docs pass; no git index or phase file was touched.
- Coverage wobbles 99.05–99.08 % between runs on a pre-existing timing-dependent line (`collectors.py` `/slots`-alias `except`/`break`), not a phase-29 path (`sources/gateway.py` is 100 %).
- `uv pip list --outdated` still lists upgrades; dependencies did not move in this phase, so they were left alone rather than upgraded mid-verification.
- Historical browser-transcript counts (phase 18/20/25 script runs) were left as recorded history and annotated instead of rewritten.
**Next phase:** none — `.agents/phases/todo/` is empty after 29; further work needs a new phase authored first.
4.5 KiB
Task 02 — The gateway job: poller, health, alerts, summary, config
Phase: 29_gateway_dashboard_page · Source: TODO.md:3 — the source is a job of its own (the disks:<host> precedent): its own interval, timeout, health record, and events, so a wedged config read ages the pipes instead of blinking /system
Story: n/a
Objective
The gateway source runs as its own poller job (the disks: shape — one job dials the same /snapshot the host: job of the gateway host reads, with the gateway's own interval/timeout), so the page ages on its own cadence and a failed poll keeps the last good pipes dimmed instead of zeroing them (invariant 4). The alerts rules keep an unconfigured source silent (invariant 3) and a dead source to exactly one line (the disks echo rule — the gateway job dials the same agent, so its failure carries no new information while the host: job is the voice; a gateway job failing while its host answers — the sections wedged — is the only voice that fault has). /api/summary gains the additive gateway block, /api/config gains the gateway row.
- ASSUMPTION: the job is
gateway(one job, thenutshape — a single source, not per-host: the page is about the one gateway host),DISKS-interval defaults from task 01 (30 s / 10 s), events under the dashboard namegateway. - ASSUMPTION: the no-verdict alert rule: the source's payload carries no
severity, soalerts.pygains no threshold forgateway— the only alerts agatewayjob raises are reachability (stale > 3× its 30 s interval →warn, stopped answering →fail, thedisks-echo suppression applied: a dead gateway job while itshost:job is also dead adds no line).
Work
src/dashboards/app.py—build_hub: thegatewayjob (one, not per host) wired thedisks:job is wired — the sameAgentTlsentry the gateway host'shost:/disks:jobs use (so a revocation fails all three with one sentence, the task-03agent_tls_mapshape), itsparsethesources.gateway.parse+samplespass-through, noRateEstimator(the source takes none — task 01). The job exists only whensettings.gateway_enabled(thedisksjob's configured gate: no job at all when the source is unconfigured, invariant 3).src/dashboards/alerts.py— thegatewayblock: the reachability rules per the assumption above; theHREFtable gains/gateway; no verdict rule (asserted: agatewaypayload with a fabricatedseveritydict still produces no verdict alert — the module may not have a threshold of its own, the phase-09 disk rule's shape).src/dashboards/api.py—/api/summary: the additivegatewayblock ({configured, supported, host, inbound: int (Σ connections), outbound: int, map_targets: int, unmatched: int, states: {gateway: str}}— a configured job with no payload yet is a stub, thesystem.hostsstub shape);/api/config: the gateway row (GATEWAY_HOST's name + theTarget.display_urlof the entry it names, redacted — invariant 6's boundary).tests/test_api.py— thebuild_hubwiring pins (the job present iffgateway_enabled; the sharedAgentTlsentry — a revocation written intometafails thegatewayjob before any dial, thetest_a_revoked_agent_fails_both_of_its_sources_without_a_dialshape extended to three sources); the/api/summarygatewayblock pin (with and without the source configured — unconfigured: the block isconfigured: falseand absent no dial happens, the spy-pinned shape); the alerts pins (unconfigured → nogatewayalert; dead job + dead host → one line, not two; a wedged-sections failure while the host answers → one line naminggateway).
Testing & Quality
- Unit: the wiring/alerts/summary pins above
- Coverage: >90% on the modified
app.py/alerts.py/api.pybranches
Completion Criteria
- a configured build carries exactly one
gatewayjob on the gateway host's shared TLS entry; an unconfigured build carries none (pinned) - a revocation in
metafails thegatewayjob before any dial (spy-pinned, thehost:/disks:pair's shape) /api/summary'sgatewayblock is pinned with and without configuration; the pre-existing blocks are unchanged- the alerts pins hold: unconfigured silent, dead-source one line, no verdict rule
uv run pytestgreen,uv run ruff check src testsanduv run pyrightclean- no behavior change in completed work: the pre-existing jobs, alerts, and summary blocks behave exactly as before