Merged
Conversation
fcaf181 to
ef30e09
Compare
ProcedureContext::with_transactionProcedureContext::with_tx
gefjon
reviewed
Nov 13, 2025
Contributor
gefjon
left a comment
There was a problem hiding this comment.
- See comment in
ModuleSubscriptions::send_procedure_message: I think (but am not confident) that we need to pass the procedure's last-referenced TX offset through and delay the procedure message in the case where the client is subscribed to confirmed reads. If I'm wrong about that because the queue is ordered anyways, you should instead update the comment with my reasoning. But I don't think that's right - if the client is not subscribed to the TX's writes, or if the TX was aborted rather than committed, we still should delay the procedure result message. In the rolled-back TX case we should include the most recent committed TX at the time of the rollback, I think. - I would greatly appreciate a test case added to the
sdk-test-proceduremodule andsdks/rust/tests/procedure-clientwhich exercises this functionality, including observing rows inserted within the TX.
gefjon
reviewed
Nov 17, 2025
bef087f to
8da6dbe
Compare
gefjon
approved these changes
Nov 19, 2025
Contributor
gefjon
left a comment
There was a problem hiding this comment.
This looks great, thanks! Minor nits which I'll trust you to handle appropriately.
649057b to
fedede8
Compare
fedede8 to
b769e58
Compare
1 task
github-merge-queue bot
pushed a commit
that referenced
this pull request
Dec 18, 2025
# Description of Changes Implements the C# equivalent of #3638 This implement uses inheritance, where abstract base classes (like `ProcedureContextBase` in `ProcedureContext.cs`) store the core of the implementation, and then generated wrappers (like `ProcedureContext` in the generated FFI.cs file) inherit from them. For error handling, we work like Rust's implementation of `Result<T,E>` but we require `where E : Exception` because of how exceptions work in C#. Transaction-level failures come back as a `TxOutcome` and user errors should follow the `Result<T,E>` pattern. In this implementation, we have `UnwrapOrThrow()` throws exceptions directly because of C#'s error handling pattern. Unlike the Rust implementation's direct `Result` propagation, we are using an `AbortGuard` pattern (in `ProcedureContext.cs`) for exception handling, which uses `IDisposable` for automatic cleanup. Most changes should have fairly similar Rust-equivalents beyond that. For module authors, the changes here allow for the transation logic to work like: ```csharp ctx.TryWithTx<ResultType, Exception>(tx => { // transaction logic return Result<ResultType, Exception>.Ok(result); }); ``` This change includes a number of tests added to the `sdks/csharp/examples~/regression-tests/`'s `server` and `client` to validate the behavior of the changes. `server` changes provide further usage examples for module authors. # API and ABI breaking changes Should not be a breaking change # Expected complexity level and risk 2 # Testing - [x] Created Regression Tests that show transitions in procedures working in various ways, all of which pass.
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.
Description of Changes
Adds
ProcedureContext::{with_tx, try_with_tx}.Fixes #3515.
API and ABI breaking changes
None
Expected complexity level and risk
2
Testing
An integration test
test_calling_with_txis added.