feat: API Server - Pipeline runs - Mirror Pipeline Run Annotations when creating a new pipeline run#216
Open
yuechao-qin wants to merge 1 commit intomasterfrom
Open
Conversation
Collaborator
Author
This stack of pull requests is managed by Graphite. Learn more about stacking. |
Ark-kun
reviewed
Apr 19, 2026
| return value[:max_len] | ||
|
|
||
|
|
||
| def _mirror_single_annotation( |
Contributor
There was a problem hiding this comment.
_mirror_single_**pipeline_run**_annotation
Ark-kun
approved these changes
Apr 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.

TL;DR
Closes https://github.com/Shopify/oasis-backend/issues/221
User-provided annotations are now mirrored into the
PipelineRunAnnotationtable at pipeline run creation time, andset_annotationnow applies truncation andNone-to-empty-string coercion via a shared helper.What changed?
_mirror_single_annotation, a helper that centralizes annotation write logic: guards against system-key prefix collisions, coercesNonevalues to empty strings, truncates values to the VARCHAR max length, and upserts the row._mirror_pipeline_run_annotations, which iterates over a user-supplied annotations dict and delegates each entry to_mirror_single_annotation._mirror_system_annotationsnow accepts an optionalannotationsdict and calls_mirror_pipeline_run_annotationsso user annotations are persisted alongside system annotations at creation time.createpassesannotationsthrough to_mirror_system_annotations.set_annotationnow delegates to_mirror_single_annotationinstead of directly constructing and merging aPipelineRunAnnotation, gaining truncation and coercion for free.set_annotationoverflowing the VARCHAR column is resolved — long values are now silently truncated rather than raising anIntegrityError.How to test?
Run the updated test suite:
Why make this change?
Previously, user-provided annotations passed to
createwere not written to thePipelineRunAnnotationtable, making them invisible to filter queries. Additionally,set_annotationlacked the same truncation and coercion guards applied to system annotations, causing potentialIntegrityErrorfailures on long values. Centralizing annotation write logic into_mirror_single_annotationensures consistent behavior across all annotation write paths.