P6-03 repo size trend + agent-update UI fix + dashboard polish #21

Merged
steve merged 17 commits from tidy-up-last-backup-projection into main 2026-05-07 23:00:04 +01:00
Owner

Summary

  • P6-03 repo size trend graphs — sparkline on every dashboard host row + 30d/90d/1y chart on the host repo page (server-rendered SVG, zero client deps)
  • Update agent UI hang fixed — watcher now publishes a synthetic job.finished through JobHub so the browser job-detail page reloads when the agent reconnects post-update
  • Per-host Jobs sub-tab — lists last 100 jobs newest-first with click-through to /jobs/{id}; the unused Settings sub-tab stub is dropped
  • Latent bug fix: hosts.repo_size_bytes has been unwritten since the initial schema, so the dashboard's Repo size column always rendered "—". Now projected from UpsertHostRepoStats so the column updates atomically with host_repo_stats
  • Smoke env tooling: new make smoke-{restart,status,logs,stop,deploy} targets backed by a systemd --user unit, so the dev server outlives shell-tool boundaries (CLAUDE.md updated)
  • Chart polish from in-browser iteration: rotated y-axis titles ("Size" / "Snapshots"), wider viewBox, single-day fallback, dashboard header brightness/alignment consistency

Test plan

  • go test ./... green
  • go vet ./... clean
  • Smoke-verified: 50 days seeded → chart renders all 3 ranges, sparkline lights up dashboard row, Update agent → succeeded, Jobs tab lists past runs, repo size column shows the right number

Spec: `docs/superpowers/specs/2026-05-07-p6-03-repo-size-trend-design.md`
Plan: `docs/superpowers/plans/2026-05-07-p6-03-repo-size-trend.md`

## Summary - **P6-03** repo size trend graphs — sparkline on every dashboard host row + 30d/90d/1y chart on the host repo page (server-rendered SVG, zero client deps) - **Update agent UI hang** fixed — watcher now publishes a synthetic `job.finished` through JobHub so the browser job-detail page reloads when the agent reconnects post-update - **Per-host Jobs sub-tab** — lists last 100 jobs newest-first with click-through to `/jobs/{id}`; the unused Settings sub-tab stub is dropped - **Latent bug fix**: `hosts.repo_size_bytes` has been unwritten since the initial schema, so the dashboard's Repo size column always rendered "—". Now projected from `UpsertHostRepoStats` so the column updates atomically with `host_repo_stats` - **Smoke env tooling**: new `make smoke-{restart,status,logs,stop,deploy}` targets backed by a `systemd --user` unit, so the dev server outlives shell-tool boundaries (CLAUDE.md updated) - **Chart polish from in-browser iteration**: rotated y-axis titles ("Size" / "Snapshots"), wider viewBox, single-day fallback, dashboard header brightness/alignment consistency ## Test plan - [x] `go test ./...` green - [x] `go vet ./...` clean - [x] Smoke-verified: 50 days seeded → chart renders all 3 ranges, sparkline lights up dashboard row, Update agent → succeeded, Jobs tab lists past runs, repo size column shows the right number Spec: \`docs/superpowers/specs/2026-05-07-p6-03-repo-size-trend-design.md\` Plan: \`docs/superpowers/plans/2026-05-07-p6-03-repo-size-trend.md\`
steve added 17 commits 2026-05-07 22:56:59 +01:00
Adds /hosts/{id}/jobs page listing recent jobs for the host (newest
first, capped at 100) with click-through to /jobs/{id}. Converts the
Jobs placeholder <div> to a real <a> nav link; removes the Settings
stub entirely. Also registers durationHuman template func and a
.jobs-row CSS grid to match the existing .schd-row idiom.
- Add rotated 'Size' (left) and 'Snapshots' (right) axis titles in
  the chart's outer margins so the two y-axes are self-describing.
- Bump the chart viewBox from 600x220 to 640x220 and lift padL from
  56 to 72 so the rotated labels and byte tick numbers don't crowd.
- Dedupe the X-axis labels for short windows (1 or 2 days collapsed
  the start/mid/end indices onto each other, stacking 'May 7' three
  times); the 1-day case now centres a single label, 2-day uses
  start+end only.
- Pin a lone data dot to the chart centre instead of the left edge
  when len(days)==1, so it sits under the centred date label.

Goldens regenerated.
- Project total_size_bytes onto hosts.repo_size_bytes inside the
  UpsertHostRepoStats transaction. The hosts row column has been
  unwritten since the initial schema in 0001, so the dashboard's
  Repo size cell has always rendered '—' even after backups. Now
  the column updates atomically alongside the host_repo_stats row,
  and FleetSummary's SUM(repo_size_bytes) becomes accurate too.
- Right-align the Alerts column header so it sits over its
  right-aligned value (was floating left of column, ambiguous).
- Add text-ink-mid to the 30d trend / Alerts / Tags headers so all
  column headers share the same brightness.
smoke env: systemd --user unit + Make targets so the dev server outlives shell tool boundaries
CI / Test (rest) (pull_request) Successful in 46s
CI / Test (store) (pull_request) Successful in 1m34s
CI / Test (server-http) (pull_request) Successful in 1m46s
CI / Build (linux/amd64) (pull_request) Successful in 23s
CI / Build (windows/amd64) (pull_request) Successful in 41s
CI / Build (linux/arm64) (pull_request) Successful in 23s
CI / Lint (pull_request) Successful in 2m9s
1b9b23f205
Spent half an evening fighting a smoke server that kept getting SIGTERM'd
mid-iteration. Root cause: backgrounded processes spawned from sandboxed
shell tool calls don't outlive the parent — even with nohup + disown.

Fix: hand the server to user-systemd as a transient unit so its lifecycle
is owned by the user's session, not by whichever bash subprocess started it.
New Make targets:

  make smoke-restart   build server + (re)launch as systemd --user unit
  make smoke-status    show unit status
  make smoke-logs      tail $HOME/smoke/server.log
  make smoke-stop      stop the unit
  make smoke-deploy    full rebuild + restage agent assets + restart

Documents the workflow in CLAUDE.md so the next session doesn't relitigate.
steve merged commit 39dcda4e9e into main 2026-05-07 23:00:04 +01:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: steve/restic-manager#21