refactor(message): remove dead to_delete intent flag#140
Merged
Conversation
`OutboxInnerMessage.to_delete` was set on every ack/terminal path but read by zero production code: `dispatch_one` branches on `terminal_failure_reason` then `pending_delay_seconds`, and `_flush_terminal`/`_terminal_has_dlq` read `terminal_failure_reason`. The flag was a misleading third field a maintainer could edit while changing nothing. Remove the field and its 5 assignments; re-express the 16 test assertions on the live decision inputs the dispatcher actually reads (`terminal_failure_reason` / `pending_delay_seconds`), so the tests now pin the real outcome. Reword the one stale comment/docstring that named the flag. Behavior-preserving. Full suite green (599 passed, coverage 100%), just lint + ty clean. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This was referenced Jul 17, 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.
What
Removes
OutboxInnerMessage.to_delete— a stored intent flag set on every ack/terminal path but read by zero production code.dispatch_onebranches onterminal_failure_reasonthenpending_delay_seconds;_flush_terminal/_terminal_has_dlqreadterminal_failure_reason.to_deletewas a misleading third field a maintainer could edit while changing nothing.From the architecture-deepening review (candidate #2). Behavior-preserving — removing a stored field with no readers cannot change runtime behavior.
Changes
message.py— drop theto_deletefield + its 5 assignments (_ack,_nack×2,_reject,allow_delivery); every neighboring line (terminal_failure_reason,pending_delay_seconds,state_set,_record_attempt()) untouched. Fix the class docstring's intent-flag list.subscriber/usecase.py— reword one stale comment that referenced the flag (terminal=True via to_delete→routed here as a plain terminal delete).tests/test_unit.py— re-express the 16to_deleteassertions on the fields the dispatcher actually branches on (terminal_failure_reason/pending_delay_seconds). The tests now pin the real outcome rather than a dead proxy. Four assertions were dropped where the adjacent line already asserts the exact reason (no intent or coverage lost).Scope note
This is the delete-only "dead-flag collapse." The larger option from the review — folding
terminal_failure_reason+pending_delay_secondsinto a singleOutcomevalue — was deliberately deferred: it touches the publicDLQFailureReasoncontract and the documented branch-ordering invariant, and deserves its own review.Verification
just test— 599 passed, Postgres 17, coverage 100.00% (message.py+subscriber/usecase.pyboth 100%)just lint— ruff clean,ty: All checks passed🤖 Generated with Claude Code