Layered diagnostics for verifying AshBilling structural contracts, PostgreSQL
schema readiness, and optional read-only provider connectivity.
Diagnostics are divided into three independent layers:
:structural— Pure static checks on Ash resources, attributes, relationships, calculations, identities, write-protection, private exposure ofWebhookEvent, single-Repo compatibility, multitenancy alignment, deduplication strategy, credential prefixes (without printing secrets), and HTTP timeout configuration.:database(opt-in viacheck_database?: true) — Read-only PostgreSQL connectivity, required tables and columns (including0.6.0last_reconciled_atand0.7.0quantity/provider_subscription_item_id), critical unique indexes, and optional non-negative quantity check constraint.:provider(opt-in viacheck_provider?: true) — Optional read-only provider probe (StripeGET /v1/balanceby default) confirming reachability and livemode alignment without exposing credentials.
configuration_valid and production_ready are deliberately separate booleans:
a configuration with no failures (configuration_valid: true) is not marked
production_ready: true if warnings remain (such as in-memory deduplication,
unbounded HTTP retry/timeout defaults, unverified database schema, or missing
expected_livemode).
Summary
Functions
Formats a diagnostics report as human-readable text with PASS, WARN, and FAIL statuses.
Runs diagnostics and returns a structured, JSON-serializable report.
Types
@type layer() :: :structural | :database | :provider
@type report() :: %{ status: status(), configuration_valid: boolean(), production_ready: boolean(), summary: %{ pass: non_neg_integer(), warn: non_neg_integer(), fail: non_neg_integer() }, layers: %{structural: [check()], database: [check()], provider: [check()]}, checks: [check()] }
@type status() :: :pass | :warn | :fail
Functions
Formats a diagnostics report as human-readable text with PASS, WARN, and FAIL statuses.
Runs diagnostics and returns a structured, JSON-serializable report.
Options
:customer_resource- Ash customer resource module.:subscription_resource- Ash subscription resource module.:deduplication_resource/:webhook_event_resource- Ash webhook event resource module.:deduplication_strategy-:resourceor:memory(defaults to application config or:resourcewhen:deduplication_resourceis provided).:api_key- Provider API key (format checked only; never echoed).:webhook_secret- Webhook signing secret (format checked only; never echoed).:expected_livemode- Optional boolean (true/false) for Stripe webhook mode binding.:stripe_account- Optional Connect account ID.:req_opts/:req_options- Outbound HTTPReqoptions to validate bounded timeouts and retry settings.:check_database?- Whentrue, executes read-only PostgreSQL connectivity, column, and index checks. Defaults tofalse.:check_provider?- Whentrue, executes a read-only provider connectivity/livemode probe. Defaults tofalse.:provider_check_fun- Optional 1-arity function(opts) -> {:ok, %{livemode: boolean()}} | {:error, term()}for custom providers or testing.