feat: migrate to Compono/Compono.TestDoubles, bump to 0.9.0-preview.88 - #76
Merged
Conversation
…from NSubstitute) Adopts Compono for composition (replacing AutoFixture) and Compono.TestDoubles for IAmazonDynamoDB test doubles (replacing NSubstitute), using the new overload-safe argument matching (DeleteItemAsyncMatching, ADR-0044 Amendment 21) and sequential/ call-count-based responses (ReturnsSequence, ADR-0054) capabilities - the two gaps that previously required NSubstitute for AcquireLockHandleAsync_DisposeHandle_ShouldCallReleaseLock and the three retry-loop tests. NSubstitute is now fully removed from the dependency graph. Validated via scripts/dogfood-validate.sh against local Compono packages across multiple rounds of PR review on the Compono side (LayeredCraft/compono#115) before this repo's own Directory.Packages.props is bumped to the real published release in the next commit. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…iew.88 The real published release containing overload-safe argument matching (ADR-0044 Amendment 21) and sequential/call-count-based responses (ADR-0054), the two capabilities the previous commit's migration depends on. Verified against the real package (not a local/dogfood build): dotnet restore + full dotnet test across all 4 TFMs (net8.0/net9.0/ net10.0/net11.0) - 180/180 passing, matching what scripts/dogfood-validate.sh already predicted in LayeredCraft/compono#115. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 181e4b7f9f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Codex review (PR #76): Compono.TestDoubles has no invocation-aware callback, so DelayedPutItemResponseAsync()/DelayedDeleteItemResponseAsync() are eagerly invoked (and their own Task.Delay starts counting) at Configure() time, one statement before the SUT actually awaits them - not when the SUT invokes the double. Any scheduling/composition overhead between that Configure() call and the SUT's own internal stopwatch starting eats directly into the delay budget, which the prior ~5ms delay against a ">4" threshold had essentially no margin to absorb - the exact CI failure just observed (2.21ms measured, not a lock-acquisition correctness bug). Compono.NSubstitute's invocation-aware Returns(callInfo => ...) would eliminate the race entirely, but reintroducing it here would partially undo the very NSubstitute-removal this PR is about. Widened the delay/threshold margin instead (100ms delay, >20ms threshold) so realistic CI scheduling overhead can't push the measured duration below threshold. Verified with 3 consecutive full local test runs (180/180 each). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
DynamoDbDistributedLockTests.cs was passing CancellationToken.None as the token driving each sut.AcquireLockAsync/ReleaseLockAsync/AcquireLockHandleAsync call - inconsistent with Retry/RetryIntegrationTests.cs and Retry/ExponentialBackoffRetryPolicyTests.cs, which already correctly wire TestContext.Current.CancellationToken so the test framework's own cancellation (test timeout, --fail-fast, etc.) can actually reach the async call under test. CancellationToken.None never observes that. The discriminator-only Configure().PutItemAsync(new PutItemRequest(), CancellationToken.None)/DeleteItemAsync(...) calls are unaffected and correctly unchanged - real arguments there are discarded, used only for compile-time C# overload resolution on a non-matching-eligible overloaded member, not compared against what the SUT actually passes at runtime. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
IAmazonDynamoDBtest doubles.DeleteItemAsyncMatching, ADR-0044 Amendment 21) and sequential/call-count-based responses (ReturnsSequence, ADR-0054) to eliminate the last 4 NSubstitute-dependent test sites — NSubstitute is now fully removed from the dependency graph.Compono/Compono.XunitV3/Compono.TestDoublesto the real published0.9.0-preview.88.Validation
scripts/dogfood-validate.shagainst local Compono packages) during LayeredCraft/compono#115's review process, before0.9.0-preview.88was published.dotnet restore+ fulldotnet testacross all 4 TFMs (net8.0/net9.0/net10.0/net11.0) — 180/180 passing, matching the dogfood predictions exactly.Test plan
dotnet restoreagainst the real published0.9.0-preview.88dotnet test— 45/45 × 4 TFMs = 180/180 passingdotnet list packageconfirms every Compono reference resolves to0.9.0-preview.88(no stale/local packages)