Skip to content

Conversation

@shruthilayaj
Copy link
Member

No description provided.

@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Jan 29, 2026
@shruthilayaj shruthilayaj marked this pull request as ready for review January 29, 2026 19:23
@shruthilayaj shruthilayaj requested a review from a team as a code owner January 29, 2026 19:23
@shruthilayaj shruthilayaj marked this pull request as draft January 29, 2026 19:29
@shruthilayaj shruthilayaj changed the title chore: convert seer preferences n+1 query to single query still wip: convert seer preferences n+1 query to single query Jan 29, 2026
Copy link
Contributor

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

status=ObjectStatus.ACTIVE,
).count()
if existing_repos_count != len(all_repos_to_check):
return Response({"detail": "Invalid repository"}, status=400)
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate repos across projects cause false validation failure

High Severity

The validation logic compares existing_repos_count (unique matching database rows) against len(all_repos_to_check) (total input entries including duplicates). When the same repository is mapped to multiple projects, all_repos_to_check contains duplicate tuples, but the database count() only returns unique matches. This causes valid requests to incorrectly fail with "Invalid repository" when the same repo is shared across projects.

Additional Locations (1)

Fix in Cursor Fix in Web

Comment on lines +261 to +265
provider = repo_data["provider"]
external_id = repo_data["external_id"]
owner = repo_data["owner"]
name = repo_data["name"]
all_repos_to_check.add((provider, external_id, f"{owner}/{name}"))
Copy link
Member Author

@shruthilayaj shruthilayaj Jan 29, 2026

Choose a reason for hiding this comment

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

Comment on lines +121 to +124
provider = repo_data["provider"]
external_id = repo_data["external_id"]
owner = repo_data["owner"]
name = repo_data["name"]
Copy link
Member Author

Choose a reason for hiding this comment

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

@shruthilayaj shruthilayaj marked this pull request as ready for review January 29, 2026 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Backend Automatically applied to PRs that change backend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants