Read-only audit of flow and step slugs against the pgflow 0.17.2 rules.
PgFlow.Slug is the reference implementation. The SQL here must agree with
it, and it must not call pgflow.is_valid_slug/1: on core V02 that function
still implements the old rule. The same SQL text feeds mix pgflow.audit_slugs,
the core V03 pre-flight block, and the tests.
The audit never renames slugs. Fix each finding, then upgrade. See
docs/UPGRADING_UPSTREAM_2026_10.md.
Summary
Functions
Selects kind, flow_slug, step_slug, and reason for every 0.17.2 violation.
DO block that raises check_violation listing every offender.
The statement run/2 issues before reading findings.
CASE expression that returns the PgFlow.Slug reason as text, or NULL when valid.
Boolean SQL for one slug expression, in the same order as PgFlow.Slug.validate/1.
Returns slug findings for the given repo.
Types
@type kind() :: :flow | :step | :step_collision
@type reason() ::
:empty
| :too_long
| :bad_chars
| :reserved
| :bad_start
| :bad_end
| :double_underscore
| :queue_name_too_long
| :case_insensitive_duplicate
Functions
Selects kind, flow_slug, step_slug, and reason for every 0.17.2 violation.
prefix must match ~r/\A[a-z_][a-z0-9_]*\z/ and is inserted as a quoted identifier.
DO block that raises check_violation listing every offender.
Installed databases are never rewritten. The hint points at
mix pgflow.audit_slugs and docs/UPGRADING_UPSTREAM_2026_10.md.
@spec read_only_statement() :: String.t()
The statement run/2 issues before reading findings.
CASE expression that returns the PgFlow.Slug reason as text, or NULL when valid.
Boolean SQL for one slug expression, in the same order as PgFlow.Slug.validate/1.
expr is interpolated, so it must be a trusted SQL expression such as $1
or a column name. This does not call pgflow.is_valid_slug/1.
Returns slug findings for the given repo.
Issues SET TRANSACTION READ ONLY as the first statement of a transaction, then
reads findings_sql/1. A caller already inside a transaction that has run
statements (the Ecto SQL sandbox) makes PostgreSQL reject that command with
25001. The savepoint is rolled back and the same read-only SELECT runs
in the caller's transaction. mix pgflow.audit_slugs opens a fresh
transaction, so that path stays read only.
Flow rows omit a nil step_slug so the finding map matches the audit tests.