Skip to content

feat: add ability to filter jobs by tags - #548

Merged
brandur merged 8 commits into
riverqueue:masterfrom
golanglemonade:feat-support-tag-filter
Aug 3, 2026
Merged

feat: add ability to filter jobs by tags#548
brandur merged 8 commits into
riverqueue:masterfrom
golanglemonade:feat-support-tag-filter

Conversation

@golanglemonade

@golanglemonade golanglemonade commented Apr 20, 2026

Copy link
Copy Markdown
Contributor

Adds exact tag filtering to the jobs list. Multiple selected tags use
match-any semantics, stay represented in the URL, and are included in
list-query cache keys so cancel, delete, and retry mutations refresh the active
result set correctly.

The backend uses the cross-driver river.JobListParams.TagsAny API merged in
riverqueue/river#1339, rather
than PostgreSQL-specific SQL. The River modules are pinned to the resulting
master merge commit.

@brandur

brandur commented Apr 20, 2026

Copy link
Copy Markdown
Collaborator

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

An unknown error occurred
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@brandur brandur left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks @golanglemonade! Thoughts on autocomplete for tag names? A bit harder maybe than queue names or job kinds, but seems like it'd be make the feature a lot more useful.

Comment thread handler_api_endpoint.go Outdated

default:
return nil, apierror.NewBadRequestf("Invalid facet %q. Valid facets are: job_kind, queue_name", req.Facet)
default:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Think this whitespace is wrong and should go back to how it was before.

@golanglemonade

Copy link
Copy Markdown
Contributor Author

Thanks @golanglemonade! Thoughts on autocomplete for tag names? A bit harder maybe than queue names or job kinds, but seems like it'd be make the feature a lot more useful.

Yep, I actually had a working automcomplete, but required direct sql because the riverdrver doesn't support the query, but I figured the preferred path would be to query the riverdriver with the update and then come back and add auto complete here?

rows, err := pgxTx.Query(ctx,
    `SELECT DISTINCT tag
    FROM river_job, unnest(tags) AS tag
    WHERE ($1 = '' OR tag ILIKE '%' || $1 || '%')
		    AND ($2 = '' OR tag > $2)
		    AND ($3::text[] IS NULL OR tag != ALL($3))
    ORDER BY tag ASC
    LIMIT 100`,
    match, after, excludeArg,
    )

@brandur

brandur commented Apr 21, 2026

Copy link
Copy Markdown
Collaborator

Ah nice. Yeah, there won't be a drive function for that.

@bgentry We better get your input before @golanglemonade goes too much further with this one. Is there a reason this feature didn't exist in the beginning, or just was never implemented?

@golanglemonade

Copy link
Copy Markdown
Contributor Author

@bgentry any update on this?

@matoszz

matoszz commented Jul 24, 2026

Copy link
Copy Markdown

Would love to see this get reviewed + merged - filtering by tag would be very useful

golanglemonade and others added 3 commits August 1, 2026 18:16
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Signed-off-by: Sarah Funkhouser <147884153+golanglemonade@users.noreply.github.com>
Tag filtering arrives without changelog coverage or regression tests, and
mutations leave active tag-filtered lists stale. The autocomplete error also
advertises a `job_tag` facet that no backend implements.

Propagate tag filters through every active job-list cache key, remove the
unsupported facet claim, and document the user-facing filter. Add coverage
for repeated query parameters, route normalization, case-insensitive OR
matching, custom schemas, and the handler request path.
@bgentry

bgentry commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

@golanglemonade I made a round of updates in here including extracting the query logic to riverqueue/river#1339 so we can keep it functional across all drivers. That's a prereq here, but otherwise @brandur can feel free to take a look at it! 🙏

bgentry added 2 commits August 1, 2026 19:28
The job-list endpoint currently implements tag matching with PostgreSQL-only
SQL through `JobListParams.Where`, preventing the handler from working with
other River drivers.

Pin River to the commit from riverqueue/river#1339 and call the new
`JobListParams.Tags` method. River now owns the case-insensitive, match-any
query semantics for PostgreSQL and SQLite, while RiverUI remains independent
of driver-specific SQL.
The tag filter tests exercise backend matching directly, but they leave the
raw request boundary, route translation, and mutation cache behavior
unprotected. Regressions in those paths can silently ignore public API
filters or leave filtered job lists stale.

Assert repeated query parameter extraction and parser type dispatch. Add a
focused route component harness that verifies tags flow from route search
state into the job query and filter control, back into navigation updates,
and through the cache keys refreshed after cancel, delete, and retry.
@bgentry
bgentry force-pushed the feat-support-tag-filter branch from d1585e3 to c1f4139 Compare August 2, 2026 00:29
bgentry added 3 commits August 1, 2026 20:16
RiverUI still calls the ambiguous tag filter and describes its matching as
case-insensitive after River splits the API into explicit any and all forms.

Pin the River modules to the revised PR commit and use TagsAny for the
existing multi-selection behavior. Describe the exact-match contract in the
changelog and include a mixed-case decoy in handler coverage so accidental
case folding is visible.
RiverUI currently points at the tag-filter PR's branch commit even though the
River change is now merged.

Move every River module to the resulting master merge commit. The dependency
now tracks the authoritative repository history while retaining the same tag
filter API and behavior.
@bgentry
bgentry requested a review from brandur August 3, 2026 00:49
@bgentry

bgentry commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@brandur want to take another look at this one? It's currently pinned to the latest river master commit, so we'll either want to ship a new river before merging this or be sure to pin to a real version before we ship the next riverui release.

@brandur brandur left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@bgentry

bgentry commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

@brandur ok merging for now, reminder this will need to have the river deps re-pinned to a release version prior to shipping a new riverui release 🙏

@bgentry

bgentry commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

Ah shoot, @golanglemonade would you mind signing the CLA so we can merge this? https://github.com/riverqueue/rivercla

@golanglemonade

Copy link
Copy Markdown
Contributor Author

Ah shoot, @golanglemonade would you mind signing the CLA so we can merge this? https://github.com/riverqueue/rivercla

done! riverqueue/rivercla#30

@brandur

brandur commented Aug 3, 2026

Copy link
Copy Markdown
Collaborator

Great. Thanks for the patch!

@brandur
brandur merged commit ccb5f99 into riverqueue:master Aug 3, 2026
6 of 17 checks passed
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.

4 participants