Threadline.OperatorSurface.Coverage.Snapshot (Threadline v0.5.0)

Copy Markdown View Source

Snapshot of Threadline.Health.trigger_coverage/1 results for the operator surface coverage dashboard and surface-header pill.

Held on socket.assigns.:threadline_coverage and refreshed by Threadline.OperatorSurface.Coverage.OnMount on a 30-second interval (configurable; floor 5_000 ms — see D-30a).

This module is pure stdlib — NO Code.ensure_loaded?(Phoenix.LiveView) file-scope gate (D-36). The struct is consumed by the LV-gated dashboard AND will be consumed by future Mix-task surfaces (mix threadline.health.coverage).

Summary

Functions

Empty snapshot — used when on_mount cannot fetch initial coverage and there is no previous Snapshot to fall back on (e.g. very first render under error).

Types

bucket()

@type bucket() :: :covered | :uncovered | :expected_uncovered

t()

@type t() :: %Threadline.OperatorSurface.Coverage.Snapshot{
  covered_count: non_neg_integer(),
  error: String.t() | nil,
  expected_uncovered_count: non_neg_integer(),
  last_checked_at: DateTime.t() | nil,
  tables: [{bucket(), [String.t()]}],
  uncovered_count: non_neg_integer()
}

Functions

empty(last_checked_at \\ nil)

Empty snapshot — used when on_mount cannot fetch initial coverage and there is no previous Snapshot to fall back on (e.g. very first render under error).

from_coverage(coverage, opts \\ [])

from_coverage/2 — builds a Snapshot from a Threadline.Health.trigger_coverage/1 result list.

:last_checked_at is read from opts (defaults to DateTime.utc_now/0).