feat(FN-5363): enforce strict target lease to prevent merge queue pollution

Enforces strict target-lease behavior on merge queue rows, gates and scrubs polluted entries, enriches no-lease handoff diagnostics, and adds regression tests covering leased-target no-lease and polluted queue reuse paths, with audit registration and docs updates.

Fusion-Task-Id: FN-5363
This commit is contained in:
Fusion (runfusion.ai)
2026-05-21 13:37:27 -07:00
committed by gsxdsm
parent b3f995c857
commit 0c2416903f
10 changed files with 513 additions and 68 deletions

View File

@@ -2,4 +2,4 @@
"@runfusion/fusion": patch
---
Fix merge queue lease race causing all in-review tasks to fail with merge:reuse-handoff-refused (no-lease) when unrelated tasks pollute the queue head. acquireReuseHandoff now targets the specific task ID rather than blindly grabbing the queue head, so the correct task gets the lease regardless of stale queue entries.
Fix merge-queue reuse-handoff contention that caused `merge:reuse-handoff-refused` (`reason=no-lease`) for valid in-review tasks when unrelated rows polluted queue head state. `acquireMergeQueueLease({ targetTaskId })` now honors the target strictly (no queue-head fallback), and merge-queue lifecycle handling is now column-aware: enqueue is rejected for non-`in-review` tasks, lease selection auto-cleans stale non-review rows, and `in-review` column exits scrub queue rows when leases are absent or expired.