stack

package
v0.46.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: MIT, MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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

func Report

func Report(o Outcome) string

Report renders an Outcome as a compact report. Presentation, not a contract.

func Status

func Status(st *spec.Stack, r exec.Runner) string

Status is what is currently running for this stack, straight from compose.

Types

type DownOptions

type DownOptions struct {
	NoVerify bool
	Force    bool
}

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

func Down(st *spec.Stack, r exec.Runner, o DownOptions, sink log.Sink) Outcome

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

func Sleep(st *spec.Stack, r exec.Runner, sink log.Sink) Outcome

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

func Up(st *spec.Stack, r exec.Runner, sink log.Sink) Outcome

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

func Verify(st *spec.Stack, r exec.Runner, sink log.Sink) Outcome

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

func (o Outcome) Leaked() bool

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

func (o Outcome) MarshalJSON() ([]byte, error)

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"
)

type StepResult

type StepResult struct {
	Axis    string  `json:"axis"`
	Phase   Phase   `json:"phase"`
	OK      bool    `json:"ok"`
	Code    int     `json:"code"`
	Message *string `json:"message,omitempty"`
	Skipped bool    `json:"skipped"`
}

StepResult is one hook's verdict. The wire shape the job transcript carries.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL