Skip to content

Phase 3b: live dashboard#7

Merged
StrangeNoob merged 14 commits into
mainfrom
phase3b-dashboard
Jun 8, 2026
Merged

Phase 3b: live dashboard#7
StrangeNoob merged 14 commits into
mainfrom
phase3b-dashboard

Conversation

@StrangeNoob

Copy link
Copy Markdown
Owner

Summary

Second Phase 3 sub-project: a live, embedded dark-editorial dashboard for Relay — per-queue depth + throughput over SSE, a dead-letter table with one-click requeue, and an enqueue form. Built with Vite + React + TypeScript, served as a single Go binary. The atomic claim is untouched, ack.lua/nack.lua remain single atomic scripts (one added INCR each), and the Go module gains no new dependency (the dashboard is a separate web/ npm workspace).

Backend

  • Cluster-wide countersack.lua INCRs q:{name}:processed, nack.lua INCRs q:{name}:dead (dead branch only). Both stay one atomic script. New broker.Counters(ctx, queue) reads them (missing key → 0).
  • SSEGET /api/stream (internal/api/stream.go) pushes a JSON snapshot of every queue's depth + cumulative counters immediately, then every ~1s; stops on client disconnect; a Redis hiccup skips a tick rather than dropping the stream.

Frontend (web/)

  • Vite + React + TS, dark-editorial look (Fraunces + IBM Plex, terracotta accent), Layout A (sidebar + main): live stat tiles, hand-rolled SVG sparkline depth + throughput charts (throughput derived client-side from the processed_total counter stream), a DLQ table with per-row Requeue, and an enqueue form.
  • EventSource stream hook; pure logic (format/series/snapshot) unit-tested with Vitest.
  • Built to a committed web/dist, embedded by web/embed.go (web.Handler() with SPA fallback), served at / by cmd/server (the more-specific /api/, /metrics, /healthz keep priority).

CI & docs

  • New web CI job: npm ci → typecheck → vitest → build → verify committed dist is in sync. Go job unchanged (builds against the committed dist).
  • CLAUDE.md updated to Phase 3b complete (new data-model keys, /api/stream, Counters, web/ layout, known limitations).

Design & plan

  • Spec: docs/superpowers/specs/2026-06-08-relay-phase3b-dashboard-design.md
  • Plan: docs/superpowers/plans/2026-06-08-relay-phase3b-dashboard.md

Test plan

  • go build ./..., go vet ./..., gofmt -l internal/ cmd/ web/ clean
  • go test -race ./... — broker (DB 15), worker (DB 14), metrics (DB 13), api (DB 12), web (no Redis), job all pass against a real Redis
  • Backend tests: processed-on-ack, dead-on-dead-only (retry does not increment), Counters reads/zeroes, SSE emits a well-formed snapshot and stops on disconnect; web.Handler serves index + SPA fallback
  • Frontend: tsc --noEmit, vitest (format/series/snapshot), vite build, and git diff --exit-code -- dist all clean
  • cmd/server smoke-tested: / 200 html, SPA fallback, /healthz, /api/queues, /api/stream

nack.lua now INCRs q:{name}:dead (KEYS[4]) atomically on the dead branch
only; retries leave the counter untouched. broker.go adds deadKey() helper
and passes the fourth key to nackScript.Run. Two new tests (TDD RED→GREEN)
cover both branches.
Wire the React UI to the existing data layer: theme.css with Fraunces/IBM
Plex typography and CSS custom properties; Sparkline, Sidebar, StatTiles,
Charts, DlqTable, EnqueueForm components; App.tsx tying useStream, rolling
60-sample windows, DLQ polling, and the enqueue modal together. Rebuilds
web/dist with the full font+CSS+JS bundle.
Mark web/ built in the layout and build-order tables, document the
Counters API, SSE stream endpoint, processed/dead Redis counters,
dashboard limitations (rolling window, per-connection SSE, committed
dist), and Node/Vite build toolchain. Add a 'web' CI job that runs
typecheck, vitest, Vite build, and verifies the committed dist is in
sync with the source.
@StrangeNoob

Copy link
Copy Markdown
Owner Author

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

🤖 Generated with Claude Code

- If this code review was useful, please react with 👍. Otherwise, react with 👎.

@StrangeNoob StrangeNoob merged commit 3df3632 into main Jun 8, 2026
3 checks passed
@StrangeNoob StrangeNoob deleted the phase3b-dashboard branch June 8, 2026 20:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant