Skip to content

fix: forward cancellation tokens in ADO.NET grain storage - #11413

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-forward-ado-net-cancellation
Oct 6, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-forward-ado-net-cancellation

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Problem

The runtime passes cancellation tokens through IGrainStorage, but ADO.NET grain storage inherited the interface defaults and passed CancellationToken.None to relational queries. Caller cancellation therefore never reached the database driver.

Solution

Implement token-aware read, write, and clear overloads and route the legacy overloads through CancellationToken.None. Forward the exact caller token to each relational query, including clear's prerequisite read and both clear/delete modes. Reject pre-canceled operations before provider work, and propagate caller cancellation intact while retaining error logging for storage failures.

Successful SQL results retain the existing state/ETag updates. A successful prerequisite read also retains its loaded state if the subsequent clear is canceled. Add deterministic provider-scoped regressions for these boundaries and regenerate the public API surface using the official GenAPI target.

Microsoft Reviewers: Open in CodeFlow

Copilot AI balanced review requested due to automatic review settings October 6, 2026 21:57

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation consistently forwards tokens and provides comprehensive regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds cancellation-token propagation to ADO.NET grain storage operations.

Changes:

  • Adds token-aware read, write, and clear overloads.
  • Preserves cancellation semantics, logging, and state metadata.
  • Adds comprehensive cancellation tests and documentation.
File Description
AdoNetGrainStorageCancellationTests.cs Tests token forwarding and cancellation boundaries.
Orleans.Persistence.AdoNet.cs Updates generated public API surface.
AdoNetGrainStorage.cs Forwards cancellation tokens to relational queries.
README.md Documents cancellation behavior.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@github-actions

github-actions Bot commented Oct 6, 2026 •

Copy link
Copy Markdown
Contributor

Code coverage

Metric Pull request Current main Variance
Lines 83.20% (117,711 / 141,479) 83.21% (117,720 / 141,473) -0.0099 pp
Branches 72.72% (34,861 / 47,940) 72.72% (34,858 / 47,934) -0.0028 pp

Report-only conclusion: regressed.

The current-main baseline is commit b084e035b8 and uses the same reviewed coverage matrix.

Coverage combines every CI test matrix job, including providers, CodeGen, .NET 8/10, Linux, Windows, and macOS, using canonical physical source and branch identities.

The comparison remains report-only while normal line and branch variance is calibrated.

Coverage details

Copilot AI balanced review requested due to automatic review settings October 6, 2026 22:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟢 Approval recommended

The implementation consistently forwards cancellation and is covered by comprehensive deterministic tests.

Review effort: Balanced
Findings: None

@ReubenBond
ReubenBond merged commit ec48d17 into dotnet:main Oct 6, 2026
92 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-forward-ado-net-cancellation branch October 6, 2026 23:18
ReubenBond added a commit to ReubenBond/orleans that referenced this pull request Oct 22, 2026
ReubenBond added a commit that referenced this pull request Oct 23, 2026
(cherry picked from commit ec48d17)

Upstream-PR: #11413
Upstream-Commit: ec48d17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants