Repository navigation
feat(serving): replay outbox + dead-letter behind ControlPlaneStore (ADR 0010 slice 3) - #133
Merged
Merged
Conversation
…ADR 0010 slice 3) Third rollout slice of ADR 0010: the replay outbox and dead-letter status transitions move behind the ControlPlaneStore port, preserving invariant 8 verbatim. Pure extraction — table DDL and SQL shapes are byte-compatible; no behavior change on the embedded (default) profile. - ControlPlaneStore gains claim_due_outbox_entries / get_pending_outbox_entry (reads), mark_outbox_sent / schedule_outbox_retry (invariant 8, one transaction each), enqueue_outbox_replay (the other invariant-8 half — EventReplayer.replay's dead-letter-update + outbox-insert), plus get_dead_letter_event_for_replay / dismiss_dead_letter_event / dead_letter_event_exists / get_dead_letter_event / list_dead_letter_events / get_dead_letter_stats for the router's read/write paths. - OutboxProcessor and EventReplayer gain an additive `store: ControlPlaneStore | None = None` kwarg; when omitted (every existing call site) they build a private embedded store from whichever conn/duckdb_path they already owned, preserving main.py's :memory:-vs-file dual-connection split verbatim. routers/deadletter.py resolves the app's shared store and passes it via store=, so it never reaches query_engine._conn directly. - ensure_outbox_table / ensure_dead_letter_table moved to control_plane/embedded.py. Unlike the webhook/alert log methods, the outbox/dead-letter write-transaction methods do NOT lazily ensure their tables — ensure_outbox_schema runs once at construction instead, matching pre-port timing exactly and keeping the fault-injection rollback tests (table-drop, connection-wrapper) meaningful. Tests: tests/unit/test_control_plane_store.py gains outbox/dead-letter coverage (claim ordering, mark-sent + rollback, retry/backoff/kafka-floor, replay enqueue + rollback, tenant-scoped reads, stats); structural ratchet extended to outbox.py/event_replayer.py/routers/deadletter.py; 6 test files' ensure_dead_letter_table imports rewired to the new module. Verified: full unit+property 1575 passed, mypy strict clean, ruff clean, targeted integration (test_outbox/test_deadletter/test_logical_correctness) 27 passed. Full integration suite re-run was interrupted by a tool error at session end — rerun tests/integration -m "not requires_docker and not live" before merging. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
brownjuly2003-code
force-pushed
the
feature/control-plane-slice3-outbox
branch
from
July 2, 2026 18:14
776e776 to
2919a5d
Compare
DORA Metrics
|
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
Third rollout slice of ADR 0010: the replay outbox and dead-letter status transitions move behind the
ControlPlaneStoreport, preserving invariant 8 verbatim (the outbox↔dead-letter transactional coupling). Pure extraction — table DDL and SQL shapes are byte-compatible; no behavior change on the embedded (default) profile.ControlPlaneStoregainsclaim_due_outbox_entries/get_pending_outbox_entry(reads),mark_outbox_sent/schedule_outbox_retry(invariant 8, one transaction each),enqueue_outbox_replay(the other invariant-8 half), plusget_dead_letter_event_for_replay/dismiss_dead_letter_event/dead_letter_event_exists/get_dead_letter_event/list_dead_letter_events/get_dead_letter_statsfor the router's read/write paths.OutboxProcessorandEventReplayergain an additivestore: ControlPlaneStore | None = Nonekwarg; when omitted (every existing call site) they build a private embedded store from whicheverconn/duckdb_paththey already owned — preservingmain.py's:memory:-vs-file dual-connection split verbatim.routers/deadletter.pyresolves the app's shared store and passes it viastore=, so it never reachesquery_engine._conndirectly.ensure_outbox_table/ensure_dead_letter_tablemoved tocontrol_plane/embedded.py. Unlike the webhook/alert log methods, the outbox/dead-letter write-transaction methods do NOT lazily ensure their tables —ensure_outbox_schemaruns once at construction instead, matching pre-port timing exactly and keeping the fault-injection rollback tests (table-drop, connection-wrapper) meaningful.Test plan
tests/unit/test_control_plane_store.py— new outbox/dead-letter coverage (claim ordering, mark-sent + rollback, retry/backoff/kafka-floor, replay enqueue + rollback, tenant-scoped reads, stats)outbox.py/event_replayer.py/routers/deadletter.pytest_outbox.py,test_deadletter.py,test_logical_correctness.py): 27 passedpytest tests/integration -m "not requires_docker and not live") — a re-run was interrupted by a tool error at the end of the authoring session. Rerun before merging; targeted runs of every touched file passed.🤖 Generated with Claude Code