From fc09fb4888e4d7f498216aa5cbca290d91d0d079 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 09:15:58 -0400 Subject: [PATCH 1/3] feat(dashboard): add a Matrix tab to the Activity Monitor header when dashboard.matrix is enabled Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- changelog.d/added-16042-matrix-header-tab.md | 1 + src/docs/streaming-the-activity-monitor.md | 2 + src/pkg/dashboard/matrix_header_tab_test.go | 52 +++++++++++++++++++ src/pkg/dashboard/server.go | 5 +- src/pkg/dashboard/static-src/html/topbar.html | 1 + src/pkg/dashboard/static-src/js/refresh.js | 4 ++ src/pkg/dashboard/static/index.html | 5 ++ 7 files changed, 69 insertions(+), 1 deletion(-) create mode 100644 changelog.d/added-16042-matrix-header-tab.md create mode 100644 src/pkg/dashboard/matrix_header_tab_test.go diff --git a/changelog.d/added-16042-matrix-header-tab.md b/changelog.d/added-16042-matrix-header-tab.md new file mode 100644 index 0000000000..232fe22048 --- /dev/null +++ b/changelog.d/added-16042-matrix-header-tab.md @@ -0,0 +1 @@ +- Add a Matrix tab to the Activity Monitor header, shown only when `dashboard.matrix.enabled` is set; the status payload gains an additive `matrixEnabled` boolean (#16042, RFC #15862). diff --git a/src/docs/streaming-the-activity-monitor.md b/src/docs/streaming-the-activity-monitor.md index 32a4f02d12..a8bc468117 100644 --- a/src/docs/streaming-the-activity-monitor.md +++ b/src/docs/streaming-the-activity-monitor.md @@ -189,6 +189,8 @@ full-screen Activity Monitor. ## Matrix mode (separate channel) +When `dashboard.matrix.enabled` is set, the Activity Monitor header also shows a **Matrix** tab that opens `?kiosk=1&view=matrix` in the same window. + Matrix is an experimental, default-off code display for a separate channel, [`twitch.tv/hivecommonsmatrix`](https://www.twitch.tv/hivecommonsmatrix). It depends on the Matrix display renderer (`/?kiosk=1&view=matrix`, diff --git a/src/pkg/dashboard/matrix_header_tab_test.go b/src/pkg/dashboard/matrix_header_tab_test.go new file mode 100644 index 0000000000..84fe806882 --- /dev/null +++ b/src/pkg/dashboard/matrix_header_tab_test.go @@ -0,0 +1,52 @@ +package dashboard + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "testing" + + "github.com/hivecommons/hive/pkg/config" +) + +func TestDashboardMatrixHeaderTabHiddenByDefault(t *testing.T) { + raw, err := staticFS.ReadFile("static/index.html") + if err != nil { + t.Fatalf("reading embedded static/index.html: %v", err) + } + html := string(raw) + start := strings.Index(html, `id="oc-matrix-tab"`) + if start < 0 { + t.Fatal("static/index.html missing the Matrix header tab") + } + open := html[strings.LastIndex(html[:start], "")] + for _, want := range []string{`href="?kiosk=1&view=matrix"`, ` hidden`, `nav-chip`} { + if !strings.Contains(open, want) { + t.Fatalf("Matrix header tab %q missing %q", open, want) + } + } + if !strings.Contains(html, "data.matrixEnabled") { + t.Fatal("static/index.html never toggles the Matrix tab from the status payload") + } +} + +func TestHandleStatus_MatrixEnabledFlag(t *testing.T) { + for _, enabled := range []bool{false, true} { + s := newTestServer() + s.MatrixObserver(config.MatrixConfig{Enabled: enabled, Repos: []string{"org/repo"}}) + s.UpdateStatus(minimalPayload()) + + rec := httptest.NewRecorder() + s.handleStatus(rec, httptest.NewRequest(http.MethodGet, "/api/status", nil)) + + var raw map[string]any + if err := json.NewDecoder(rec.Body).Decode(&raw); err != nil { + t.Fatalf("decode error: %v", err) + } + if got, ok := raw["matrixEnabled"].(bool); !ok || got != enabled { + t.Errorf("matrixEnabled = %v (present=%v), want %v", raw["matrixEnabled"], ok, enabled) + } + } +} diff --git a/src/pkg/dashboard/server.go b/src/pkg/dashboard/server.go index 632b27f46b..81cca893a2 100644 --- a/src/pkg/dashboard/server.go +++ b/src/pkg/dashboard/server.go @@ -3719,7 +3719,7 @@ func (s *Server) handleStatus(w http.ResponseWriter, r *http.Request) { return } now := time.Now().UTC() - payload := statusWithWebhooks{StatusPayload: s.statusWithOverviewBands(status, now), Webhooks: github.WebhookHealthSnapshot(), CIFailureSignals: github.CIFailureSignals().Snapshot()} + payload := statusWithWebhooks{StatusPayload: s.statusWithOverviewBands(status, now), Webhooks: github.WebhookHealthSnapshot(), CIFailureSignals: github.CIFailureSignals().Snapshot(), MatrixEnabled: s.currentMatrixConfig().Enabled} if s.deps != nil && s.deps.EvalLoop != nil { loop := s.deps.EvalLoop() payload.EvalLoopStatus = &loop @@ -3740,6 +3740,9 @@ type statusWithWebhooks struct { // signals, the last one, webhook-triggered kicks and unmatched heads. CIFailureSignals github.CIFailureSignalsStatus `json:"ci_failure_signals"` *EvalLoopStatus + // MatrixEnabled mirrors dashboard.matrix.enabled so the header can show + // the Matrix tab only on hives that opted in. + MatrixEnabled bool `json:"matrixEnabled"` // UpgradeProgress is the spoke's view of the scheduled-upgrade state // machine (scheduled / draining / pulling / … / missed) with the drain // countdown, derived at serve time (#14856). Absent on a hive the hub diff --git a/src/pkg/dashboard/static-src/html/topbar.html b/src/pkg/dashboard/static-src/html/topbar.html index d6696d7d0f..2b07aaeb9d 100644 --- a/src/pkg/dashboard/static-src/html/topbar.html +++ b/src/pkg/dashboard/static-src/html/topbar.html @@ -25,6 +25,7 @@
+ diff --git a/src/pkg/dashboard/static-src/js/refresh.js b/src/pkg/dashboard/static-src/js/refresh.js index 22116f0c01..beda121ede 100644 --- a/src/pkg/dashboard/static-src/js/refresh.js +++ b/src/pkg/dashboard/static-src/js/refresh.js @@ -484,6 +484,10 @@ if (data.statusSeq < _statusSeqFloor || data.statusSeq < _lastStatusSeq) return; _lastStatusSeq = data.statusSeq; } + if (typeof data.matrixEnabled === 'boolean') { + const matrixTab = document.getElementById('oc-matrix-tab'); + if (matrixTab) matrixTab.hidden = !data.matrixEnabled; + } if (document.body.style.opacity === '0') document.body.style.opacity = '1'; const scrollAnchor = captureScrollAnchor(); updateNavbarClockTimeZone(data); diff --git a/src/pkg/dashboard/static/index.html b/src/pkg/dashboard/static/index.html index f86e9fe8dd..95e2787a95 100644 --- a/src/pkg/dashboard/static/index.html +++ b/src/pkg/dashboard/static/index.html @@ -7760,6 +7760,7 @@

