Skip to content

fix(BA-5975): honor AND/OR/NOT in deployment my/project search#11506

Merged
jopemachine merged 3 commits intomainfrom
fix/BA-5975-deployment-filter-and-or-not
May 8, 2026
Merged

fix(BA-5975): honor AND/OR/NOT in deployment my/project search#11506
jopemachine merged 3 commits intomainfrom
fix/BA-5975-deployment-filter-and-or-not

Conversation

@fregataa
Copy link
Copy Markdown
Member

@fregataa fregataa commented May 7, 2026

Summary

  • my_search and project_search in the deployment GQL adapter inlined the filter conversion and silently dropped DeploymentFilter.AND / OR / NOT, so multi-condition queries degenerated into "no filter applied" (e.g. myDeployments with AND: [{tags:{iContains:"4123"}}, {tags:{iContains:"1"}}] returned every non-stopped deployment).
  • Both methods now delegate to the existing _convert_deployment_filter helper that admin_search already uses, so all three variants share one correct path. As a side effect, the previously dropped domain_name, project_id, resource_group, created_user_id, created_at, and destroyed_at fields are now honored on my_search / project_search as well.
  • Adds component tests covering AND on my_search and project_search plus OR on my_search to pin the regression.

Test plan

  • pants fmt fix lint check on the changed files
  • pants test tests/component/deployment/test_deployment.py (15/15 pass, including the 3 new TestDeploymentAdapterFilter cases)

Resolves BA-5975

my_search and project_search inlined filter conversion and dropped
DeploymentFilter.AND/OR/NOT. Delegate to _convert_deployment_filter
so all three search variants share one correct path.
Copilot AI review requested due to automatic review settings May 7, 2026 10:38
@github-actions github-actions Bot added size:L 100~500 LoC comp:manager Related to Manager component labels May 7, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Fixes a regression in the deployment GraphQL adapter where my_search / project_search ignored nested AND / OR / NOT filters, causing multi-condition queries to return effectively unfiltered results.

Changes:

  • Refactors my_search and project_search to delegate filter handling to the shared _convert_deployment_filter helper.
  • Adds component tests to validate AND behavior for my_search / project_search and OR behavior for my_search.
  • Adds a changelog entry describing the fix.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
src/ai/backend/manager/api/adapters/deployment/adapter.py Routes my_search / project_search filter conversion through the shared helper to honor nested boolean filters.
tests/component/deployment/test_deployment.py Adds component coverage for adapter filtering behavior (AND/OR) to prevent regressions.
changes/11506.fix.md Documents the GraphQL filter fix in the changelog.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

)
if condition is not None:
conditions.append(condition)
conditions.extend(self._convert_deployment_filter(input.filter))
Comment on lines +491 to +496
filter_input = DeploymentFilterV2(
OR=[
DeploymentFilterV2(tags=StringFilter(i_contains="alpha")),
DeploymentFilterV2(tags=StringFilter(i_contains="beta")),
],
)
Comment on lines +47 to +48
)
from ai.backend.common.dto.manager.v2.deployment.request import (
OR flattened sub-filter conditions into a single OR list, degenerating
(A∧B) ∨ (C∧D) into A ∨ B ∨ C ∨ D. NOT had the symmetric problem.

Add combine_conditions_and helper. Each OR sub is AND-grouped before
OR-combining; each NOT sub is independently negated and pushed to the
top-level AND list. Apply to all _convert_*_filter methods in the
deployment adapter.
@github-actions github-actions Bot added size:XL 500~ LoC and removed size:L 100~500 LoC labels May 7, 2026
@fregataa fregataa requested a review from a team May 7, 2026 12:48
@jopemachine jopemachine merged commit f0d3d3c into main May 8, 2026
36 checks passed
@jopemachine jopemachine deleted the fix/BA-5975-deployment-filter-and-or-not branch May 8, 2026 01:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp:manager Related to Manager component size:XL 500~ LoC

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants