Skip to content

JobCountByQueueAndState: fix empty queue parity, coverage#1140

Open
bgentry wants to merge 1 commit intomasterfrom
bg/missing-job-count-driver-test-coverage
Open

JobCountByQueueAndState: fix empty queue parity, coverage#1140
bgentry wants to merge 1 commit intomasterfrom
bg/missing-job-count-driver-test-coverage

Conversation

@bgentry
Copy link
Contributor

@bgentry bgentry commented Feb 6, 2026

JobCountByQueueAndState returned inconsistent results across drivers when callers requested queues with no matching jobs. PostgreSQL returned those requested queues with zero counts because the query materialized an all_queues CTE, while SQLite needed wrapper-level fill-in to produce the same rows.

This change keeps the SQLite sqlc query for counting existing queues, but makes the wrapper complete missing requested queues so behavior is aligned. It also defines deduplicated queue-name semantics consistently: PostgreSQL now uses DISTINCT in all_queues, and SQLite deduplicates its sorted input in the wrapper to match.

Driver conformance coverage now explicitly checks missing requested queues and deduplicated queue-name input for
JobCountByQueueAndState, so parity stays enforced across drivers.

Fixes riverqueue/riverui#496.

`JobCountByQueueAndState` returned inconsistent results across drivers
when callers requested queues with no matching jobs. PostgreSQL returned
those requested queues with zero counts because the query materialized an
`all_queues` CTE, while SQLite needed wrapper-level fill-in to produce
the same rows.

This change keeps the SQLite `sqlc` query for counting existing queues,
but makes the wrapper complete missing requested queues so behavior is
aligned. It also defines deduplicated queue-name semantics consistently:
PostgreSQL now uses `DISTINCT` in `all_queues`, and SQLite deduplicates
its sorted input in the wrapper to match.

Driver conformance coverage now explicitly checks missing requested
queues and deduplicated queue-name input for
`JobCountByQueueAndState`, so parity stays enforced across drivers.

Fixes riverqueue/riverui#496.
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.

SQLite Queues tab panic

1 participant