Skip to content

Fix Durable client current-app detection - #3527

Closed
wangbill (YunchuWang) wants to merge 1 commit into
Azure:devfrom
YunchuWang:yunchuwang-fix-durable-client-current-app-detection
Closed

wangbill (YunchuWang) wants to merge 1 commit into
Azure:devfrom
YunchuWang:yunchuwang-fix-durable-client-current-app-detection

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

Fixes #3523.

This compatibility correction builds on merged PR #3514 (477a92915cbeb46423fe55ceb36c036b845b00b0). It keeps the single shared DurableClient.ClientReferencesCurrentApp gate introduced there, but compares a target client with the host's actual default durability provider instead of comparing the target provider with itself.

Before / after

Scenario Before After
Same exact TaskHub, different connection, missing orchestrator Rejected by local metadata; target provider not called Local validation skipped; target provider receives the start
Same exact TaskHub, different connection, missing entity Rejected by local metadata; message not sent Local validation skipped; entity signal is sent
Same exact TaskHub, different connection, locally startup-disabled orchestrator start/restart Rejected locally Local validation skipped; target backend receives start/restart
Azure Storage case-only TaskHub difference Classified as remote Classified as current app because Azure Storage hub identity is case-insensitive
Azure Managed / exact-case provider case-only TaskHub difference Classified as remote Remains classified as remote
ExternalClient = true Bypasses local validation Unchanged
Unknown registry key / disabled null entry / active or deregistered listener #3514 behavior Unchanged; only current-app classification is corrected

Design rationale

  • ClientReferencesCurrentApp remains the only predicate used by missing-orchestrator, missing-entity, and startup-disabled-orchestrator validation.
  • Connection identity is evaluated by virtual dispatch on DurableTaskExtension.DefaultDurabilityProvider, passing the target provider. This preserves provider-specific connection matching direction.
  • TaskHub identity is an internal durability-provider semantic. The base implementation uses ordinal matching (including Azure Managed's shipped exact-case semantics), while Azure Storage overrides it with ordinal-ignore-case matching to reflect its lowercased storage resources.
  • No provider-name string switches, public API additions, entity dispatch changes, or HTTP/gRPC error-mapping changes are introduced.

Compatibility

The intentional behavior change is limited to local metadata validation at corrected current/remote boundaries. Cross-connection operations now reach their configured backend; Azure Storage case variants now receive current-app validation. Exact-case providers, the explicit external-client bypass, replay, and deregistered listener drain behavior remain unchanged.

Tests

TDD RED evidence on net8.0 before production changes:

  • DurableClientBaseTests: 8 expected failures covering cross-connection missing/disabled orchestrator start, restart, entity signal, and Azure Storage case-only matching.
  • HTTP cross-connection disabled start: expected Accepted, observed BadRequest.
  • gRPC cross-connection disabled start: observed the expected pre-fix InvalidArgument local rejection.

GREEN results:

  • Focused DurableClientBaseTests: 50/50 passed on net8.0; 50/50 passed on net10.0.
  • Focused HTTP current/remote/missing/disabled tests: 4/4 passed on each TFM.
  • Focused gRPC current/remote/unknown/disabled/restart tests: 5/5 passed on each TFM.
  • Complete relevant classes (DurableClientBaseTests, DisabledFunctionDispatchTests, HttpApiHandlerTests, LocalGrpcListenerTests): 187/187 passed on net8.0; 187/187 passed on net10.0.
  • git -c core.whitespace=cr-at-eol diff --check: passed.

A principal-level review found no critical or important findings.

Compare durable client targets with the host default provider and let providers define TaskHub identity casing. Cover cross-connection routing and shared HTTP, gRPC, orchestrator, restart, and entity validation behavior.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot AI lite review requested due to automatic review settings August 20, 2026 15:34

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.

Pull request overview

This PR fixes DurableClient.ClientReferencesCurrentApp so that “current app” detection is based on the host’s default durability provider (connection + provider-specific TaskHub identity semantics) rather than accidentally self-comparing the target provider. This corrects when local missing/disabled-function validation should be applied vs skipped for truly remote backends, and introduces provider-specific TaskHub casing semantics (Azure Storage case-insensitive, others default to exact/ordinal).

Changes:

  • Fix current-app detection to compare against DurableTaskExtension.DefaultDurabilityProvider (and guard against config == null).
  • Add DurabilityProvider.TaskHubNameMatches(...) (ordinal by default) and override it for Azure Storage (ordinal-ignore-case).
  • Update/add unit tests across direct client, HTTP, and gRPC paths for cross-connection targeting and TaskHub case-variant scenarios.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/FunctionsV2/Tests/Unit/LocalGrpcListenerTests.cs Adds gRPC coverage for cross-connection disabled-orchestrator starts and exact-case provider TaskHub casing behavior.
test/FunctionsV2/Tests/Unit/HttpApiHandlerTests.cs Updates HTTP disabled-orchestrator tests for cross-connection behavior and adds Azure Storage TaskHub case-variant rejection coverage.
test/FunctionsV2/Tests/Unit/DurableClientBaseTests.cs Adjusts direct-client tests to validate corrected current/remote classification across connections and provider-specific TaskHub casing semantics.
src/WebJobs.Extensions.DurableTask/DurabilityProvider.cs Introduces TaskHubNameMatches extensibility point for provider-specific TaskHub identity matching.
src/WebJobs.Extensions.DurableTask/ContextImplementations/DurableClient.cs Fixes current-app detection to use host default provider for connection + hub matching (and ensures config is present).
src/WebJobs.Extensions.DurableTask/AzureStorageDurabilityProvider.cs Overrides TaskHubNameMatches to be case-insensitive for Azure Storage semantics.

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

@YunchuWang
wangbill (YunchuWang) requested a balanced review from Copilot August 20, 2026 16:11

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.

Pull request overview

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@YunchuWang

Copy link
Copy Markdown
Member Author

Superseded by #3528. The replacement PR uses a branch in Azure/azure-functions-durable-extension so secret-dependent CI workflows can run.

@YunchuWang
wangbill (YunchuWang) deleted the yunchuwang-fix-durable-client-current-app-detection branch August 20, 2026 18:51
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.

Fix Durable client current-app detection across connections and TaskHub casing

2 participants