Skip to content

fix: resolve the event store connection at call time - #13

Merged
Claw666 merged 1 commit into
mainfrom
ID-225-connection-aware-event-store
Aug 18, 2026
Merged

Claw666 merged 1 commit into
mainfrom
ID-225-connection-aware-event-store

Conversation

@Claw666

@Claw666 Claw666 commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • SqlEventStore accepts a Closure(): PDO and resolves it on every call, so add() joins whichever transaction the caller has open instead of writing the event on a second session
  • Previously a fixed PDO meant the event row committed independently of the business change it described: a consumer could see the event before the row it referred to existed, or after that row rolled back
  • Optional schema qualifies the outbox tables (platform.event_outbox) for when the inserting connection's default schema is not the outbox's
  • Each method resolves the connection once into a local, so a closure cannot hand back a different handle part-way through a transaction
  • Constructor still accepts a bare PDO, so existing consumers are unaffected

🤖 Generated with Claude Code

- SqlEventStore accepts a Closure(): PDO so add() joins whichever transaction
  the caller has open, instead of committing the event on a second session
  independently of the business change it describes
- Add an optional schema so the outbox tables can be qualified when they live
  outside the calling connection's default schema
- Resolve the connection once per method so a closure cannot hand back a
  different handle mid-transaction
@Claw666
Claw666 merged commit 979152c into main Aug 18, 2026
1 check passed
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.

2 participants