Skip to content

Add tag filtering to the runs endpoint#3

Open
Aryan95614 wants to merge 2 commits into
w3-time-rangefrom
w4-tag-filter
Open

Add tag filtering to the runs endpoint#3
Aryan95614 wants to merge 2 commits into
w3-time-rangefrom
w4-tag-filter

Conversation

@Aryan95614

Copy link
Copy Markdown
Owner

Stacked on PR #2 (base is w3-time-range). Adds the fourth composable filter to the runs endpoint. Retarget to Netflix master once Netflix#481 and #2 land.

What

Adds an optional tag query param to GET /flows/{flow_id}/runs, filtering by the run's tags and system_tags combined. Repeating the param is an OR (?tag=a&tag=b).

How

  • Uses the jsonb ?| operator against (tags || system_tags), which hits the existing GIN index runs_v3_idx_gin_tags_combined, mirroring the ui_backend's tag-filter approach.
  • Drops in as one more ANDed predicate in the get_all_runs condition-builder, so it composes with the existing status, user, and time-range filters. No joins needed; tags/system_tags are base columns. Values are bound as placeholders.

Tests

Integration tests for tag match (user and system tags), OR over tags, no-match, and composition with status. Full integration suite green; the one failure is the pre-existing tasks_test flake.

Add an optional 'tag' query param to GET /flows/{flow_id}/runs, filtering by the
run's tags and system_tags combined. Repeating the param is an OR. Implemented with
the jsonb ?| operator against (tags || system_tags), which uses the existing GIN
index runs_v3_idx_gin_tags_combined, mirroring the ui_backend's tag-filter approach.

Drops in as one more ANDed predicate in the get_all_runs condition-builder, so it
composes with the existing status, user, and time-range filters. No joins needed;
tags and system_tags are base columns. Values are bound as placeholders.

Add integration tests for tag match (user and system tags), OR over tags, no-match,
and composition with status.
Add exclude_status / exclude_user / exclude_tag query params (each repeatable) to
GET /flows/{flow_id}/runs, the NOT counterparts of the existing filters. Each negates
the same predicate in the get_all_runs condition-builder: status NOT IN (...),
NOT ((tags || system_tags) ?| ...), and a NULL-safe user exclusion
(user IS NULL OR user NOT IN (...)) so runs with no verified owner survive. The
exclude_status values are validated against the same allowlist; exclusion composes
with the inclusion filters.

Add an integration test covering status/user/tag exclusion, the no-owner keep, the
400 on an unknown exclude_status, and inclusion-plus-exclusion composition.
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.

1 participant