Skip to content

feat(list-jobs): add ListJobs facade for JIMM#1878

Merged
SimoneDutto merged 6 commits intocanonical:v3from
SimoneDutto:list-river-jobs
Feb 23, 2026
Merged

feat(list-jobs): add ListJobs facade for JIMM#1878
SimoneDutto merged 6 commits intocanonical:v3from
SimoneDutto:list-river-jobs

Conversation

@SimoneDutto
Copy link
Contributor

@SimoneDutto SimoneDutto commented Feb 19, 2026

Description

Add ListJobs To JIMM facade.

A bunch of maybe controversial decisions I've made:

  • don't handle the pagination: .First() accepts from 1 to 10000 so i don't think there is a world where we actually need 2 pages of jobs. We can always query from the CLI the maximum.
  • No defaults: the default Kind, Status and Count will be set from the CLI, and the server will just validate it's the right thing.

ListJobs is paginated with a continuation token (it doesn't support limit and offset), and the token is the riverCursor struct base64 encoded.
ListJobs accepts filters, but if empty it will just return all jobs of all kinds and error state

I've added a way to do actual integration testing with river, because I wasn't sure the mock tests were enough for this pagination feature.
To accomplish that I need to add func (c *Client) SetClient(client *river.Client[*sql.Tx]) because i need the internal/river:Client struct to initialize the JobManager, but i also need the actual riverClient to interact with river inserting jobs, waiting, etc.

@SimoneDutto SimoneDutto requested a review from a team as a code owner February 19, 2026 14:22
Copy link
Contributor

@kian99 kian99 left a comment

Choose a reason for hiding this comment

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

This is great, ty!

Copy link
Collaborator

@alesstimec alesstimec left a comment

Choose a reason for hiding this comment

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

LGTM with a few comments

count = 100
}
if count > 10000 {
return apiparams.ListJobsResponse{}, errors.E("Count must be between 1 and 10_000.")
Copy link
Collaborator

Choose a reason for hiding this comment

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

i think our errors strings begin with a lower case character.. also, 100 and 10000 should be consts.. why did you put it as 10_000 in the error string?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

10_000 is the max accepted by the river's API

Copy link
Contributor Author

Choose a reason for hiding this comment

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

i can put them in a const

@SimoneDutto SimoneDutto merged commit ff8781a into canonical:v3 Feb 23, 2026
8 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.

3 participants