Skip to content

JobCountByQueueAndState: fix empty queue parity, coverage#1140

Merged
bgentry merged 1 commit intomasterfrom
bg/missing-job-count-driver-test-coverage
Feb 8, 2026
Merged

JobCountByQueueAndState: fix empty queue parity, coverage#1140
bgentry merged 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.
@bgentry bgentry force-pushed the bg/missing-job-count-driver-test-coverage branch from 398179d to 15aa344 Compare February 8, 2026 05:11
@bgentry bgentry enabled auto-merge (squash) February 8, 2026 05:11
@bgentry bgentry merged commit 4fdba79 into master Feb 8, 2026
14 checks passed
@bgentry bgentry deleted the bg/missing-job-count-driver-test-coverage branch February 8, 2026 05:14
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

2 participants