Skip to content

feat(runtime): generalize cluster service views and ownership - #11225

Open
ReubenBond wants to merge 33 commits into
dotnet:mainfrom
ReubenBond:rb-feat-runtime-generalize-cluster-views
Open

ReubenBond wants to merge 33 commits into
dotnet:mainfrom
ReubenBond:rb-feat-runtime-generalize-cluster-views

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Sep 10, 2026

Copy link
Copy Markdown
Member

Dependency

Depends on #10969 and should land after it. This branch contains #10969's exact head (a183e2a3a95ee3c390713f43fea85632adc85e66) in its ancestry. Integration of #10969 with main remains pending.

The dependency foundation is a183e2a3a95ee3c390713f43fea85632adc85e66. The twelve commits above that foundation implement this follow-up, ending at eae2e6bc8d6660578e7c8ad94b047595d1e66303. Review only the follow-up changes. After #10969 lands, rebase those twelve commits onto main without replaying the parent implementation. This PR targets main because the parent branch lives in a fork.

Problem

Cluster-service coordination needs to serve both membership-derived directory ownership and independently published resource assignments. A universal ring-shaped view and direction-checked transition APIs constrain those services and spread protocol invariants across callers.

Solution

  • Introduce internal generic view/provider contracts, typed acquisition/release/barrier gates, and resource/range gate maps. Readiness, completion, failure, and abort share an atomic boundary; failed gates preserve their original exception and remain blocking.
  • Add canonical immutable finite-resource/ring assignments with authority-scoped revisions, explicit authoritative predecessors, service-specific participation, and independently refreshed membership liveness.
  • Implement an Azure Blob authority with primary snapshot reads and ETag CAS. A successful write atomically installs its returned ETag with the view, preserving identity across competing writers and immediate recreation.
  • Exercise production transitions through a resource consumer with draining, transfer/recovery, receiver identity, recipient-enforced fencing, authority validation, and bounded retained handoff state.
  • Preserve the directory's membership-derived adapter, sealed bindings, native range differences, ordered owner visitation, startup, addressing, wire meanings, and request-path behavior.

Rationale

Generic contracts let each service own its concrete payload and resource semantics. Typed gates centralize lifecycle invariants; providers supply placement authority and service protocols supply durable-state and external-effect guarantees. The existing 32-bit ring remains the directory's native representation. New abstractions remain internal.

The implementation includes concurrency/lifecycle/protocol/real Blob CAS/fenced skipped-lineage regressions and measured request/control-plane costs.

Fixes #11205.
Fixes #11156.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings September 10, 2026 03:18

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

🟡 Changes recommended

