feat(preprod): Add install_groups as a filterable key in artifact search#115818
feat(preprod): Add install_groups as a filterable key in artifact search#115818mtopo27 wants to merge 4 commits into
Conversation
Support filtering artifacts by install_groups in artifact_search.py so that builds list, sequential base resolution, quota matching, and the upcoming latest-build route can narrow results by install group.
Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
has:install_groups produced a SearchFilter with an empty-string value, which silently built Q(extras__install_groups__contains=[""]) instead of checking key existence. Reject it with InvalidSearchQuery, matching how size_state and distribution_error_code implicitly reject empty values via their validation functions. Also replace the inline OR-of-contains loop with the existing build_install_groups_q() helper from build_distribution_utils to eliminate duplication. Co-Authored-By: Claude Opus 4 <noreply@anthropic.com>
There was a problem hiding this comment.
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.
Reviewed by Cursor Bugbot for commit 5b65e69. Configure here.
| if token.is_negation: | ||
| queryset = queryset.exclude(q) | ||
| else: | ||
| queryset = queryset.filter(q) |
There was a problem hiding this comment.
Unhandled None return from build_install_groups_q
Medium Severity
build_install_groups_q has return type Q | None and returns None when passed an empty sequence. In the is_in_filter branch, token.value.value (a list) is passed directly, and if it's empty, the returned None is passed to queryset.filter() or queryset.exclude(), which will raise a TypeError. The existing caller in build_distribution_utils.py handles this defensively with a guard check, but this new caller does not.
Reviewed by Cursor Bugbot for commit 5b65e69. Configure here.


Support filtering artifacts by
install_groupsinartifact_search.pyso that all search consumers (builds list, sequential base resolution, quota matching, and the upcoming latest-build route) can narrow results by install group.install_groupsis stored as a JSON array inPreprodArtifact.extras, so it gets a special-case handler inapply_filters()that builds an OR of JSON containment queries — matching the same semantics as the existingbuild_install_groups_q()helper. Supports single value (install_groups:beta), IN filter (install_groups:[beta, internal]), and negation (!install_groups:beta).Special-case handler
Unlike flat-column filters that fall through to the generic handler,
install_groupsneedsextras__install_groups__containscontainment lookups, so it's handled explicitly alongsidesize_state,distribution_error_code, andsnapshot_status.Refs EME-1160