fix(db): surface silent partition catch-all collapse with warn + metric (#4033)
Summary
Fixes #4033.
Once a fresh deployment's initial migration boundary is crossed, ensure_future_partitions silently stops creating the "current month" partition. The migration's *_p_future catch-all already covers the range (FOR VALUES FROM ('2026-07-01') TO (MAXVALUE)), so every monthly CREATE PARTITION collides with Postgres 42P17 ("would overlap partition"). The collision was caught and logged at info, then treated as success — the monthly partition is never created, never recreated, and the only signal is an unsuppressable Postgres server-log line most operators never watch. Every row for the range keeps landing in the growing catch-all, defeating monthly pruning/archival/maintenance-by-boundary.
This is not an edge case: it recurs for every fresh install on/after the migration boundary month, and again at the next catch-all boundary for any host that hand-repairs it by re-basing.
Fix — Option B (smallest reviewable change)
The issue proposes two directions; this PR implements the low-risk one (operator-visible signal), leaving catch-all detach/reattach surgery as a follow-up:
is_partition_overlap_error— extracts the42P17/"would overlap partition"classification into a pure predicate, unit-testable without a live Postgres connection.info!→warn!on the overlap arm, with an explicit "monthly partition was NOT created" message naming the catch-all and the remedy (re-base or split), replacing the benign "range already covered" phrasing.buzz_db_partition_catchall_coveragecounter (labelled bytable) so the silent collapse is alertable independent of log level.- Still returns
Ok— the table remains write-safe and startup must not fail; only the observability changes.
Tests
overlap_predicate_classifies_42p17— PG-free predicate contract.catchall_metric_emits_under_local_recorder— verifies the counter emits with the correcttablelabel viametrics-util'sDebuggingRecorder.
buzz-db lib: 96 passed / 0 failed / 152 ignored (PG-gated) — no regressions.
Notes
- A real-Postgres reproducer (the
current_month_partition_is_never_created_once_a_future_catchall_exists#[sqlx::test]referenced in the issue) can land here or as a follow-up; it is PG-gated and skipped in this environment. The predicate + metric tests are PG-free and cover the changed logic.