Skip to content

ref(autopilot): Limit missing integration detector to JS and python#107398

Merged
ArthurKnaus merged 3 commits intomasterfrom
aknaus/ref/autopilot/limit-missing-integration-detector-to-js-and-python
Feb 2, 2026
Merged

ref(autopilot): Limit missing integration detector to JS and python#107398
ArthurKnaus merged 3 commits intomasterfrom
aknaus/ref/autopilot/limit-missing-integration-detector-to-js-and-python

Conversation

@ArthurKnaus
Copy link
Member

For other platforms, we cannot rely on the docs yet to give us the information we need.
Fixed docs URL for python.

@ArthurKnaus ArthurKnaus requested a review from a team as a code owner February 2, 2026 09:28
@github-actions github-actions bot added the Scope: Backend Automatically applied to PRs that change backend components label Feb 2, 2026
Comment on lines 288 to 297
# Get the repository mapped to each project via RepositoryProjectPathConfig
repo_configs = RepositoryProjectPathConfig.objects.filter(
project__in=projects,
repository__status=ObjectStatus.ACTIVE,
).select_related("repository")

repo_config_by_project_id = {config.project_id: config for config in repo_configs}

for project in projects:
repo_config = repo_config_by_project_id.get(project.id)
Copy link
Member Author

Choose a reason for hiding this comment

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

Moved the query out of the loop

Copy link
Contributor

@constantinius constantinius left a comment

Choose a reason for hiding this comment

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

Looks clean. I like the Q() trick

Comment on lines 276 to 294
platform_filter = Q()
for prefix in SupportedPlatformPrefix:
platform_filter |= Q(platform__startswith=prefix)

projects = Project.objects.filter(
platform_filter,
organization=organization,
).all()

if len(projects) == 0:
return

for project in projects:
# Get the repository mapped to this project via RepositoryProjectPathConfig
repo_config = (
RepositoryProjectPathConfig.objects.filter(
project=project,
repository__status=ObjectStatus.ACTIVE,
)
.select_related("repository")
.first()
)
# Get the repository mapped to each project via RepositoryProjectPathConfig
repo_configs = RepositoryProjectPathConfig.objects.filter(
project__in=projects,
repository__status=ObjectStatus.ACTIVE,
).select_related("repository")

repo_config_by_project_id = {config.project_id: config for config in repo_configs}
Copy link
Member

@shellmayr shellmayr Feb 2, 2026

Choose a reason for hiding this comment

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

I think this can be simplified - and then all you need to do is iterate over the configs returned:

Suggested change
platform_filter = Q()
for prefix in SupportedPlatformPrefix:
platform_filter |= Q(platform__startswith=prefix)
projects = Project.objects.filter(
platform_filter,
organization=organization,
).all()
if len(projects) == 0:
return
for project in projects:
# Get the repository mapped to this project via RepositoryProjectPathConfig
repo_config = (
RepositoryProjectPathConfig.objects.filter(
project=project,
repository__status=ObjectStatus.ACTIVE,
)
.select_related("repository")
.first()
)
# Get the repository mapped to each project via RepositoryProjectPathConfig
repo_configs = RepositoryProjectPathConfig.objects.filter(
project__in=projects,
repository__status=ObjectStatus.ACTIVE,
).select_related("repository")
repo_config_by_project_id = {config.project_id: config for config in repo_configs}
platform_filter = Q()
for prefix in SupportedPlatformPrefix:
platform_filter |= Q(project__platform__startswith=prefix)
# Query RepositoryProjectPathConfig directly with platform filter on the related project
# This avoids fetching projects that don't have repo configs
repo_configs = RepositoryProjectPathConfig.objects.filter(
platform_filter,
project__organization=organization,
repository__status=ObjectStatus.ACTIVE,
).select_related("repository")```

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point!

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.

project__organization=organization,
repository__status=ObjectStatus.ACTIVE,
)
.select_related("repository")
Copy link
Contributor

Choose a reason for hiding this comment

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

Ineffective select_related before values() call

Low Severity

The .select_related("repository") call on line 286 has no effect because it's immediately followed by .values(). In Django, select_related() optimizes access to related model instances, but values() returns dictionaries. Django automatically creates the necessary JOIN for repository__name in the values() call, making select_related() redundant dead code.

Fix in Cursor Fix in Web

@ArthurKnaus ArthurKnaus merged commit 07bc1dc into master Feb 2, 2026
70 checks passed
@ArthurKnaus ArthurKnaus deleted the aknaus/ref/autopilot/limit-missing-integration-detector-to-js-and-python branch February 2, 2026 10:21
priscilawebdev pushed a commit that referenced this pull request Feb 2, 2026
…107398)

For other platforms, we cannot rely on the docs yet to give us the
information we need.
Fixed docs URL for python.
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.

3 participants