test(runtime): cover ring range collection invariants - #10879
Merged
ReubenBond merged 2 commits intoAug 28, 2026
Merged
Conversation
7 tasks
11 tasks
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs — SizePercent is a float, but this assertion uses an int literal. Depending on xUnit overload… |
What changed in this PR
Improves Orleans.Runtime.GrainDirectory correctness assurance by replacing ineffective generated tests with deterministic, invariant-focused coverage for RingRangeCollection and related RingRange behaviors (containment, intersections, growth deltas, equality, enumeration, formatting).
Changes:
- Replaced randomized/generative cases with deterministic assertions for range construction and ordering, including empty/full handling.
- Added explicit tests for boundary semantics (exclusive start, inclusive end) and wrapped range behavior.
- Added tests for collection/collection and collection/range intersection, difference (“growth only”), equality/hash code, enumeration, and formatting.
| File | Description |
|---|---|
| test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs | Replaces prior generative tests with deterministic assertions covering RingRangeCollection invariants and edge cases. |
Suppressed comments (1)
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs:47
SizePercentis afloat, but this assertion uses anintliteral. Prefer a float assertion with tolerance to avoid flakiness from floating-point rounding.
Assert.Equal(100, full.SizePercent);
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
ReubenBond
force-pushed
the
rb-issue-10858-raise-runtime-coverage
branch
from
August 28, 2026 00:39
40fea05 to
7b93c38
Compare
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs — This test method name states it verifies the GrainId overload uses the uniform hash code, but the… |
Pre-existing issues (1)
| Severity | Finding |
|---|---|
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs — SizePercent is a float, but this assertion uses an int literal. Depending on xUnit overload… View comment |
Contributor
Code coverage78.61% line coverage - 99,520 / 126,605 lines Coverage details
|
Contributor
There was a problem hiding this comment.
Copilot review overview
Review tier: Lite
Findings: 1
New issues introduced by this change (1)
| Severity | Finding |
|---|---|
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs — GrainId is in the Orleans.Runtime namespace, but this test file does not import that namespace.… |
Issues resolved since last review (2)
| Severity | Finding |
|---|---|
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs — This test method name states it verifies the GrainId overload uses the uniform hash code, but the… View resolved comment |
|
test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs — SizePercent is a float, but this assertion uses an int literal. Depending on xUnit overload… View resolved comment |
Comment on lines
+71
to
+72
| var grainId = GrainId.Create("test", "grain"); | ||
| var collection = Create(RingRange.FromPoint(grainId.GetUniformHashCode())); |
This was referenced Aug 29, 2026
This was referenced Sep 7, 2026
This was referenced Sep 14, 2026
Open
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.



Problem
RingRangeCollectionTestsgenerated only empty collections, so core directory range operations such as collection intersection and handoff growth deltas remained effectively untested. The merged baseline measured the target at 37.78% line coverage and 14.29% branch coverage, with CRAP scores of 156 and 110 for the collection/range intersection overloads.Solution
Replace the ineffective generated cases with deterministic assertions for sorted range construction, exclusive/inclusive boundaries, wrapped ranges, empty/full collections, both intersection directions, handoff growth deltas, wrapped-result ordering, equality, hashing, enumeration, and formatting.
Coverage impact
Focused Cobertura coverage for
RingRangeCollectionreaches 100% line coverage and 98.72% branch coverage. Against the merged issue baseline, this covers 84 previously uncovered lines and 47 previously uncovered branches. All target methods now have CRAP scores below 30.Part of #10858.
Microsoft Reviewers: Open in CodeFlow