🧪 Add testing for record_tool_usage token logic#91
Conversation
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
|
👋 Jules, reporting for duty! I'm here to lend a hand with this pull request. When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down. I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job! For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
There was a problem hiding this comment.
Sorry @sheepdestroyer, you have reached your weekly rate limit of 500000 diff characters.
Please try again later or upgrade to continue using Sourcery
📝 WalkthroughWalkthroughAdds an isolated test module for ChangesRecord tool usage tests
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
@jules there are conflicts preventing merge |
I have resolved the merge conflicts in |
|
@jules there are conflicts preventing merge |
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
I have previously resolved the conflicts and submitted the changes. The PR should be in a mergeable state now. |
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
|
@jules there are new conflicts preventing merge |
I have successfully merged |
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
|
@jules there are conflicts preventing rebase |
I have successfully rebased onto the latest master and resolved the merge conflicts in |
Co-authored-by: sheepdestroyer <1377479+sheepdestroyer@users.noreply.github.com>
There was a problem hiding this comment.
🧹 Nitpick comments (1)
test_record_tool_usage.py (1)
17-21: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffAsync persistence path is left untested. Because these tests run synchronously,
asyncio.get_running_loop()always raisesRuntimeErrorandrecord_tool_usagetakes the sync fallback (_atomic_write_json_sync). Theloop.create_task(save_persisted_stats())branch is therefore never exercised. If you want coverage of that path, consider an async test that runs within an event loop and asserts the background task is scheduled.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test_record_tool_usage.py` around lines 17 - 21, The current fixture only exercises the synchronous persistence fallback in record_tool_usage, so the asyncio.get_running_loop and loop.create_task(save_persisted_stats()) path remains untested. Add an async test around record_tool_usage that runs inside an event loop and verifies the background persistence task is scheduled, while keeping the existing mock_persistence setup for router.main._atomic_write_json_sync and router.main.save_persisted_stats.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@test_record_tool_usage.py`:
- Around line 17-21: The current fixture only exercises the synchronous
persistence fallback in record_tool_usage, so the asyncio.get_running_loop and
loop.create_task(save_persisted_stats()) path remains untested. Add an async
test around record_tool_usage that runs inside an event loop and verifies the
background persistence task is scheduled, while keeping the existing
mock_persistence setup for router.main._atomic_write_json_sync and
router.main.save_persisted_stats.
|
@jules assess and address code reviews and comments |
I have successfully run |
🎯 What:
Added dedicated testing for
record_tool_usageinrouter/main.py. This covers a testing gap where the in-memory token accumulator and sliding-window timeline tracker for agent tools were entirely untested, despite interacting closely with production dict state.📊 Coverage:
✨ Result:
The
record_tool_usagetoken logic is fully tested and guarded from future regressions. Test cases execute locally and mock async JSON writes successfully to stay isolated from filesystem impact and fast.PR created automatically by Jules for task 3580129709200353766 started by @sheepdestroyer
Summary by CodeRabbit