fix: add thread-safe accessor methods to mockRecorderClient #80
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.
Fixes #59
Fixes data race in
bridge_integration_test.gowhere test code was directly accessingmockRecorderClientfields (tokenUsages,userPrompts,toolUsages,interceptions) without holding the mutex, while theRecord*methods were modifying these fields under the mutex.Changes
Added four new accessor methods that return copies of the recorded data under mutex protection:
RecordedTokenUsages()RecordedPromptUsages()RecordedToolUsages()RecordedInterceptions()All direct field accesses in tests have been replaced with calls to these new thread-safe accessor methods.
Testing
All tests pass with
-raceflag enabled:Non-agent testing