Skip to content

Annotation Filter input#1706

Merged
Mbeaulne merged 1 commit intomasterfrom
01-27-annotation_filter_input
Feb 18, 2026
Merged

Annotation Filter input#1706
Mbeaulne merged 1 commit intomasterfrom
01-27-annotation_filter_input

Conversation

@Mbeaulne
Copy link
Collaborator

@Mbeaulne Mbeaulne commented Jan 27, 2026

Resolves: https://github.com/Shopify/oasis-frontend/issues/458

Description

Adds an annotation filter input component for filtering pipeline runs by key-value annotation pairs.

Note: This is a UI-only preview. The filters update the URL but are not properly connected to the API, causing a broken search state. This is resolved in a later PR in the stack.

Type of Change

  • New feature

Changes

  • Added AnnotationFilterInput component with:
    • Add annotation filters with key and optional value
    • Inline editing of existing filters (double-click to edit)
    • Remove filters with X button
    • Keyboard support (Enter to add/save, Escape to cancel)
  • Integrated annotation filters into PipelineRunFiltersBar

Checklist

  • I have tested this does not break current pipelines/runs functionality

Test Instructions

  1. Enable the feature flag: Settings → Beta → "Pipeline run filters bar (UI only)"
  2. Navigate to the Runs tab on the home page
  3. Click "Add filter" in the Annotations row
  4. Enter a key and optional value, press Enter or click Add
  5. Double-click a badge to edit, click X to remove

Copy link
Collaborator Author

Mbeaulne commented Jan 27, 2026

@Mbeaulne Mbeaulne mentioned this pull request Jan 27, 2026
2 tasks
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 702e058 to 055a218 Compare January 27, 2026 15:48
This was referenced Jan 27, 2026
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 055a218 to aeda0ef Compare January 27, 2026 15:59
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch 3 times, most recently from 185fc8e to d548dd0 Compare January 27, 2026 16:39
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from d548dd0 to 57641b0 Compare January 27, 2026 18:57
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 57641b0 to 60e5301 Compare January 28, 2026 20:46
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch 3 times, most recently from a4e2ef4 to e9ccb7d Compare February 2, 2026 20:31
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch 2 times, most recently from f74981d to fbe5916 Compare February 2, 2026 21:08
@Mbeaulne Mbeaulne force-pushed the 01-27-date_picker branch 2 times, most recently from 713cdad to 7e04972 Compare February 2, 2026 21:10
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from fbe5916 to 40b0fda Compare February 2, 2026 21:10
if (filters.pipeline_name) count++;
if (filters.annotations && filters.annotations.length > 0) {
count += filters.annotations.length;
}
Copy link

@morgan-wowk morgan-wowk Feb 9, 2026

Choose a reason for hiding this comment

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

Hmm, it's interesting that we have dedicated business logic for determining the active filters count. As opposed to just checking the length of active filters; Assuming there is a source of active filters or active filters actually mean something beyond just a count.

The reason I mention this is because with this business logic not just being a simple length check from a better source of truth, I could see this function diverging in the future and becoming inaccurate.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I agree this was a maintenance hazard. I refactored countActiveFilters to derive from serializeFiltersToUrl as the source of truth for which filters are active, rather than manually enumerating each field. Now new scalar filter fields are automatically counted via a generic Object.keys loop, and only the fields that need special counting logic (date range grouped as one, annotations counted individually) are explicitly special-cased. This way the function stays accurate as the PipelineRunFilters type grows.

Choose a reason for hiding this comment

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

Wonderful

@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 4df5ece to baaaa48 Compare February 10, 2026 15:03
@Mbeaulne Mbeaulne force-pushed the 01-27-date_picker branch 2 times, most recently from 8ecc3fd to 757b00a Compare February 10, 2026 15:35
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch 2 times, most recently from 5ec1579 to 0c832cc Compare February 10, 2026 17:00
@Mbeaulne Mbeaulne requested a review from morgan-wowk February 10, 2026 17:22
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 0c832cc to 13eccc4 Compare February 10, 2026 17:22
Comment on lines +51 to +61
const handleKeyDown = (e: KeyboardEvent<HTMLInputElement>) => {
if (e.key === "Enter" && keyInput.trim()) {
e.preventDefault();
handleAdd();
}
if (e.key === "Escape") {
setIsExpanded(false);
setKeyInput("");
setValueInput("");
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm surprised these shortcuts are not already handle by our Input component?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Our Input is a thin styling wrapper around <input> — it doesn't handle any keyboard shortcuts. These are also app-specific behaviours (Enter = submit filter, Escape = collapse and reset), so they wouldn't really belong in a generic input primitive.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmm. Maybe we should consider if there's value adding onEscape and onEnter props to our input component and providing some base level of support. (separate to this PR)

@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 13eccc4 to e072f6e Compare February 17, 2026 15:45
@Mbeaulne Mbeaulne requested a review from camielvs February 17, 2026 16:00
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from e072f6e to 5c53819 Compare February 17, 2026 16:00
Copy link
Collaborator

camielvs commented Feb 18, 2026

Side nit: it bothers me that the placeholder in this input field is cut off on the last letter

image.png

Copy link
Collaborator

@camielvs camielvs left a comment

Choose a reason for hiding this comment

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

This seems fine but it's hard to evaluate given the full E2E feature isn't implemented. e.g. I have no idea what the EditableAnnotationBadge looks or functions like because the app crashes (by design?) when I try to add a filter

Even though this is just a UI preview it should still function without crashing. Is it possible to just mock the flow instead of actually waiting and expecting anything from the backend? e.g. just store the k:v annotation pairs in an array and render them

image.png

@Mbeaulne Mbeaulne changed the base branch from 01-27-date_picker to graphite-base/1706 February 18, 2026 14:55
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 5c53819 to 0be99fb Compare February 18, 2026 14:57
@graphite-app graphite-app bot changed the base branch from graphite-base/1706 to master February 18, 2026 14:58
@Mbeaulne Mbeaulne force-pushed the 01-27-annotation_filter_input branch from 0be99fb to 00dbf7b Compare February 18, 2026 14:58
Copy link
Collaborator Author

Mbeaulne commented Feb 18, 2026

Merge activity

  • Feb 18, 3:09 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Feb 18, 3:10 PM UTC: @Mbeaulne merged this pull request with Graphite.

@Mbeaulne Mbeaulne merged commit 49988e5 into master Feb 18, 2026
8 checks passed
@Mbeaulne Mbeaulne deleted the 01-27-annotation_filter_input branch February 18, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Comments