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

Enhances repository discoverability in Django admin and optimizes name lookups.

  • Expands RepositoryAdmin.search_fields to include name and service_id and extends get_search_results to match numeric repoid; adds select_related("author") to avoid N+1 queries (apps/codecov-api/core/admin.py).
  • Introduces GinIndex(OpClass(Upper("name"), name="gin_trgm_ops"), name="repos_name_trgm_idx") to Repository model (libs/shared/shared/django_apps/core/models.py).
  • Adds migration 0077_repository_repos_name_trgm_idx creating the GIN trigram index on repos(UPPER(name)) via RiskyAddIndex.

Written by Cursor Bugbot for commit 9a04e63. 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 93.89%. Comparing base (aca0c54) to head (9a04e63).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #591   +/-   ##
=======================================
  Coverage   93.89%   93.89%           
=======================================
  Files        1286     1287    +1     
  Lines       46807    46816    +9     
  Branches     1517     1517           
=======================================
+ Hits        43951    43960    +9     
  Misses       2547     2547           
  Partials      309      309           
Flag Coverage Δ
apiunit 96.56% <100.00%> (+<0.01%) ⬆️
sharedintegration 38.84% <0.00%> (-0.02%) ⬇️
sharedunit 88.80% <100.00%> (+<0.01%) ⬆️
workerintegration 58.26% <ø> (ø)
workerunit 91.31% <ø> (ø)

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

CodSpeed Performance Report

Merging #591 will not alter performance

Comparing cy/repo_admin_search_fields (9a04e63) with main (aca0c54)

Summary

✅ 9 untouched

@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
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