GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — feat(analyzers): detect RPC contract changes by ReubenBond · Pull Request #10337 · dotnet/orleans

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 3, 2026 •
edited by dotnet-policy-service Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Member

Orleans RPC contracts can change without an explicit record of the prior interface shape, making accidental incompatibilities difficult to catch before rolling upgrades.

This adds a grain interface version analyzer and code fixes which compare source interfaces with a GrainInterfaces.txt contract manifest. It reports undeclared interfaces and members, version mismatches, unretired removals, missing manifests, and duplicate declarations, with focused analyzer coverage for versioning, aliases, generics, inheritance, and code fixes.

Microsoft Reviewers: Open in CodeFlow

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI lite review requested due to automatic review settings August 3, 2026 22:51
Copilot started reviewing on behalf of ReubenBond August 3, 2026 22:52
View session
Copilot AI reviewed Aug 3, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

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 introduces a new Orleans analyzer + code fix workflow to detect RPC contract drift by comparing grain interfaces in source against a GrainInterfaces.txt manifest, helping prevent accidental incompatibilities during rolling upgrades.

Changes:

  • Added GrainInterfaceVersionAnalyzer (ORLEANS0016–ORLEANS0021) to validate interface declarations, versions, members, file presence, retirements, and duplicates.
  • Added GrainInterfaceVersionCodeFix to update/create GrainInterfaces.txt entries based on diagnostics.
  • Added extensive analyzer/code-fix unit tests and registered new diagnostics in analyzer release notes and resources.
Show a summary per file
File Description
test/Orleans.Analyzers.Tests/GrainInterfaceVersionAnalyzerTest.cs Adds coverage for new diagnostics and code fixes across aliases, versions, generics, and inheritance.
src/Orleans.Analyzers/Resources.resx Adds localized strings for new diagnostics and code fix titles.
src/Orleans.Analyzers/Resources.Designer.cs Updates strongly-typed resource accessors for the new strings.
src/Orleans.Analyzers/GrainInterfaceVersionCodeFix.cs Implements code fixes which update/create GrainInterfaces.txt based on diagnostics.
src/Orleans.Analyzers/GrainInterfaceVersionAnalyzer.cs Implements analyzer + manifest parser for interface/member/version tracking.
src/Orleans.Analyzers/Constants.cs Adds constants for VersionAttribute FQN and GrainInterfaces.txt filename.
src/Orleans.Analyzers/AnalyzerReleases.Unshipped.md Documents the newly introduced diagnostic IDs and severities.

Copilot's findings

Files not reviewed (1)
  • src/Orleans.Analyzers/Resources.Designer.cs: Generated file
Suppressed comments (2)

src/Orleans.Analyzers/GrainInterfaceVersionCodeFix.cs:366

  • AddMemberToFileAsync suppresses insertion when the next interface declaration line StartsWith(interfaceName). This fails when the next interface name happens to share the same prefix (for example, IMyGrain followed by IMyGrainExtended), causing the new member to be inserted in the wrong section.
                // If next line is empty, a comment, or another interface, insert the member here
                if (string.IsNullOrEmpty(nextLine) ||
                    nextLine.StartsWith("#", StringComparison.Ordinal) ||
                    (nextLine.Contains("[Version(") && !nextLine.StartsWith(interfaceName, StringComparison.Ordinal)))
                {

src/Orleans.Analyzers/GrainInterfaceVersionCodeFix.cs:422

  • RetireInterfaceInFileAsync uses trimmedLine.Contains(interfaceName), which can retire the wrong interface when one interface name is a substring/prefix of another. It should ensure it matched the full interface-name token before adding the RETIRED prefix.
            // Check if this line contains the interface declaration
            if (trimmedLine.Contains(interfaceName) && trimmedLine.Contains("[Version(") &&
                !trimmedLine.StartsWith(GrainInterfaceVersionAnalyzer.RetiredPrefix, StringComparison.Ordinal))
            {
  • Files reviewed: 6/7 changed files
  • Comments generated: 4

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/Orleans.Analyzers/GrainInterfaceVersionCodeFix.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/Orleans.Analyzers/Resources.resx Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/Orleans.Analyzers/GrainInterfaceVersionAnalyzer.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Comment thread src/Orleans.Analyzers/GrainInterfaceVersionCodeFix.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

Copilot AI review requested due to automatic review settings August 5, 2026 23:47
Copilot started reviewing on behalf of ReubenBond August 5, 2026 23:48
View session
@ReubenBond
ReubenBond force-pushed the recover-rpc-contract-analyzer branch from df743cf to 2c62824 Compare August 5, 2026 23:49
Copilot AI reviewed Aug 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot's findings

Files not reviewed (1)
  • src/Orleans.Analyzers/Resources.Designer.cs: Generated file
Suppressed comments (1)

src/Orleans.Analyzers/GrainInterfaceVersionCodeFix.cs:263

  • AddGrainClassToFileAsync only reactivates an existing contracts entry when the declared CLR name matches className. If a grain class is renamed but keeps a stable [GrainType("...")] alias, the analyzer can still match by alias, but the code fix will append a new entry instead of updating the existing (possibly RETIRED) one. That can introduce duplicate alias declarations, which are treated as errors by the parser (see GrainInterfaceFileParser.Parse duplicate check in GrainInterfaceVersionAnalyzer.cs:1003-1005). Consider matching existing entries by alias (and updating/unretiring that line) before appending a new declaration.
        for (var i = 0; i < lines.Length; i++)
        {
            if (GrainInterfaceFileParser.TryGetGrainClassName(lines[i], out var declaredName)
                && string.Equals(declaredName, className, StringComparison.Ordinal))
            {
  • Files reviewed: 23/24 changed files
  • Comments generated: 0 new

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Copilot AI review requested due to automatic review settings August 5, 2026 23:53
Copilot started reviewing on behalf of ReubenBond August 5, 2026 23:53
View session
Copilot AI reviewed Aug 5, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Copilot's findings

Files not reviewed (1)
  • src/Orleans.Analyzers/Resources.Designer.cs: Generated file
Suppressed comments (1)

src/Orleans.Runtime/OrleansContracts.txt:31

  • The contract manifest entry for IGrainDirectoryPartition.GetSnapshotAsync drops the nullable annotation from the return type. The source interface returns ValueTask<GrainDirectoryPartitionSnapshot?>, so this signature should include ? to match the analyzer's contract type rendering (it preserves nullable reference modifiers, e.g., GrainAddress?).
  GetSnapshotAsync(Orleans.Runtime.MembershipVersion, Orleans.Runtime.MembershipVersion, RingRange, System.Threading.CancellationToken) -> ValueTask<GrainDirectoryPartitionSnapshot>
  • Files reviewed: 23/24 changed files
  • Comments generated: 0 new

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond
ReubenBond force-pushed the recover-rpc-contract-analyzer branch 3 times, most recently from b1b3605 to fbfbed6 Compare August 10, 2026 13:45
@ReubenBond
ReubenBond marked this pull request as ready for review August 10, 2026 15:34
ReubenBond and others added 4 commits August 11, 2026 13:21
@ReubenBond
feat(analyzers): detect RPC contract changes
30a33c6
Recover the grain interface version analyzer and its code fixes. Track grain interface signatures in GrainInterfaces.txt so incompatible changes are identified during development.

Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 72583b82-973f-4897-939d-e29e6cedd2a0
@ReubenBond
feat(analyzers): complete Orleans contract tracking
18a38b7
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20a2d18d-fb94-43cc-8f92-67274910d221
@ReubenBond
chore(streaming): update Orleans contracts
50fa0fc
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20a2d18d-fb94-43cc-8f92-67274910d221
@ReubenBond
feat(analyzers): make contract checks opt-in
475d4da
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20a2d18d-fb94-43cc-8f92-67274910d221
@ReubenBond
ReubenBond force-pushed the recover-rpc-contract-analyzer branch from 13af6c7 to 475d4da Compare August 11, 2026 20:26
@ReubenBond
docs(analyzers): document Orleans contract checks
ff7f8bf
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20a2d18d-fb94-43cc-8f92-67274910d221
Copilot AI review requested due to automatic review settings August 11, 2026 21:12
Copilot started reviewing on behalf of ReubenBond August 11, 2026 21:13
View session
Copilot AI reviewed Aug 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Review details

Files not reviewed (1)
  • src/Orleans.Analyzers/Resources.Designer.cs: Generated file
  • Files reviewed: 30/31 changed files
  • Comments generated: 1
  • Review effort level: Lite

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread src/Orleans.Analyzers/GrainInterfaceVersionAnalyzer.cs Resolved

Uh oh!

There was an error while loading. Please reload this page.

@ReubenBond
fix(analyzers): include generic method arity
75b3e7f
Co-authored-by: Copilot App <[email protected]>

Copilot-Session: 20a2d18d-fb94-43cc-8f92-67274910d221
Copilot AI review requested due to automatic review settings August 11, 2026 22:37
Copilot started reviewing on behalf of ReubenBond August 11, 2026 22:38
View session
Copilot AI reviewed Aug 11, 2026
View reviewed changes

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

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

Review details

Files not reviewed (1)
  • src/Orleans.Analyzers/Resources.Designer.cs: Generated file
Suppressed comments (2)

src/Orleans.Analyzers/Resources.resx:198

  • The resource section header comment says the analyzer covers ORLEANS0016-0021, but this file also defines resources for ORLEANS0022-0025 (grain class diagnostics). Updating the comment will keep the resx self-describing and avoid confusion when adding future diagnostics.
  <!-- Grain Interface Version Analyzer (ORLEANS0016-0021) -->

test/Orleans.Analyzers.Tests/GrainInterfaceVersionAnalyzerTest.cs:1087

  • CreateProjectWithAdditionalFilesForCodeFix duplicates almost all of CreateProjectWithAdditionalFiles (usings prep, reference assembly setup, AdhocWorkspace project creation). This duplication makes future changes to the test harness (e.g., reference set updates) easy to apply inconsistently across the file.
  • Files reviewed: 30/31 changed files
  • Comments generated: 0 new
  • Review effort level: Lite

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@ReubenBond
ReubenBond merged commit ff1960c into dotnet:main Aug 12, 2026
135 of 138 checks passed

Uh oh!

There was an error while loading. Please reload this page.

@ReubenBond
ReubenBond deleted the recover-rpc-contract-analyzer branch August 12, 2026 00:56
@dependabot dependabot Bot mentioned this pull request Aug 28, 2026
Bump Microsoft.Orleans.Dashboard from 10.2.2 to 10.3.0 csrakowski/FeedManager#20
Merged
This was referenced Aug 31, 2026
chore: Bump Microsoft.Orleans.Serialization.Abstractions from 10.2.2 to 10.3.1 managedcode/Communication#154
Merged
chore: Bump Microsoft.Orleans.Persistence.Memory and 3 others managedcode/Communication#155
Closed
chore: Bump Microsoft.Orleans.TestingHost from 10.2.2 to 10.3.1 managedcode/Communication#156
Merged
Bump the orleans group with 1 update vgmello/momentum#341
Closed
Bump Microsoft.Orleans.BroadcastChannel and 5 others intochat/intochat#77
Closed
Bump the orleans group with 10 updates bartul/agave#86
Closed
Bump the orleans group with 3 updates microsoft/aspire-samples#1930
Closed
Bump the nuget-minor-patch group with 21 updates Systemorph/MeshWeaver#3519
Closed
chore(deps): Bump the nuget-patch-and-minor group with 13 updates petesramek/microservices-vs-virtual-actors#8
Closed
This was referenced Sep 7, 2026
Bump the orleans group with 3 updates microsoft/aspire-samples#1931
Merged
Bump the orleans group with 10 updates bartul/agave#87
Merged
Bump the dotnet group with 5 updates dotnet/docs#55908
Merged
Bump the dotnet group with 4 updates dotnet/docs#55909
Merged
Bump the dotnet group with 4 updates dotnet/docs#55910
Merged
Bump the dotnet group with 5 updates dotnet/docs#55911
Merged
Bump the dotnet group with 4 updates IvanMarkitan/dotnet-docs#838
Closed
Bump the dotnet group with 6 updates IvanMarkitan/dotnet-docs#839
Closed
Bump the dotnet group with 7 updates IvanMarkitan/dotnet-docs#840
Closed
Bump Microsoft.Orleans.Sdk and Microsoft.Orleans.Server IvanMarkitan/dotnet-docs#843
Open
Bump Microsoft.Orleans.Clustering.Redis and 4 others IvanMarkitan/dotnet-docs#845
Closed
Bump the dotnet group with 7 updates IvanMarkitan/dotnet-docs#846
Open
Bump the dotnet group with 5 updates BillWagner/docs#9804
Closed
Bump the dotnet group with 4 updates BillWagner/docs#9805
Closed
Bump the dotnet group with 4 updates BillWagner/docs#9806
Closed
Bump the dotnet group with 5 updates BillWagner/docs#9807
Closed
Bump the dotnet group with 7 updates zbalkan/docs#2339
Closed
Bump the dotnet group with 5 updates zbalkan/docs#2340
Closed
Bump the dotnet group with 6 updates zbalkan/docs#2341
Closed
Bump the dotnet group with 10 updates zbalkan/docs#2347
Open
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 11, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Reviewers

Copilot code review Copilot
Copilot review effort
Applies to this pull request for everyone.Learn more about Copilot code review.
Copilot left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@ReubenBond
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.