Repository navigation
Fix retry feature activation in mocha - #10363
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
PooledFeatureCollection.GetOrSet currently evicts cached entries before activation and doesn’t evict type-mismatched cache entries, which can lose cached instances on initialization failures and cause persistent cache poisoning.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
This PR fixes feature activation/reuse behavior in Mocha’s pooled feature collections, which is particularly important for retry flows where pooled ReceiveContext instances (and their feature storage) get reused across attempts and across messages.
Changes:
- Reworked
PooledFeatureCollectionto keep a cache of reusable pooled features and to reactivate them viaGetOrSetwithout letting cached items shadow inherited/default features. - Added default-interface
GetOrSetoverloads toIFeatureCollectionand refactoredFeatureCollectionExtensionsto delegate to those overloads. - Added/updated tests covering default interface implementations, pooled feature reuse/initialization, and saga retry behavior with warmed receive-context pools.
File summaries
| File | Description |
|---|---|
| src/Mocha/test/Mocha.Tests/Features/PooledFeatureCollectionTests.cs | New test coverage for pooled feature caching, initialization, inheritance preference, and reset behavior. |
| src/Mocha/test/Mocha.Tests/Features/FeatureCollectionTests.cs | New tests validating IFeatureCollection default-interface GetOrSet behavior and read-only handling. |
| src/Mocha/test/Mocha.Sagas.Tests/SagaRetryScopeTests.cs | Strengthened saga retry test to validate fresh scoped stores across retries and behavior when the receive-context pool is warmed. |
| src/Mocha/src/Mocha.Utilities/Features/PooledFeatureCollection.cs | Refactor: split active vs cached features and add cache-aware GetOrSet behavior to support safe pooling reuse. |
| src/Mocha/src/Mocha.Utilities/Features/IPooledFeature.cs | Updated XML docs to reflect “activation” semantics in pooled collections. |
| src/Mocha/src/Mocha.Utilities/Features/FeatureCollectionExtensions.cs | Simplified GetOrSet extension overloads to delegate to IFeatureCollection GetOrSet APIs; added a null check in Configure. |
| src/Mocha/src/Mocha.Abstractions/IFeatureCollection.cs | Introduced default-interface GetOrSet overloads to standardize feature creation/activation across implementations. |
Review details
- Files reviewed: 7/7 changed files
- Comments generated: 1
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
This was referenced Oct 25, 2026
Merged
This was referenced Nov 16, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 32 others
AdCodicem/AdCodicem.ValueObjects#262
Closed
This was referenced Nov 23, 2026
fix(deps): Bump Basic.Reference.Assemblies.Net100 and 43 others
AdCodicem/AdCodicem.ValueObjects#274
Closed
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.
No description provided.