Skip to content

test(transactions): verify consistency histories - #10875

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

ReubenBond merged 2 commits into
dotnet:mainfrom
ReubenBond:rb-issue-10863-raise-state-coverage

Conversation

@ReubenBond

@ReubenBond ReubenBond commented Aug 27, 2026

Copy link
Copy Markdown
Member

Problem

The transaction TestKit consistency verifier had no deterministic coverage despite carrying the highest measured state-testing risk: CheckConsistency was uncovered with cyclomatic complexity 54 and CRAP 2970. Its rejection rules were exercised primarily through randomized and stress-oriented tests.

Solution

Add deterministic BVT tests for valid serialized histories, missing versions, multiple and invalid writers, invalid readers, dependency cycles, in-doubt outcomes, and timeout tolerance. Factor history recording and consistency checks into invariant-specific helpers so runtime collection and deterministic verification use the same paths.

Rationale

The focused suite verifies persisted version observations, ordering, serializability, abort state, corruption-shaped histories, and recoverable incomplete outcomes without cloud dependencies. The extraction lowers CheckConsistency complexity from 54 to 8 while focused coverage reaches 93.3% line and 100% branch for that method.

Progress toward #10863.

Microsoft Reviewers: Open in CodeFlow

Copilot AI lite review requested due to automatic review settings August 27, 2026 23:22

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 src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.cs — CheckConsistency mutates and relies on the instance fields 'orderEdges' and 'marks' but never…
What changed in this PR

This PR adds deterministic BVT coverage for the Transactions TestKit’s consistency verifier and refactors ConsistencyTestHarness.CheckConsistency into smaller invariant-focused helpers so both randomized history collection and deterministic verification exercise the same code paths.

Changes:

  • Added a new deterministic BVT test suite covering valid histories and specific inconsistency cases (missing versions, multiple writers, invalid readers/writers, dependency cycles, in-doubt and timeout tolerance).
  • Refactored ConsistencyTestHarness to factor history recording into helpers and decompose consistency checking into smaller methods.
File Description
test/​Transactions/​Orleans.Transactions.Tests/​ConsistencyTestHarnessTests.cs New deterministic BVT tests for serialized history validation and rejection rules.
src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.cs Refactors recording/checking into helpers and initializes output to a no-op by default.

💡 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 01:00
@ReubenBond
ReubenBond force-pushed the rb-issue-10863-raise-state-coverage branch from 4ff750e to 7f5b262 Compare August 28, 2026 01:00

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

New issues introduced by this change (1)
Severity Finding
Medium severity src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.cs — RecordSucceeded mutates harness state (adds to succeeded and starts recording observations) before…
Pre-existing issues (1)
Severity Finding
Medium severity src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.cs — CheckConsistency mutates and relies on the instance fields 'orderEdges' and 'marks' but never… View comment

@github-actions

github-actions Bot commented Aug 28, 2026

Copy link
Copy Markdown
Contributor

Code coverage

78.65% line coverage - 99,638 / 126,681 lines

Coverage details

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

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 src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.csCheckConsistency now only uses the method parameter tolerateUnknownExceptions, while the…
Issues resolved since last review (2)
Severity Finding
Medium severity src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.cs — RecordSucceeded mutates harness state (adds to succeeded and starts recording observations) before… View resolved comment
Medium severity src/​Orleans.Transactions.TestKit.Base/​Consistency/​ConsistencyTestHarness.cs — CheckConsistency mutates and relies on the instance fields 'orderEdges' and 'marks' but never… View resolved comment

Comment on lines 183 to +187
public void CheckConsistency(bool tolerateGenericTimeouts = false, bool tolerateUnknownExceptions = false)
{
orderEdges.Clear();
marks.Clear();

@ReubenBond
ReubenBond merged commit db0b4ca into dotnet:main Aug 28, 2026
76 checks passed
@ReubenBond
ReubenBond deleted the rb-issue-10863-raise-state-coverage branch August 28, 2026 06:55
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