Skip to content

fix(analyzers): clarify Orleans contract identities - #10910

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-analyzers-clarify-identities
Aug 28, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-fix-analyzers-clarify-identities

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 28, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #10869.

The hash-first method layout obscured the CLR method being reviewed and represented generated, [Id], and [Alias] identities differently. This change makes every method entry identity-first and uniform:

remove: RemoveAsync(string) -> Task

The analyzer now compares the effective runtime identity string regardless of whether source provides it through [Id], [Alias], or the generated method hash. Regeneration keeps CLR signatures inline, escapes syntax-sensitive identity characters, updates manifests only, and produces deterministic ordering which makes wire-breaking identity changes prominent in diffs.

The analyzer category is shortened from Orleans.Versioning to the conventional Versioning, yielding the standard category-Versioning editorconfig syntax.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 28, 2026 18:47

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

Review tier: Lite
Findings: 2 High severity

New issues introduced by this change (2)
Severity Finding
High severity src/​Orleans.Analyzers/​GrainInterfaceVersionAnalyzer.cs — memberSignature is computed but never used in this loop. With warnings-as-errors, this will fail…
High severity src/​Orleans.Analyzers/​GrainInterfaceVersionAnalyzer.cs — [Id(...)] values should be formatted using CultureInfo.InvariantCulture to match the code…
What changed in this PR

Updates the Orleans contract-compatibility analyzer and regeneration code fix to use a uniform, identity-first OrleansContracts.txt method format (wire-identity: CLR-signature), aligning diagnostics, code fixes, docs, and generated manifests around the effective runtime wire identity (from [Id], [Alias], or generated hash) and a shortened diagnostic category name (Versioning).

Changes:

  • Switches manifests and regeneration output to wire-identity: signature lines with escaping for syntax-sensitive identity characters and deterministic ordering.
  • Updates analyzer matching logic and diagnostic messaging to compare effective wire identity consistently, and renames the analyzer category from Orleans.Versioning to Versioning.
  • Refreshes tests and documentation to reflect the new manifest format and configuration guidance.
File Description
test/​Orleans.Analyzers.Tests/​GrainInterfaceVersionAnalyzerTest.cs Updates/extends unit tests for the new identity-first manifest syntax, escaping, and deterministic ordering behaviors.
src/​Orleans.Transactions/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Transactions.TestKit.Base/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.TestingHost/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Streaming/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Runtime/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format (including alias-based identities).
src/​Orleans.Reminders/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Persistence.Memory/​OrleansContracts.txt Updates manifest header to document the new format version and method line syntax.
src/​Orleans.EventSourcing/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.DurableJobs/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Core/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Core.Abstractions/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.BroadcastChannel/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Dashboard/​Orleans.Dashboard/​OrleansContracts.txt Regenerated manifest entries to the new wire-identity: signature format.
src/​Orleans.Analyzers/​Resources.resx Updates diagnostic message text to reference effective wire identity and new argument ordering.
src/​Orleans.Analyzers/​Resources.Designer.cs Regenerated designer output from updated resources (formatting changes).
src/​Orleans.Analyzers/​GrainInterfaceVersionCodeFix.cs Updates regeneration/code-fix logic to emit identity-first member lines and updated header guidance.
src/​Orleans.Analyzers/​GrainInterfaceVersionAnalyzer.cs Updates analyzer category, identity extraction/escaping, and matching logic to compare effective wire identity consistently.
src/​Orleans.Analyzers/​AnalyzerReleases.Unshipped.md Updates rule category names to Versioning for shipped analyzer metadata.
docs/​site/​src/​content/​docs/​grains/​grain-versioning/​contract-compatibility-analyzer.md Updates documentation to explain the new method-line syntax and how to configure severity using category-Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0027.md Updates category and wording to align with the new manifest identity model.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0025.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0024.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0023.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0022.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0021.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0020.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0019.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0018.md Updates category and guidance text to match identity-first manifest semantics.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0017.md Updates category to Versioning.
docs/​site/​src/​content/​docs/​diagnostics/​orleans0016.md Updates category to Versioning.

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

Copilot AI review requested due to automatic review settings August 28, 2026 19:40

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

Review tier: Lite
Findings: None

Issues resolved since last review (2)
Severity Finding
High severity src/​Orleans.Analyzers/​GrainInterfaceVersionAnalyzer.cs — [Id(...)] values should be formatted using CultureInfo.InvariantCulture to match the code… View resolved comment
High severity src/​Orleans.Analyzers/​GrainInterfaceVersionAnalyzer.cs — memberSignature is computed but never used in this loop. With warnings-as-errors, this will fail… View resolved comment
Suppressed comments (1)

Previously missed (1) — in code that hasn't changed since the last review.

src/Orleans.Analyzers/GrainInterfaceVersionAnalyzer.cs:1250

  • TryGetMemberDeclaration assumes the delimiter is exactly ": " and then uses Substring(identityDelimiter + 2) without trimming. If a manifest line is formatted as identity: Method(...) -> ... (extra whitespace after the colon), the parsed signature will start with a space and will never match GetManifestMethodSignature, producing spurious diagnostics. Trimming after the delimiter makes parsing tolerant to common whitespace variations without affecting the canonical output format.
        wireIdentity = new MethodWireIdentity(
            UnescapeWireIdentity(declaration.Substring(0, identityDelimiter)));
        declaration = declaration.Substring(identityDelimiter + 2);
        var match = MemberPattern.Match(declaration);

@ReubenBond
ReubenBond merged commit 137d9ac into dotnet:main Aug 28, 2026
72 checks passed
@ReubenBond
ReubenBond deleted the rb-fix-analyzers-clarify-identities branch August 28, 2026 20:02
@github-actions github-actions Bot locked and limited conversation to collaborators Sep 28, 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