Skip to content

feat: migrate to Compono/Compono.TestDoubles, bump to 0.9.0-preview.88 - #76

Merged
ncipollina merged 4 commits into
mainfrom
feat/compono-0.9.0-preview.88
Aug 28, 2026
Merged

feat: migrate to Compono/Compono.TestDoubles, bump to 0.9.0-preview.88#76
ncipollina merged 4 commits into
mainfrom
feat/compono-0.9.0-preview.88

Conversation

@ncipollina

Copy link
Copy Markdown
Collaborator

Summary

  • Migrates from AutoFixture to Compono for test composition, and from NSubstitute to Compono.TestDoubles for IAmazonDynamoDB test doubles.
  • Uses the new overload-safe argument matching (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.
  • Bumps Compono/Compono.XunitV3/Compono.TestDoubles to the real published 0.9.0-preview.88.

Validation

  • This migration was validated across multiple rounds of dogfooding (scripts/dogfood-validate.sh against local Compono packages) during LayeredCraft/compono#115's review process, before 0.9.0-preview.88 was published.
  • Re-verified against the real, publicly published package in this PR: dotnet restore + full dotnet test across all 4 TFMs (net8.0/net9.0/net10.0/net11.0) — 180/180 passing, matching the dogfood predictions exactly.

Test plan

  • dotnet restore against the real published 0.9.0-preview.88
  • dotnet test — 45/45 × 4 TFMs = 180/180 passing
  • dotnet list package confirms every Compono reference resolves to 0.9.0-preview.88 (no stale/local packages)

ncipollina and others added 2 commits August 27, 2026 21:13
…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>
@github-actions github-actions Bot added the type: feat New feature label Aug 28, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread test/DynamoDb.DistributedLock.Tests/DynamoDbDistributedLockTests.cs
ncipollina and others added 2 commits August 27, 2026 21:50
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>
@ncipollina
ncipollina merged commit a5ec6ee into main Aug 28, 2026
5 checks passed
@ncipollina
ncipollina deleted the feat/compono-0.9.0-preview.88 branch August 28, 2026 01:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type: feat New feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant