Documentation
¶
Overview ¶
Package sagacoveragegen renders the saga fanout artifacts derived from the saga.Status / journal.EventKind const sets — the single source of truth for SAGA-STATUS-FANOUT-COVERAGE-01.
It produces three byte-locked artifacts (consumed by `gocell generate saga-coverage` to write, and by the archtest to verify):
- terminal_coverage_gen.go — a struct with exactly one field per TERMINAL saga.Status. The hand-written keyless composite literal of that struct in kernel/saga/sagajournaltest/conformance.go is a COMPILE-TIME exhaustiveness gate: add a terminal status const → regen adds a field → the keyless literal fails to compile ("too few values in struct literal") until a happy-path driver is supplied. This is the Hard half of the fanout closure.
- the readyz.md saga lifecycle status table (Status / Value / Phase / Terminal? rows) — generated from the const value + Status.IsTerminal().
- the alerting-rules.md "kind 速查" legend (value=wire entries) — generated from the EventKind value + EventKind.String().
Names are derived from String() via PascalCase under the project naming convention (const name == "Status"+PascalCase(String()) / "Kind"+PascalCase(String())); a convention violation surfaces as a build failure of the generated const references, never a silent drift.
Index ¶
Constants ¶
const ( ReadyzTableStartMarker = "<!-- gocell:generated:saga-status-table — DO NOT EDIT (regen: gocell generate saga-coverage) -->" ReadyzTableEndMarker = "<!-- /gocell:generated:saga-status-table -->" KindLegendStartMarker = "<!-- gocell:generated:saga-event-kind-legend — DO NOT EDIT (regen: gocell generate saga-coverage) -->" KindLegendEndMarker = "<!-- /gocell:generated:saga-event-kind-legend -->" )
Marker pairs delimit the generated regions inside the hand-curated ops docs. The CLI replaces the text between each pair; the archtest extracts and byte-compares it against the rendered fragment.
Variables ¶
var ErrNoPhase = errcode.New(errcode.KindInvalid, errcode.ErrValidationFailed,
"sagacoveragegen: saga.Status missing a statusPhase description")
ErrNoPhase is returned when a saga.Status has no statusPhase entry. Declared via errcode.New (EXPORTED-ERROR-NEW-01 bans exported errors.New sentinels).
Functions ¶
func ExtractRegion ¶
ExtractRegion returns the generated body between the start and end markers (exclusive of both marker lines). Used by the archtest to byte-compare the committed doc region against the rendered fragment.
func ReplaceRegion ¶
ReplaceRegion replaces the body between the start and end markers with body, preserving the marker lines and all surrounding content. body must end with a newline so the end marker stays on its own line.
Types ¶
type Artifacts ¶
type Artifacts struct {
// TerminalCoverageGo is the gofmt-canonical content of
// kernel/saga/sagajournaltest/terminal_coverage_gen.go.
TerminalCoverageGo []byte
// ReadyzTable is the markdown status table fragment (no markers, trailing \n).
ReadyzTable string
// KindLegend is the single-line markdown legend fragment (trailing \n).
KindLegend string
}
Artifacts holds the three rendered fanout artifacts.