Conversation
There was a problem hiding this comment.
Pull request overview
This PR targets People page query optimization by adding a composite index and reducing N+1 queries / expensive counting on the People index page. However, the accompanying db/structure.sql re-dump introduces incompatibilities and suspicious migration bookkeeping changes that will break db:structure:load in CI (PostgreSQL 11) and likely indicates an unintended dump artifact.
Changes:
- Add a partial composite index on
people(name_id, kudo_position)to support People page query patterns. - Reduce People index DB work by preloading additional associations and replacing an explicit unclaimed count query with a “fetch 4, show 3” approach.
- Update structure dump to include the new index (but also includes PG14-specific dump output and duplicated
schema_migrationsinserts).
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| db/structure.sql | Adds the new index, but also contains a PG14-specific re-dump and duplicated/shifted schema_migrations inserts (problematic). |
| db/migrate/20260603065929_add_index_to_people_name_id_kudo_position.rb | Adds the intended partial composite index for query optimization. |
| app/views/people/_people.html.haml | Switches “more unclaimed” rendering logic to use @more_unclaimed instead of a count. |
| app/views/people/_claimed_person.html.haml | Attempts to avoid persisting Markup, but current change makes the rendered first line blank. |
| app/models/person.rb | Expands preloads for claimed people; switches some includes to preload for unclaimed relations query. |
| app/models/account.rb | Makes best_account_analysis respect preloaded association when available. |
| app/helpers/people_helper.rb | Preloads projects when building contribution sentences to reduce N+1. |
| app/controllers/unclaimed_controller.rb | Adjusts unclaimed query and forces relation evaluation for memory/behavior consistency. |
| app/controllers/people_controller.rb | Removes count query by fetching one extra unclaimed group and using @more_unclaimed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
1156bdf to
cdee65a
Compare
33d6a43 to
8bc4aca
Compare
Niharika1117
approved these changes
Jun 15, 2026
Priya5
reviewed
Jun 22, 2026
Priya5
approved these changes
Jun 22, 2026
Priya5
pushed a commit
that referenced
this pull request
Jun 25, 2026
* OTWO-7667 People page Query optimization * OTWO-7667 Fixed test errors for people page * OTWO-7667 Cache changes in people page * OTWO-7667 Removed ApplicationHelper from people controller
Priya5
pushed a commit
that referenced
this pull request
Jun 25, 2026
* OTWO-7667 People page Query optimization * OTWO-7667 Fixed test errors for people page * OTWO-7667 Cache changes in people page * OTWO-7667 Removed ApplicationHelper from people controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.