Files
57_WolveandClaude Opus 5.5 5ae323b570 Keep unique jobs' references in the SQLite job store
The queue answers a repeated ntfy message or digest with its earlier
job, by the source and reference of unique jobs. For that check to
outlive a restart, the store keeps those references too.

Add, for a unique job, stores its source and reference with its job
ID in refs, in the insert's commit, and drops those of the source
beyond the newest 512, in the order they were kept, as the queue
forgets them. Job IDs do not give that order: one minted after the
clock was set back, as on a host whose clock does not run while it is
off, sorts before those kept, and pruning by ID would drop the new
reference and keep the oldest. A reference the store still holds for
an earlier job is dropped and kept again for the new one, as the
newest of its source; a plain insert would fail and stop the daemon.
Pruning statuses leaves refs alone. Load returns the references by
source, the first kept first, and reads a job as unique while its
reference is kept.

A test runs the same calls against this store and the memory store
and finds the same records, references, content and refusals. Another
keeps 512 references and then one whose job ID sorts before them all,
and finds that one kept and the first gone.

Part of stage 1d of docs/plans/job-store.md (decision 10).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-01 16:37:45 -06:00
..