Skip to content

refactor: Use OutboxEventStore for IEventOutbox DI#369

Merged
samtrion merged 1 commit intomainfrom
chore/removed-complexity
Apr 13, 2026
Merged

refactor: Use OutboxEventStore for IEventOutbox DI#369
samtrion merged 1 commit intomainfrom
chore/removed-complexity

Conversation

@samtrion
Copy link
Copy Markdown
Contributor

@samtrion samtrion commented Apr 13, 2026

Remove direct registration and usage of provider-specific IEventOutbox implementations (EntityFrameworkOutbox, SqlServerEventOutbox, PostgreSqlEventOutbox, SQLiteEventOutbox) from the public API and DI setup. Instead, always register OutboxEventStore as the IEventOutbox implementation. Update extension method docs and tests to reflect this change. Delete provider-specific IEventOutbox classes and their unit tests. This enforces OutboxEventStore as the single entry point for event outbox operations, simplifying the API and reducing coupling to provider-specific types.

Summary by CodeRabbit

  • Refactor

    • Consolidated database-specific outbox event storage implementations into a unified outbox service for improved maintainability and consistency across all supported platforms.
    • Updated service registration to use the new unified implementation with no changes to the public API or end-user functionality.
    • Refreshed internal documentation to reflect the updated architecture.
  • Tests

    • Removed legacy unit tests for database-specific implementations.
    • Updated remaining tests to verify the new unified service registration behavior.

Remove direct registration and usage of provider-specific IEventOutbox implementations (EntityFrameworkOutbox, SqlServerEventOutbox, PostgreSqlEventOutbox, SQLiteEventOutbox) from the public API and DI setup. Instead, always register OutboxEventStore as the IEventOutbox implementation. Update extension method docs and tests to reflect this change. Delete provider-specific IEventOutbox classes and their unit tests. This enforces OutboxEventStore as the single entry point for event outbox operations, simplifying the API and reducing coupling to provider-specific types.
@samtrion samtrion self-assigned this Apr 13, 2026
@samtrion samtrion requested a review from a team as a code owner April 13, 2026 17:53
@samtrion samtrion added state:ready for merge Indicates that a pull request has been reviewed and approved, and is ready to be merged into the mai type:chore Indicates some housework that needs to be done. labels Apr 13, 2026
@samtrion samtrion requested a review from benwirren April 13, 2026 17:53
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai bot commented Apr 13, 2026

Walkthrough

The pull request removes database-specific IEventOutbox implementations across all supported providers (Entity Framework Core, PostgreSQL, SQLite, and SQL Server) and consolidates the outbox event storage responsibility into a unified OutboxEventStore component. Service registration methods are updated accordingly, and the corresponding unit test suites for the removed implementations are deleted. Test assertions verifying implementation types are updated to reference the new common implementation.

Changes

Cohort / File(s) Summary
Service Registration Updates
src/NetEvolve.Pulse.EntityFramework/EntityFrameworkExtensions.cs, src/NetEvolve.Pulse.SqlServer/SqlServerExtensions.cs
Refactored AddOutbox() service chains to remove/re-register only repository and management services; IEventOutbox now relies on OutboxEventStore as the default scoped implementation. XML documentation updated to reference OutboxEventStore instead of database-specific classes.
Deleted IEventOutbox Implementations
src/NetEvolve.Pulse.EntityFramework/Outbox/EntityFrameworkOutbox.cs, src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlEventOutbox.cs, src/NetEvolve.Pulse.SQLite/Outbox/SQLiteEventOutbox.cs, src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerEventOutbox.cs
Removed all database-specific IEventOutbox implementations (constructor, StoreAsync method, and related validation/serialization logic) totaling ~594 lines of code.
Deleted Test Suites
tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkEventOutboxTests.cs, tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlEventOutboxTests.cs, tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteEventOutboxTests.cs, tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerEventOutboxTests.cs
Removed unit test classes validating constructor arguments and StoreAsync behavior for each deleted outbox implementation, including test events and mock schemas.
Test Assertion Updates
tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerExtensionsTests.cs
Updated two test assertions to verify that IEventOutbox is implemented by OutboxEventStore rather than SqlServerEventOutbox.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Poem

🐰 With whiskers twitching, this rabbit did spy
Four outbox friends must now say goodbye,
One unified store takes their place with grace,
As consolidation quickens the pace! 🎯✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 25.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main refactoring objective: consolidating IEventOutbox implementations to use OutboxEventStore exclusively across all DI registrations.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerExtensionsTests.cs (1)

72-81: ⚠️ Potential issue | 🟡 Minor

These assertions don't actually prove AddSqlServerOutbox() wires IEventOutbox.

Both tests pre-register IEventOutbox via AddOutbox(), so they still pass even if AddSqlServerOutbox(...) forgets to add the shared event store. To cover this PR's behavior, initialize with only AddSqlServerOutbox(...) in these two tests.

Suggested test adjustment
-        _ = services.AddPulse(config => config.AddOutbox().AddSqlServerOutbox("Server=.;Encrypt=true;"));
+        _ = services.AddPulse(config => config.AddSqlServerOutbox("Server=.;Encrypt=true;"));-        _ = services.AddPulse(config => config.AddOutbox().AddSqlServerOutbox(_ => "Server=.;Encrypt=true;"));
+        _ = services.AddPulse(config => config.AddSqlServerOutbox(_ => "Server=.;Encrypt=true;"));

Also applies to: 153-164

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerExtensionsTests.cs`
around lines 72 - 81, The tests currently call services.AddPulse(config =>
config.AddOutbox().AddSqlServerOutbox(...)) which pre-registers IEventOutbox and
masks whether AddSqlServerOutbox actually wires the shared event store; change
both affected tests to initialize with only AddSqlServerOutbox(...) (remove
AddOutbox()) so the assertion on the ServiceDescriptor for IEventOutbox truly
verifies AddSqlServerOutbox's behavior (update both occurrences around the
earlier block and the second block at lines ~153-164).
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerExtensionsTests.cs`:
- Around line 72-81: The tests currently call services.AddPulse(config =>
config.AddOutbox().AddSqlServerOutbox(...)) which pre-registers IEventOutbox and
masks whether AddSqlServerOutbox actually wires the shared event store; change
both affected tests to initialize with only AddSqlServerOutbox(...) (remove
AddOutbox()) so the assertion on the ServiceDescriptor for IEventOutbox truly
verifies AddSqlServerOutbox's behavior (update both occurrences around the
earlier block and the second block at lines ~153-164).

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c80c4bee-f3eb-487e-9300-59416655248b

📥 Commits

Reviewing files that changed from the base of the PR and between c5784ec and 4bd2d97.

📒 Files selected for processing (11)
  • src/NetEvolve.Pulse.EntityFramework/EntityFrameworkExtensions.cs
  • src/NetEvolve.Pulse.EntityFramework/Outbox/EntityFrameworkOutbox.cs
  • src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlEventOutbox.cs
  • src/NetEvolve.Pulse.SQLite/Outbox/SQLiteEventOutbox.cs
  • src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerEventOutbox.cs
  • src/NetEvolve.Pulse.SqlServer/SqlServerExtensions.cs
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerExtensionsTests.cs
💤 Files with no reviewable changes (8)
  • tests/NetEvolve.Pulse.Tests.Unit/EntityFramework/EntityFrameworkEventOutboxTests.cs
  • src/NetEvolve.Pulse.PostgreSql/Outbox/PostgreSqlEventOutbox.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SQLite/SQLiteEventOutboxTests.cs
  • src/NetEvolve.Pulse.SQLite/Outbox/SQLiteEventOutbox.cs
  • src/NetEvolve.Pulse.EntityFramework/Outbox/EntityFrameworkOutbox.cs
  • tests/NetEvolve.Pulse.Tests.Unit/PostgreSql/PostgreSqlEventOutboxTests.cs
  • tests/NetEvolve.Pulse.Tests.Unit/SqlServer/SqlServerEventOutboxTests.cs
  • src/NetEvolve.Pulse.SqlServer/Outbox/SqlServerEventOutbox.cs

@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.06%. Comparing base (c5784ec) to head (4bd2d97).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #369      +/-   ##
==========================================
+ Coverage   83.61%   85.06%   +1.45%     
==========================================
  Files         110      106       -4     
  Lines        4076     3837     -239     
  Branches      369      351      -18     
==========================================
- Hits         3408     3264     -144     
+ Misses        574      486      -88     
+ Partials       94       87       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samtrion samtrion merged commit bfbc314 into main Apr 13, 2026
12 checks passed
@samtrion samtrion deleted the chore/removed-complexity branch April 13, 2026 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state:ready for merge Indicates that a pull request has been reviewed and approved, and is ready to be merged into the mai type:chore Indicates some housework that needs to be done.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant