Skip to content

[DB-1951] Add MSA idempotency tests that correspond to the existing behaviour#5565

Open
timothycoleman wants to merge 2 commits intomasterfrom
timothycoleman/msa-idempotency-tests
Open

[DB-1951] Add MSA idempotency tests that correspond to the existing behaviour#5565
timothycoleman wants to merge 2 commits intomasterfrom
timothycoleman/msa-idempotency-tests

Conversation

@timothycoleman
Copy link
Contributor

These are probably largely covered by tests elsewhere, but I wanted to have a systematic approach in one place. It'll make it easier to verify the effect of adjusting the idempotency behaviour of check-only streams

Copilot AI review requested due to automatic review settings March 25, 2026 06:43
@qodo-code-review
Copy link
Contributor

Review Summary by Qodo

Add comprehensive MSA idempotency tests for multi-stream writes

🧪 Tests

Grey Divider

Walkthroughs

Description
• Add comprehensive idempotency test suite for multi-stream writes
• Test Full, Partial, WithFailedCheck, and WithSuccessfulCheck idempotency scenarios
• Test idempotent behavior across different expected versions and stream states
• Test idempotent behavior when stream is modified after initial write
Diagram
flowchart LR
  A["Test Suite Setup"] --> B["IdempotencyKind Enum"]
  B --> C["IdempotentBehaviorByKindCases"]
  C --> D["idempotent_behaviour_by_kind Test"]
  B --> E["StreamModification Enum"]
  E --> F["IdempotentBehaviorByStreamChangedCases"]
  F --> G["idempotent_behavior_by_stream_change Test"]
Loading

Grey Divider

File Changes

1. src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs 🧪 Tests +305/-0

Add systematic idempotency test coverage for multi-stream writes

• Added IdempotencyKind enum with Full, Partial, WithFailedCheck, and WithSuccessfulCheck variants
• Added IdempotentBehaviorByKindCases() theory data with 40+ test cases covering different
 expected versions and stream states
• Added idempotent_behaviour_by_kind() test method validating idempotency behavior for each kind
• Added StreamModification enum and IdempotentBehaviorByStreamChangedCases() theory data with
 15+ test cases
• Added idempotent_behavior_by_stream_change() test method validating idempotency when streams are
 modified

src/KurrentDB.Core.XUnit.Tests/TransactionLog/MultiStreamWrites/MultiStreamWritesTests.cs


Grey Divider

Qodo Logo

@qodo-code-review
Copy link
Contributor

qodo-code-review bot commented Mar 25, 2026

Code Review by Qodo

🐞 Bugs (0) 📘 Rule violations (0) 📎 Requirement gaps (0) 📐 Spec deviations (0)

Grey Divider

Great, no issues found!

Qodo reviewed your code and found no material issues that require review

Grey Divider

ⓘ The new review experience is currently in Beta. Learn more

Grey Divider

Qodo Logo

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a systematic set of multi-stream append idempotency tests to capture and lock in current behavior, especially around check-only streams and stream-state transitions, making future behavior changes easier to validate.

Changes:

  • Introduces theory-driven test matrices for idempotent retries by “kind” (full/partial + check-only variants).
  • Adds theory-driven tests for idempotent retries when the target stream changes between attempts (more events / soft-delete / tombstone).
  • Introduces supporting enums and case tables to enumerate applicable (ExpectedVersion, StreamState) combinations.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +1433 to +1434
Assert.Equal(expectedResult, retry.Result);

Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For non-success retries, this test only asserts retry.Result. Other tests in this file also assert ConsistencyCheckFailures (and often FirstEventNumbers/LastEventNumbers) to verify which stream failed and why. Adding those assertions here would make these idempotency cases much more specific and prevent regressions where the error shifts from T to the check-only stream (or vice versa).

Copilot uses AI. Check for mistakes.
@timothycoleman timothycoleman changed the title Add MSA idempotency tests that correspond to the existing behaviour [DB-1951] Add MSA idempotency tests that correspond to the existing behaviour Mar 25, 2026
@linear
Copy link

linear bot commented Mar 25, 2026

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants