Repository navigation
fix(analyzers): clarify Orleans contract identities - #10910
Conversation
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: 2
New issues introduced by this change (2)
| Severity | Finding |
|---|---|
src/Orleans.Analyzers/GrainInterfaceVersionAnalyzer.cs — memberSignature is computed but never used in this loop. With warnings-as-errors, this will fail… |
|
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: signaturelines 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.VersioningtoVersioning. - 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.
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: None
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
src/Orleans.Analyzers/GrainInterfaceVersionAnalyzer.cs — [Id(...)] values should be formatted using CultureInfo.InvariantCulture to match the code… View resolved comment |
|
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
TryGetMemberDeclarationassumes the delimiter is exactly": "and then usesSubstring(identityDelimiter + 2)without trimming. If a manifest line is formatted asidentity: Method(...) -> ...(extra whitespace after the colon), the parsedsignaturewill start with a space and will never matchGetManifestMethodSignature, 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);

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: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.Versioningto the conventionalVersioning, yielding the standardcategory-Versioningeditorconfig syntax.Microsoft Reviewers: Open in CodeFlow