Skip to content

test(runtime): cover ring range collection invariants - #10879

Merged
ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-issue-10858-raise-runtime-coverage
Aug 28, 2026
Merged

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-issue-10858-raise-runtime-coverage

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 27, 2026

Copy link
Copy Markdown
Member

Problem

RingRangeCollectionTests generated 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 RingRangeCollection reaches 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

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: 1 Medium severity

New issues introduced by this change (1)
Severity Finding
Medium severity test/​Orleans.Core.Tests/​Directory/​RingRangeCollectionTests.csSizePercent 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

  • SizePercent is a float, but this assertion uses an int literal. 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.

Comment thread test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs Outdated
Copilot AI review requested due to automatic review settings August 28, 2026 00:39
@ReubenBond
ReubenBond force-pushed the rb-issue-10858-raise-runtime-coverage branch from 40fea05 to 7b93c38 Compare August 28, 2026 00:39

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: 1 Medium severity · 1 Low severity

New issues introduced by this change (1)
Severity Finding
Low severity 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
Medium severity test/​Orleans.Core.Tests/​Directory/​RingRangeCollectionTests.csSizePercent is a float, but this assertion uses an int literal. Depending on xUnit overload… View comment

Comment thread test/Orleans.Core.Tests/Directory/RingRangeCollectionTests.cs
@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Code coverage

78.61% line coverage - 99,520 / 126,605 lines

Coverage details

Copilot AI review requested due to automatic review settings August 28, 2026 03:45

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: 1 High severity

New issues introduced by this change (1)
Severity Finding
High severity test/​Orleans.Core.Tests/​Directory/​RingRangeCollectionTests.csGrainId is in the Orleans.Runtime namespace, but this test file does not import that namespace.…
Issues resolved since last review (2)
Severity Finding
Low severity 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
Medium severity test/​Orleans.Core.Tests/​Directory/​RingRangeCollectionTests.csSizePercent 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 Sep 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants