Unit tests for project_a2a - #2253
Conversation
|
Warning Review limit reached
Next review available in: 16 minutes Enable usage-based reviews in Billing to review now. Otherwise, wait until the next included review is available. How can I continue?After more reviews become available, a review can be triggered using the To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews. How do review limits work?CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability. For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window. Please refer docs for additional details. Review details⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (2)
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 |
|
Reviewed: purely additive new file, 30 unit tests over the project-A2A channel provisioning helpers - idempotency, member add/remove sync, lead resolution, duplicate archival, and the archived-only reprovision path all covered. Unit-level is right for these helpers per the card. Merging on green. |
PR Summary by QodoAdd async unit tests for A2A channel provisioning and torrent settings routes
AI Description
Diagram
High-Level Assessment
Files changed (2)
|
|
nemotron-ultra-kilo review VERDICT: Two new test files added with good coverage but several issues: tight coupling to implementation details, missing error/edge case tests, and potential test interference via global state mutation.
Automated first-pass review by the nemotron-ultra-kilo lane. The lead still reviews before merge. |
|
nemotron-super review VERDICT: Pass Automated first-pass review by the nemotron-super lane. The lead still reviews before merge. |
|
nemotron-ultra-orB review Based on the diff provided, here's my code review: VERDICT: PASS with minor issues
No blocking issues found. Automated first-pass review by the nemotron-ultra-orB lane. The lead still reviews before merge. |
Code Review by Qodo
1. Unrelated test_routes_torrent.py added
|
| """Endpoint tests for tinyagentos/routes/torrent.py.""" | ||
|
|
||
| from __future__ import annotations |
There was a problem hiding this comment.
1. Unrelated test_routes_torrent.py added 📜 Skill insight ⚙ Maintainability
This PR is titled and described as unit tests for project_a2a, but it also adds a separate route test suite for tinyagentos/routes/torrent.py, bundling two concerns in one PR. Bundled changes reduce reviewability and increase regression risk.
Agent Prompt
## Issue description
This PR bundles two unrelated test additions: `project_a2a` unit tests and `torrent` route endpoint tests.
## Issue Context
Compliance requires PRs to contain only changes related to the stated purpose, to keep reviews focused and reduce unintended side effects.
## Fix Focus Areas
- tests/test_routes_torrent.py[1-81]
- tests/test_project_a2a.py[1-573]
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| @pytest.mark.asyncio | ||
| async def test_build_agent_lookups_with_config(stores): | ||
| """_build_agent_lookups builds id->agent and name->agent dicts from config.""" | ||
| from tinyagentos.projects.a2a import _build_agent_lookups |
There was a problem hiding this comment.
2. Unused stores fixture setup 🐞 Bug ➹ Performance
Several pure helper-function tests in tests/test_project_a2a.py request the async stores fixture but never use it, so each test still opens/inits/closes two SQLite stores unnecessarily. This adds avoidable overhead to the test suite and makes these unit-level tests depend on DB setup despite only exercising synchronous helpers.
Agent Prompt
### Issue description
Some helper-function unit tests (`_build_agent_lookups`, `_resolve_member_names`, `_resolve_lead_names`) declare a `stores` fixture parameter but never reference it. Because `stores` initializes `ProjectStore` and `ChatChannelStore`, these tests pay unnecessary SQLite init/teardown cost and implicitly depend on DB availability.
### Issue Context
These tests only call synchronous helper functions and do not need `ProjectStore`/`ChatChannelStore`.
### Fix Focus Areas
- tests/test_project_a2a.py[28-37]
- tests/test_project_a2a.py[39-177]
### Suggested fix
- Remove the `stores` parameter from tests that don’t use it.
- Optionally remove `@pytest.mark.asyncio` and make those tests synchronous (they don’t `await`).
- Keep `stores` only for tests that actually unpack/use `(project_store, channel_store)`.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
| chans = await channel_store.list_channels(project_id=p["id"]) | ||
| a2a = next(c for c in chans if (c.get("settings") or {}).get("kind") == A2A_KIND) | ||
| assert a2a["settings"]["leads"] == ["coord"] No newline at end of file |
There was a problem hiding this comment.
3. Missing trailing newline 🐞 Bug ⚙ Maintainability
tests/test_project_a2a.py is added without a trailing newline at end-of-file. This is a minor formatting defect that can cause style/lint noise and inconsistent diffs in future edits.
Agent Prompt
### Issue description
The new test file ends without a final newline.
### Issue Context
Git diff metadata flags the missing newline; many editors/formatters expect a POSIX-style trailing newline.
### Fix Focus Areas
- tests/test_project_a2a.py[571-573]
### Suggested fix
- Add a single newline after the last line in the file.
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools
CARD TITLE (intent, not commit subject): Unit tests for project_a2a
Autonomous build of board card tsk-rctyui.
Files:
tests/test_project_a2a.py | 573 ++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 573 insertions(+)