Skip to content

Add initial implementation of the Outbox pattern with database integration and serializers.#1

Merged
gustavofreze merged 3 commits into
mainfrom
feature/develop
May 14, 2026
Merged

Add initial implementation of the Outbox pattern with database integration and serializers.#1
gustavofreze merged 3 commits into
mainfrom
feature/develop

Conversation

@gustavofreze
Copy link
Copy Markdown
Member

No description provided.

gustavofreze and others added 2 commits May 14, 2026 01:04
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings May 14, 2026 04:07
@github-advanced-security
Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Introduces the first end-to-end implementation of a transactional outbox write-side adapter for the tiny-blocks ecosystem, including Doctrine DBAL persistence, configurable schema layout, payload/snapshot serialization, and a comprehensive test/tooling setup.

Changes:

  • Adds DoctrineOutboxRepository plus supporting schema, SQL-building, and exception types for persisting outbox records inside an existing transaction.
  • Introduces payload and snapshot serialization abstractions (including reflection-based defaults) with JSON validation.
  • Adds integration/unit tests (including Docker-backed MySQL) plus CI/static-analysis configuration and expanded README documentation.

Reviewed changes

Copilot reviewed 65 out of 66 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
tests/OutboxTableFactory.php Test helper to create outbox tables for integration tests.
tests/Models/RefundIssued.php Test domain event fixture.
tests/Models/OrderPlaced.php Test domain event fixture.
tests/Models/OrderId.php Test aggregate identity fixture.
tests/Models/Order.php Test aggregate fixture producing events/snapshots.
tests/Models/EventRecordFactory.php Test factory for building deterministic EventRecords.
tests/Mocks/RefundIssuedSerializer.php Test payload serializer for refund events.
tests/Mocks/OrderPlacedSerializer.php Test payload serializer for order events.
tests/Mocks/InvalidSnapshotSerializer.php Test snapshot serializer producing invalid JSON.
tests/Mocks/InvalidPayloadSerializer.php Test payload serializer producing invalid JSON.
tests/Mocks/InMemoryOutboxRepositoryMock.php In-memory outbox repository test double.
tests/Mocks/FallbackOrderPlacedSerializer.php Secondary serializer used to test “first match wins”.
tests/Mocks/DriverExceptionStub.php Test stub for DBAL driver exception plumbing.
tests/Mocks/CustomOrderSnapshotSerializer.php Test snapshot serializer producing custom JSON.
tests/IntegrationTestCase.php Base class for DB-backed integration tests with cleanup.
tests/InMemoryOutboxRepositoryTest.php Unit tests for in-memory repository behavior.
tests/DoctrineOutboxRepositoryTest.php Integration + unit-style tests for Doctrine repository behavior.
tests/Database.php Docker-based MySQL test database bootstrap.
tests/bootstrap.php PHPUnit bootstrap that starts the database container.
src/Serialization/SnapshotSerializers.php Collection wrapper to locate snapshot serializers.
src/Serialization/SnapshotSerializerReflection.php Default reflection snapshot serializer.
src/Serialization/SnapshotSerializer.php Snapshot serializer interface.
src/Serialization/SerializedSnapshot.php Value object for validated snapshot JSON.
src/Serialization/SerializedPayload.php Value object for validated payload JSON.
src/Serialization/PayloadSerializers.php Collection wrapper to locate payload serializers.
src/Serialization/PayloadSerializerReflection.php Default reflection payload serializer.
src/Serialization/PayloadSerializer.php Payload serializer interface.
src/Schema/UniqueConstraint.php Encapsulates configured unique constraint name detection.
src/Schema/TableLayout.php Public schema configuration object (table/columns/constraint).
src/Schema/IdentityColumnType.php Enum for BINARY vs STRING identity storage.
src/Schema/Columns.php Column-name configuration object.
src/OutboxRepository.php Public outbox repository contract.
src/Internal/TableLayoutBuilder.php Internal builder for TableLayout.
src/Internal/StringIdentityColumn.php Converts identities to string for SQL bindings.
src/Internal/OutboxInsert.php Builds INSERT SQL + parameter bindings from a record.
src/Internal/IdentityColumn.php Base identity-column abstraction.
src/Internal/ColumnsBuilder.php Internal builder for Columns.
src/Internal/BinaryIdentityColumn.php Converts UUID strings to 16-byte binary.
src/Exceptions/SnapshotSerializerNotConfigured.php Public exception for missing snapshot serializer.
src/Exceptions/PayloadSerializerNotConfigured.php Public exception for missing payload serializer.
src/Exceptions/OutboxRequiresActiveTransaction.php Public exception for missing active transaction.
src/Exceptions/InvalidSnapshotJson.php Public exception for invalid snapshot JSON.
src/Exceptions/InvalidPayloadJson.php Public exception for invalid payload JSON.
src/Exceptions/DuplicateOutboxEvent.php Public exception for duplicate event id insertion.
src/Exceptions/DuplicateAggregateSequence.php Public exception for duplicate aggregate sequence insertion.
src/DoctrineOutboxRepository.php Doctrine DBAL-backed OutboxRepository implementation.
README.md Full library documentation and usage examples.
phpunit.xml PHPUnit configuration with coverage outputs.
phpstan.neon.dist PHPStan configuration (level 9).
Makefile Dev/test/review helper targets via Docker.
infection.json.dist Infection mutation testing configuration.
composer.json Package metadata, deps, and scripts.
.gitignore Ignores vendor, reports, caches, IDE dirs.
.github/workflows/codeql.yml CodeQL security workflow configuration.
.github/workflows/ci.yml CI pipeline for install, review, and tests.
.github/workflows/auto-assign.yml Auto-assign workflow for issues/PRs.
.github/dependabot.yml Dependabot configuration for Composer and Actions.
.github/copilot-instructions.md Repository Copilot instruction pointer.
.gitattributes Export-ignore rules for Packagist tarball.
.editorconfig Editor configuration for consistent formatting.
.claude/rules/php-library-testing.md Testing conventions (BDD structure, PHPUnit rules).
.claude/rules/php-library-modeling.md Library modeling/public API boundary rules.
.claude/rules/php-library-documentation.md Documentation standards for README and docs.
.claude/rules/php-library-code-style.md Project-wide PHP code style and design rules.
.claude/rules/github-workflows.md GitHub Actions workflow standards for this repo.
.claude/CLAUDE.md High-level project conventions and command list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/Internal/OutboxInsert.php
Comment thread .github/workflows/codeql.yml
Comment thread src/OutboxRepository.php
Comment thread .github/workflows/ci.yml
Comment thread .github/workflows/auto-assign.yml
@gustavofreze gustavofreze merged commit 47b2e53 into main May 14, 2026
6 checks passed
@gustavofreze gustavofreze deleted the feature/develop branch May 14, 2026 04:20
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.

3 participants