feat: Annotation search for Pipeline Runs #70
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
TODO
Description
Closes #45
Implemented a new API to search annotations for runs.
Background
Annotations are
key-valuepairs. The following examples of annotations (e.g.key = value):env=productionteam=backendThis PR allows searches for key/value strings.
Features
/api/pipeline_runs/) to search key/value in annotations.(key=key1 and value=value1) or (key=key2 and value=value2)(key=key1 and value=value1) and (key=key2 and value=value2)Use Cases and Examples
1. Key equals a string
Find runs where annotation key equals "environment":
{"annotation_filters": [{"key": {"operator": "equals", "text": "environment"}}]}2. Key equals string AND value in set
Find runs where key equals "environment" AND value is "prod" or "staging":
{ "annotation_filters": [ { "key": {"operator": "equals", "text": "environment"}, "value": {"operator": "in_set", "texts": ["prod", "staging"]} } ] }3. Complex: (key equals AND value contains) AND key NOT contains
Find runs where (key equals "environment" AND any value contains "prod") AND key NOT contains "team":
{ "operator": "and", "annotation_filters": [ { "key": {"operator": "equals", "text": "environment"}, "value": {"operator": "contains", "text": "prod"} }, {"key": {"operator": "contains", "text": "team", "negate": true}} ] }Test Plan
uv run pytest tests/test_pipeline_run_search.py -v/api/pipeline_runs/<ID>/annotations/<KEY>/)/api/pipeline_runs/<ID>/annotations/)/api/pipeline_runs/search/)Video of E2E Testing
Screen.Recording.2026-01-28.at.1.18.33.PM.mov