f79fe0f0db
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>
88 lines
3.0 KiB
Go
88 lines
3.0 KiB
Go
// Package tests contains the per-stage executors the agent runs on the
|
|
// host under test. Each stage implements Runner, is called with a
|
|
// Context that carries the client + forwarder + run params, and returns
|
|
// an Outcome that the caller POSTs to /result.
|
|
package tests
|
|
|
|
import (
|
|
"context"
|
|
"encoding/json"
|
|
"time"
|
|
)
|
|
|
|
// Outcome is what a stage returns; it maps directly to the /result body.
|
|
// - Passed=true and len(Skipped)>0 counts as a pass but surfaces in the
|
|
// tile summary so operators can see "GPU: skipped (no VGA device)".
|
|
// - Message is only used on failure; the UI displays it in the log.
|
|
// - Extras is merged into the posted summary so stages can add
|
|
// their own shape (e.g. Storage returns per-disk probe results).
|
|
// - SubSteps carries agent-authored sub-step rows (CPU/Memory passes,
|
|
// per-disk SMART, per-device GPU, …). Empty for stages with no
|
|
// natural breakdown; persisted verbatim by the /result handler.
|
|
type Outcome struct {
|
|
Passed bool
|
|
Message string
|
|
Summary string // short human-readable one-liner
|
|
Extras map[string]any // merged into posted summary JSON
|
|
SubSteps []SubStepReport // agent-authored granular rows
|
|
}
|
|
|
|
// SubStepReport is one entry a stage contributes to its sub-step list.
|
|
// Ordinal is assigned in the order entries appear in the slice — the
|
|
// agent shouldn't set it manually. State is derived from Passed/Skipped
|
|
// the same way Outcome is: Skipped wins if set, else Passed ? passed :
|
|
// failed. StartedAt/CompletedAt are required so the UI can order rows
|
|
// and slice the stage log by time window.
|
|
type SubStepReport struct {
|
|
Name string
|
|
Passed bool
|
|
Skipped bool
|
|
StartedAt time.Time
|
|
CompletedAt time.Time
|
|
SummaryJSON json.RawMessage
|
|
}
|
|
|
|
// MarshalSummary builds the summary JSON body POSTed to /result.
|
|
// Stages accumulate fields via Extras; this helper adds "summary" (the
|
|
// human-readable line) and serializes.
|
|
func (o Outcome) MarshalSummary() (json.RawMessage, error) {
|
|
body := map[string]any{}
|
|
for k, v := range o.Extras {
|
|
body[k] = v
|
|
}
|
|
if o.Summary != "" {
|
|
body["summary"] = o.Summary
|
|
}
|
|
return json.Marshal(body)
|
|
}
|
|
|
|
// Deps bundles what stages need without pulling in the whole agent.
|
|
// Logger methods print to stdout + forward to the orchestrator; Sensor
|
|
// drops numeric samples; OverrideFlags carries operator-set bypasses.
|
|
type Deps struct {
|
|
Info func(string)
|
|
Warn func(string)
|
|
Error func(string)
|
|
Sensor func(ctx context.Context, samples []Sample) error
|
|
OverrideWipe bool
|
|
NonDestructive bool // skip wipe-probe + writes in Storage
|
|
ExpectedDisks []ExpectedDisk // serials + sizes from host.expected_spec
|
|
StageTimeout time.Duration
|
|
}
|
|
|
|
// Sample mirrors the server's SensorSample but lives in the tests
|
|
// package so probe code doesn't import internal/api.
|
|
type Sample struct {
|
|
Kind string
|
|
Key string
|
|
Value float64
|
|
Unit string
|
|
}
|
|
|
|
// ExpectedDisk is the subset of internal/spec.DiskSpec that Storage
|
|
// needs: a device allowlist keyed on serial.
|
|
type ExpectedDisk struct {
|
|
Serial string
|
|
SizeGB int
|
|
}
|