AAP-95125 XLAB Add the organization ownership data to the Leaderboard API #457
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #457"
general
weight: 0.35
kcagran
AAP-95125 Adding the organization ownership data to the Leaderboard API
Description
<!-- Mandatory: Provide a clear, concise description of the changes and their purpose -->
This pull request updates the organization streak and leaderboard logic to scope results to the current user's organization memberships, rather than the globally busiest organization. It ensures that the organization streak, leaderboard highlighting, and related achievements are personalized for each user. The changes also improve robustness when organization membership data is unavailable and enhance test coverage for these scenarios.
Personalized organization streak and leaderboard:
The
org_streakand leaderboard are now scoped to the user's busiest organization among their memberships, rather than the busiest overall. If the user has no organizations or none with activity, the streak is empty and zero-filled. [[1]](diffhunk://#diff-4fe1e1feabca7383b24ce87564bb8db4bb23dcc273958fb0b5f8e1bc6170bd4dR258-R298) [[2]](diffhunk://#diff-4fe1e1feabca7383b24ce87564bb8db4bb23dcc273958fb0b5f8e1bc6170bd4dL285-R344) [[3]](diffhunk://#diff-a93df127aa6ddf382c2cefc76870ec8770111cbd27f38d801c6ef9e817e13666L419-R424)Each leaderboard row now includes a
user_organizationboolean flag, indicating whether the current user is a member of that organization. [[1]](diffhunk://#diff-4fe1e1feabca7383b24ce87564bb8db4bb23dcc273958fb0b5f8e1bc6170bd4dR258-R298) [[2]](diffhunk://#diff-a93df127aa6ddf382c2cefc76870ec8770111cbd27f38d801c6ef9e817e13666R433-R435)Organization membership is matched by any name an organization ran under during the window, supporting mid-window renames. [[1]](diffhunk://#diff-4fe1e1feabca7383b24ce87564bb8db4bb23dcc273958fb0b5f8e1bc6170bd4dR258-R298) [[2]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL216-R305)
Error handling and API consistency:
If organization memberships cannot be determined (e.g., due to an error), the user's organization streak is empty, and errors are logged. [[1]](diffhunk://#diff-4fe1e1feabca7383b24ce87564bb8db4bb23dcc273958fb0b5f8e1bc6170bd4dR258-R298) [[2]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL216-R305)
The API schema and serializer are updated so
org_streakis always present (never null), but may be empty if the user has no organizations. [[1]](diffhunk://#diff-a93df127aa6ddf382c2cefc76870ec8770111cbd27f38d801c6ef9e817e13666L473-R479) [[2]](diffhunk://#diff-81a9b7058ab72273bd15c4ae5df5a9132a31a86d7c154d88a511b5359709476cL12203-L12208) [[3]](diffhunk://#diff-81a9b7058ab72273bd15c4ae5df5a9132a31a86d7c154d88a511b5359709476cL12642-R12637)Test improvements:
Extensive new and updated tests verify personalized streaks, leaderboard highlighting, empty states, error handling, and organization renames. [[1]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efR43-R61) [[2]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL216-R305) [[3]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL239-R338) [[4]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL494-R594) [[5]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL576-R677) [[6]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL605-R706) [[7]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efL631-R733) [[8]](diffhunk://#diff-51509534737182423e7b527e2bb782e9e3e1a894be422c1565fab6cb0e1a01efR551-R554)
These changes make the dashboard's organization-related metrics more relevant to each user and ensure correct behavior across edge cases.
Type of Change
<!-- Mandatory: Check one or more boxes that apply -->
Self-Review Checklist
<!-- These items help ensure quality - they complement our automated CI checks -->
Testing Instructions
<!-- Optional for test-only changes. Mandatory for all other changes -->
<!-- Must be detailed enough for reviewers to reproduce -->
Prerequisites
<!-- List any specific setup required -->
Steps to Test
1.
2.
3.
Expected Results
<!-- Describe what should happen after following the steps -->
Additional Context
<!-- Optional but helpful information -->
Required Actions
<!-- Check if changes require work in other areas -->
<!-- Remove section if no external actions needed -->
<!-- API docs, feature docs, deployment guides -->
<!-- Specify repos: django-ansible-base, eda-server, etc. -->
<!-- CI/CD, installer updates, new services -->
<!-- UI team, platform services, infrastructure -->
<!-- Reference blocking PRs/MRs with brief context -->
Screenshots/Logs
<!-- Add if relevant to demonstrate the changes -->