🐝 Getting Started + @@ -43863,6 +43864,10 @@ if (data.statusSeq < _statusSeqFloor || data.statusSeq < _lastStatusSeq) return; _lastStatusSeq = data.statusSeq; } + if (typeof data.matrixEnabled === 'boolean') { + const matrixTab = document.getElementById('oc-matrix-tab'); + if (matrixTab) matrixTab.hidden = !data.matrixEnabled; + } if (document.body.style.opacity === '0') document.body.style.opacity = '1'; const scrollAnchor = captureScrollAnchor(); updateNavbarClockTimeZone(data); From 3af8e60dbe7bfd950374c1d824d69325ed145a51 Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 09:38:45 -0400 Subject: [PATCH 2/3] fix(dashboard): drop dashboard.matrix.enabled from settings parity allowlist Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/settings_parity_allowlist.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/src/pkg/dashboard/settings_parity_allowlist.txt b/src/pkg/dashboard/settings_parity_allowlist.txt index ce7bf641d3..132829c6de 100644 --- a/src/pkg/dashboard/settings_parity_allowlist.txt +++ b/src/pkg/dashboard/settings_parity_allowlist.txt @@ -182,7 +182,6 @@ compliance.frameworks[] # TODO #11854 contribute.token_idle_max # TODO #11854 contribute.token_max_age # TODO #11854 convergence.mutation.max_writers_per_target # boundary capacity tuning; yaml-only (#14645) -dashboard.matrix.enabled # experimental default-off Matrix block; nothing reads it yet (#15862) dashboard.matrix.exclude_paths[] # experimental default-off Matrix block; nothing reads it yet (#15862) dashboard.matrix.repos[] # experimental default-off Matrix block; nothing reads it yet (#15862) debug.pprof_addr # loopback-only pprof bind address, operator/debug knob, not a Settings control (#14681) From 7aa7373ef3780bc62881474d5817d33a68ddcc5b Mon Sep 17 00:00:00 2001 From: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> Date: Sat, 31 Oct 2026 10:12:59 -0400 Subject: [PATCH 3/3] fix(dashboard): restore matrix.enabled parity allowlist; gate header tab on Active() The MatrixEnabled doc comment spelled out the literal yaml leaf path, which the settings-parity corpus (static/index.html + pkg/dashboard/*.go) counted as a Settings reference and led to the allowlist line being dropped even though no Settings control exists. Reword the comment and restore the entry. Also derive the /api/status flag from MatrixConfig.Active() (enabled with at least one repo) so the header tab only appears when /api/matrix/lines and the SSE nudge will actually serve it. Hive-Fix-Attempt: 1/6 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Signed-off-by: scanner <280983584+hivecommons-hive[bot]@users.noreply.github.com> --- src/pkg/dashboard/server.go | 7 ++++--- src/pkg/dashboard/settings_parity_allowlist.txt | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/pkg/dashboard/server.go b/src/pkg/dashboard/server.go index 81cca893a2..a97c03d51f 100644 --- a/src/pkg/dashboard/server.go +++ b/src/pkg/dashboard/server.go @@ -3719,7 +3719,7 @@ func (s *Server) handleStatus(w http.ResponseWriter, r *http.Request) { return } now := time.Now().UTC() - payload := statusWithWebhooks{StatusPayload: s.statusWithOverviewBands(status, now), Webhooks: github.WebhookHealthSnapshot(), CIFailureSignals: github.CIFailureSignals().Snapshot(), MatrixEnabled: s.currentMatrixConfig().Enabled} + payload := statusWithWebhooks{StatusPayload: s.statusWithOverviewBands(status, now), Webhooks: github.WebhookHealthSnapshot(), CIFailureSignals: github.CIFailureSignals().Snapshot(), MatrixEnabled: s.currentMatrixConfig().Active()} if s.deps != nil && s.deps.EvalLoop != nil { loop := s.deps.EvalLoop() payload.EvalLoopStatus = &loop @@ -3740,8 +3740,9 @@ type statusWithWebhooks struct { // signals, the last one, webhook-triggered kicks and unmatched heads. CIFailureSignals github.CIFailureSignalsStatus `json:"ci_failure_signals"` *EvalLoopStatus - // MatrixEnabled mirrors dashboard.matrix.enabled so the header can show - // the Matrix tab only on hives that opted in. + // MatrixEnabled reports whether the Matrix block is active (enabled with + // at least one repo, see config.MatrixConfig.Active) so the header shows + // the Matrix tab only on hives whose /api/matrix/lines will serve it. MatrixEnabled bool `json:"matrixEnabled"` // UpgradeProgress is the spoke's view of the scheduled-upgrade state // machine (scheduled / draining / pulling / … / missed) with the drain diff --git a/src/pkg/dashboard/settings_parity_allowlist.txt b/src/pkg/dashboard/settings_parity_allowlist.txt index 132829c6de..8ffbfd74fd 100644 --- a/src/pkg/dashboard/settings_parity_allowlist.txt +++ b/src/pkg/dashboard/settings_parity_allowlist.txt @@ -182,6 +182,7 @@ compliance.frameworks[] # TODO #11854 contribute.token_idle_max # TODO #11854 contribute.token_max_age # TODO #11854 convergence.mutation.max_writers_per_target # boundary capacity tuning; yaml-only (#14645) +dashboard.matrix.enabled # experimental default-off Matrix block; gates the header tab via /api/status, no Settings control (#15862, #16042) dashboard.matrix.exclude_paths[] # experimental default-off Matrix block; nothing reads it yet (#15862) dashboard.matrix.repos[] # experimental default-off Matrix block; nothing reads it yet (#15862) debug.pprof_addr # loopback-only pprof bind address, operator/debug knob, not a Settings control (#14681)