Skip to content

Fix deferred MongoDB read exception translation - #106

Merged
AGiorgetti merged 3 commits into
developfrom
fix/91-deferred-mongo-exceptions
Nov 6, 2026
Merged

AGiorgetti merged 3 commits into
developfrom
fix/91-deferred-mongo-exceptions

Conversation

@AGiorgetti

@AGiorgetti AGiorgetti commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Summary

Fixes #91.

  • Guard cursor acquisition and each cursor batch in all nine synchronous enumerable read paths using the existing storage-exception translation.
  • Preserve lazy streaming, ordering, repeated enumeration, and cursor disposal on completion, early termination, and failures.
  • Keep document projection outside the driver guard so serializer exceptions retain their original identity, even if a serializer throws a MongoException.
  • Retain the immediate disposed-engine guard and enforce it before deferred driver calls. Document exception/lifetime compatibility in the changelog.
  • Keep async reads, public signatures, stored data, dependencies, CI, and MongoDB 4.2 minimum unchanged.

Validation

  • Test-first commit c6b005ad: CI run 41856965260 passed Windows/Linux builds. Each of net8/net9/net10 reproduced exactly 54 expected failures: raw driver exceptions escaped instead of storage exceptions; 945 other tests passed, 0 skipped.
  • Final fix: all 447 focused .NET 10 regression tests pass locally, 0 skipped.
  • Full .NET 10 suite on MongoDB 4.2.25 and 7.0.45: 1,025 passed, 1 failed, 0 skipped on each server. The sole failure is the existing exact-ID explain assertion in [P2] Exact-ID explain assertion rejects MongoDB 7 IDHACK despite using the _id index #94, handled separately by Fix exact-ID explain assertions across MongoDB plans #105.
  • MongoDB 8.0.34 could not start in this cloud container because of a tcmalloc CPU-detection error; no tests ran against that server locally.
  • Final CI run 41859980224 is green for exact head 02f06f0d4c5afa6f07075009e7d19008ce51e1b6: Windows/Linux builds passed, and all 1,026 tests passed on each of net8/net9/net10 with MongoDB 9.0.4, 0 skipped. Existing CI is unchanged.

Compatibility

Consumers catching raw MongoDB exceptions during iteration should catch StorageException or StorageUnavailableException instead. Keep the persistence engine alive until enumeration finishes. Serializer errors remain unchanged. No API/schema migration or dependency update is required.

Co-authored by Alessandro Giorgetti and Codex (OpenAI).

AGiorgetti and others added 3 commits November 6, 2026 12:55
Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com>
Co-authored-by: Codex (OpenAI) <codex@openai.com>
Guard cursor acquisition and batches while retaining streaming and serializer error identity. Cover disposal guards and document exception compatibility.

Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com>
Co-authored-by: Codex (OpenAI) <codex@openai.com>
Hoist the MoveNext delegate while retaining both virtual TryMongo dispatches. Cover dispatch order and callback identity across all nine read paths, and document the observable identity change for derived engines.

Co-authored-by: Alessandro Giorgetti <alessandro.giorgetti@live.com>
Co-authored-by: Codex (OpenAI) <codex@openai.com>
@AGiorgetti
AGiorgetti force-pushed the fix/91-deferred-mongo-exceptions branch from e5ea11b to 240f563 Compare November 6, 2026 11:56
@AGiorgetti
AGiorgetti merged commit 662cd19 into develop Nov 6, 2026
5 checks passed
@AGiorgetti
AGiorgetti deleted the fix/91-deferred-mongo-exceptions branch November 6, 2026 14:35
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.

[P2] Deferred GetFrom enumeration bypasses MongoDB exception translation

1 participant