ResourceTransitionGateMap.PruneCore() mutates its dictionary during enumeration, which will throw at runtime and break pruning/shutdown paths.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity src/​Orleans.Runtime/​ClusterServices/​ResourceTransitionGateMap.csPruneCore removes entries from _transitions while iterating it (`foreach (var entry in…
What changed in this PR

This PR extends Orleans.Runtime’s internal “view-synchronous” coordination model beyond membership-derived directory ownership by introducing generalized cluster-service view/provider contracts, typed transition gates, and reusable gate maps, then exercising the new primitives with targeted unit/integration tests and updated documentation.

Changes:

  • Adds internal generic cluster-service view abstractions plus typed acquisition/release/barrier gates and resource/range gate maps.
  • Introduces registered (CAS-backed) authoritative service views and an Azure Blob–backed register implementation.
  • Updates the distributed grain directory integration to use the generalized view/provider and strengthens protocol/test coverage and docs.
File Description
test/​TestInfrastructure/​Orleans.GrainDirectory.Compatibility.ReleaseHost/​Orleans.GrainDirectory.Compatibility.ReleaseHost.csproj Adds a “released Orleans” compatibility host targeting published packages.
test/​TestInfrastructure/​Orleans.GrainDirectory.Compatibility.CurrentHost/​Orleans.GrainDirectory.Compatibility.CurrentHost.csproj Adds a “current source” compatibility host using project references.
test/​Orleans.Runtime.Internal.Tests/​Orleans.Runtime.Internal.Tests.csproj Adds Accordant dependency for model-based tests.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​TransitionGateMapTests.cs New unit tests for resource/range transition gate maps.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​GrainDirectoryTransitionTests.cs New tests validating failed transitions remain blocking + fatal error reporting.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceViewTests.cs Tests authority-scoped ordering and membership-derived view behavior.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceViewProviderTests.cs Tests keyed providers, epoch checks, and directory integration behavior.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceTopologyTests.cs Tests topology projection/visitation and probe bounds.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceOperationResultTests.cs Tests operation disposition semantics + serializer behavior.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceConfigurationTests.cs Tests configuration argument validation.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​ClusterServiceAccordantTests.cs Adds Accordant model-based spec tests for gate lifecycle semantics.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​AzureBlobClusterServiceViewRegisterTests.cs Unit tests for Azure Blob register CAS semantics via mocked transport.
test/​Orleans.Runtime.Internal.Tests/​ClusterServices/​AzureBlobClusterServiceViewRegisterIntegrationTests.cs Azure integration tests for concurrent writers + ETag lineage handling.
test/​Orleans.GrainDirectory.Tests/​README.md Adds documentation for new directory protocol confidence suites.
test/​Orleans.GrainDirectory.Tests/​Orleans.GrainDirectory.Tests.csproj Wires compatibility host projects into directory test build.
test/​Orleans.GrainDirectory.Tests/​GrainDirectory/​GrainDirectoryResilienceTests.cs Refactors chaos test with clearer deadlines/monitoring and cancellation flow.
test/​Orleans.GrainDirectory.Tests/​GrainDirectory/​DirectoryChaosMonitorTests.cs Tests the new chaos monitor evidence/attribution behavior.
test/​Orleans.GrainDirectory.Tests/​GrainDirectory/​DirectoryChaosMonitor.cs Adds a monitor for directory invariant evidence and expected disruptions.
src/​Orleans.Runtime/​Utilities/​SearchAlgorithms.cs Adds probe-counting overload for ring binary search.
src/​Orleans.Runtime/​Orleans.Runtime.csproj Adds InternalsVisibleTo for AzureStorage to access internal register types.
src/​Orleans.Runtime/​Hosting/​CoreHostingExtensions.cs Registers keyed membership-based view provider for the directory.
src/​Orleans.Runtime/​GrainDirectory/​GrainDirectoryPartition.Interface.cs Threads membership snapshot through core ops for consistent “is silo dead” checks.
src/​Orleans.Runtime/​GrainDirectory/​DistributedGrainDirectory.cs Integrates fatal error handling + view/membership refresh refinements.
src/​Orleans.Runtime/​GrainDirectory/​DirectoryTransitions.cs Adds directory-specific typed wrappers over generic gates/maps.
src/​Orleans.Runtime/​GrainDirectory/​DirectoryMembershipSnapshot.cs Refactors snapshot to use ClusterServiceTopology and a view identity.
src/​Orleans.Runtime/​GrainDirectory/​DirectoryMembershipService.cs Refactors to consume IClusterServiceViewProvider and publish directory snapshots.
src/​Orleans.Runtime/​Diagnostics/​GrainDirectoryEvents.cs Adds integrity violation event for chaos/invariant evidence.
src/​Orleans.Runtime/​ClusterServices/​TransitionGate.cs Introduces typed transition gate hierarchy and lifecycle rules.
src/​Orleans.Runtime/​ClusterServices/​ResourceTransitionGateMap.cs Adds exact-identity resource gate map for blocking queries and pruning.
src/​Orleans.Runtime/​ClusterServices/​RegisteredClusterServiceViewProvider.cs Adds CAS-authority provider which polls/installs registered views.
src/​Orleans.Runtime/​ClusterServices/​RegisteredClusterServiceView.cs Adds immutable registered view payload + indexes for ownership/ring mapping.
src/​Orleans.Runtime/​ClusterServices/​RangeTransitionGateMap.cs Adds ring-range gate map for overlap-based blocking queries.
src/​Orleans.Runtime/​ClusterServices/​MembershipBasedClusterServiceViewProvider.cs Adds membership-derived view provider with epoch-aware IDs.
src/​Orleans.Runtime/​ClusterServices/​IClusterServiceViewRegister.cs Adds register read/write CAS contract for authoritative views.
src/​Orleans.Runtime/​ClusterServices/​IClusterServiceViewProvider.cs Adds generic view + provider contracts.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceViewVersion.cs Adds ordered version value type for view IDs.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceViewId.cs Adds authority-scoped view identity with epoch + version.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceView.cs Adds membership-based view implementation and successor checks.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceTopology.cs Adds canonical topology projection + range visitation/ownership lookup.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceOperationResult.cs Adds operation result/disposition model used by coordination paths.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceFence.cs Adds fence metadata for acquisition gating.
src/​Orleans.Runtime/​ClusterServices/​ClusterServiceConfiguration.cs Adds fixed assignment inputs for membership-derived views.
src/​Azure/​Orleans.Persistence.AzureStorage/​Orleans.Persistence.AzureStorage.csproj Grants InternalsVisibleTo for runtime internal tests.
src/​Azure/​Orleans.Persistence.AzureStorage/​AzureBlobClusterServiceViewRegister.cs Implements Azure Blob–backed CAS register for authoritative service views.
Orleans.slnx Adds new test infrastructure projects to the solution.
docs/​site/​src/​data/​external-link-allowlist.json Allows DOI link used by new/updated docs content.
docs/​site/​src/​content/​docs/​toc.yml Adds new implementation doc entry for view-synchronous cluster services.
docs/​site/​src/​content/​docs/​implementation/​index.md Links to new view-synchronous cluster services documentation.
docs/​site/​src/​content/​docs/​implementation/​grain-directory.md Updates directory docs to align with new coordination model terminology.
docs/​site/​src/​content/​docs/​implementation/​cluster-management.md References view-synchronous cluster services from membership docs.
docs/​AGENTS.md Updates documentation authoring/linking guidance.

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

Comment thread src/Orleans.Runtime/ClusterServices/ResourceTransitionGateMap.cs
Copilot AI review requested due to automatic review settings September 10, 2026 09:21

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

🔵 Needs a closer look

The changes introduce and wire up new internal coordination primitives across runtime, Azure storage integration, and multiple test suites, making it unsuitable for confident automated approval without final human review.

Review tier: Lite
Findings: None

Issues resolved since last review (1)
Severity Finding
High severity src/​Orleans.Runtime/​ClusterServices/​ResourceTransitionGateMap.csPruneCore removes entries from _transitions while iterating it (`foreach (var entry in… View resolved comment

Copilot AI review requested due to automatic review settings September 10, 2026 15:36
@ReubenBond
ReubenBond force-pushed the rb-feat-runtime-generalize-cluster-views branch from 7fc572e to 3354657 Compare September 10, 2026 15:36

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

🔵 Needs a closer look

It introduces broad, protocol- and concurrency-sensitive runtime coordination changes plus new authority-backed ownership mechanics which merit final human review.

Review tier: Lite
Findings: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Orleans.Runtime/​Utilities/​SearchAlgorithms.csprobeCount is intended to reflect the number of binary-search probes, but in DEBUG builds it is…

Comment thread src/Orleans.Runtime/Utilities/SearchAlgorithms.cs
@ReubenBond
ReubenBond force-pushed the rb-feat-runtime-generalize-cluster-views branch from 3354657 to 5cbfed3 Compare September 10, 2026 19:09
Copilot AI review requested due to automatic review settings September 10, 2026 19: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.

Copilot review overview

🟡 Changes recommended

A constructor validation ordering issue can cause null participant inputs to throw unintended exceptions instead of the intended argument validation error.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Review tier: Lite
Findings: 2 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Orleans.Runtime/​ClusterServices/​RegisteredClusterServiceView.cs — Validate participants before ordering to avoid null-driven exceptions
Pre-existing issues (1)
Severity Finding
Medium severity src/​Orleans.Runtime/​Utilities/​SearchAlgorithms.csprobeCount is intended to reflect the number of binary-search probes, but in DEBUG builds it is… View comment

Comment thread src/Orleans.Runtime/ClusterServices/RegisteredClusterServiceView.cs Outdated
Copilot AI review requested due to automatic review settings September 10, 2026 19:42
@ReubenBond
ReubenBond force-pushed the rb-feat-runtime-generalize-cluster-views branch from 2e6f72b to a67646a Compare September 10, 2026 19:42

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

🔵 Needs a closer look

The changes introduce new internal coordination primitives and refactor critical runtime ownership/membership pathways, warranting final human review for protocol, lifecycle, and compatibility risks.

Review tier: Lite
Findings: 2 Medium severity

Pre-existing issues (2)
Severity Finding
Medium severity src/​Orleans.Runtime/​ClusterServices/​RegisteredClusterServiceView.cs — Validate participants before ordering to avoid null-driven exceptions View comment
Medium severity src/​Orleans.Runtime/​Utilities/​SearchAlgorithms.csprobeCount is intended to reflect the number of binary-search probes, but in DEBUG builds it is… View comment

Copilot AI review requested due to automatic review settings September 12, 2026 09:18

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

🟡 Changes recommended

The moderate liveness-refresh and critical stale-view-installation findings remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 High severity

Open findings (1)
Resolved findings (2)

Comment thread src/Orleans.Runtime/ClusterServices/ResourceOwnershipConsumer.cs Outdated
Copilot AI review requested due to automatic review settings September 12, 2026 14:19

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

🔵 Needs a closer look

The broad coordination, persistence, and ownership-transition changes require final human review.

Review tier: Lite
Findings: None

Resolved findings (1)

Copilot AI review requested due to automatic review settings September 13, 2026 14:59
@ReubenBond
ReubenBond force-pushed the rb-feat-runtime-generalize-cluster-views branch from 760cf35 to 99a43e3 Compare September 13, 2026 14:59

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

🟡 Changes recommended

The critical authority-content validation and moderate enumerable-snapshot issues remain unresolved.

Get a fresh assessment by requesting another Copilot review.

Review tier: Lite
Findings: 1 High severity

Open findings (1)

Comment thread src/Orleans.Runtime/ClusterServices/ResourceOwnershipConsumer.cs Outdated
Copilot AI review requested due to automatic review settings September 14, 2026 09:21
Exercise the default in controlled and mixed-version scenarios, update guidance, and bound ElasticChaos with an overall deadline and independent cleanup limits.
Use the runtime output layout instead of CallerFilePath, which deterministic CI builds map to a virtual source path.
Restore minimum-view admission and the original directory RPC signatures. Preserve liveness, recovery, harness, and CI fixes, and document admission policy as a service-specific choice.
Cover duplicate stop IDs in both compatibility hosts and correct the documentation of faulted transition completion.
Copilot AI review requested due to automatic review settings September 16, 2026 10:22
@ReubenBond
ReubenBond force-pushed the rb-feat-runtime-generalize-cluster-views branch from 6c030a7 to 5a0fbf4 Compare September 16, 2026 10:22

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

🔵 Needs a closer look

The critical handoff issue and moderate compatibility race remain unresolved, and the concurrency scope requires human review.

Review tier: Lite
Findings: 2 High severity

Open (2)

Comment thread src/Orleans.Runtime/ClusterServices/ResourceOwnershipConsumer.cs Outdated
Copilot AI review requested due to automatic review settings September 16, 2026 14:23

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

🔵 Needs a closer look

The unresolved moderate liveness-refresh issue and broad ownership changes require human review.

Review tier: Lite
Findings: 1 High severity

Open (1)
Resolved since last review (1)

This branch has not been deployed

No deployments
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.

feat(runtime): generalize view-synchronous ownership coordination feat(runtime): support extensible cluster service view sources

2 participants