perf(groups): scale membership summaries - #772
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (5)
WalkthroughGroup summaries now populate ChangesGroup membership scaling
Estimated code review effort: 3 (Moderate) | ~25 minutes Merge Risk: ⚪ Minimal · up to The change preserves existing response behavior and includes regression coverage and migration validation; no actionable merge-blocking risk remains. Sequence Diagram(s)sequenceDiagram
participant GroupListAPI
participant get_group
participant SQLDatabase
GroupListAPI->>get_group: Request group summaries
get_group->>SQLDatabase: Count user associations and fetch groups
SQLDatabase-->>get_group: Return groups with total_users
get_group-->>GroupListAPI: Return summaries without Group.users
Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 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 |
|
@coderabbitai review |
✅ Action performedReview finished.
|
Summary
Group.total_usersin SQL for the group-list query instead of hydrating every relatedUserCloses #771
Type of change
Checklist
Testing
uv run ruff check .— passeduv run ruff format --check app/db/models.py app/db/crud/group.py tests/test_group_membership_indexes.py tests/api/test_group.py— passeduv run pytest -q tests/test_group_membership_indexes.py tests/api/test_group.py::test_groups_get_counts_users_without_loading_user_rows— 3 passeduv run alembic checkon SQLite — no new upgrade operationsCOMMIT,CREATE INDEX CONCURRENTLY, thenBEGIN; downgrade emitsDROP INDEX CONCURRENTLYSynthetic SQLite benchmark (500,000 memberships / 100 groups):
The benchmark is directional and is not presented as a production guarantee.
Screenshots
Not applicable (backend/database-only change).
Notes for reviewers
autocommit_block()for this path.Summary by CodeRabbit
Improvements
Bug Fixes
Tests