Skip to content

feat: Search annotations in pipeline run API#107

Merged
yuechao-qin merged 1 commit into
masterfrom
ycq/search-pipeline-run-annotations
Mar 6, 2026
Merged

feat: Search annotations in pipeline run API#107
yuechao-qin merged 1 commit into
masterfrom
ycq/search-pipeline-run-annotations

Conversation

@yuechao-qin
Copy link
Copy Markdown
Collaborator

@yuechao-qin yuechao-qin commented Feb 24, 2026

TL;DR

Implemented annotation-based filtering for Pipeline Run API and proper pagination handling.

What changed?

API GET /api/pipeline_runs/

Functionality

  • Implemented support for filter_query which handles annotation searches in pipeline runs.
  • Added new database index for annotation-based queries. Covering index (key, pipeline_run_id, value).
  • Enhanced pagination to preserve both legacy filter and new filter_query across pages.

Other

  • Created new filter_query_sql.py module with comprehensive filter query processing:
    • PageToken class for encoding/decoding pagination state
    • Support for annotation-based predicates: key_exists, value_equals, value_contains, value_in
    • Logical operators: and, or, not with proper nesting
    • Integration with existing legacy filter system
  • Refactored pipeline run listing to use the new filter query system while maintaining backward compatibility

How to test?

uv run pytest tests/test_api_server_sql.py tests/test_filter_query_sql.py
  • Test basic annotation filtering: {"and": [{"key_exists": {"key": "team"}}]}
  • Test value-based filtering: {"and": [{"value_equals": {"key": "env", "value": "prod"}}]}
  • Test logical combinations with nested and/or/not predicates
  • Verify mutual exclusivity validation between filter and filter_query parameters
  • Test pagination preservation of filter_query state across multiple pages
  • Confirm legacy filter functionality remains unchanged

Why make this change?

Annotation search support is the backbone for all the upcoming search features (create_by, pipeline name, status) for Pipeline Runs. The other searches will be search against the annotations table.

Comment thread cloud_pipelines_backend/filter_query_sql.py
Comment thread cloud_pipelines_backend/filter_query_sql.py Outdated
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-pydantic-models to graphite-base/107 February 25, 2026 05:27
Comment thread cloud_pipelines_backend/database_ops.py Outdated
Comment thread cloud_pipelines_backend/database_ops.py Outdated
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from 41a18a2 to 7606c83 Compare February 25, 2026 06:34
@yuechao-qin yuechao-qin changed the base branch from graphite-base/107 to ycq/search-pipeline-run-pydantic-models February 25, 2026 06:34
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch 2 times, most recently from 98e7d41 to ecd7842 Compare February 26, 2026 05:34
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-pydantic-models branch from f7dc9bc to b5f0ba9 Compare February 26, 2026 05:34
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-pydantic-models branch from b5f0ba9 to 88b265f Compare February 27, 2026 21:55
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from ecd7842 to ba5594e Compare February 27, 2026 21:55
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-pydantic-models to graphite-base/107 February 28, 2026 10:21
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from ba5594e to d6f04df Compare February 28, 2026 10:23
@yuechao-qin yuechao-qin changed the base branch from graphite-base/107 to ycq/search-pipeline-run-pydantic-models February 28, 2026 10:23
Comment thread cloud_pipelines_backend/filter_query_sql.py Outdated
Comment thread cloud_pipelines_backend/component_structures.py
Comment thread cloud_pipelines_backend/backend_types_sql.py
Comment thread cloud_pipelines_backend/backend_types_sql.py Outdated
Comment thread cloud_pipelines_backend/backend_types_sql.py Outdated
Comment thread cloud_pipelines_backend/filter_query_sql.py
Comment thread tests/test_filter_query_sql.py Outdated
Comment thread cloud_pipelines_backend/backend_types_sql.py Outdated
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-pydantic-models to graphite-base/107 March 4, 2026 00:41
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from d6f04df to 7369ffc Compare March 4, 2026 00:41
@yuechao-qin yuechao-qin changed the base branch from graphite-base/107 to ycq/search-pipeline-run-pydantic-models March 4, 2026 00:41
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch 2 times, most recently from 331fe0f to e29a08e Compare March 4, 2026 05:03
@yuechao-qin yuechao-qin requested review from Ark-kun and Volv-G March 4, 2026 05:05
Copy link
Copy Markdown
Contributor

@Ark-kun Ark-kun left a comment

Choose a reason for hiding this comment

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

Approved with comments.

Copy link
Copy Markdown
Contributor

@Ark-kun Ark-kun left a comment

Choose a reason for hiding this comment

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

Approved. But please resolve the comments.

Comment thread cloud_pipelines_backend/filter_query_sql.py
Comment thread cloud_pipelines_backend/filter_query_sql.py
@yuechao-qin yuechao-qin requested a review from morgan-wowk March 5, 2026 08:10
Copy link
Copy Markdown
Collaborator Author

yuechao-qin commented Mar 6, 2026

Merge activity

  • Mar 6, 8:42 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Mar 6, 8:45 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 6, 8:46 PM UTC: @yuechao-qin merged this pull request with Graphite.
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-pydantic-models to graphite-base/107 March 6, 2026 20:43
@yuechao-qin yuechao-qin changed the base branch from graphite-base/107 to master March 6, 2026 20:44
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from e29a08e to 89e8ee5 Compare March 6, 2026 20:45
@yuechao-qin yuechao-qin merged commit 538bdc0 into master Mar 6, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

4 participants