Shared rule scaffolding: the migration-local fold, message construction, finding assembly.
Summary
Functions
Finding assembly for every check, in-fold or global. source names where
the finding anchors: a %Migration{} (only its .file is read — pass the
struct whenever one is in hand), a bare file path for callers that only
hold a path, or nil for a global finding about no file at all (e.g.
snapshot age). Defaults: relations [], engine nil, metadata %{}.
The migration-local fold: judges each operation against the catalog as the
operations before it leave it — fun.(op, catalog) returns the findings
for one operation, then the op is applied via Catalog.apply/2 so later
ops in the same migration see the overlay.
Functions
@spec describe_scale(Cerbero.Catalog.t(), String.t()) :: String.t()
@spec finding( module(), Cerbero.Finding.severity(), String.t(), Cerbero.Migration.t() | String.t() | nil, integer() | nil, keyword() ) :: Cerbero.Finding.t()
Finding assembly for every check, in-fold or global. source names where
the finding anchors: a %Migration{} (only its .file is read — pass the
struct whenever one is in hand), a bare file path for callers that only
hold a path, or nil for a global finding about no file at all (e.g.
snapshot age). Defaults: relations [], engine nil, metadata %{}.
@spec fold_operations(Cerbero.Migration.t(), Cerbero.Catalog.t(), (term(), Cerbero.Catalog.t() -> [ Cerbero.Finding.t() ])) :: [ Cerbero.Finding.t() ]
The migration-local fold: judges each operation against the catalog as the
operations before it leave it — fun.(op, catalog) returns the findings
for one operation, then the op is applied via Catalog.apply/2 so later
ops in the same migration see the overlay.
@spec human_rows(non_neg_integer()) :: String.t()
@spec stats_date(Cerbero.Catalog.t(), String.t()) :: String.t() | nil