fix: resolve 16 confirmed bugs from the 2026-06-12 code audit (B1–B16)#61
Merged
Conversation
Data integrity / delivery: - B5/B6/B7: reject-fallback trap — MANUAL+exception, NackMessage(delay=) kwargs, and retry-strategy errors no longer DELETE a row. assert_state_set nacks (honors retry) when an exception is present; ack/nack/reject accept and ignore **options; a raising strategy degrades to retry_terminal; ExponentialRetry clamps the exponent to avoid OverflowError. - B8: publish_batch no longer drops a leading/sole None body (OutboxPublishCommand overrides batch_bodies to keep every positional body). - B10: DLQ CTE and validate_schema are schema-aware (format_table / MetaData(schema=...)) — schema-qualified deployments no longer hit UndefinedTable. Liveness / health: - B1/B2/B3/B4: fetch loop halts on drain (no churn/livelock), start() resets _stopping, backoff resets after sustained uptime, LISTEN connection closed on add_listener failure/cancel. - B11/B12: ping() walks the subscribers property (router subs) and honors its timeout via anyio.move_on_after. Metrics / packaging: - B9: Prometheus in-process gauge no longer goes negative (dec gated on duration_seconds). - B13: missing-extra ImportErrors are reachable (guarded container import / import-time friendly errors). Test broker: - B14/B15/B16: loops spawn once, loop tasks are cancelled on context exit, fake fetch_unprocessed accepts limit=. Each fix ships a regression test. Full dockerized suite: 423 passed, 100% coverage; ruff + ty clean. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The friendly "requires the X extra" install hint was duplicated in each middleware module — once in the import-time guard, once in the __init__ probe guard. Centralize the template in missing_extra_message() so the two guards can't drift. Imported as a function (not a module constant) to keep the guarded upstream import first without tripping E402. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes all 16 confirmed bugs from the 2026-06-12 code audit (
planning/active/2026-06-12-code-audit-findings.md). Each fix ships a regression test that fails on the pre-fix code. Suspected findings, test-holes, and improvements (P1–P35) are intentionally out of scope for this PR.Data integrity / delivery
AckPolicy.MANUAL+ a handler exception,raise NackMessage(delay=…)kwargs, and retry-strategy errors no longer silentlyDELETEa row.assert_state_setnow nacks (honoring the retry strategy) when an exception is present;ack/nack/rejectaccept-and-ignore**options; a raising strategy degrades toretry_terminal;ExponentialRetryclamps the exponent to avoidOverflowError.publish_batchno longer drops a leading/soleNonebody (OutboxPublishCommandoverridesbatch_bodiesto keep every positional body).validate_schemaare schema-aware (format_table/MetaData(schema=...));MetaData(schema="app")deployments no longer hitUndefinedTableon every terminal failure.Liveness / health
start()resets_stopping, backoff resets after sustained uptime, and the LISTEN connection is closed whenadd_listenerfails or is cancelled.ping()walks thesubscribersproperty (so router-registered subscribers are checked) and honors itstimeoutviaanyio.move_on_after.Metrics / packaging
.dec()is gated onduration_seconds, absent on themax_deliveriesterminal).ImportErrors are now reachable (probe-guarded container import inmetrics/prometheus.py; import-time friendly errors on the native middleware).Test broker
fetch_unprocessedacceptslimit=.Test Plan
ruff format+ruff check+ty checkclean🤖 Generated with Claude Code