feat(runtime): generalize cluster service views and ownership - #11225
ReubenBond wants to merge 33 commits into
Conversation
There was a problem hiding this comment.
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
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/ClusterServices/ResourceTransitionGateMap.cs — PruneCore 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.
There was a problem hiding this comment.
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 |
|---|---|
src/Orleans.Runtime/ClusterServices/ResourceTransitionGateMap.cs — PruneCore removes entries from _transitions while iterating it (`foreach (var entry in… View resolved comment |
7fc572e to
3354657
Compare
There was a problem hiding this comment.
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
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/Utilities/SearchAlgorithms.cs — probeCount is intended to reflect the number of binary-search probes, but in DEBUG builds it is… |
3354657 to
5cbfed3
Compare
There was a problem hiding this comment.
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
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/ClusterServices/RegisteredClusterServiceView.cs — Validate participants before ordering to avoid null-driven exceptions |
Pre-existing issues (1)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/Utilities/SearchAlgorithms.cs — probeCount is intended to reflect the number of binary-search probes, but in DEBUG builds it is… View comment |
2e6f72b to
a67646a
Compare
There was a problem hiding this comment.
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
Pre-existing issues (2)
| Severity | Finding |
|---|---|
src/Orleans.Runtime/ClusterServices/RegisteredClusterServiceView.cs — Validate participants before ordering to avoid null-driven exceptions View comment |
|
src/Orleans.Runtime/Utilities/SearchAlgorithms.cs — probeCount is intended to reflect the number of binary-search probes, but in DEBUG builds it is… View comment |
There was a problem hiding this comment.
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
Open findings (1)
760cf35 to
99a43e3
Compare
There was a problem hiding this comment.
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
Open findings (1)
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.
6c030a7 to
5a0fbf4
Compare




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 ateae2e6bc8d6660578e7c8ad94b047595d1e66303. 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
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