Documentation
¶
Overview ¶
Package stack is lifecycle orchestration. The whole point of this file is the asymmetry between `down` and `verify`:
down is BEST-EFFORT — a resource may already be gone, a network may be busy, an API may
flake. Aborting halfway leaves MORE garbage than continuing, so every failure is
recorded and teardown carries on.
verify is STRICT — it asserts each axis is actually gone and exits non-zero if not.
Homegrown teardown scripts almost always implement the first half and skip the second, which is why they leak: `docker compose down -v` never removes images, and a `down` that omits a profile silently leaves that profile's network behind. `verify` is the part that catches it.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type DownOptions ¶
DownOptions: `Verify` runs assert_gone after destroying (default true — a teardown that silently half-worked is the failure this tool exists to catch); `Force` allows a `kind: shared` teardown.
type Outcome ¶
type Outcome struct {
OK bool `json:"ok"`
Steps []StepResult `json:"steps"`
// Outputs is the env accumulated from axis outputs during `up` — the inter-axis credential
// channel. Ordered (OutputKeys) so the job record matches the TS byte for byte.
Outputs map[string]string `json:"outputs"`
OutputKeys []string `json:"-"`
}
Outcome is a lifecycle action's result.
func Down ¶
Down tears a stack down: compose down (with EVERY profile), then axes in REVERSE order, then verify. Reverse order matters for the same reason as up's forward order.
func Sleep ¶
Sleep puts a stack to SLEEP: the compose project goes down, its volumes and every axis stay. Not a teardown and not reported as one — there is no verify, because nothing is supposed to be gone. Refused for `kind: shared`: sleeping a singleton stops every preview that depends on it.
func Up ¶
Up brings a stack up: every requirement by name, every axis in declaration order, then compose up. Fails FAST — a half-provisioned stack should not proceed to deploy: if the database axis fails there is no point starting the app that migrates it.
func Verify ¶
Verify asserts every axis is gone. The leak gate: a non-zero exit means something survived teardown. Axes without assert_gone are reported `unverifiable` rather than passing silently.
func (Outcome) Leaked ¶
Leaked is THE leak step scan, the one copy: a torn-down stack where something survived. The TS had four copies in three files; invariant 8 says they must agree, and one function agrees with itself.
func (Outcome) MarshalJSON ¶
MarshalJSON emits outputs in accumulation order (OutputKeys), the way Object.assign per axis left them; keys the list does not name (a hand-built Outcome) follow in byte order.
type Phase ¶
type Phase string
Phase is which hook a step ran.
const ( PhaseRequires Phase = "requires" PhaseUp Phase = "up" PhaseDown Phase = "down" PhaseAssertGone Phase = "assert_gone" PhaseAssertLive Phase = "assert_live" PhaseCompose Phase = "compose" // PhaseCapacity is no hook: the API refused an up or wake because no node has room. PhaseCapacity Phase = "capacity" )