Skip to content

fix: forward cancellation tokens in Firestore grain storage - #11414

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

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

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Oct 6, 2026 •

Copy link
Copy Markdown
Member

Firestore grain storage implements the cancellation-aware IGrainStorage overloads and forwards caller tokens through reads, creates, conditional and wildcard updates, deletes, and existence checks. Legacy overloads delegate with CancellationToken.None.

Pre-canceled calls complete before accessing state or preparing requests. Caller-requested in-flight cancellation preserves grain state, ETags, and the original cancellation exception. Concurrency failures retain their existing classification. SDK cancellation failures with an uncanceled caller token retain write and clear error diagnostics, including legacy calls.

The existence check uses Firestore's strongly consistent single-document read with the exact caller token. This preserves its existence semantics while allowing in-flight read cancellation; Firestore 4.3.0's transaction snapshot implementation disposes its linked cancellation source before the asynchronous read completes (reported as googleapis/google-cloud-dotnet#15958).

Focused deterministic regression coverage exercises the provider through the native SDK with a fake Firestore transport across both clear modes and the ETag paths, including caller-requested and unrequested SDK cancellation.

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 propagates cancellation while preserving existing concurrency behavior and includes comprehensive regression coverage.

Review effort: Balanced
Findings: None

What changed in this PR

Adds cancellation-aware Firestore grain storage operations and avoids the Firestore transaction cancellation issue described in googleapis/google-cloud-dotnet#15958.

Changes:

  • Forwards caller cancellation tokens through all storage operations.
  • Uses a strongly consistent document read for existence checks.
  • Adds deterministic cancellation and state-preservation tests.
File Description
FirestoreGrainStorageCancellationTests.cs Covers cancellation, ETags, failures, and state preservation.
FirestoreDataManager.cs Replaces transactional existence checks with direct document reads.
FirestoreGrainStorage.cs Implements and forwards cancellation-aware overloads.

💡 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.19% (117,697 / 141,478) 83.21% (117,720 / 141,473) -0.0192 pp
Branches 72.71% (34,855 / 47,938) 72.72% (34,858 / 47,934) -0.0123 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:38

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, preserves existing error semantics, and has comprehensive deterministic coverage.

Review effort: Balanced
Findings: None

@ReubenBond
ReubenBond merged commit 397e3b3 into dotnet:main Oct 6, 2026
92 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-forward-firestore-cancellation branch October 6, 2026 23:14
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 397e3b3)

Upstream-PR: #11414
Upstream-Commit: 397e3b3
This was referenced Oct 29, 2026
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