mix threadline.verify_coverage (Threadline v0.11.2)

Copy Markdown View Source

Verifies that tables listed in application config have Threadline audit triggers installed, using the same catalog queries as Threadline.Health.trigger_coverage/1.

Configuration

Hosts must set a non-empty list of public table names (strings only):

config :threadline, :verify_coverage,
  expected_tables: ["users", "posts"]

Usage

mix threadline.verify_coverage
mix threadline.verify_coverage --schema=NAME

Prints a TABLE / STATUS report to stdout, then a line containing summary: with counts. Exits with status 1 if any expected table is missing or uncovered, or if Threadline.Health.trigger_findings/1 reports an :error finding for an expected table; exits 0 when all expected tables are covered and no expected table has an error finding.

Table names in output are public-schema metadata only (same scope as Health).

Findings gate

After the coverage report, this task also checks Threadline.Health.trigger_findings/1 and prints a FINDINGS section:

  • An :error finding for a table in :expected_tables fails the task (exit({:shutdown, 1})), the same as a missing or uncovered table.
  • An :error finding for a table not in :expected_tables is printed under a heading marking it as not gated, and never fails the task, so the positive-list contract stays intact.
  • :warning findings are always printed and never fail the task.

A malformed config :threadline, :trigger_capture stops the task with Mix.raise/1 before any findings are checked.

Schema scope

By default, this task verifies the "public" schema. Pass --schema=NAME to verify a non-public schema (e.g. mix threadline.verify_coverage --schema=tenant_42). NAME is validated at the edge (regex + pg_namespace lookup); invalid input exits 1 via Mix.raise/1.