Repository navigation
fix: propagate async cancellation and await observer callbacks (#86) - #99
Draft
AGiorgetti wants to merge 3 commits into
Draft
AGiorgetti wants to merge 3 commits into
AGiorgetti wants to merge 3 commits into
Conversation
Co-authored by Alessandro Giorgetti and Codex (OpenAI).
Co-authored by Alessandro Giorgetti and Codex (OpenAI).
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.
Summary
Fixes #86.
OperationCanceledException(includingTaskCanceledException) from ordinaryTask/Task<T>operations instead of returning success with null/default values.AddSnapshotAsynccancellation propagate while keeping its existing false result for non-cancellation failures.OnCompletedAsyncwith the original request token. Normal completion is kept outside the operation guard, so a terminal callback's own cancellation/failure propagates without a second terminal notification.Tests first
The first commit contains only permanent regression tests against unchanged develop
286c0ae. With MongoDB 7.0.45 and .NET 10, its 167 focused checks produced 22 failures, 145 passes, 0 skips. The second commit fixes production code; all 167 focused checks pass.The tests cover:
CommitAsyncwith a supported checkpoint generator, both cancellation exception types, pre-cancellation and a gated in-flight async boundary, canceled task state/token, and no write when cancellation occurs before persistence.The focused filter is
FullyQualifiedName~Issue_86. Test-first and fix commits are separate; this branch contains no changes from the #87 or #85 PRs.Local validation
Full Release solution build: 0 errors, including compilation of net472, net8.0, net9.0, and net10.0. Existing analyzer/dependency warnings remain; no dependency upgrades.
On each of .NET 8, 9, and 10 with MongoDB 7.0.45:
The sole local adapter failure is the pre-existing #94 IDHACK query-plan portability assertion,
Stream_head_delete_by_id_should_use_the_builtin_id_index. It is unchanged and is not fixed or weakened here.Contract and validation boundaries
Observer reads intentionally differ from ordinary task operations: their existing interface contract treats read cancellation as completion. That completion callback is now awaited; if it cancels or fails, the returned task reflects that outcome.
Cancellation after a server write is not a rollback guarantee. The deterministic in-flight tests cancel at supported checkpoint/callback async boundaries, not by interrupting a live network packet or server command. Real MongoDB I/O is covered by pre-canceled public operations and successful reads/writes.
Local MongoDB 8 cannot start in this cloud host because required /sys CPU metadata is unavailable, so local integration tests use MongoDB 7.0.45. The existing GitHub Actions matrix uses MongoDB 8; its verified result is recorded below. net472 is compile-only locally on Linux. No timing benchmarks were run.
Exact-head GitHub CI
CI run 39972739691 succeeded for head
79c751ccd9ca2eda614aa007bf6788e5aa862091. Ubuntu and Windows builds succeeded, and each MongoDB 8 Linux test job (.NET 8, 9, and 10) passed 387 tests, 0 failures, 0 skips, verified in the individual job logs. The PR workflow tested its merge with unchanged develop286c0ae. No rerun was needed.Draft for user review. This is the third and final fix in the requested batch; no merge or package publication is part of this task.
Co-authored by Alessandro Giorgetti and Codex (OpenAI).