Problem
BlobJobsHandler.canHandleQueue ORs the same handler with itself instead of checking the second handler:
public canHandleQueue(queue: JobQueue): boolean {
return this.#batchChangeAccessTierJobHandler.canHandleQueue(queue)
|| this.#batchChangeAccessTierJobHandler.canHandleQueue(queue);
}
The second operand should be this.#blobUndeleteJobHandler.canHandleQueue(queue).
handleJob, directly above it in the same class, dispatches to both handlers:
if (this.#batchChangeAccessTierJobHandler.canHandleQueue(lease.queue)) { ... }
else if (this.#blobUndeleteJobHandler.canHandleQueue(lease.queue)) { ... }
Because canHandleQueue is the gate used to decide whether this handler accepts a queue at all, a queue that only #blobUndeleteJobHandler can service reports false. The blobUndelete branch of handleJob is therefore unreachable through that path, so blob undelete jobs are not dispatched.
Origin
Introduced by 573149eca1 (2023-11-21, Matthew Rayermann, PR 512190 - Combine blob job handlers into one bundle). That commit added this file, and it was born with the doubled operand. The defect has been continuously present ever since.
Verified two ways:
- A pickaxe search over the file's whole history,
git log -S"batchChangeAccessTierJobHandler.canHandleQueue", matches exactly one commit: 573149eca1. A single hit on the commit that added the file is itself the signal that the bug was never introduced by a later edit.
- Inspecting the method body at all six commits that ever touched the file (
573149eca1, 43058b17cd, 1c09804d49, f87f57f99a, 4f0aef261b, bf7fbb1cb9) shows the doubled operand present at every one.
Correction: an earlier revision of this issue attributed the defect to 4f0aef261b (Merged PR 765301: Consolidate job queue runtime). That was wrong. 4f0aef261b only changed the type annotation on this method (IJobQueue -> JobQueue) and left the logic untouched.
Fix
Change the second operand to this.#blobUndeleteJobHandler.canHandleQueue(queue), restoring the invariant that the guard covers the same set of handlers handleJob dispatches to.
Proposed in ADO PR !778117 - Dispatch blob undelete jobs from queue guard. This issue stays open until that merges.
No regression test accompanies the fix: blob-extension has no existing test file covering this handler (none of its 28 test files exercise the job handlers), and standing up new test infrastructure was judged out of scope for a one-line correction. Worth revisiting separately if job-handler coverage is added.
Notes
Spotted by Patrick Verbrugge during review of ADO PR !777789. That PR only changed the type annotation on this method and did not touch the logic, so the fix is tracked separately rather than expanded into a type-rename PR.
Problem
BlobJobsHandler.canHandleQueueORs the same handler with itself instead of checking the second handler:The second operand should be
this.#blobUndeleteJobHandler.canHandleQueue(queue).handleJob, directly above it in the same class, dispatches to both handlers:Because
canHandleQueueis the gate used to decide whether this handler accepts a queue at all, a queue that only#blobUndeleteJobHandlercan service reportsfalse. TheblobUndeletebranch ofhandleJobis therefore unreachable through that path, so blob undelete jobs are not dispatched.Origin
Introduced by
573149eca1(2023-11-21, Matthew Rayermann, PR 512190 - Combine blob job handlers into one bundle). That commit added this file, and it was born with the doubled operand. The defect has been continuously present ever since.Verified two ways:
git log -S"batchChangeAccessTierJobHandler.canHandleQueue", matches exactly one commit:573149eca1. A single hit on the commit that added the file is itself the signal that the bug was never introduced by a later edit.573149eca1,43058b17cd,1c09804d49,f87f57f99a,4f0aef261b,bf7fbb1cb9) shows the doubled operand present at every one.Correction: an earlier revision of this issue attributed the defect to
4f0aef261b(Merged PR 765301: Consolidate job queue runtime). That was wrong.4f0aef261bonly changed the type annotation on this method (IJobQueue->JobQueue) and left the logic untouched.Fix
Change the second operand to
this.#blobUndeleteJobHandler.canHandleQueue(queue), restoring the invariant that the guard covers the same set of handlershandleJobdispatches to.Proposed in ADO PR !778117 - Dispatch blob undelete jobs from queue guard. This issue stays open until that merges.
No regression test accompanies the fix:
blob-extensionhas no existing test file covering this handler (none of its 28 test files exercise the job handlers), and standing up new test infrastructure was judged out of scope for a one-line correction. Worth revisiting separately if job-handler coverage is added.Notes
Spotted by Patrick Verbrugge during review of ADO PR !777789. That PR only changed the type annotation on this method and did not touch the logic, so the fix is tracked separately rather than expanded into a type-rename PR.