ui: GitHub-Actions-style detail page, sub-steps, mini-tile run-view
Reshapes the detail page into a run-view: hybrid horizontal pipeline
+ expanded active-step pane with sub-steps, a per-step log pane with
line-numbered permalinks and client-side search, and a runs-history
sidebar that navigates via ?run=N. Default step is server-picked
(running → failed → Reporting) so the operator lands on the thing
that's moving.
Adds a sub_steps table + SSE topic (substep-{run}-{stage}-{ordinal})
so per-disk and per-pass work (SMART, CPUStress CPU/RAM, Storage,
GPU) is visible in the UI instead of buried in stage summary JSON.
Agent emits sub-step reports from existing per-iteration loops.
Dashboard tiles become a mini run-view with a 9-dot step strip so
the operator reads run health across the whole grid at a glance.
Register page gets the same card shell + button styling.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -143,3 +143,69 @@ func waitForSSEEvent(r *bufio.Reader, name string, timeout time.Duration) error
|
||||
type timeoutErr struct{}
|
||||
|
||||
func (e *timeoutErr) Error() string { return "timeout waiting for sse event" }
|
||||
|
||||
// TestSSE_SubStepEvent confirms PublishSubStepUpdate lands on the wire
|
||||
// with the exact "substep-{runID}-{stage}-{ordinal}" event name that
|
||||
// detail-page swap targets key on. Without this, the template renders
|
||||
// the right attribute but a middleware or renderer regression silently
|
||||
// drops the payload.
|
||||
func TestSSE_SubStepEvent(t *testing.T) {
|
||||
conn, err := db.Open(filepath.Join(t.TempDir(), "vetting.db"))
|
||||
if err != nil {
|
||||
t.Fatalf("open db: %v", err)
|
||||
}
|
||||
t.Cleanup(func() { _ = conn.Close() })
|
||||
|
||||
hosts := &store.Hosts{DB: conn}
|
||||
runs := &store.Runs{DB: conn}
|
||||
stages := &store.Stages{DB: conn}
|
||||
diffs := &store.SpecDiffs{DB: conn}
|
||||
arts := &store.Artifacts{DB: conn}
|
||||
hub := events.NewHub()
|
||||
runner := &orchestrator.Runner{Runs: runs, Hosts: hosts, Stages: stages, EventHub: hub}
|
||||
tiles := &api.TileEnricher{Runs: runs, Artifacts: arts, SpecDiffs: diffs}
|
||||
|
||||
orchestrator.SubStepRenderer = func(_ model.SubStep) string {
|
||||
return `<div class="substep">row</div>`
|
||||
}
|
||||
|
||||
ui := &api.UI{
|
||||
Hosts: hosts, Runs: runs, Stages: stages, SpecDiffs: diffs, Artifacts: arts,
|
||||
EventHub: hub, Runner: runner, Tiles: tiles,
|
||||
}
|
||||
agent := &api.Agent{
|
||||
Hosts: hosts, Runs: runs, Stages: stages, Artifacts: arts,
|
||||
SpecDiffs: diffs, Runner: runner, EventHub: hub,
|
||||
}
|
||||
|
||||
router := NewRouter(Deps{UI: ui, Agent: agent})
|
||||
srv := httptest.NewServer(router)
|
||||
t.Cleanup(srv.Close)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
defer cancel()
|
||||
req, _ := http.NewRequestWithContext(ctx, http.MethodGet, srv.URL+"/events", nil)
|
||||
resp, err := http.DefaultClient.Do(req)
|
||||
if err != nil {
|
||||
t.Fatalf("GET /events: %v", err)
|
||||
}
|
||||
defer func() { _ = resp.Body.Close() }()
|
||||
|
||||
reader := bufio.NewReader(resp.Body)
|
||||
if err := waitForSSEEvent(reader, "hello", 1*time.Second); err != nil {
|
||||
t.Fatalf("hello preamble: %v", err)
|
||||
}
|
||||
time.Sleep(50 * time.Millisecond)
|
||||
|
||||
runner.PublishSubStepUpdate(context.Background(), model.SubStep{
|
||||
RunID: 42,
|
||||
StageName: "CPUStress",
|
||||
Ordinal: 1,
|
||||
Name: "Memory pass",
|
||||
State: model.StagePassed,
|
||||
})
|
||||
|
||||
if err := waitForSSEEvent(reader, "substep-42-CPUStress-1", 2*time.Second); err != nil {
|
||||
t.Fatalf("substep event: %v", err)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user