Skip to content

Conversation

@calvin-codecov
Copy link
Contributor

@calvin-codecov calvin-codecov commented Dec 2, 2025

Closes https://linear.app/getsentry/issue/CCMRG-1906/allow-django-admin-repository-table-to-be-searchable-across-more


Note

Improves repository discoverability and search performance in Django admin.

  • Expands RepositoryAdmin search to include name and exact service_id, plus numeric repoid matching; adds select_related("author") to avoid N+1 queries
  • Adds PostgreSQL GinIndex on OpClass(Upper("name"), gin_trgm_ops) (repos_name_trgm_idx) with a migration to speed case-insensitive, trigram-based name searches

Written by Cursor Bugbot for commit 98f30ba. This will update automatically on new commits. Configure here.

@linear
Copy link

linear bot commented Dec 2, 2025

@sentry
Copy link

sentry bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.54%. Comparing base (482156a) to head (98f30ba).
⚠️ Report is 1 commits behind head on main.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #591   +/-   ##
=======================================
  Coverage   92.53%   92.54%           
=======================================
  Files        1295     1296    +1     
  Lines       47678    47686    +8     
  Branches     1592     1592           
=======================================
+ Hits        44121    44129    +8     
  Misses       3248     3248           
  Partials      309      309           
Flag Coverage Δ
apiunit 96.36% <100.00%> (+<0.01%) ⬆️
sharedintegration 37.55% <0.00%> (-0.02%) ⬇️
sharedunit 85.99% <100.00%> (+<0.01%) ⬆️
workerintegration 58.48% <ø> (ø)
workerunit 90.14% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@codecov-eu
Copy link

codecov-eu bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codecov-notifications
Copy link

codecov-notifications bot commented Dec 2, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@calvin-codecov calvin-codecov marked this pull request as ready for review December 3, 2025 20:48
# Also search by repoid if the search term is numeric
try:
search_term_as_int = int(search_term)
except ValueError:

This comment was marked as outdated.

Copy link
Contributor

@thomasrockhu-codecov thomasrockhu-codecov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should double-check that those fields are indexed or it's going to be slow as hell

Is service_id not just github, gitlab, etc?

@calvin-codecov calvin-codecov force-pushed the cy/repo_admin_search_fields branch from 2350489 to ac9554d Compare December 4, 2025 01:34
@calvin-codecov calvin-codecov requested a review from a team as a code owner December 4, 2025 01:34
Comment on lines 188 to 198
# Also search by repoid if the search term is numeric
try:
search_term_as_int = int(search_term)
except ValueError:
pass
else:
queryset |= self.model.objects.filter(repoid=search_term_as_int)
# avoid N+1 queries for foreign key author
queryset = queryset.select_related("author")

This comment was marked as outdated.

@codspeed-hq
Copy link

codspeed-hq bot commented Dec 4, 2025

Merging this PR will not alter performance

✅ 9 untouched benchmarks


Comparing cy/repo_admin_search_fields (98f30ba) with main (5c11737)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (482156a) during the generation of this report, so 5c11737 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@calvin-codecov calvin-codecov force-pushed the cy/repo_admin_search_fields branch from 4db8f39 to 25c1372 Compare December 23, 2025 00:28
Comment on lines 186 to 191
request,
queryset,
search_term,
)
.select_related("author")
)

This comment was marked as outdated.

@calvin-codecov calvin-codecov force-pushed the cy/repo_admin_search_fields branch from 25c1372 to 9a04e63 Compare December 23, 2025 20:36
@calvin-codecov calvin-codecov added this pull request to the merge queue Jan 12, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 12, 2026
@calvin-codecov calvin-codecov added this pull request to the merge queue Jan 12, 2026
@calvin-codecov calvin-codecov removed this pull request from the merge queue due to a manual request Jan 12, 2026
@calvin-codecov calvin-codecov added this pull request to the merge queue Jan 12, 2026
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jan 12, 2026
@calvin-codecov calvin-codecov force-pushed the cy/repo_admin_search_fields branch from 9a04e63 to 67bb126 Compare January 13, 2026 19:49
@calvin-codecov calvin-codecov force-pushed the cy/repo_admin_search_fields branch from 67bb126 to ebd56e2 Compare January 23, 2026 17:27
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

@calvin-codecov calvin-codecov force-pushed the cy/repo_admin_search_fields branch from ebd56e2 to cb46d50 Compare January 23, 2026 18:39
@calvin-codecov calvin-codecov added this pull request to the merge queue Jan 23, 2026
github-merge-queue bot pushed a commit that referenced this pull request Jan 23, 2026
* feat: Add repo name and service id to django admin repo search

* fix: Add service_id to search fields instead of custom

* feat: Add GIN index for name field

* feat: Add select_related for author in repos list

* fix: Add select_related for original queryset

* fix: Fix select_related usage

* chore: Relabel migration with new dependencies
@calvin-codecov calvin-codecov removed this pull request from the merge queue due to a manual request Jan 23, 2026
@calvin-codecov calvin-codecov added this pull request to the merge queue Jan 26, 2026
Merged via the queue into main with commit 3981c2e Jan 26, 2026
125 of 129 checks passed
@calvin-codecov calvin-codecov deleted the cy/repo_admin_search_fields branch January 26, 2026 19:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants