Skip to content

refactor(message): remove dead to_delete intent flag#140

Merged
lesnik512 merged 1 commit into
mainfrom
refactor/remove-dead-to-delete-flag
Jul 17, 2026
Merged

refactor(message): remove dead to_delete intent flag#140
lesnik512 merged 1 commit into
mainfrom
refactor/remove-dead-to-delete-flag

Conversation

@lesnik512

Copy link
Copy Markdown
Member

What

Removes OutboxInnerMessage.to_delete — a stored intent flag set on every ack/terminal path but read by zero production code. dispatch_one branches on terminal_failure_reason then pending_delay_seconds; _flush_terminal/_terminal_has_dlq read terminal_failure_reason. to_delete was 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 the to_delete field + 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_deleterouted here as a plain terminal delete).
  • tests/test_unit.py — re-express the 16 to_delete assertions 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_seconds into a single Outcome value — was deliberately deferred: it touches the public DLQFailureReason contract and the documented branch-ordering invariant, and deserves its own review.

Verification

  • just test599 passed, Postgres 17, coverage 100.00% (message.py + subscriber/usecase.py both 100%)
  • just lint — ruff clean, ty: All checks passed

🤖 Generated with Claude Code

`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>
@lesnik512
lesnik512 merged commit 5a030dc into main Jul 17, 2026
7 checks passed
@lesnik512
lesnik512 deleted the refactor/remove-dead-to-delete-flag branch July 17, 2026 06:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant