github.com/rotari-dev/rotari/internal/runview

Overview

package runview // import "github.com/rotari-dev/rotari/internal/runview"

Package runview loads a run's persisted snapshot and resolves its displayed job
statuses for read-side consumers such as the CLI and Web UI.

Functions

func ClientStatus(paths state.ProjectPaths, runID string) (model.RunClientStatus, error)
    ClientStatus reads the initiating client's recorded state and rejects stale
    live-attachment claims unless a local supervisor is confirmed alive.

func ClientStatusIn(paths state.ProjectPaths, runID string, phase project.RunPhase) (model.RunClientStatus, error)
    ClientStatusIn is ClientStatus for a run whose phase a caller already read
    (project.PhaseFrom).

func ClientStatusLabel(status model.RunClientStatus) string
    ClientStatusLabel formats client attachment independently from run
    lifecycle.

func FinalFailureGroups(paths state.ProjectPaths, runID string, store state.Store) ([]runlineage.FailureGroup, error)
    FinalFailureGroups groups the jobs of runID that have failed with no retry
    left, by cause. A failed attempt that an active run will retry does not
    count. `rotari wait --until-failure` and the MCP wait tool stop on it.

func HeartbeatWarning(paths state.ProjectPaths, runID string, now time.Time) string
    HeartbeatWarning says when runID is the project's active run, its
    coordinator is on another host or in another PID namespace that this host
    cannot check, and its heartbeat looks stopped: "no heartbeat from HOST for
    12m", or why the heartbeat cannot be read. It is "" for any other run,
    for a run without a heartbeat, and for one that beat recently.

    It compares the beat's own time with now, so it waits
    state.HeartbeatClockMargin longer than runwatch, which watches the beat
    change by its own clock. A warning proves nothing about the run; it only
    says what the heartbeat shows.

func LifecycleLabel(phase project.RunPhase, summary model.RunSummary) string
    LifecycleLabel is RunLifecycleLabel from facts a caller already read:
    the run's phase and, for a finished run, its summary.

func LineageStatus(job jobstatus.Job) string
    LineageStatus classifies a resolved job for run lineage summaries, which
    count cancellations as failures.

func LoadRun(paths state.ProjectPaths, runID string, store state.Store) (runlineage.Run, error)
    LoadRun loads a run's command snapshot and resolves every job through
    the shared jobstatus fallback chain. An active run without a snapshot,
    which only an earlier rotari could leave, has no jobs yet; for any other run
    a missing snapshot is an error.

func PreviousRun(paths state.ProjectPaths, runID string) (string, error)
    PreviousRun returns the run of the project that started just before runID.

func RunLifecycleLabel(paths state.ProjectPaths, runID string) (string, error)
    RunLifecycleLabel names a run's persisted lifecycle for status views.

func RunsByStart(paths state.ProjectPaths) ([]string, error)
    RunsByStart lists a project's run IDs oldest first. Runs of one project
    never overlap, so start order is run order. Run IDs only have one-second
    resolution, so runs are ordered by their first load sample, which has
    nanoseconds, then by the summary's start time, then by run ID.

func Summary(paths state.ProjectPaths, runID string, store state.Store) (runlineage.RunSummary, error)
    Summary loads runID and describes it without comparing it to another run:
    counts, diagnosis counts, failure groups, and origins.