fix(pow): drop checkpoint before removing job from the jobs flow

removeEntry published the empty jobs list before calling
persistence.remove, so an observer waking on the job's disappearance
(e.g. PoWPublishQueueTest.persistedJobIsSavedThenRemovedOnCompletion)
could still see the checkpoint. Remove the checkpoint first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MKvUGSMiCwjSdVm33hD4yp
This commit is contained in:
Claude
2026-09-23 19:43:38 +00:00
parent 374a8bd8e8
commit 4ab7da5aa9
@@ -476,9 +476,11 @@ class PoWPublishQueue(
dropCheckpoint: Boolean,
persisted: Boolean,
) {
// drop the checkpoint before the entry leaves [jobs]: anyone observing
// the job disappear must also see its checkpoint gone.
if (persisted && dropCheckpoint) persistence?.remove(jobId)
pending.update { it.removing(jobId) }
_jobs.update { list -> list.filter { it.id != jobId }.toImmutableList() }
if (persisted && dropCheckpoint) persistence?.remove(jobId)
}
companion object {