fix(messaging): register EF Core and MongoDB messaging patterns through the shared helper (#1333) - #1399
Conversation
…ixes Add PublicAPI entry for AddOutboxInboxSagaSchedulingServices method. Add changelog fragment documenting MongoDB InboxPipelineBehavior registration and EF Core/MongoDB ISagaRunner/ISagaNotFoundDispatcher registration fixes.
…EF Core and MongoDB EF Core and MongoDB hand-rolled their Outbox/Inbox/Saga/Scheduling registration blocks instead of calling the shared Encina.Messaging helper the ADO.NET and Dapper packages use, so the registrations had drifted: MongoDB never wired InboxPipelineBehavior against IPipelineBehavior<,>, and neither EF Core nor MongoDB registered ISagaRunner or ISagaNotFoundDispatcher. Add AddOutboxInboxSagaSchedulingServices<...> to MessagingServiceCollectionExtensions, a granular overload of the existing Outbox/Inbox/Saga/Scheduling registration logic that takes individual flags and options instead of a MessagingConfiguration, so a provider whose own options type is not a MessagingConfiguration (Encina.MongoDB.EncinaMongoDbOptions) can still share the exact same registrations. AddMessagingServices now delegates to it internally with no behavior change for ADO.NET/Dapper. EF Core keeps its own DbContext-bound TransactionPipelineBehavior registered separately, since it is not interchangeable with the generic Encina.Messaging.TransactionPipelineBehavior ADO.NET and Dapper share. Add DI tests per provider that build under ValidateOnBuild/ValidateScopes with every messaging pattern enabled and resolve ISagaRunner, ISagaNotFoundDispatcher and the InboxPipelineBehavior<,> registration.
Add GuardTests coverage for the new public AddOutboxInboxSagaSchedulingServices method (null checks on services and all four options parameters), extract MongoDB's duplicated registration call into a private RegisterMessagingPatterns helper shared by both AddEncinaMongoDB overloads, and correct the knowledge record's overstated claim about ADO.NET/Dapper DI test coverage.
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars. ⚙️ Run configurationConfiguration used: Repository: dlrivada/Encina/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 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. Comment |
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
…hreshold Split AddEncinaEntityFrameworkCore, AddEncinaMongoDB (both overloads), AddMessagingServices and AddOutboxInboxSagaSchedulingServices into small, single-concern private methods (one per messaging pattern or optional feature block), each using an early-return guard so its own cyclomatic complexity stays low. No registration changes: every DI registration is identical before and after, only regrouped into smaller methods. Also extracts MongoDB's duplicated common registration block (audit stores, anonymization, ABAC, index creation, health check, module isolation, read/write separation) into one shared RegisterCommonServices helper used by both AddEncinaMongoDB overloads, removing the duplication between them. Adds unit tests for branches that had no coverage: the Recoverability pipeline (including the delayed-retry sub-branch) shared by ADO.NET and Dapper via AddMessagingServices, and MongoDB's AddEncinaRepository.
|
The first CI run failed the blocking crap-gate on five registration methods (CRAP up to 61.6). 756103f splits them into single-concern private helpers, one per messaging pattern or feature block, with the same registrations, lifetimes and order. It also adds tests for the previously uncovered Recoverability and MongoDB repository branches; 7e3e354 fixes a test summary. Local run of the gate script on real coverage: "No changed method exceeds the CRAP threshold" (45 changed methods). Build 0 warnings; unit 3514/3515 and guard 1100/1101, where the single failure in each needs a Docker daemon and is unrelated; contract 304/304. An independent adversarial review confirmed every extracted block is a verbatim move. The duplicated blocks left in |
…gh the shared helpers (#1406) (#1422) * refactor(messaging): route AddMessagingServicesCore through the shared Register* helpers AddMessagingServicesCore carried its own inline copy of the per-pattern registration blocks that PR #1399 already extracted into Register* helpers for AddMessagingServices, so the two paths could drift again. Replace every inline block with a call to the matching helper and drop the redundant outer flag checks each helper already performs. Add MessagingServiceCollectionExtensionsCoreEquivalenceTests, pinning the exact ServiceDescriptor set AddMessagingServicesCore produces with all patterns enabled and all patterns disabled against the pre-refactor snapshot, proving no behavior change for the ADO.NET tenancy extensions. Fixes #1406. * docs(knowledge): link PR #1422 in the #1406 record --------- Co-authored-by: dlrivada <3762783+dlrivada@users.noreply.github.com>
…as the review-bot fallback (#1447) (#1458) * docs(plans): implementation plan for pr-reviewer agent (#1447) * feat(agents): add pr-reviewer agent definition (#1447) * feat(hooks): wire pr-reviewer into spawn/publish/path-ownership hooks (#1447) * test(hooks): add pr-reviewer regression cases to Test-Hooks.ps1 (#1447) * docs(pr-cycle): trigger pr-reviewer instead of adversarial-reviewer when CodeRabbit is unavailable (#1447) * docs(engineering): sync pr-reviewer agent into routing table and history (#1447) Adds pr-reviewer to the Claude subagent tier table in ai-task-routing.md (kept verbatim in sync with .claude/agents/README.md) and records it as item 15 of the 2026-09-23 agent system review in AI-DEVELOPMENT-MODEL.md. * docs(knowledge): record pr-reviewer implementation and #1397/#1399 dry-run comparison (#1447) * fix(agents): wire enforce-path-ownership on pr-reviewer's Bash|PowerShell matcher too * docs(knowledge): record the self-review finding and fix (#1447) * docs(knowledge): link PR #1458 in the #1447 record --------- Co-authored-by: dlrivada <3762783+dlrivada@users.noreply.github.com>
Summary
EF Core and MongoDB hand-rolled their messaging-pattern registrations instead of using the shared helper in
Encina.Messaging, and the copies had drifted. MongoDB never registeredInboxPipelineBehavior<,>, soUseInboxsilently skipped deduplication. Neither provider registeredISagaRunnerorISagaNotFoundDispatcher, soUseSagasthrew at first resolution.What changed
Encina.Messaging: new publicAddOutboxInboxSagaSchedulingServices<...>. It takes the four pattern flags and their option types separately, so a provider whose configuration type is notMessagingConfigurationcan use it.AddMessagingServices<...>, used by the six ADO.NET and Dapper packages, now delegates to it with no behaviour change.PublicAPI.Unshipped.txtis updated.Encina.EntityFrameworkCore: Outbox, Inbox, Saga and Scheduling now register through the shared method. Its own DbContext-boundTransactionPipelineBehaviorstays registered directly. It is a different class from the generic one inEncina.Messaging, and routing it through the full helper broke an existing test.Encina.MongoDB: bothAddEncinaMongoDBoverloads call the shared method through one private helper.EncinaMongoDbOptionsexposes the same four option types.ValidateOnBuildandValidateScopes. They assert thatInboxPipelineBehavior<,>is present whenUseInboxis on and absent when it is off, and thatISagaRunnerandISagaNotFoundDispatcherresolve whenUseSagasis on. One test enables every pattern for completeness.changelog.d/1333-messaging-registration.fixed.mdand the knowledge recorddocs/knowledge/issues/1333.md.Verification
Encina.slnx: 0 warnings, 0 errors.InboxPipelineBehaviormissing, andNo service for type 'Encina.Messaging.Sagas.LowCeremony.ISagaRunner'. All pass again with the fix.dotnet format --verify-no-changesclean on changed files.changelog-fragments --checkandknowledge-records --checkOK.AddMessagingServiceslost complexity.Follow-ups
ISagaRunnerwithoutValidateOnBuild/ValidateScopesand check neitherISagaNotFoundDispatchernorInboxPipelineBehavior.Cross-cutting checklist (ADR-018)
This is a registration fix, with no new entity, store, behavior or integration. Registration completeness (AGENTS.md §3) is integrated, with a DI test per provider. The 12 functions are not applicable.
Fixes #1333