Skip to content

Add mass dashboard, a live terminal view of the organization - #272

Open
coryodaniel wants to merge 36 commits into
mainfrom
dashboard
Open

coryodaniel wants to merge 36 commits into
mainfrom
dashboard

Conversation

@coryodaniel

@coryodaniel coryodaniel commented Nov 27, 2026 •

Copy link
Copy Markdown
Member

mass dashboard (aliases dash, constellation) opens a full-screen, live view of the organization, built on the runtime and application queries and the instance alarm, deployment, upgrade, and dependency fields in the v2 API.

Focus

An organization can have hundreds of projects, so the dashboard reads one neighborhood, not everything. It centers on the environment --env names, or else the environment of the most recent deployment. It reads that environment and its neighbors, out to --depth hops (default 1), ring by ring with environments(filter: {id: {in: ...}}).

  • Neighbors are the producers its instances depend on, the consumers that reference its resources or default to them (resources { remoteReferences, environmentDefaults }), and the environment it was forked from.
  • Environments past the edge show as not loaded. Ids asked for and not returned show as no access.
  • A selection made with a key that rests for 700ms, or enter, becomes the focus, and nodes glide from their old places to their new ones. A search being typed, or a selection that --watch makes, does not move the focus.
  • / matches what is in view first, then falls back to a directory of environment ids and names, read once, to move the focus anywhere in the organization.
  • Every other read follows the view: the stash feed, annotations, refreshes, the Alarms and Upgrades tabs, the instance counts on Runtimes, and --watch, which sees alarms only in view. Runtime and application lists stay org-wide.

Tabs

  • Constellation: every environment you can view, linked by the resources it uses and the environment it was forked from. Sparks run from producer to consumer. Rings show instance status; firing alarms pulse, running deployments sweep around the ring, and ↑N marks available upgrades. Selecting an environment shows its instances, alarms, deployments, neighbors, and blast radius, which lights up downstream environments by hop. Toggles: blast radius, instance dots, cost sizing, grouping by project, producers on top. / searches.
  • Runtimes: version adoption per runtime, instances and applications marked Latest or Behind, and a what-if for a patch, minor, or major release.
  • Alarms: every firing alarm in the environments in view, with how far its blast radius reaches.
  • Upgrades: every instance in view with a newer bundle version its constraint allows.

Live

  • A ticker polls the audit log (--events, default 5s). New events flash their environment, and deployment events re-read the organization. Polling the audit log works with API keys; the org-level subscription carries no deployment events and per-environment subscriptions require a personal access token.
  • t replays a window of the audit log, 5 minutes to 24 hours, onto the map at a speed that finishes in under a minute.
  • o opens the selection in the web app.
  • --refresh (default 30s) re-reads the organization.

Stash, widgets, and annotations

The dashboard follows the stash as a feed, through the SDK's Stash service. It reads every project, environment, component, and instance scope in view once, in batches of up to 200, four at a time. Then it streams each key as it is set or deleted, one subscription for each environment in view, moved as the view moves. Each refresh reads the whole stash again to catch what a dropped stream missed, and a read that races a streamed event keeps the event.

  • A profile without a personal access token cannot stream, and a view of more than 20 environments does not try. Both poll every --stash interval (default 3s). A dropped stream resubscribes at once, then backs off up to a minute, and polls meanwhile.
  • Each set or deleted key goes on the ticker, replacing that key's earlier line, and flashes its environment.
  • Widgets come from the md/ keys the way the Massdriver UI draws them: the versioned well-known keys md/v1/health, md/v1/usage, md/v1/traffic (rate, errors, p95 latency, and stale after 10 minutes), md/v1/banner, and md/v1/links. The unversioned md/health keys no longer draw widgets. The thresholds match the UI: usage turns amber at 80% and red at 95%, a few errors are amber, and ten or more are red.
  • Pinned widget annotations bind any stash key, with a path into JSON values and numbers read from text. A pinned widget replaces the automatic one on the same surface.
  • Note annotations render their Liquid templates with the same project, environment, component, instance, source, and destination stash bindings as the UI. Markdown is reduced to text, and images are dropped. Notes show on the environment, the project, the instances, and the links in the side panel.
  • A service account has no annotations, and ? says why notes are missing.
  • Stash text is stripped of control characters, and only http and https links are clickable.

Incidents

--watch takes the view to each alarm that starts firing between reads. It locks on to the environment and shows the blast radius under a banner that counts up. It rings the terminal and sends an OSC 9 desktop notification. esc puts the banner away. When the alarm clears, the banner shows how long it lasted, and the view goes back to the tab and selection it had, unless someone moved it. Alarm, deployment, and stash events in the audit log trigger a re-read, so the view reacts within one event poll.

When stdout is not a terminal, the command prints environments, firing alarms, and runtimes as tables.

Themes and palettes

--theme picks how the map is drawn, and v switches between themes:

  • constellation: a force layout with braille rings and curved links.
  • metro: stations on a band per project, producers to the left, with links drawn as box-drawing track and sparks running along it.
  • radar: the focus at the center of a sweeping scope, each environment on the ring as many hops out as it is, and blips that light as the sweep passes.

--palette picks the colors and backdrop: night (starfield), rain (falling streams), or blueprint (drafting grid). Red, orange, and yellow keep their meaning in every palette.

A banner from the stash runs across the top of the map: the selected environment's, or else the most urgent banner in view.

Layout

cmd/dashboard.go is wiring only. Logic lives in internal/commands/dashboard, which reads through a narrow API interface over the SDK's GraphQL transport, audit log, and stash services. Before merging, go.mod moves from the massdriver-sdk-go#59 pseudo-version to its release.

🤖 Generated with Claude Code

Shows environments as a constellation linked by the resources they share,
with firing alarms, blast radius, deployments in flight, available upgrades,
and spend. Runtimes, Alarms, and Upgrades tabs cover runtime adoption, what
is firing, and what can upgrade. A ticker follows the audit log and lights
up where things happen, and a replay plays a chosen window of it back onto
the map. Piped output prints the same data as tables.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 12s —— View job


Review of mass dashboard (#272)

I read cmd/dashboard.go, api.go, dashboard.go, model.go, ticker.go and the start of replay.go. I skimmed the rest. go test ./internal/commands/dashboard/ passes. golangci-lint isn't installed in this runner, so I didn't run lint or make check.

Layering and structure

  • The layering follows CLAUDE.md. cmd/dashboard.go is wiring only, logic is in internal/commands/dashboard behind a narrow API interface, and there are no test files in cmd/.
  • The SDK owns auth and config: the profile comes from newMassdriverClient, and nothing resolves credentials locally.
  • I didn't check that every cmd/ flag and helpdoc change is reflected in docs/generated. CI will catch that if make docs was missed.

Issues, most important first

  1. Event poll reads one page of 50 (api.go, Events; model.go, applyEvents).

    • Events fetches a single page. applyEvents then advances since to the newest event time.
    • If more than 50 events land between polls, the extras are never shown. This is most likely with a short --events interval or a busy org.
    • Either page until Next == "" or until a seen ID turns up, or document the cap.
    • This also assumes ListPage returns newest-first. History relies on the same assumption when it truncates "keeping the newest". Please confirm that ordering is guaranteed, or pass an explicit sort.
  2. Replay silently truncates (api.go, History).

    • historyLimit = 1000 drops the oldest events on a 24h window with no sign in the UI. The replay looks complete but starts partway through the window.
    • Surfacing "showing newest 1000 of N+" in the replay ticker would help.
  3. A stale historyMsg can be applied to a later replay (replay.go).

    • applyHistory only checks m.replay.loading.
    • If you press t to cancel during loading, then t and enter again, the first request's result can arrive and be taken as the second's. The windows may differ.
    • A request ID on historyMsg, compared on apply, fixes it. The same applies to snapshotMsg and eventsMsg if you ever allow concurrent requests.
  4. Unbounded seen map (model.go).

    • seen map[string]bool grows for the life of the session while events is capped at 40.
    • It is small, but on a long-running dashboard you could prune IDs older than since - eventBacklog.
  5. Fetch is heavy and has no partial-failure path (api.go, Fetch).

    • It drains environments, runtimes and applications one after another.
    • Each environment page nests instances, alarms, dependencies and cost.
    • On a large org, one error in any later page discards everything, and the next refresh re-reads it all.
    • Consider running the three drains concurrently with errgroup, and keeping the previous snapshot on error. The model already does the latter.
    • Alarms only read the first page per instance (AlarmsPage). Instances with many alarms can under-report firing alarms. Worth a comment, or a limit argument on the query.
  6. Fetch and the polling commands use context.Background().

    • fetch, fetchEvents and startReplay ignore the ctx passed to Run.
    • Quitting the program won't cancel in-flight requests. Exit is quick in practice, but threading the context through Config would be cleaner.
  7. OpenBrowser (dashboard.go).

    • cmd.Start() is never followed by Wait() or Release(), so xdg-open and open leave zombie processes until the program exits.
    • Use go cmd.Wait() or cmd.Process.Release().
  8. Environment ID inferred from the audit subject (ToEvent).

    • Building EnvID as parts[2] + "-" + parts[3] from an MRI string is fragile if the ID format ever changes.
    • The unit test covers the current shape. Consider noting this next to the code, since it's a non-obvious coupling.

CLAUDE.md comment rule

  • The rule is "default to none, and no doc comments on unexported helpers". Several unexported items carry narrating doc comments:
    • ticker in ticker.go
    • applyEvents in model.go
    • startSpeed, toggleReplay and replay in replay.go
    • bar in detail.go
    • settle in layout.go
    • several in graph.go and canvas.go
  • Comments that explain why are fine (maxPages, the replaySteps note). The ones that restate what the code does should go.

Tests

  • Coverage looks good and is table-driven, with one _test.go per source file. views.go and theme.go have no test file, which is acceptable if they are render-only.
  • It would be worth adding a regression test for the stale-history case (item 3) and the event-burst case (item 1).

Minor

  • go.mod: x/ansi moved from indirect to direct. This is correct, and go mod tidy should be a no-op.
  • The non-TTY summary prints three tables with no section headers, only blank lines between them. A one-line header per table would make piped output easier to read.

Items 1 and 3 are worth fixing before merge. The rest are follow-ups or polish.
· branch dashboard

A burst of events between polls no longer loses all but the newest 50,
and a replay says when its window held more than it can play. A replay
cancelled while loading can no longer take the answer meant for the one
that replaced it. Firing counts use the instance's count rather than the
first page of alarms, reads stop when the dashboard closes, and the three
reads run at once.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Thanks. Fixed in 05eaf7a:

  1. Event poll paging. Events now pages until the last page, up to 500 events per poll. The audit log's default order is newest first (auditlogs.ListInput documents DESC as the default), and both Events and History page back from the newest.
  2. Silent replay truncation. History returns a Log with Truncated, and the replay ticker shows "newest N only" when the window held more than 1,000 events.
  3. Stale historyMsg. Each replay read carries a request number, and applyHistory ignores answers to cancelled reads. Added a regression test. Snapshot and event reads never overlap, because loading guards the first and polls are chained.
  4. Unbounded seen. Reads start at since inclusive, so only events at since can come back. seen now drops IDs older than since after each read.
  5. Fetch. The three reads run concurrently with errgroup. The model already keeps the previous snapshot on error. Firing counts now use firingAlarmCount rather than the length of the first page of alarms.
  6. Context. Run's context reaches every read through Config.Context.
  7. OpenBrowser. It now waits on the process in a goroutine.
  8. MRI coupling. No change. ToEvent's doc comment already states the subject format and how the environment ID comes out of it, and TestToEvent pins it.

Comments. I removed the doc comments on unexported helpers that only restated the code. The ones left explain why: maxPages, readAudit's ordering assumption, historyMsg's request number, applyEvents's re-read, nearest's scoring, and stats' drop order.

Not changed:

  • Section headers on piped output. Each table already has its own column headers, and plain tables stay easy to grep and awk.
  • Event-burst regression test. Item 1 is covered by TestReadAudit, which reads a 320-event burst and checks truncation of a 1,200-event window.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 23s —— View job


Re-review of mass dashboard (#272) at 05eaf7a

I read the diff of 05eaf7a (api.go, model.go, replay.go, dashboard.go, go.mod). go build ./..., go vet and go test ./internal/commands/dashboard/ pass. golangci-lint isn't available in this runner, so I didn't run make check or make docs. CI will cover those.

Items 1–7 from the first review are resolved. Nothing blocks merge.

Checked and fine

  • Event paging (readAudit).
    • The loop stops at the limit or when Next is empty. Truncated is len > limit || Next != "", which is correct. The reverse to oldest-first happens after trimming, so the newest events are the ones kept.
    • An empty page with a non-empty Next also stops the loop, so it can't spin.
  • Stale replay reads. Each replay read carries a request number, and applyHistory checks it along with loading. Both cancelling during a load and restarting are handled.
  • seen pruning. Deleting IDs with at < since is safe because reads start at since inclusive. Events stamped exactly since stay in the map, so they aren't re-flashed.
  • Fetch with errgroup. Each goroutine writes a different Snapshot field, so there is no race. The first error cancels the other two reads and the error is wrapped with which read failed.
  • firingAlarmCount. The field exists in the SDK schema (schema.graphql:8772, Int!).
  • OpenBrowser. go cmd.Wait() removes the zombie process.
  • go.mod. x/sync moved from indirect to direct, which is correct.

Remaining nits

  1. Alarm counts can disagree with the Alarms list (graph.go:201).
    • in.Firing = max(len(firing), inst.FiringAlarmCount) fixes the counts and rings. node.Firing and g.Firing, which feed the Alarms tab and the detail panel, still hold only the first page of alarms.
    • An instance with more alarms than one page shows, for example, "7 firing" with fewer rows listed. That is acceptable, but it's worth a short comment or a "+N more" row so it doesn't look like a bug.
  2. Poll truncation is silent (api.go, Events).
    • Events discards Log.Truncated. A burst over 500 events between polls drops the oldest events, and since advances past them. The ticker and flashes never show that anything was missed. Unlike the replay, this has no indicator.
    • It's rare and the cap is documented in a comment, so it's fine to leave. A toast would be the cheap fix.
  3. Late-arriving audit events.
    • since advances to the newest event time, and seen entries older than since are dropped. An event with an older timestamp that is ingested late would never be read. This only matters if the audit log can lag, and it's the same tradeoff as before, so I'm only noting it.
  4. Event-burst test coverage. TestReadAudit covers the burst and truncation at the API layer. applyEvents pruning seen has no direct test. A small case in model_test.go would pin the "event at since isn't re-flashed" behavior.

Your two "not changed" decisions are reasonable. The ToEvent doc comment plus TestToEvent covers the MRI coupling, and unheadered tables are easier to pipe.

Summary: the fixes are correct and the tests pass. The nits above can be follow-ups.
· branch dashboard

The footer says when more events arrived between polls than one poll
reads, and the side panel counts firing alarms beyond the first page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

coryodaniel commented Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Thanks. Fixed in aaae7dc and 7e41571:

  1. Alarm counts vs. listed rows. The side panel heading now uses the instance count, and it adds "+N more on the instances' alarm pages" when the first page lists fewer. Covered by TestEnvDetailMoreAlarms.
  2. Silent poll truncation. Events returns the Log, and the footer says "more than N events since the last check; showing the newest" when a poll was cut short.
  3. Late-arriving events. You're right that this can happen. EventStream.record stamps the CloudEvent before the insert commits, so a slower transaction can land behind events already read. Each poll now re-reads the last 30 seconds before since, and seen keeps IDs for that window so the overlap doesn't repeat them.
  4. seen pruning test. TestModelEvents now polls three times. It checks that an event read again shows once, that a late event stamped before the previous read still shows, and that a cut-short read shows its notice.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 54s —— View job


Re-review of mass dashboard (#272) at aaae7dc

I read the diff of aaae7dc (api.go, detail.go, model.go, views.go and their tests). go test ./internal/commands/dashboard/ and go vet pass. I didn't run make check or make docs, and golangci-lint isn't available in this runner. CI covers those.

Nothing blocks merge.

Checked and fine

  • Alarm count in the side panel (detail.go).
    • The heading now uses env.FiringCount(), the sum of per-instance Firing, which is max(len(firing), FiringAlarmCount). It matches the rings and counts elsewhere.
    • The "+N more" line only shows when the total exceeds the listed rows, so it won't appear in the normal case.
  • Poll truncation (api.go, model.go).
    • Events now returns the Log.
    • applyEvents shows the notice only when !msg.initial, so the first read doesn't warn.
    • len(msg.log.Events) is the cap when truncated, because readAudit trims to the limit, so the "more than N" text is accurate.
  • Toast prefix move (views.go). The ↗ now lives in the message strings, and the opened-URL toast was updated to match. The truncation toast carries no arrow, which is reasonable.
  • Late-arriving events. Your explanation holds if occurredAt is written in the same transaction as the change. Leaving since as is and keeping seen as the dedupe is consistent.

Nits, none blocking

  1. defer in writeFiring (detail.go:107).
    • The deferred closure only runs after the loop. A plain statement after the loop does the same, and the loop has no early returns.
    • It reads more simply without defer.
  2. Truncation notice can be overwritten. It shares the one toast slot with the "opened" toast, so a keypress like o right after a poll replaces it. It also expires after toastFrames. This is acceptable for a rare condition.
  3. Alarms tab still lists only listed rows. The side panel now says when rows are missing, but the Alarms tab, which is fed by g.Firing, doesn't. If its heading shows the total, it will have the same mismatch. It's worth checking, and a one-line note would fix it.

Summary: the changes do what the comment says and the tests pass. The nits can be follow-ups.
· branch dashboard

coryodaniel and others added 2 commits November 27, 2026 02:36
An event is stamped before the transaction that writes it commits, so it
can land behind events a poll has already read.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Thanks. The review covered aaae7dc. 7e41571 had already changed item 3 of my earlier reply. EventStream.record stamps the event before the insert commits, so occurredAt can trail events already read. Each poll now re-reads the last 30 seconds, and seen keeps IDs for that window. I edited my earlier comment to match.

Fixed in the latest push:

  1. defer in writeFiring. It's now a plain call after the loop, through a shared moreAlarms helper.
  2. Alarms tab. The heading counts every firing alarm, and the tab ends with the same "+N more" line when the first pages list fewer. It shows the calm state only when the count is zero. The test covers both the side panel and the tab.

Not changed:
2. Shared toast slot. A keypress can replace the truncation notice. The condition is rare, the notice is informational, and the ticker already shows the events that did arrive.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 58s —— View job


Re-review of mass dashboard (#272) at 9db59de

I read the diffs of 7e41571 and 9db59de (model.go, detail.go, views.go, detail_test.go). go test ./internal/commands/dashboard/ and go vet pass. I didn't run make check or make docs, and I didn't confirm that golangci-lint is available here. CI covers those.

Nothing blocks merge.

Checked and fine

  • 30-second overlap (model.go).
    • fetchEvents reads from since - eventOverlap. seen is pruned at the same boundary, so an event the overlap returns again is already in seen and doesn't flash twice.
    • An event older than since that lands late still shows. The window is inclusive at both ends, so nothing drops between the read and the prune.
    • The truncation toast counts the overlap events against the 500 cap. A quiet org re-reads about 30 seconds per poll, which is cheap.
  • writeFiring / moreAlarms (detail.go).
    • The defer is gone. moreAlarms returns an empty string when nothing is missing, so the normal case is unchanged.
  • Alarms tab (views.go).
    • The total is the sum of FiringCount(), which matches the side panel and the rings. The calm state shows only when the total is zero.
    • If the first pages list no alarms but the count is above zero, the heading and "+N more" line still show. That is correct.
    • The new test covers the tab with FiringAlarmCount = 3 and checks the heading and the "+2 more" line.
  • Shared toast slot. Leaving it as is seems reasonable for a rare, informational notice.

Nits, none blocking

  1. Piped output undercounts (dashboard.go:108-113).
    • The non-TTY environments table reports env.FiringCount(), but the "Firing" table lists only g.Firing. With many alarms on one instance, the two disagree and nothing says why.
    • The fix is a short trailing line, reusing the same total minus listed rows. This is the same fix as for the Alarms tab.
  2. Count loop duplicated. alarmsBody sums FiringCount() over g.Envs inline. If nit 1 is taken up, a small Graph method for the total would serve both places.

Summary: the changes do what the commit messages say and the tests pass. The nits can be follow-ups.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Thanks. Both nits are fixed in the latest push:

  1. Piped output. The summary's alarm table now ends with "+N more on the instances' alarm pages" when the first pages list fewer than the count. Covered by TestRunSummaryMoreAlarms.
  2. Duplicated count loop. Graph.FiringCount() sums the environments, and both the Alarms tab and the summary use it.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 40s —— View job


Re-review of mass dashboard (#272) at 584ff70

I read the diff of 584ff70 (dashboard.go, graph.go, views.go, dashboard_test.go). go test ./internal/commands/dashboard/ and go vet pass. I didn't run make check or make docs. CI covers those.

Nothing blocks merge.

Checked and fine

  • Graph.FiringCount() (graph.go). It sums EnvNode.FiringCount() over g.Envs. The Alarms tab, the summary and the side panel now count the same way. The inline loop in alarmsBody is gone.
  • Piped output (dashboard.go).
    • writeAlarms computes the total from the graph, not from len(g.Firing). If the first pages list no alarms but FiringAlarmCount is above zero, the table and the "+N more" line still print.
    • The trailing line is plain text with no ANSI styling, which suits piped output.
  • TestRunSummaryMoreAlarms. Setting FiringAlarmCount = 3 on an instance that lists one alarm gives "+2 more", and the test checks that line.

Nit, not blocking

  • Duplicated wording. The "+N more on the instances' alarm pages" text is in moreAlarms (detail.go:117, styled) and again as a literal in writeAlarms. Moving the plain string into a shared helper that the styled version wraps would keep the two from drifting. It's two lines, so it's fine to leave.

Summary: the changes do what the commit message says and the tests pass.
· branch dashboard

@coryodaniel

Copy link
Copy Markdown
Member Author

Thanks. Leaving the duplicated wording: one copy is styled for the panel and the other is plain for pipes, and a shared helper for two lines of text would add more than it saves.

Widgets set through md/ stash keys show where they belong: health colors an
instance, usage draws a bar, traffic paces the sparks on the links an
instance sends on and labels them, a banner flags an environment, and
header links appear in the side panel. A server without widgets leaves
them out.

With --watch, an alarm that starts firing takes the view to its
environment, locks on, shows its blast radius under a banner, and rings
the terminal with a desktop notification. When it clears the view goes
back where it was, unless someone moved it. A running plan no longer
counts as a deploy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Added stash widgets and --watch incident mode in 636b42b (see the updated description). @claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 30s —— View job


Review of mass dashboard (#272) at 636b42b

I read the stash widgets (widgets.go) and the --watch incident mode (incident.go). I also read the Fetch and key-handling changes. go build, go vet and go test ./internal/commands/dashboard/ pass. I didn't run make check or make docs, and golangci-lint isn't available here.

Item 1 is worth fixing before merge. Items 2 and 3 are real bugs in --watch.

Bugs

  1. Widgets are always read with a cancelled context (api.go, Fetch).

    • group, ctx := errgroup.WithContext(ctx) shadows ctx. The derived context is cancelled when group.Wait() returns.
    • fetchWidgets(ctx, ...) runs after Wait, so against a real server every widget request fails with context canceled. fetchWidgets swallows the error and returns nil, so the dashboard silently shows no widgets.
    • The tests pass because the fake API ignores ctx.
    • Fix: keep the outer context for the widget read, for example group, gctx := errgroup.WithContext(ctx) and use gctx only inside the Go closures.
    • Add a test whose fake Widgets returns ctx.Err().
  2. The "unless someone moved it" restore doesn't work during the resolved banner (model.go:341, incident.go:118).

    • touched is only set when len(m.watch.open) > 0.
    • Once the alarm clears, open is empty. Moving the selection or tab during the 60-frame "resolved after…" window doesn't set touched, so settleWatch jumps the view back to the saved state.
    • Fix: set touched whenever m.watch.back != nil, or whenever open is non-empty or resolved is non-nil.
  3. A new incident during the resolved window overwrites the saved view (incident.go:93).

    • openIncidents saves w.back whenever len(w.open) == 0. That is also true while the previous incident's resolved banner is showing.
    • The saved view then becomes the locked-on incident view, and the original tab and selection are lost.
    • Fix: only set back and reset touched when w.back == nil. settleWatch already clears the whole state.

Security

  1. Unsanitised stash content reaches the terminal (detail.go:247, theme.go:117).
    • hyperlink writes the stash-provided URL straight into an OSC 8 sequence, and the label is not sanitised either.
    • Stash values can be written by anyone with write access to an instance. An ESC or BEL in the URL ends the sequence early, and the rest is interpreted by the terminal.
    • Banner messages, labels and alarm names are rendered the same way.
    • Run oscSafe-style control-character stripping on the URL, label and banner text. Also only link http:// and https:// URLs, so file: and custom schemes aren't clickable.
    • oscSafe already exists for the notification, and the notification path is handled correctly.

Smaller points

  1. Widget reads are sequential and all-or-nothing (widgets.go:144).

    • One batch per project, read one after another. This adds latency to every refresh, and it runs after the three parallel reads.
    • A failure in any batch returns nil, which discards the batches that already succeeded.
    • Run the batches concurrently (bounded), and keep the ones that succeed.
    • Errors from a server that has the widget API but fails are also indistinguishable from "no widget API". A footer note would help.
  2. Incident detection sees only the first page of alarms (incident.go:56).

    • It diffs Graph.Firing, which is first-page only, as noted in earlier rounds.
    • An alarm that moves on or off the first page can open a false incident or a false resolve.
    • Alarms beyond the first page can never open one.
    • This is worth a comment, or a diff keyed on counts per instance.
  3. Notification write races with rendering (dashboard.go).

    • TerminalNotifier writes \a and the OSC 9 sequence to opts.Out from a tea.Cmd goroutine, while Bubble Tea is rendering to the same file.
    • A frame write can interleave with it. Writes are usually atomic at this size, but it isn't guaranteed.
    • tea.Printf or tea.Raw (if available in the pinned bubbletea) goes through the renderer.

Checked and fine

  • widgetScopes batches per project at 200 scopes, as the description says.
  • Values.UnmarshalJSON handles both the object and the encoded-string form.
  • oscSafe on the notification, and the guard on before == nil so the first read opens no incident.

Summary: the widget context bug (1) and the two state bugs in --watch (2, 3) should be fixed before merge, along with the injection hardening (4). The rest can be follow-ups.
· branch dashboard

Widget reads ran on a context the parallel reads had already cancelled,
so no widget ever showed against a real server. Widget batches now run
four at a time and keep the ones that succeed.

Text from the platform has its control characters stripped before it
reaches the terminal, and only http and https links are clickable.

--watch now opens an incident only when an instance's firing count rises,
and resolves one only when the list shows every alarm of its instance, so
an alarm moving on or off the first page opens or closes nothing. The view
goes back to where it was before the first incident, and a move during the
resolved banner keeps it where it was moved.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

coryodaniel commented Nov 27, 2026 •

Copy link
Copy Markdown
Member Author

Thanks, these were real. Fixed in eb5a4b9:

  1. Cancelled widget context. Confirmed. The group's context is now groupCtx, used only inside the three reads, and widgets read with the caller's context. The fake Widgets returns ctx.Err(), so TestWidgetsOnTheGraph fails without the fix.
  2. Move during the resolved banner. touched is now set whenever a saved view exists (watch.back != nil), which covers the resolved window. Covered by TestIncidentKeepsAMoveWhileResolved.
  3. New incident during the resolved window. The view is saved only when none is saved, and settleWatch clears it. Covered by TestIncidentDuringResolvedKeepsTheFirstView.
  4. Terminal injection. Text from the platform has C0 and C1 control characters stripped when it enters the graph or the ticker: stash widget strings, environment and project names, alarm names and messages, and audit log details and actors. Only http and https header links are kept, and hyperlink refuses anything else. Covered by TestWidgetsCannotEscapeTheTerminal.
  5. Widget reads. Batches now run four at a time, and a failed batch leaves out only its own project. Covered by TestWidgetsKeepTheReadsThatWork. I didn't add a footer note: before the widget API ships, every org would see it on every refresh.
  6. First-page diff. Detection is now count-based. An incident opens only when an instance's firing count rises. If nothing new is listed, it opens as "N alarms firing" on the instance. An alarm missing from the list resolves only when the list shows every firing alarm of its instance, or the count reaches zero. Covered by TestIncidentPastTheFirstPage and TestIncidentLeavingThePageStaysOpen.

Not changed:
7. Notification write vs. renderer. bubbletea v1.3.10 has no raw-output command (tea.Printf and tea.Println are dropped in the alt screen). The notifier writes its sequence in one call, and the renderer writes each frame in one call. In practice the notification lands between frames, though a terminal isn't required to keep two writes whole. A stray bell sequence inside a frame would cost one garbled frame, which the next one repaints.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 27s —— View job


Re-review of mass dashboard (#272) at eb5a4b9

I read the diff of eb5a4b9 (api.go, widgets.go, incident.go, model.go, theme.go, graph.go, dashboard.go). go build, go vet and go test ./internal/commands/dashboard/ pass. I didn't run make check or make docs, and I didn't confirm that golangci-lint is available here. CI covers those.

Nothing blocks merge. Items 1–6 from my last review are resolved, and I agree with leaving item 7 as is.

Checked and fine

  • Widget context (api.go). Fetch reads widgets with the caller's ctx. groupCtx is used only inside the three Go closures, and the fake Widgets returns ctx.Err(), so the test would catch a regression.
  • Resolved-banner restore (model.go:341, incident.go:148).
    • touched is now set whenever watch.back != nil.
    • openIncidents saves the view only when back == nil, and settleWatch clears the whole watchState.
    • A move during the resolved window is kept. A new incident in that window keeps the first saved view.
  • Widget batches (widgets.go).
    • Each goroutine writes only results[i], so there is no race. The loop variables are per-iteration under go 1.26.
    • A failed batch leaves out only its own project. Dropping the footer note is reasonable for a server without the widget API.
  • Count-based detection (incident.go).
    • An incident opens only when an instance's firing count rises. An unlisted rise opens as "N alarms firing".
    • stillFiring resolves an incident only when the instance's count is zero, or when the list shows every alarm of the instance and the incident's alarm isn't among them.
    • An alarm moving off the first page therefore closes nothing.
  • Notification write. Your reasoning holds. bubbletea v1.3.10 has no raw-output command, and a single write under 300 bytes is practical.
  • Hyperlinks. hyperlink refuses non-web URLs and strips control characters from the URL.

Nits, none blocking

  1. Some platform text still bypasses clean.
    • graph.go:244-246 copies bundle name and version and runtime name and version straight into InstNode.
    • The runtime and application names in rollout.go also look uncleaned.
    • These aren't stash values. Publishers and admins write them, so the risk is lower. But the stated rule is that text from the platform is cleaned on entry, and these reach the screen and the piped tables.
    • Cleaning them where they enter the graph or snapshot would make the rule uniform.
  2. webURL is case-sensitive. HTTPS://example.com is dropped. This is safe and only drops a valid link. strings.EqualFold on the prefix, or url.Parse and a scheme check, would accept it.
  3. Repeated unlisted incidents. An Unlisted incident is named "%d alarms firing". If the count rises again on the same instance, a second incident opens under a different name. Both resolve when the count reaches zero. The banner will show "+1 more" for what is one instance. Consider reusing the open unlisted incident for the instance.
  4. clean and C1 range. clean strips 0x7f–0x9f, which covers the 8-bit CSI/OSC introducers. It leaves Unicode bidi overrides (U+202A–U+202E, U+2066–U+2069) in place. These can make a label or URL display differently from its text. This is cosmetic spoofing and could be stripped too.

Summary: the fixes do what the commit message says and the tests pass. The nits can be follow-ups.
· branch dashboard

…dents

Bundle names and versions are publisher text, so they lose control
characters too, and so does a bidirectional override in any platform text.
A second rise on an instance whose alarms are past the first page updates
its open incident instead of opening another.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Thanks. All four are fixed in the latest push:

  1. Bundle and runtime text. Fetch cleans bundle names and versions, runtime and application IDs, and adoption versions before anything reads them, so the graph, the Runtimes tab and the piped tables see the same cleaned text.
  2. webURL case. The scheme check is case-insensitive.
  3. Repeated unlisted incidents. A second rise on an instance with an open unlisted incident renames that incident to the new count, and doesn't notify again. Covered in TestIncidentPastTheFirstPage.
  4. Bidi overrides. clean also strips U+202A–U+202E and U+2066–U+2069. Covered in TestWidgetsCannotEscapeTheTerminal.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 6s —— View job


Re-review of mass dashboard (#272) at a888892

I read the diff of a888892 (api.go, incident.go, widgets.go and their tests). go build and go test ./internal/commands/dashboard/ pass; I ran go vet as well. I didn't run make check or make docs. CI covers those.

Nothing blocks merge. All four nits from the last review are resolved.

Checked and fine

  • webURL. The prefix check is case-insensitive and still allows only http and https. The test links HTTPS://LOUD.example.com, and it is kept.
  • clean. It now strips U+202A–U+202E and U+2066–U+2069 in addition to the C0 and C1 controls. The test checks that Loudevil comes out as Loudevil.
  • foldUnlisted. A second rise on an instance with an open unlisted incident renames that incident, and openIncidents returns early without re-locking or notifying. TestIncidentPastTheFirstPage checks the "6 alarms firing" banner, that there is no "+1 more", and that only one notification was sent.
  • cleanSnapshot. It runs after the widget read, so it doesn't change the IDs used for scopes. Runtime IDs, application IDs and bundle names are all cleaned, so the joins between them still match.

Nits, none blocking

  1. No direct test for cleanSnapshot. TestWidgetsCannotEscapeTheTerminal covers stash text. Nothing puts a control character in a bundle name, version or runtime ID and checks that Fetch strips it. One table case would stop a future new field from slipping past, and it would pin the claim in your reply.
  2. foldUnlisted mutates w.open in place. It writes into the shared backing array. This is harmless today because the model holds the only reference. A short comment would stop someone copying the slice later and being surprised.
  3. Other invisible characters. clean leaves U+200E, U+200F and U+061C (directional marks) and U+2028/U+2029 (line and paragraph separators) in place. The directional marks are much weaker than overrides, so this is cosmetic. Stripping them would make the set complete.

Summary: the changes do what the commit message says and the tests pass. The nits can be follow-ups.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Thanks. All three are fixed in the latest push:

  1. cleanSnapshot test. TestFetchCleansPublisherText puts control characters, an override and a directional mark into runtime, adoption, application, deployed-version, bundle and runtime-name fields. It checks that each comes out cleaned and that the rollout still joins instances and applications to the runtime.
  2. foldUnlisted mutation. openIncidents clones w.open before folding, so the rename touches only the model's own copy.
  3. Other invisible characters. clean also strips U+200E, U+200F, U+061C, U+2028 and U+2029. Covered in TestWidgetsCannotEscapeTheTerminal.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 44s —— View job


Re-review of mass dashboard (#272) at 09e2d3c

I read the diff of 09e2d3c (api_test.go, incident.go, widgets.go, widgets_test.go). go test ./internal/commands/dashboard/ and go vet pass. I didn't run make check or make docs, and I didn't check that golangci-lint is installed here. CI covers those.

Nothing blocks merge. All three nits from the last review are resolved.

Checked and fine

  • TestFetchCleansPublisherText.
    • It covers every field cleanSnapshot touches: runtime ID, adoption version, application ID, application runtime name, deployed version, bundle name, and instance runtime name.
    • The closing BuildRollout assertion confirms the cleaned runtime and application names still join, which is the part most likely to break silently.
    • The test sets each input to a distinct control, override, or directional mark.
  • foldUnlisted mutation. slices.Clone(w.open) runs before folding, so the rename no longer writes into a shared backing array. The comment now says the rename happens "in open".
  • clean. It now also strips U+200E, U+200F, U+061C, U+2028 and U+2029. Combined with the earlier ranges, the list covers C0, C1, bidi overrides and isolates, directional marks, and line and paragraph separators.

Nit, not blocking

  • Zero-width and tag characters. clean still passes U+200B–U+200D, U+2060, U+FEFF and the U+E0000 tag block. They are invisible but can't open or close an escape sequence, so this is cosmetic, for example making two bundle names look identical. Stripping them is a one-line change to the case if you want the set to be complete.

Summary: the changes do what the commit message says and the tests pass.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 26s —— View job


Re-review of mass dashboard (#272) at e2436f3

I read the diff of e2436f3 (model.go, themes.go, views.go, their tests, and the docs). I didn't run make check, make docs or the tests in this pass, so CI has to cover those.

Nothing blocks merge.

Checked and fine

  • Key handling. p is handled only in handleConstellationKey. Search typing goes through handleSearchKey first, so p in a query doesn't switch palettes. On Runtimes, p is still the patch what-if, so there is no clash.
  • Cycling. Palettes() returns the default first and the rest sorted, which gives night → blueprint → rain → night. TestPaletteKey expects exactly that, and it restores the default in t.Cleanup.
  • paletteName. UsePalette sets it only after the lookup succeeds, so a failed switch can't leave the name out of step with the colors.
  • Docs. The helpdoc and docs/generated/mass_dashboard.md changed together.

Nits, none blocking

  1. Palette state is process-global, not in Model.
    • UsePalette rewrites package-level colors and styles from Update. The tests avoid a leak with t.Cleanup, and none of them use t.Parallel.
    • v stores its choice in m.cfg.Theme, but p stores it in a global, so the two behave differently. It works for one program per process. A short comment on why palettes are global would help the next reader.
  2. Ignored error. _ = UsePalette(NextPalette(paletteName)) can't fail today, because NextPalette only returns names from Palettes(). A reader can't tell that at a glance. A short comment would say so.
  3. Footer width. The constellation footer now ends with v <theme> p <palette>, which makes it longer. At 80 columns the new p hint is among the first to be cut. That only drops the hint. ? still lists it.
  4. Legend height. The new KEYS section adds four rows to a legend that was already clipped on 24-row terminals, as discussed earlier. It also repeats keys that the footer shows. On a short terminal, BADGES and now KEYS are cut off. You decided to leave this before, so I'm only noting that the new section makes it somewhat worse.
  5. Test coverage. TestPaletteKey checks the palette name only. It doesn't check that a redraw changes colors or the backdrop. TestPalettesDraw covers drawing for each palette, so this is fine.

Summary: the change does what the commit message says and is consistent with the earlier work. The nits can be follow-ups.
· branch dashboard

@coryodaniel

Copy link
Copy Markdown
Member Author

No changes for e2436f3:

  1. The colors were package-level styles before this change. p only switches which set is in use. Moving them into Model would mean passing a palette to every render function, which doesn't pay for itself while there's one program per process.
  2. NextPalette returns only names from Palettes(), which the cycle test covers. I'd rather not add a comment that restates that.
  3. The KEYS section in ? was added for this: the footer is cut off even at 160 columns.
  4. That fits with 3. The legend is already cut off at 24 rows, and I'm keeping that trade-off.
  5. Agreed, TestPalettesDraw covers the drawing.

Navigating the constellation jumped: the layout recentred at once, before
the new read arrived, then reshuffled from scratch when it did. Each layout
now starts from the last one and eases there from where the nodes are on
screen, redrawing at 60fps while anything moves.

A read the focus moved past is cancelled, and only the latest read keeps a
refresh timer, so stepping around no longer stacks up refresh loops.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 2m 0s —— View job


Re-review of mass dashboard (#272) at 5f2e881

I read the diff of 5f2e881 (model.go, layout.go, canvas.go, graph.go, diagrams.go, scene.go and their tests). go build, go vet and go test ./internal/commands/dashboard/ pass. I didn't run make check or make docs, so CI has to cover those. No command, flag or helpdoc text changed, so make docs should be a no-op.

Nothing blocks merge.

Checked and fine

  • Read sequencing.
    • fetch cancels the read in flight and bumps fetchSeq. applySnapshot drops any answer, failed or not, whose seq isn't current.
    • A cancelled read therefore can't revert the focus, and the newest read clears loading.
    • refreshSeq is bumped only when a read lands, so one refresh timer survives and stale ones return early.
    • applyEvents still guards its fetch with !m.loading, so a deployment event doesn't cancel a focus read.
  • Layout rewrite.
    • The slice-based repel, attract and cluster give the same forces as the map-based ones. I checked the algebra: for example dx/d*(d*d/k) equals dx*(d/k).
    • seeded returns nil when the seed lacks the center, so settle starts afresh.
    • Shape() covers what labelHalfWidths and the links use, so a refresh that changes none of it doesn't relayout.
  • Motion.
    • progress takes the larger of the frame-based and clock-based value, so motion is never slower than before.
    • moving is cleared when nothing animates, so the 16ms tick stops.
  • Canvas.
    • Escape codes are cut around a private-use marker, so the output matches style.Render for the styles in TestCanvasStyles.
    • Scene.Render returns a string before release, so nothing aliases the pooled canvas.
    • dotEscapes is keyed by color value, so switching palettes with p stays correct.
  • TestANewFocusCancelsTheReadBefore. It checks both that the old read is cancelled and that the new focus survives it.

Nits, none blocking

  1. The map still recenters before the read arrives.
    • refocus sets m.focus, and layoutKey includes focus. Update therefore relays out the old graph around the new center at once, and then again when the snapshot lands.
    • The commit message says this recentring used to jump. It now glides, but it still happens twice. Keying the layout on shownFocus would defer it to the real data.
    • If the read fails, m.focus reverts and the map glides back. That is the same cost, but it may be what you want.
  2. A window resize starts a glide.
    • A size change alters layoutKey, so withLayout sets pan.from to the on-screen positions in the old dot space.
    • Each resize event during a drag starts a 14-frame glide from stale coordinates to the new ones. Skipping the pan when only w or h changed would avoid it.
  3. Layout depends on history.
    • The Layout doc comment says the same graph and options always give the same layout. With Seed, the result also depends on the previous layout.
    • Toggling grouping on and off may not return to the original positions. The comment on Layout could say "given the same seed".
  4. The first read isn't cancellable. Init passes func() {} as done and has no cancel func, so a focus change before the first answer drops that read but doesn't stop it. It is rare and bounded.
  5. Comments (CLAUDE.md). borrowCanvas, release, motionTick, animating and tickMotion are unexported helpers. tickMotion, animating and Style carry comments that restate the function. The ones that say why (canvases, escapes, seeded, motionInterval) are fine.

Summary: the sequencing and cancellation changes are sound and tested, and the layout and canvas rewrites keep the previous behavior. The nits can be follow-ups.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in ac9b6f8:

  • 2: a resize now snaps to the new layout and ends any glide in progress. It doesn't glide from positions in the old scale.
  • 3: the Layout doc says the seed is part of what makes a layout repeatable.
  • 5: I removed the comment on tickMotion. Style is exported, so it keeps its doc comment.

No change:

  • 1: the recentring before the read arrives is deliberate. The map moves the moment the selection settles, rather than after a network round trip, and starts from where the nodes are on screen. When the read lands, the new neighbours grow out of the focus and the map adjusts from there. That second glide is small because the layout is seeded.
  • 4: Init can't store a cancel func on the model. The first read is dropped by seq once a focus change supersedes it, and Fetch is bounded by the program context.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 19s —— View job


Re-review of mass dashboard (#272) at ac9b6f8

I read the diff of ac9b6f8 (model.go, layout.go) and the surrounding withLayout, progress and animating. I didn't run the tests, make check or make docs, so CI has to cover those. No command, flag or helpdoc text changed, so make docs should be a no-op.

Nothing blocks merge.

Checked and fine

  • Resize snap (withLayout).
    • A change in w or h resets pan to the zero motion. progress returns 1 when on is false, and animating follows it, so a glide in progress ends and the 16ms tick stops.
    • When the size is unchanged and a position exists, the glide starts from animatedPos() as before.
    • The first layout has a zero layoutKey, so it takes the snap branch. That is the same result as the old m.pos != nil guard.
  • Mixed changes. A resize that lands together with a focus or theme change also snaps. That is right, because the old positions are in the old scale.
  • Layout doc. Now says "seed included". That settles the point I raised last round.
  • tickMotion comment. Removed, as CLAUDE.md asks. Style keeps its doc comment because it is exported.
  • Your two "no change" replies.
    • Recentring before the read arrives is a fair choice for a responsive map, and the seeded layout keeps the second adjustment small.
    • Init can't hold a cancel func, and seq drops the superseded read, so the leftover cost is bounded.

Nits, none blocking

  1. No test for the snap.
    • The change has no test. A case that glides after a focus change, sends a tea.WindowSizeMsg, and then checks animating() is false and pan.on is false would pin it.
    • model_test.go already drives WindowSizeMsg, so it is a short case in the existing file.
  2. unfold is not reset on resize.
    • If a resize lands while the intro unfold is running, only pan is cleared. I didn't trace where unfold reads positions, so check it doesn't depend on the old scale.
    • If it only grows nodes out of the focus, it is fine.
  3. Comment wording.
    • The new comment in withLayout explains why, which fits the rule.
    • "sweep every node across the screen" is a little loose but clear enough.

Summary: the change does what the commit message says, and the animation state stays consistent after a resize. The nits can be follow-ups.
· branch dashboard

@coryodaniel

Copy link
Copy Markdown
Member Author

No changes for ac9b6f8:

  1. pan and animating are unexported, and the tests are in dashboard_test. From outside, 'nothing moves after a resize' can't be told apart from twinkling stars and pulsing rings, which change every frame. A test that switches the file to the internal package for one case costs more than it pins down.
  2. unfold scales the current Pos from the canvas center each frame (Scene.unfold). It doesn't hold positions from before the resize, so the new scale is right.

The dashboard read every stash in view every few seconds whether anything
changed or not. It now reads them once and streams each key as it is set,
one subscription per environment in view, and polls only when it cannot
stream. Well-known keys move to their versioned names.

The SDK is pinned to massdriver-sdk-go#59 until it is released.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 2m 5s —— View job


Re-review of mass dashboard (#272) at d5a142b

I read the diff of d5a142b (stash streaming: feed.go, stash.go, model.go, api.go, widgets.go, annotations.go, cmd/dashboard.go, tests). I also read the pinned SDK's stash package. go build, go vet and go test ./internal/commands/dashboard/ pass. I didn't run make check or make docs, so CI has to cover those. The flag help and docs/generated/mass_dashboard.md changed together.

One thing blocks merge, and it is outside the code.

Before merge

  1. go.mod pins an unreleased SDK pseudo-version.
    • It points at v0.6.1-0.20261127213446-d5730d9509ae, from massdriver-sdk-go#59.
    • Release the SDK and bump to the tag before merging. Otherwise main depends on a commit that may be rebased or garbage-collected.

Checked and fine

  • Scope-kind casing.
    • You now drop the old scopeOf normalisation on ingest, and Stash.Get still lowercases on lookup.
    • The SDK lowercases kinds on ListForScopes, on stream events and on widgets (lowerScopeKind), so keys match. This works only because of that SDK behaviour.
  • Stale subscription messages.
    • gen is compared in current() before anything is applied.
    • subscribe cancels the old context and syncSubscriptions cancels subscriptions for environments that left the view.
  • Read racing a stream event.
    • KeepTouched carries forward any key an event touched after the read started, and touched is pruned after one minute.
    • A deleted key stays deleted, and delete on a nil map is safe.
  • Fallback to polling.
    • ErrRequiresPAT sets cannot, cancels every subscription and clears the map. live() is then false, so pollStash reads again.
    • With --stash 0, nothing polls and the stash is read with each refresh.
  • Reconnect.
    • The first failure resubscribes at once, and later ones back off up to 1m. A reconnect after a failure triggers a full re-read to catch what the stream missed.
  • Stash.Apply. It clones each touched scope map, so the old model's map isn't mutated.

Issues, none blocking

  1. A refresh read can be skipped while a stash read is in flight (feed.go, fetchStash).
    • fetchStash returns early when m.feed.reading is set, and applySnapshot doesn't retry.
    • After a refocus, environments that just entered the view get no initial stash read until the next refresh.
    • Streams only carry changes, so once their subscriptions connect, live() is true and polling stops. Those environments then show no widgets or notes for up to --refresh.
    • Remember a pending read and run it when applyStash clears reading.
  2. One stream per environment in view has no cap.
    • --depth 2 or 3 on a well-connected org can mean dozens of long-lived subscriptions started at once, each re-created on every focus change.
    • Consider a cap, or fall back to polling above a threshold.
  3. A non-PAT error from one subscription retries forever.
    • msg.err != nil goes through retry, which backs off to 1m. An environment you can't subscribe to (a permissions error) is retried each minute for the session.
    • Each retry is followed by a full stash read (failures > 0). Consider treating a permanent refusal like ErrRequiresPAT for that environment.
  4. takeStash runs ApplyStash for every event batch.
    • It re-renders all notes and widgets, though renderNote is cached by bindings. A busy stream means a full graph redraw per batch of up to 64 events. It's bounded and probably fine, but it's the first place to look if a busy org feels slow.
  5. The PR description is out of date.
    • It still names md/health, md/usage, md/traffic, md/banner and md/links, and says the feed polls every --stash interval. The keys are now the versioned md/v1/... names from the SDK constants.
    • Stashes that still use the old unversioned keys and annotation templates that reference them (the tests changed to md/v1/health) will stop rendering. Say so in the description, and in the helpdoc if it lists the keys.
  6. Comments (CLAUDE.md).
    • applyStash, takeStash, syncSubscriptions, receive, applyStashClosed, live and Stash.Apply are unexported, or in Apply's case a method on an exported type, and several only restate the name.
    • The ones that explain why (touchedFor, the failures > 0 re-read, feed's shared maps) are fine.

Summary: the streaming design is sound and well covered by the tests, and nothing in the code blocks merge. Release the SDK and replace the pseudo-version first. Item 1 is the most likely to show up in use. The rest can be follow-ups.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in 2b525ab:

  • 1: a stash read asked for while another is in flight is remembered and runs when the first lands, so environments new to the view get their first read. live() is also false while any environment in view has no stream.
  • 2: a view of more than 20 environments doesn't stream; it polls.
  • 5: the PR description now covers streaming, the versioned md/v1/ keys, and that unversioned keys no longer draw widgets. The helpdoc already lists the md/v1/ keys.
  • 6: I removed the comments that restated applyStash, takeStash, syncSubscriptions and applyStashClosed. receive's comment now says why it drains.

No change:

  • 3: the full re-read runs only after a subscribe succeeds, in applySubscribed, not after each failed attempt. An environment that keeps refusing costs one subscribe a minute, which I'll keep.
  • 4: agreed, it's the first place to look. Note rendering is cached by bindings, so a batch of events costs one widget pass.
  • Blocker: go.mod moves to the SDK release before merge, as the description says.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 33s —— View job


Re-review of mass dashboard (#272) at 2b525ab

I read the diff of 2b525ab (feed.go, model.go) and the surrounding fetchStash, pollStash, applyStash, takeStash, syncSubscriptions and live. I didn't run the tests, make check or make docs, so CI has to cover those. No command, flag or helpdoc text changed, so make docs should be a no-op.

Nothing blocks the code. The only open merge item is the go.mod pseudo-version, which you've said you'll move to the SDK release.

Checked and fine

  • Pending read.
    • fetchStash sets pending when a read is in flight, and applyStash clears reading and pending before it starts the next read. The chain can't double up.
    • The queued read takes m.snap.Environments when it starts, so it covers the environments that are in view then.
    • The model returns early when m.graph == nil but still returns again, so the queued read isn't lost.
    • The read is merged against m.stash when it lands, so ordering with the read that just finished is fine.
  • live().
    • It is false until a snapshot exists.
    • It is also false while any environment with a project has no subscription entry. That is the same set syncSubscriptions uses for want, so the two agree.
    • While a subscription is still connecting, its stream is nil and live() is false, so polling covers the gap.
  • Stream cap.
    • Above maxStreams, want is cleared. The existing loop then cancels every subscription, so subs ends up empty and live() is false. A wide view polls every --stash interval, as the description says.
    • Exactly 20 environments still streams.
  • applyStash signature. model.go returns m.applyStash(msg) directly, and the again command reaches the runtime.
  • Comments. The ones that restated applyStash, takeStash, syncSubscriptions and applyStashClosed are gone. The rewritten one on receive says why it drains, and the ones on pending and maxStreams say why.

Nits, none blocking

  1. No tests for the two new behaviours.
    • The commit has no test changes.
    • A case where a second fetchStash during a read sets pending, and applyStash then returns a non-nil command, would pin the first fix.
    • A case with 21 environments, checking that syncSubscriptions starts no streams and live() is false, would pin the cap.
    • feed_test.go is the place for both.
  2. The queued read reports every key of a new environment as a change.
    • It runs with initial = false, so Changes compares against a m.stash that has nothing for environments that just entered the view.
    • That puts each of their keys on the ticker as stash.set and flashes the environment. A refocus onto a stash-heavy neighborhood can flood the ticker.
    • I read the refresh path (fetchStash(!m.stashOn)), and it behaves the same way after the first read. So this isn't new in this commit. The queued read makes it more likely, because it exists to give new environments their first read.
    • A cheap fix is to skip changes for scopes that have no earlier entries in m.stash.
  3. An older read can replace entries it didn't cover.
    • A read that started before an environment entered the view replaces m.stash with a map that lacks that environment's scopes. KeepTouched covers only keys touched by stream events in the last minute.
    • The queued read repairs this when it lands, so the gap is brief. It only matters if entries for that environment were already in m.stash, for example one that left the view and came back.

Summary: the queued read and the stream cap do what the commit message says, and the polling fallback stays consistent. Nit 1 is the most useful follow-up, and nit 2 is the one to watch in use.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in 8bd7cb6:

  • 1: tests now cover the stream cap (TestWideViewsPollInsteadOfStreaming). Test 2 below also covers the read a refocus queues. I couldn't trigger an in-flight read from the external test package, so pending has no direct test.
  • 2: a read now reports changes only in scopes an earlier read covered. An environment that enters the view shows its stash without flooding the ticker (TestStashFirstReadOfANewEnvironmentIsNotNews). Streamed events always count.
  • Also moved the SDK pin to the current head of massdriver-sdk-go#59.

No change:

  • 3: the queued read fixes it as soon as it lands, as you say. Merging only the scopes each read covered would keep entries for environments that left the view.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 26s —— View job


Re-review of mass dashboard (#272) at 8bd7cb6

I read the diff of 8bd7cb6 (feed.go, stash.go, feed_test.go, go.mod) and the surrounding applyStash, takeStash and Stash.Keep. I didn't run the tests, make check or make docs, so CI has to cover those. No command, flag or helpdoc text changed, so make docs should be a no-op.

Nothing blocks the code. The one merge item left is the go.mod pseudo-version. It now points at the head of massdriver-sdk-go#59 and moves to the release before merge, as you said.

Checked and fine

  • Stream cap test. TestWideViewsPollInsteadOfStreaming builds a hub with 21 consumers, so the view holds 22 environments. It checks that nothing is subscribed. That pins the maxStreams fallback.
  • First read of a new environment.
    • known records the scopes each read covered. applyStash clones it before updating, so the closure judges against what earlier reads covered.
    • The very first read passes a nil news, so it reports nothing.
    • Streamed events pass func(Scope) bool { return true }, so they always count.
    • TestStashFirstReadOfANewEnvironmentIsNotNews refocuses onto sandbox-demo and checks that the banner shows and "stash set" doesn't.
  • Leaving pending untested. I agree that the external test package can't reach it. The refocus test covers the read it queues.

Issues, none blocking

  1. Failed batches are marked known (feed.go, applyStash; stash.go, ReadStash).
    • Scopes holds every scope the read asked for, failed or not. The struct comment says so. applyStash marks all of them known.
    • Take an environment that enters the view while its batch fails. Its scope is known but has no entries, because Keep has nothing to carry forward.
    • The next successful read then reports every key in that scope as stash.set. That is the ticker flood this commit is meant to prevent.
    • The fix is small: mark only the scopes not in msg.read.Failed.
    • A test could fail one project's batch on the first read after a refocus, then succeed, and check that the ticker stays quiet.
  2. known never shrinks.
    • A scope that leaves the view loses its entries, because the next read doesn't cover it and Keep only carries forward failed scopes. It stays in known.
    • When the user refocuses back, its first read counts as news and floods the ticker. This is the case your "No change" reply on item 3 leaves open.
    • Replace known with the scopes of the latest read, and add the failed scopes the read carried forward. A scope that left the view then counts as new again on return.
  3. known is mutated in place on the shared map. applyStash writes into m.feed.known after cloning for the closure. Model is copied by value, so older copies see the write. Nothing reads an older copy today. Building a fresh map and assigning it, which the fix for item 2 does anyway, removes the question.

Nits
4. Comments (CLAUDE.md). The takeStash doc comment restates the signature, so it can go. The one on known explains why and stays.
5. Test gap. The cap test checks that subscribed is empty. It doesn't check that polling then reads the stash, which is the other half of the claim. The existing --stash poll tests may already cover that.

Summary: the change does what the commit message says for the common case, and the cap is now tested. Items 1 and 2 are the same flood on a rarer path, and one change to how known is built fixes both. They can be follow-ups.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in 5a38cb5:

  • 1–3: known is rebuilt from each read: the scopes it read, plus failed scopes that were already known. A failed first read no longer marks a scope known, and a scope that left the view counts as new when it comes back. It's a fresh map each time, so nothing writes to a shared one. TestStashFirstReadAfterAFailureIsNotNews covers the failure case.
  • 4: I removed the takeStash comment.

No change:

  • 5: the --stash poll tests in stash_test.go already cover polling once streaming is off.

@claude please review.

@claude

claude Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 1m 10s —— View job


Re-review of mass dashboard (#272) at 5a38cb5

I read the diff of 5a38cb5 (feed.go, feed_test.go). go test ./internal/commands/dashboard/ and go vet pass. I didn't run make check or make docs. No command, flag or helpdoc text changed, so make docs should be a no-op.

Nothing blocks the code. The one merge item left is the go.mod pseudo-version, which you've said moves to the SDK release first.

Checked and fine

  • known is rebuilt on each read.
    • It holds the scopes the read covered, plus failed scopes that were already known.
    • A scope that left the view drops out, so its return counts as new. That closes the earlier item 2.
    • A failed first read no longer marks a scope known, which closes item 1. A failed scope that was already known stays known, and Keep carries its entries forward, so nothing is reported as deleted or set.
  • Shared map.
    • Assigning a fresh map settles the earlier item 3.
    • The closure captures prev, the old map, which nothing writes to after this.
  • Initial read. news is still nil on the first read, so it reports nothing. The known set is built either way.
  • Streamed events. They still pass an accept-all closure, so they always count.
  • Comments. The takeStash comment is gone and the known comment matches the new behavior.
  • TestStashFirstReadAfterAFailureIsNotNews. It fails the sandbox scope during the refocus read, clears the failure, refreshes, and checks that the banner shows and "stash set" doesn't.
  • Item 5. I agree the existing poll tests in stash_test.go cover polling once streaming is off.

Nit, not blocking

  • The new test never asserts that the read actually failed. If failScope stopped matching the scope, the test would still pass through the ordinary first-read path. A check that the first read left sandbox-demo without its banner would tie it to the failure case.

Summary: the change does what the commit message says and the tests pass. The PR is in good shape from my side. Move go.mod to the SDK release before merging.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in 04fcd85: the test now checks that the read after the refocus failed before it clears the failure. A test-only change, so I'm not asking for another review.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

@claude please review.

@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Claude finished @coryodaniel's task in 18s —— View job


Review of mass dashboard (#272) at 04fcd85

I read the diff of 33e531a (--render blocks) and the test-only 04fcd85. I did not run make check, make docs or the tests in this pass, so CI has to cover those. I checked the generated docs by diff only, and they changed alongside the flag help and helpdoc.

Nothing blocks the code. The one merge item left is the go.mod pseudo-version, which moves to the SDK release first, as you said.

Checked and fine

  • Layering. cmd/dashboard.go only reads the flag and passes Render through. Run validates it and defaults an empty value to braille. There are no new test files in cmd/.
  • Pooled canvas. borrowCanvas resets Blocks to false, and Scene.Render sets it from s.Blocks. A pooled canvas can't carry the setting from one render to the next.
  • Octant table.
    • I spot-checked it against the braille bit layout (0x01 0x02 0x04 0x40 in the left column, 0x08 0x10 0x20 0x80 in the right).
    • Index 1 is the top-left eighth, index 3 is the upper-left quadrant ▘, and index 255 is █.
    • TestCanvasBlocksCoverEveryPattern checks that all 256 patterns draw different glyphs. It doesn't check that each glyph covers the right eighths, so only the spot checks in TestCanvasBlocks pin that.
  • Colors. Dots still go through dotCodes(ce.color), so palettes and the red/orange/yellow meanings are unchanged.
  • Tests. TestSceneBlocks checks both renders end to end. The new tests are in the existing files, as CLAUDE.md asks.

Nits, none blocking

  1. TestSceneBlocks could miss a stale pool. It runs the default render first and the blocks render second. A Blocks flag that leaked through the pool in the other direction (blocks, then braille) wouldn't be caught. A second default render after the blocks one would cover it.
  2. Font support. Octants are Unicode 16, so a terminal or font without them shows tofu. The flag help says it is for terminals that draw block characters themselves, such as Ghostty, which is reasonable. If you want to be helpful, say in the helpdoc that braille is the safe default.
  3. Comments (CLAUDE.md). Renders and the Blocks field comments restate the code. octants says why it exists and is fine.

Summary: the change does what the commit message says, and the pooled canvas is reset correctly. The nits can be follow-ups. Move go.mod to the SDK release before merging.
· branch dashboard

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@coryodaniel

Copy link
Copy Markdown
Member Author

Fixed in 2142c53:

  • 1: TestSceneBlocks now draws braille again after the blocks render.
  • 2: the helpdoc says braille works in any terminal.

No change:

  • 3: Renders and the Blocks field are exported, so lint requires their doc comments.

Test and doc changes only, so I'm not asking for another review.

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