Compares health coverage entries with the host's expected audited tables.
violations/2 finds missing or uncovered expected tables,
summary_counts/2 totals coverage, and partition_findings/2 separates
gated findings from the rest.
Intersection semantics: Only tables listed in expected_tables are
evaluated. Each must appear in the coverage list as {:covered, name}.
{:uncovered, name} for an expected name is a violation. If a name is not
present in the coverage list at all (e.g. typo or table outside the catalog
Health enumerates), that is reported as {:missing, name}.
An empty expected_tables list yields no violations; the Mix task fails
closed before invoking this module when the configured list is missing or empty.
Findings
partition_findings/2 sorts Threadline.Health.Finding structs into three
buckets so a CI gate can fail on the ones it is responsible for while still
surfacing everything else: :error findings on an expected table gate the
task, :error findings on a table the host never listed are informational
only, and :warning findings never fail the task regardless of table.
Summary
Types
A coverage entry accepted from Threadline.Health.trigger_coverage/1.
Findings divided into gated errors, other errors, and warnings.
Counts of expected, covered, and violated table names.
A violation kind and the expected table name that caused it.
Functions
Partitions Threadline.Health.Finding structs into gated, not-gated and
warning buckets, given the host's expected-table positive list.
Returns counts of unique expected tables, tables without violations, and violations.
Returns a sorted list of violations for tables the host expects to be covered.
Types
@type coverage_entry() :: Threadline.Health.coverage_entry()
A coverage entry accepted from Threadline.Health.trigger_coverage/1.
@type partitioned_findings() :: %{ gated: [Threadline.Health.Finding.t()], not_gated: [Threadline.Health.Finding.t()], warnings: [Threadline.Health.Finding.t()] }
Findings divided into gated errors, other errors, and warnings.
@type summary_result() :: %{ expected: non_neg_integer(), covered: non_neg_integer(), violated: non_neg_integer() }
Counts of expected, covered, and violated table names.
@type violation() :: {:missing | :uncovered, String.t()}
A violation kind and the expected table name that caused it.
Functions
@spec partition_findings([Threadline.Health.Finding.t()], [String.t()]) :: partitioned_findings()
Partitions Threadline.Health.Finding structs into gated, not-gated and
warning buckets, given the host's expected-table positive list.
:gated—:errorfindings whosetableis inexpected_tables. These are the findings a CI gate must fail on.:not_gated—:errorfindings whosetableis not inexpected_tables. Printed for visibility; never fails the task.:warnings— every:warningfinding, regardless of table.
Each bucket keeps the input list's order. Pure; does not read the database
or call Mix.raise.
@spec summary_counts([coverage_entry()], [String.t()]) :: summary_result()
Returns counts of unique expected tables, tables without violations, and violations.
Returns
- A
summary_result()with the expected, covered, and violated counts.
@spec violations([coverage_entry()], [String.t()]) :: [violation()]
Returns a sorted list of violations for tables the host expects to be covered.
coverage contains entries from Threadline.Health.trigger_coverage/1.
expected_tables is a list of table-name strings; duplicates are ignored.
Returns
- A sorted list of
violation()values. Missing and uncovered tables are included.