Documentation
¶
Overview ¶
Package matrix is the env × family screen: one row per family, one column per env, the family's image tag in each cell with its state spelled out — pinned, unpinned, split, external, drifted — as a word an operator can read without a legend. cells.go derives the cell values from a discovered repo (and, when the cluster has answered, from what each env is actually running) with no terminal dependency; model.go lays them out.
Index ¶
- func FirstPartyRepos(fam *gitops.Family, promotable []string) []string
- type Cell
- type DriftFunc
- type DriftMsg
- type Model
- func (m Model) CapturesText() bool
- func (m Model) CurrentEnv() string
- func (m Model) CurrentFamily() string
- func (m Model) Cursor() int
- func (m Model) InFlight() []flight.Summary
- func (m Model) Init() tea.Cmd
- func (m Model) IsProduction(env string) bool
- func (m Model) Matrix() Table
- func (m Model) SetInFlight(list []flight.Summary, err error) Model
- func (m Model) SetSize(width, height int) Model
- func (m Model) SetStyles(s ui.Styles) Model
- func (m Model) Update(msg tea.Msg) (Model, tea.Cmd)
- func (m Model) View() string
- func (m Model) WithDrift(drift DriftFunc) Model
- func (m Model) WithNotice(notice string) Model
- func (m Model) WithNow(now func() time.Time) Model
- type OpenPlanMsg
- type OpenRestartMsg
- type OpenTagsMsg
- type ResumeMsg
- type Row
- type Running
- type State
- type Table
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Cell ¶
type Cell struct {
// Present is false when the family has no Application in this env; the other fields
// are then zero and String renders blank.
Present bool
// Text is the tag shown: the single first-party tag, "N images" when the family's
// first-party occurrences span N image repos, or "N versions" when one image repo runs
// under N references inside the env. A third-party-only family shows the same for its
// third-party images.
Text string
// State is the word beside Text; "" for a present cell with no images at all.
State State
// Pinned: every first-party occurrence carries a digest.
Pinned bool
// Differs: the set of refs differs from the previous env column's. Never set on the
// first column or when the previous column is blank. Kept as data for a caller that
// wants to colour a change across columns; it is no longer a glyph.
Differs bool
// ThirdParty: the family has no first-party image at all.
ThirdParty bool
// Running is what the cluster reports for a drifted cell — the tag, or a short digest —
// for the sentence under the table ("marketing runs sha-77c0ffe here; manifest says …").
// Empty unless State is StateDrifted.
Running string
// contains filtered or unexported fields
}
Cell is one family × env intersection.
type DriftFunc ¶
DriftFunc reports what one env's cluster is running, keyed by image repo — the pod digests hoist already resolves for a plan, asked for per env at boot so the matrix can say "drifted" where the manifest and the cluster disagree. nil means no cluster is configured and no cell is ever claimed drifted (nor not drifted). The root builds it from the same resolve function the plan screen uses (AGENTS.md §4.8: this package takes a function value, never an adaptor).
type DriftMsg ¶
type DriftMsg struct {
// contains filtered or unexported fields
}
DriftMsg is one env's answer. gen is the refresh generation it belongs to, so a slow answer from before a refresh (F5) or a previous instance of this screen is dropped rather than painting stale drift over a newer answer.
type Model ¶
type Model struct {
// contains filtered or unexported fields
}
Model is the matrix screen. It is a value: Update, SetSize and SetStyles return the updated model.
func New ¶
New builds the screen for a discovered repo. promotable lists the first-party image repo prefixes (see Compute). envs is the repo's policy (which envs are production — marked in the header and named in the footer, since this is the one screen where an operator chooses an env and until M10 the one place that fact was absent, #86). drift is how the cluster is asked what each env runs; nil never asks. The model has no size until SetSize is called.
func (Model) CapturesText ¶
CapturesText reports whether the image chooser is open: its "/" filter takes letters, and the root's q-to-quit must not fire over it.
func (Model) CurrentEnv ¶
CurrentEnv is the env the column cursor is on, "" when the repo has none.
func (Model) CurrentFamily ¶
CurrentFamily is the family the row cursor is on, "" when the matrix has no rows.
func (Model) Init ¶
Init asks the cluster what every env is running, one command per env, when a DriftFunc was supplied. The table is already drawn from the manifests; each answer refines its column when it lands.
func (Model) IsProduction ¶
IsProduction reports whether env is listed in envs.production.
func (Model) SetInFlight ¶
SetInFlight replaces what the pane shows. err is the listing's own failure (the state directory unreadable), shown in the pane's place; a per-promotion re-observation failure travels inside its Summary.
func (Model) SetStyles ¶
SetStyles applies a palette to the table, the help line and the status bar.
func (Model) Update ¶
Update handles the screen's keys and forwards the rest to the table. Quit is the root's.
func (Model) View ¶
View renders the frame: the table, the notes, the in-flight pane and the footer, with a chooser dialog over it when one is open — or the too-small line.
func (Model) WithDrift ¶
WithDrift replaces the cluster-asking function New was given — the root uses it to hand the matrix a pods-only resolver built after New.
func (Model) WithNotice ¶
WithNotice sets the notice shown under the table — exported so the root can surface an honest message on the matrix after popping back to it from another screen whose own message it chose not to act on.
type OpenPlanMsg ¶
OpenPlanMsg is emitted when the operator asks to plan a promotion from CurrentEnv: p asks for the configured pair (envs.pairs[Source] — the root looks it up), P (Force) always prompts for the target instead. The root recognizes this by concrete type in its own Update switch (see internal/app/screen.go).
type OpenRestartMsg ¶
type OpenRestartMsg struct {
Family, Target string
}
OpenRestartMsg is emitted when the operator asks to restart the family under the cursor in CurrentEnv (R). It names a family rather than an image because a restart changes no image: what it rolls is every Deployment that family declares, which is the unit an Argo Application already covers and therefore the unit the rollout is watched at.
type OpenTagsMsg ¶
type OpenTagsMsg struct {
ImageRepo, Target string
}
OpenTagsMsg is emitted when the operator asks to pick a new tag for the current cell (d, "deploy image" — the tag picker, internal/app/tags). ImageRepo is the one first-party image repo the family runs in CurrentEnv, or the one the operator chose when there were several.
type ResumeMsg ¶
type ResumeMsg struct {
ID string
}
ResumeMsg asks the root to re-drive one in-flight promotion on the flight screen (r, or enter on the pane) — the TUI's `hoist resume <id>`.
type Running ¶
Running is what each env's cluster is actually running, keyed env → image repo → the running reference (tag and digest as the pod reports them). nil, or a missing env, means the cluster has not answered for that env — no cell there can be drifted, and none is claimed not to be.
type State ¶
type State string
State is the one word a cell shows beside its tag. Colour reinforces it; it never replaces it (docs/tui/mockups.html: "state is a word, not a glyph").
const ( // StatePinned means every first-party occurrence carries a digest. StatePinned State = "pinned" // StateUnpinned means at least one first-party occurrence is a bare tag — a moved tag is // invisible to imagePullPolicy: IfNotPresent (AGENTS.md principle 3). StateUnpinned State = "unpinned" // StateSplit means one image repo runs under more than one reference inside the env — the // condition the runbook blocks a promotion on, so it should look like a problem. StateSplit State = "split" // StateExternal means the family has no first-party image at all. StateExternal State = "external" // StateDrifted means the cluster runs a build the manifest does not declare. The single most // important fact on the screen when it is true, so it gets a sentence under the table too. StateDrifted State = "drifted" )
type Table ¶
Table is the whole matrix: envs sorted by name, families sorted by name (the union across envs).