Threadline.Health.Policy (Threadline v1.0.0)

Copy Markdown View Source

Validates :expected_uncovered_tables and :audit_anyway configuration for Threadline.Health.trigger_coverage/1's third bucket.

Adopters typically configure:

config :threadline, :health,
  expected_uncovered_tables: ["oban_jobs", "oban_peers", "oban_producers"],
  audit_anyway: []

Validate at boot in application.ex to fail loud on bad config:

Threadline.Health.Policy.validate!(Application.get_env(:threadline, :health, []))

Lazy validation at first poll tick is supported but discouraged in production — a delay between release and first dashboard tick can hide config errors.

Summary

Types

The keyword-list or map form accepted by validate!/1.

A health policy configuration entry containing a list of table names.

Functions

Returns :ok after validating :expected_uncovered_tables and :audit_anyway config, or raises ArgumentError when the config is invalid.

Types

config()

@type config() ::
  [config_opt()]
  | %{
      optional(:expected_uncovered_tables) => [String.t()],
      optional(:audit_anyway) => [String.t()]
    }

The keyword-list or map form accepted by validate!/1.

config_opt()

@type config_opt() ::
  {:expected_uncovered_tables, [String.t()]} | {:audit_anyway, [String.t()]}

A health policy configuration entry containing a list of table names.

Functions

validate!(opts)

@spec validate!(config()) :: :ok

Returns :ok after validating :expected_uncovered_tables and :audit_anyway config, or raises ArgumentError when the config is invalid.

Accepts a keyword list or a map, matching the dual-form intake used by capture-time redaction validation.

Raises ArgumentError on:

  • non-binary entries inside either list
  • duplicate entries inside either list
  • unknown top-level keys
  • non-keyword / non-map input shape