Implement P05 checked services and safe selected delivery recovery
All checks were successful
CI Smoke / host-smoke (push) Successful in 0s
CI Smoke / container-smoke (push) Successful in 1s
Build and Publish Container Image / build-and-push (push) Successful in 19s
Account journey acceptance / journeys (push) Successful in 5s

Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a092fe-13b1-7f12-ac74-7d258af4d79c
This commit is contained in:
tegwick 2026-09-13 22:11:49 +02:00
parent 99618488e0
commit ac0eb14b75
15 changed files with 735 additions and 88 deletions

View file

@ -92,3 +92,16 @@ class PostgresJourneyTests(unittest.TestCase):
self.assertIsNone(second.user(u.user_id))
self.seed.commit()
self.assertEqual(u,second.user(u.user_id))
def test_two_connections_deliver_one_event_once(self):
from user_engine.domain import OutboxEvent
event=OutboxEvent(event_id='p05-concurrent',event_type='membership.added',aggregate_id='fixture',tenant=self.tenant,correlation_id='p05',payload={})
service=self.service(self.seed)
with service.store.transaction():service.store.append_outbox(event)
services=[self.service(self.connect()),self.service(self.connect())]
barrier=Barrier(2);calls=[]
def run(service):
barrier.wait(timeout=5)
return service.deliver_outbox(self.actor,lambda e:calls.append(e.event_id),worker_id='fixture',event_id=event.event_id)
with ThreadPoolExecutor(max_workers=2) as pool:list(pool.map(run,services))
self.assertEqual(['p05-concurrent'],calls)