bd reclaim was global-only: on a federated deployment one machine's reaper
can revert a stale-looking unit that is alive on the machine that granted its
lease. Add scope filters mirroring the claim-side label surface
(bd ready --claim) so a supervisor can point its reaper at exactly the
partition it claims from.
- types.ReclaimFilter (IDs/Assignees/Labels/LabelsAny/ExcludeLabels) + IsEmpty.
- sqlbuild.BuildReclaimScopeClauses/ReclaimScopeSQL: same SQL shapes the
claim/ready path emits, alias-qualified for the reclaim JOIN. Fails closed
(1=0) on a degenerate all-empty field so a scoped sweep can never silently
widen to global.
- issueops.ReclaimExpiredLeasesInTx threads the filter into the snapshot SELECT
only; the per-row revert re-checks by id from the already-scoped snapshot.
- Threaded ReclaimExpiredLeases through the Store/domain interfaces and every
backend (dolt, embedded dolt, sql repo, use case) and both CLI paths
(direct + proxied server). A zero ReclaimFilter reproduces the exact prior
global behavior.
- CLI hard-errors a scope flag supplied with no usable value (e.g. --label
"$LANE" with LANE unset) instead of degrading to a global sweep; --json now
reports a "scoped" boolean.
- Cross-backend conformance coverage (testReclaimScoped) + sqlbuild and
flag-parsing unit tests.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>