Repository navigation
perf(api): batch project-list user and avatar expansions - #9952
GODOSTROYER wants to merge 1 commit into
Conversation
Load only included user expansions and their avatar assets while preserving the existing project-lead join. Add database-backed coverage for bounded query growth, sparse fields, exact identities, null relations and visibility.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe project list now batches avatar-asset loading for expanded user fields, while respecting requested sparse fields. Contract tests cover serialized user data, query counts, visibility, and pagination behavior. ChangesProject list user expansions
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Merge Risk: ⚪ Minimal · up to The project-list expansion change is ready to merge after normal checks; no concrete response or loading regression remains identified. 🚥 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 |
Description
The public project-list endpoint performs repeated user and avatar reads when a page expands user relationships. For example,
fields=id,name,created_by,updated_by&expand=created_by,updated_byon 100 projects with uploaded-avatar audit users issued 408 SQL statements in the local request-stack benchmark.This follow-up to #9717 batches included
created_by,updated_by,project_lead, anddefault_assigneeexpansions together with their avatar assets. It intersectsexpandwithfields, allowlists the supported relationships, and retains the existing project-lead join. Other users use their base manager to preserve ordinary foreign-key lookup semantics, including inactive historical users.The change is confined to the list GET handler and regression tests. Serialization, permissions, ordering, pagination, writes, and schema remain unchanged. Cover-image loading is outside this scope.
Type of Change
Screenshots and Media (if applicable)
Not applicable.
Test Scenarios
6 October 2026 rerun of the corrected published harness: local 100-project audit-user measurements (20 randomized trials per variant after two warmups; SQL counts captured separately from timing):
Responses were identical. These measurements cover
APIClient.getplus JSON parsing forfields=id,name,created_by,updated_by&expand=created_by,updated_by, rather than TCP or production traffic. The A/B harness reconstructs legacy loading by removing only the new expansion prefetches at pagination; the pristine-base regression run is separate. The null-user median increased by about 12 ms, and the distinct-user optimized IQR is broad; no statistical-significance or universal latency claim is made. Real replica routing and production-scale workspaces were not exercised. Earlier 5 October measurements are preserved unchanged in the historical evidence archive; the table above uses the latest replay.References
Summary by CodeRabbit