defmodule Bloccs.Web.Panels.Coverage do
@moduledoc """
Panel 4 — structural coverage. Records a run (or loads a `.bloccs-trace`),
derives the reached obligations with `Bloccs.Web.Coverage`, and overlays them
on the topology graph (reached nodes/edges lit) alongside a summary bar and the
list of unreached obligations. Trace export sits behind the `:trace_export`
feature (the Pro seam) — enabled in the open build.
"""
use Bloccs.Web, :html
import Bloccs.Web.Components.Graph
alias Bloccs.Web.{Access, Coverage}
attr :network, :any, required: true
attr :base_path, :string, required: true
attr :features, :any, required: true
attr :coverage, :any, default: nil
attr :recording, :boolean, default: false
attr :upload, :any, default: nil
def render(assigns) do
~H"""
No coverage yet.
Record a run while messages flow through the network, or load a Coverage
{source_label(@coverage.source)}
.bloccs-trace
file, to see which ports and edges were exercised.
✓ Full structural coverage — every port and edge was exercised.
""" end defp label({:port_in, node, port}), do: "in · #{node}.#{port}" defp label({:port_out, node, port}), do: "out · #{node}.#{port}" defp label({:edge, {fn_, fp}, {tn, tp}}), do: "edge · #{fn_}.#{fp} → #{tn}.#{tp}" defp source_label(:recording), do: "from a recorded run" defp source_label(:trace), do: "from a loaded .bloccs-trace" defp source_label(_), do: "" end