Skip to content

feat: Search created by user in pipeline run API#108

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

feat: Search created by user in pipeline run API#108
yuechao-qin merged 1 commit into
masterfrom
ycq/search-pipeline-run-created-by

Conversation

@yuechao-qin
Copy link
Copy Markdown
Collaborator

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

TL;DR

Implemented search created_by user in Pipeline Runs.

What changed?

Functionality

  • API GET /api/pipeline_runs/

    • Search created_by user in filter_query. Example query (not URL encoded for example):
      /api?filter_query={"and": [{"value_equals": {"key": "system/pipeline_run.created_by", "value": "alice@example.com"}}]}
    • Annotation value me is supported for created_by search.
  • API POST /api/pipeline_runs/

    • Copies the created_by data to the annotations table for future searching. Example pipeline run annotations table after API is called:
      pipeline_run_id key value
      abc123 system/pipeline_run.created_by alice@example.com
  • API [PUT|DELETE] /api/pipeline_runs/{id}/annotations/{key}

    • Prevent (create, update, delete) of annotations with system/ prefix. Reserved for system annotation usage.

Other

  • Database migration: Added backfill logic to populate existing pipeline runs with created_by annotations. Example what a pipeline run's created by user would look like in the annotations table:
pipeline_run_id key value
42 system/pipeline_run.created_by alice@example.com

How to test?

uv run pytest tests/test_api_server_sql.py  tests/test_filter_query_sql.py tests/test_database_ops.py
  1. Create pipeline runs with different created_by values
  2. Use filter queries like {"and": [{"value_equals": {"key": "system/pipeline_run.created_by", "value": "alice"}}]} to search by creator
  3. Test the "me" placeholder: {"and": [{"value_equals": {"key": "system/pipeline_run.created_by", "value": "me"}}]}
  4. Verify that attempts to set/delete system annotations return 422 errors
  5. Test that unsupported predicates on system keys (like value_contains) are rejected

Why make this change?

  • This enables users to search for pipeline runs by creator using the new filter query system.
  • Following safety guards and synchronization will allow old and new data (create_by) to be searchable with the new filter.
    • Preventing (create, delete, update) system prefix in annotations
    • Saving created_by to annotations table when starting a Pipeline Run
@yuechao-qin yuechao-qin marked this pull request as ready for review February 24, 2026 17:06
@yuechao-qin yuechao-qin requested a review from Ark-kun as a code owner February 24, 2026 17:06
Copy link
Copy Markdown
Collaborator

@Volv-G Volv-G left a comment

Choose a reason for hiding this comment

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

looks good to me

@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-annotations to graphite-base/108 February 25, 2026 06:34
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 6789217 to 01de682 Compare February 25, 2026 06:39
@yuechao-qin yuechao-qin changed the base branch from graphite-base/108 to ycq/search-pipeline-run-annotations February 25, 2026 06:39
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 01de682 to 9a3927b Compare February 25, 2026 06:43
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from 7606c83 to 98e7d41 Compare February 25, 2026 18:45
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 9a3927b to 0e3ac9b Compare February 25, 2026 18:45
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-annotations branch from 98e7d41 to ecd7842 Compare February 26, 2026 05:34
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 0e3ac9b to df1b586 Compare February 26, 2026 05:34
Comment thread cloud_pipelines_backend/database_ops.py Outdated
@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 force-pushed the ycq/search-pipeline-run-created-by branch from df1b586 to 05e42b2 Compare February 27, 2026 21:55
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-annotations to graphite-base/108 February 28, 2026 10:23
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 05e42b2 to afa68d5 Compare February 28, 2026 10:24
@yuechao-qin yuechao-qin changed the base branch from graphite-base/108 to ycq/search-pipeline-run-annotations February 28, 2026 10:24
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch 2 times, most recently from 527caa1 to 7b5d7cb Compare February 28, 2026 20:29
Comment thread cloud_pipelines_backend/filter_query_sql.py
Comment thread tests/test_database_ops.py Outdated
Comment thread tests/test_database_ops.py Outdated
Comment thread cloud_pipelines_backend/api_server_sql.py Outdated
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-annotations to graphite-base/108 March 4, 2026 00:41
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 7b5d7cb to af49aee Compare March 4, 2026 00:41
@yuechao-qin yuechao-qin changed the base branch from graphite-base/108 to ycq/search-pipeline-run-annotations March 4, 2026 00:41
Comment thread tests/test_database_ops.py
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-annotations to graphite-base/108 March 4, 2026 04:57
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from af49aee to 7536ef5 Compare March 4, 2026 04:57
@yuechao-qin yuechao-qin changed the base branch from graphite-base/108 to ycq/search-pipeline-run-annotations March 4, 2026 04:57
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-annotations to graphite-base/108 March 4, 2026 05:03
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 7536ef5 to 9e58770 Compare March 4, 2026 05:06
@yuechao-qin yuechao-qin changed the base branch from graphite-base/108 to ycq/search-pipeline-run-annotations March 4, 2026 05:06
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 9e58770 to 4be1e8b Compare March 4, 2026 08:52
@yuechao-qin yuechao-qin requested a review from Ark-kun March 4, 2026 08:56
Comment thread cloud_pipelines_backend/filter_query_models.py
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 comment.

Comment thread cloud_pipelines_backend/filter_query_models.py Outdated
Comment thread cloud_pipelines_backend/filter_query_models.py
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 4be1e8b to 5354455 Compare March 5, 2026 09:20
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:47 PM UTC: Graphite rebased this pull request as part of a merge.
  • Mar 6, 8:48 PM UTC: @yuechao-qin merged this pull request with Graphite.
@yuechao-qin yuechao-qin changed the base branch from ycq/search-pipeline-run-annotations to graphite-base/108 March 6, 2026 20:45
@yuechao-qin yuechao-qin changed the base branch from graphite-base/108 to master March 6, 2026 20:46
@yuechao-qin yuechao-qin force-pushed the ycq/search-pipeline-run-created-by branch from 5354455 to 513dbd1 Compare March 6, 2026 20:47
@yuechao-qin yuechao-qin merged commit 38dc5e7 into master Mar 6, 2026
4 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