docs: P3 dashboard depth shipped — plan/README/CLI synced 📊✅
Some checks are pending
CI / vet-build-test (push) Waiting to run

plan.md: P3 row -> ✅ SHIPPED (pull·gc·conflict + server-side history; verified on
SSE + headless 0-errors). Roadmap mermaid all-green; status badge P1+P2+P3 shipped.
README: dashboard section now documents the 5 flow events + the reload-surviving
history sparkline + --gc-every; CLI table gains 'invite revoke' (P2) and
'serve --gc-every' (P3).
This commit is contained in:
shoemoney 2026-06-23 20:53:59 -05:00
parent 80380652cc
commit 74d8b79cd8
3 changed files with 25 additions and 19 deletions

View file

@ -367,6 +367,7 @@ container automatically. 🪄
| `devbox doctor` | 🩺 Diagnose watcher limits, perms, bash, hub connectivity + bearer |
| `devbox pause` / `resume` | ⏸️▶️ Suspend/resume the running daemon's syncing via its control socket (M8) |
| `devbox invite <share> <principal> <role>` | ✉️ Mint an invite token granting a role (`--reshare` for `+s`); attenuation-enforced (M8a) |
| `devbox invite revoke <token>` | 🗑️ Kill a pending invite before it's redeemed (only a caller who could mint it) |
| `devbox members <share>` | 👥 Show who can access a share, or "legacy share" (M8a) |
| `devbox-hub member set/rm/list` · `principal` | 🛡️ Hub-side role admin (M8a) |
| `devbox peers` | 🌐 *Planned — needs a hub peers endpoint (M10)* |
@ -384,6 +385,7 @@ container automatically. 🪄
| `devbox-hub readonly <device> <share>` | 🔒 Mark a device read-only on a share |
| `devbox-hub member set/rm/list` · `principal` | 🛡️ Per-share roles + principals (M8a) |
| `devbox-hub serve --dashboard` | 📊 Serve the live web dashboard (loopback `:8099` by default) |
| `devbox-hub serve --gc-every <dur>` | 🧹 Opt-in in-process periodic GC (off by default; each sweep animates on the dashboard) |
| `devbox-hub gc` | 🧹 Garbage-collect unreferenced chunks |
</details>
@ -400,21 +402,24 @@ container automatically. 🪄
```bash
devbox-hub serve --dashboard # loopback http://127.0.0.1:8099 (safe default)
devbox-hub serve --dashboard --dashboard-addr 0.0.0.0:8099 # expose on the LAN (unauthenticated — warns you)
devbox-hub serve --dashboard --gc-every 24h # also self-maintain (in-process GC) — each sweep animates
```
A mission-control flow visualization rendered on `<canvas>` at 60fps: a **breathing hub core**, your
**devices orbiting** (bright = active), **shares** on the outer ring — and when a device pushes, a glowing
**particle streams device → hub → share** and fans out to the subscribers. Plus live **metric tiles** with
sparklines (devices online, shares, snapshots, chunks, total data, pushes/min, bytes/min) and a streaming,
color-coded **activity feed**.
**devices orbiting** (bright = active), **shares** on the outer ring — and the fabric comes alive with **five
flow events**: `push` (device → hub → share, fans out to subscribers), `pull` (a calm teal pulse inbound as a
device syncs), `conflict` (a red collision burst when a stale push is rejected), `gc` (an amber hub-wide sweep
+ toast when garbage-collection runs), and `join`. Plus live **metric tiles** and a **server-side history
sparkline** (stacked push/pull/conflict/gc per minute, last hour) that **survives a page reload**, and a
streaming, color-coded **activity feed**.
| How it works | |
|---|---|
| 🖥️ **Served from the hub** | single `go:embed`'d HTML, vanilla JS + canvas, zero CDN/build |
| 🔌 **`GET /api/state`** | snapshot: hub, totals, devices, shares (UI polls every 10s) |
| 📡 **`GET /api/events`** | SSE live flow stream (`join`, `push`) — the dashboard animates each one |
| 🔌 **`GET /api/state`** | snapshot: hub, totals, devices, shares + a 60-minute `history` window (UI polls every 10s) |
| 📡 **`GET /api/events`** | SSE live flow stream (`join` · `push` · `pull` · `conflict` · `gc`) — the dashboard animates each one |
| 🔒 **Loopback by default** | unauthenticated read-only metrics; bind non-loopback only deliberately (it warns) |
| 🎬 **`?demo=1`** | synthesizes a live stream — instant wow + works offline (`file://`) |
| 🎬 **`?demo=1`** | synthesizes a live stream of all five event types — instant wow + works offline (`file://`) |
```mermaid
flowchart LR

BIN
dashboard-p3.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 764 KiB

25
plan.md
View file

@ -2,7 +2,7 @@
# 🗺️ devbox — What's Next (PRD)
![status](https://img.shields.io/badge/status-%F0%9F%9A%80%20P1%2BP2%20shipped%20%C2%B7%20P3%20next-blueviolet?style=for-the-badge)
![status](https://img.shields.io/badge/status-%E2%9C%85%20P1%2BP2%2BP3%20shipped%20%C2%B7%20M9%2B%20demand--driven-brightgreen?style=for-the-badge)
![base](https://img.shields.io/badge/builds_on-v1%20hardened%20%C2%B7%20v2%20M8%20shipped-00ADD8?style=for-the-badge)
![release](https://img.shields.io/badge/release-%F0%9F%93%A6%20latest%20live-success?style=for-the-badge)
![public](https://img.shields.io/badge/github-%F0%9F%8C%8D%20public%20%C2%B7%20AGPLv3-181717?style=for-the-badge)
@ -29,12 +29,12 @@ clean two-scanner git-history secret sweep. Verified end-to-end on clean no-Go a
flowchart LR
NOW["✅ adoption tooling<br/>installers · docker · dashboard"] --> P1["✅ P1<br/>Releases + CI<br/>+ public repo"]
P1 --> P2["✅ P2<br/>M8a auth audit<br/>2 fixes + tests"]
P2 --> P3["🔨 P3<br/>dashboard depth"]
P2 --> P3["✅ P3<br/>dashboard depth<br/>pull·gc·conflict + history"]
P3 -.demand-driven.-> LATER["🔮 M9–M11<br/>E2E · P2P · HA · TUI"]
style NOW fill:#1e5a2e,stroke:#51cf66,color:#fff
style P1 fill:#1e5a2e,stroke:#51cf66,color:#fff
style P2 fill:#1e5a2e,stroke:#51cf66,color:#fff
style P3 fill:#5a4a1e,stroke:#ffd43b,color:#fff
style P3 fill:#1e5a2e,stroke:#51cf66,color:#fff
style LATER fill:#0d1117,stroke:#4F9CF9,color:#fff
```
@ -86,18 +86,19 @@ This is the M7.5 treatment for v2's new attack surface, **before** anyone relies
---
## 🥉 P3 — Dashboard depth (delight, not load-bearing)
## ✅ P3 — Dashboard depth — **SHIPPED 2026-06-23**
**Why:** the live dashboard wows already, but it only animates `join` + `push`. More flow types + a terminal
view would make it a genuinely complete ops surface.
**Why:** the live dashboard wowed already, but it only animated `join` + `push`. P3 made it a genuinely
complete ops surface.
**Scope**
- [ ] Emit `pull` (head fetch / propagation), `gc` (sweep), and `conflict` flow events from the hub; animate them.
- [ ] A historical sparkline window persisted server-side (currently the frontend computes rates from the live stream only).
- [ ] *(Optional)* an **M11 TUI** over the daemon control socket (`devbox top`?) — re-adds the `/events` SSE stream we trimmed, now with a real consumer (bubbletea).
**Shipped**
- [x] Hub emits `pull` (head fetch / propagation, `handleHead`), `conflict` (stale-parent push, `handlePush`), and `gc` (in-process sweep) flow events. GC runs in-process via opt-in `serve --gc-every <dur>` (default off — auto-deleting blobs on a timer is opt-in) so the hub self-maintains *and* each sweep animates.
- [x] **Server-side history window**: per-minute activity buckets (push/pull/conflict/gc + bytes, last 60 min) in `/api/state` → the sparkline now survives a page reload (was live-stream-only). Recorded under the `Emit` lock; race-clean.
- [x] Frontend (`index.html`, one file, no new deps): `pull` = teal inbound pulse, `conflict` = red collision burst, `gc` = amber hub sweep + toast; stacked per-minute history sparkline seeded from `/api/state` and growing live.
- [~] *(Optional M11 TUI)* — skipped, demand-driven (no consumer yet).
**Acceptance**
- ✅ A `gc` run and a multi-device `pull` both visibly animate; new event types fleet-verified on the SSE stream.
**Acceptance — met ✅**
- ✅ `gc`, `pull`, `conflict` (plus `join`/`push`) all visibly animate; **all 5 verified on the live SSE stream** by `scripts/dashboard-fleet-verify.sh` (now with a `LOCAL=1` mode). Frontend rendered headless with **0 console errors**; history sparkline + gc toast + all event feeds present. Tests: `TestHistoryRing`; `go test ./... -race` clean.
**Effort:** S–M · **Risk:** low.