Skip to content

Conversation

@fain182
Copy link
Collaborator

@fain182 fain182 commented Dec 14, 2025

This fixes issue #303 where reusing the result of that() for multiple should() calls would cause duplicate violations due to shared mutable state in the RuleBuilder.

The fix makes should() and andThat() clone the RuleBuilder before adding constraints/specs, ensuring each rule branch gets an isolated copy of the builder state.

Added RuleBuilder::__clone() to deep clone Specs and Constraints objects.

@codecov
Copy link

codecov bot commented Dec 14, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.75%. Comparing base (f8978a3) to head (49ad5fc).
⚠️ Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##               main     #543   +/-   ##
=========================================
  Coverage     97.75%   97.75%           
- Complexity      616      617    +1     
=========================================
  Files            80       80           
  Lines          1779     1784    +5     
=========================================
+ Hits           1739     1744    +5     
  Misses           40       40           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This fixes issue #303 where reusing the result of that() for multiple
should() calls would cause duplicate violations due to shared mutable
state in the RuleBuilder.

The fix makes should() and andThat() clone the RuleBuilder before
adding constraints/specs, ensuring each rule branch gets an isolated
copy of the builder state.

Added RuleBuilder::__clone() to deep clone Specs and Constraints objects.
@fain182 fain182 force-pushed the claude/fix-issue-303-rKjhC branch from 6852fdd to 49ad5fc Compare December 14, 2025 13:01
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.

3 participants