Repository navigation
Align async Mongo exception boundaries with synchronous reads (#108) - #116
Conversation
Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com> Co-authored-by: Codex (OpenAI) <codex@openai.com>
Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com> Co-authored-by: Codex (OpenAI) <codex@openai.com>
|
Forwarding-lambda cleanup pushed in 606a417: seven read callbacks now return EnumerateMongoAsync directly. Protected guard signatures, observer semantics and legacy behavior are unchanged. Regression coverage adds synchronous cursor acquisition failures across all seven routes in default and legacy modes. 789 focused exception/cancellation/notification tests pass in all eight lanes (net472/net8/net9/net10 with MongoDB.Driver 3.0.0 and 3.13.0). Full net10/Driver 3.13/MongoDB 8 suite: 1,882 passed, zero failed or skipped. No performance benchmark or measured speedup claimed. Co-authored-by: Alessandro Giorgetti alessandro.giorgetti@live.com |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues remain for the async observer-read exception-boundary changes.
No open issues 🎉
What changed in this PR
Addresses #108 by aligning async observer-read exception boundaries with synchronous reads in the MongoDB persistence adapter.
Changes:
- Limits default storage-error translation to cursor acquisition and advancement, preserving application and cleanup exceptions.
- Adds a legacy whole-read wrapping option and documents migration implications for protected guard overrides.
- Adds exception-origin and notification tests, and updates cancellation-test expectations for per-driver guard calls.
| File | Description |
|---|---|
| src/NEventStore.Persistence.MongoDB/MongoPersistenceOptions.cs | Adds the legacy exception-wrapping option. |
| src/NEventStore.Persistence.MongoDB/MongoPersistenceEngine.Async.cs | Separates driver-error translation from application callbacks and observer notifications. |
| src/NEventStore.Persistence.MongoDB.Tests/AcceptanceTests/Issues/Issue86CancellationTests.Async.cs | Updates expected guard invocation counts. |
| src/NEventStore.Persistence.MongoDB.Tests/AcceptanceTests/Issues/Issue108AsyncExceptionOrigin.cs | Tests exception identity, legacy wrapping, cancellation, notifications, and disposal. |
| Changelog.md | Documents breaking behavior and migration options. |
Review effort: Balanced
…ult value for cancellationToken in async methods
Summary
Alternative implementation for #108, based directly on develop. Keeps #113 untouched for comparison; merge only one implementation.
Breaking changes
Default application/cleanup Mongo exceptions reach OnErrorAsync unchanged. Driver failures retain storage wrappers and original InnerException. Protected non-result TryMongoAsync overrides now run per driver operation without an observer, not once around the read; callback/cleanup interception changes. Legacy opt-out preserves whole-read wrapping and scope. Public observer signatures unchanged. Cursor cleanup matches sync plain using semantics. See changelog migration notes.
Verification
Co-authored-by: Alessandro Giorgetti alessandro.giorgetti@live.com
Co-authored-by: Codex (OpenAI) codex@openai.com