Documentation
¶
Overview ¶
Package report defines the structure and rendering of RestoreLab recovery drill reports.
A Report is populated by the workflow orchestrator and can be serialized to JSON or HTML. It intentionally avoids scores like "85/100" — only categorical outcomes (PASS/FAIL/WARNING/...) which are honest about what was and was not tested.
Index ¶
- Constants
- func DefaultScopeNotes() []string
- type Check
- type Report
- func (r *Report) AddCheck(c Check)
- func (r *Report) AddStage(s Stage)
- func (r *Report) FillNotRun(canonical []string)
- func (r *Report) Finalize()
- func (r *Report) WriteHTML(w io.Writer) error
- func (r *Report) WriteHTMLFile(path string) error
- func (r *Report) WriteJSON(w io.Writer) error
- func (r *Report) WriteJSONFile(path string) error
- type Stage
- type Status
Constants ¶
const CurrentVersion = "1.0"
CurrentVersion is the report schema version.
Variables ¶
This section is empty.
Functions ¶
func DefaultScopeNotes ¶
func DefaultScopeNotes() []string
DefaultScopeNotes returns the standard scope limitations for the v0.1.0 release. These strings are deliberately factual and contain no unverified statistics.
Types ¶
type Check ¶
type Check struct {
Name string `json:"name"`
Status Status `json:"status"`
Expected string `json:"expected,omitempty"`
Actual string `json:"actual,omitempty"`
Error string `json:"error,omitempty"`
}
Check is one SQL validation result.
type Report ¶
type Report struct {
// Identity
Version string `json:"version"`
RunID string `json:"run_id"`
ContractName string `json:"contract_name"`
ContractPath string `json:"contract_path"`
StartedAt time.Time `json:"started_at"`
CompletedAt time.Time `json:"completed_at"`
DurationMS int64 `json:"duration_ms"`
// Environment facts
ResticVersion string `json:"restic_version,omitempty"`
PostgresVersion string `json:"postgres_version,omitempty"`
ImageDigest string `json:"image_digest,omitempty"`
ArtifactSize int64 `json:"artifact_size,omitempty"`
// Results
Stages []Stage `json:"stages"`
Checks []Check `json:"checks,omitempty"`
Overall Status `json:"overall"`
FailureReason string `json:"failure_reason,omitempty"`
CleanupStatus Status `json:"cleanup_status"`
// Scope: explicitly records what was and was not tested.
ScopeNotes []string `json:"scope_notes,omitempty"`
}
Report is the complete outcome of a single recovery drill.
func (*Report) FillNotRun ¶
FillNotRun marks every stage in canonical that does not already appear in r.Stages as StatusNotRun, preserving the canonical order at the end of the stage list. This is called by the workflow before Finalize so that early-return paths still produce a report that shows every stage.
func (*Report) Finalize ¶
func (r *Report) Finalize()
Finalize sets CompletedAt, DurationMS, and computes Overall. It must be called exactly once before serializing the report.
func (*Report) WriteHTMLFile ¶
WriteHTMLFile renders the report to the given file path. The file is written with mode 0600.
func (*Report) WriteJSONFile ¶
WriteJSONFile writes the report to the given file path, creating or truncating the file. The file is written with mode 0600.