Skip to content

Conversation

graycampbell
Copy link
Collaborator

@graycampbell graycampbell commented Jul 26, 2025

📝 Summary

  • Updated all the mock method and mock property backing types to read and write data directly to their private, locked properties instead of to the locked properties' public-facing wrappers to prevent race conditions.
  • Updated unit tests to validate that the race conditions are no longer possible.

🛠️ Type of Change

  • Bug fix (change that fixes an issue)
  • New feature (change that adds functionality)
  • Breaking change (bug fix or feature that is not backwards compatible)
  • Documentation (DocC, API docs, markdown files, templates, etc.)
  • Testing (new tests, updated tests, etc.)
  • Refactoring or code formatting (no logic changes)
  • Updating dependencies (Swift packages, Homebrew, etc.)
  • CI/CD (change to automated workflows)
  • Chore (other maintenance)

🧪 How Has This Been Tested?

  • Updated unit tests to validate that the race conditions are no longer possible by using a barrier to force concurrent execution across tasks.
  • Added new unit tests.

🔗 Related PRs or Issues

✅ Checklist

  • I have added relevant tests
  • I have verified all tests pass
  • I have formatted my code using SwiftFormat
  • I have updated documentation (if needed)
  • I have added the appropriate label to my PR
  • I have read the contributing guidelines
  • I agree to follow this project's Code of Conduct

@graycampbell graycampbell self-assigned this Jul 26, 2025
@graycampbell graycampbell added the bug Something isn't working label Jul 26, 2025
@graycampbell graycampbell changed the title Bugfix/mock does not properly record simultaneous input Fix race conditions in mock methods and mock properties Jul 26, 2025
@graycampbell graycampbell force-pushed the bugfix/mock-does-not-properly-record-simultaneous-input branch from ad97739 to fe19537 Compare July 28, 2025 15:14
Copy link

codecov bot commented Jul 28, 2025

Codecov Report

❌ Patch coverage is 77.87611% with 75 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.65%. Comparing base (27a14fa) to head (fe19537).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...kPropertyAsyncGetter/MockPropertyAsyncGetter.swift 0.00% 15 Missing ⚠️
...rowingGetter/MockPropertyAsyncThrowingGetter.swift 0.00% 15 Missing ⚠️
...essors/MockPropertyGetter/MockPropertyGetter.swift 0.00% 15 Missing ⚠️
...essors/MockPropertySetter/MockPropertySetter.swift 0.00% 15 Missing ⚠️
...rtyThrowingGetter/MockPropertyThrowingGetter.swift 0.00% 15 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #122      +/-   ##
==========================================
+ Coverage   69.24%   69.65%   +0.40%     
==========================================
  Files          73       73              
  Lines        4585     4811     +226     
==========================================
+ Hits         3175     3351     +176     
- Misses       1410     1460      +50     

☔ 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.

@graycampbell graycampbell marked this pull request as ready for review July 28, 2025 15:30
@graycampbell
Copy link
Collaborator Author

In regards to the Codecov Report, I didn't add any new tests in this PR. It's already a very big PR, so I decided to only update existing tests. I will add new tests for all the mock property accessors in a separate PR later this week.

Copy link
Member

@pjtnt11 pjtnt11 left a comment

Choose a reason for hiding this comment

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

Some things I think we can improve but otherwise looks good ✅

@graycampbell graycampbell merged commit 8a1acea into main Jul 28, 2025
8 checks passed
@graycampbell graycampbell deleted the bugfix/mock-does-not-properly-record-simultaneous-input branch July 28, 2025 19:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Mock doesn't record every invocation when invoked simultaneously across threads
3 participants