Files
Vetting/internal/model/model.go
T
josh a0c0fb114f
CI / Lint + build + test (push) Has been cancelled
Add host-mode heartbeat: vetting-agent host + last-seen badge
vetting-agent gains a `host` subcommand that runs as a systemd service
installed by the quick-register one-liner, POSTing every 30s to
/api/v1/hosts/{mac}/heartbeat so the dashboard tile shows "online" or
"Nm ago" without waiting on WoL. Ships dormant client code for the
Phase 2 reboot_for_vetting command so the server can flip it on later
without a binary redeploy.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-17 23:34:15 -04:00

98 lines
2.2 KiB
Go

package model
import "time"
type Host struct {
ID int64
Name string
MAC string
WoLBroadcastIP string
WoLPort int
ExpectedSpecYAML string
PDUConfigJSON string
IPMIConfigJSON string
Notes string
CreatedAt time.Time
UpdatedAt time.Time
LastSeenAt *time.Time // host-mode agent heartbeat; nil = never seen
}
type RunState string
const (
StateRegistered RunState = "Registered"
StateQueued RunState = "Queued"
StateWaitingWoL RunState = "WaitingWoL"
StateBooting RunState = "Booting"
StateInventoryCheck RunState = "InventoryCheck"
StateSpecValidate RunState = "SpecValidate"
StateSMART RunState = "SMART"
StateCPUStress RunState = "CPUStress"
StateStorage RunState = "Storage"
StateNetwork RunState = "Network"
StateGPU RunState = "GPU"
StatePSU RunState = "PSU"
StateReporting RunState = "Reporting"
StateCompleted RunState = "Completed"
StateFailed RunState = "Failed"
StateFailedHolding RunState = "FailedHolding"
StateReleased RunState = "Released"
)
type Run struct {
ID int64
HostID int64
State RunState
Result string
FailedStage string
NextBootTarget string
AgentTokenHash string
StartedAt time.Time
CompletedAt *time.Time
ReportPath string
HoldIP string
OverrideFlagsJSON string
}
type StageState string
const (
StagePending StageState = "pending"
StageRunning StageState = "running"
StagePassed StageState = "passed"
StageFailed StageState = "failed"
StageSkipped StageState = "skipped"
)
type Stage struct {
ID int64
RunID int64
Name string
Ordinal int
State StageState
StartedAt *time.Time
CompletedAt *time.Time
SummaryJSON string
}
type Measurement struct {
ID int64
RunID int64
StageID *int64
TS time.Time
Kind string
Key string
Value float64
Unit string
}
type SpecDiff struct {
ID int64
RunID int64
Field string
Expected string
Actual string
Severity string // critical|warning|info
Ignored bool
}