Adopt IntegrationEvent pipeline in outbox persistence.#4
Merged
Conversation
PayloadSerializer now receives IntegrationEventRecord instead of EventRecord, and DoctrineOutboxRepository gains a required IntegrationEventTranslators parameter. Domain events without a registered translator are silently skipped, making translator registration the explicit opt-in for cross-context publication. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Pull request overview
This pull request updates the outbox persistence pipeline to operate on integration events (translated from domain events) before payload serialization and insertion, aligning the library with the IntegrationEvent* abstractions from tiny-blocks/building-blocks v4.
Changes:
- Introduces an
IntegrationEventTranslatorsstep in repository implementations; domain events without a matching translator are silently skipped. - Updates payload serialization to work with
IntegrationEventRecord(including reflection serializer and serializer resolution). - Refreshes unit/integration tests and README documentation to demonstrate and validate the new translation + serialization flow, and bumps
tiny-blocks/building-blocksto^4.0.
Reviewed changes
Copilot reviewed 22 out of 22 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/Unit/OrderPlacedSerializer.php | Updates test serializer fixture to accept IntegrationEventRecord. |
| tests/Unit/InvalidPayloadSerializer.php | Updates invalid-JSON serializer fixture to accept IntegrationEventRecord. |
| tests/Unit/InMemoryOutboxRepositoryTest.php | Adds translator wiring in unit tests; adds coverage for “no translator => skip”. |
| tests/Unit/InMemoryOutboxRepositoryMock.php | Implements translation step in the in-memory repository test double. |
| tests/Models/RefundIssuedTranslator.php | Adds a test translator mapping a domain event to an integration event. |
| tests/Models/RefundCompleted.php | Adds a test integration event used by refund translation tests. |
| tests/Models/OrderShipped.php | Adds a test integration event used by order translation tests. |
| tests/Models/OrderPlacedTranslator.php | Adds a test translator mapping OrderPlaced domain event to OrderShipped integration event. |
| tests/Integration/RefundIssuedSerializer.php | Updates integration serializer fixture to accept IntegrationEventRecord. |
| tests/Integration/FallbackOrderPlacedSerializer.php | Updates fallback serializer fixture to accept IntegrationEventRecord. |
| tests/Integration/DuplicateOrderShipped.php | Adds an integration event used to validate “first translator wins”. |
| tests/Integration/DuplicateOrderPlacedTranslator.php | Adds a second translator supporting the same domain event for precedence tests. |
| tests/Integration/DoctrineOutboxRepositoryTest.php | Updates repository construction + assertions to validate translation/skip/precedence behavior. |
| src/Serialization/SerializedPayload.php | Reorders factory methods (no functional change) to match style/ordering. |
| src/Serialization/PayloadSerializers.php | Resolves serializers against IntegrationEventRecord instead of EventRecord. |
| src/Serialization/PayloadSerializerReflection.php | Reflective serializer now serializes the integration event payload. |
| src/Serialization/PayloadSerializer.php | Public serializer contract now targets IntegrationEventRecord. |
| src/OutboxRepository.php | Updates contract docs to define translation + skip semantics as part of persistence. |
| src/Internal/OutboxInsert.php | Inserts now use IntegrationEventRecord fields (event type/revision from integration event). |
| src/DoctrineOutboxRepository.php | Adds translation step and persists translated integration event records. |
| README.md | Documents the translation pipeline and how to declare/register integration events + translators. |
| composer.json | Bumps tiny-blocks/building-blocks to ^4.0 and adds “integration-events” keyword. |
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
What this pull request does.
Related issue
Closes #...
Checklist
composer reviewpasses.composer testspasses.