beads/internal/storage/issueops
Steve Yegge 39bed11aa5 fix(lease): stop arming worker leases on bare status/assignee updates (bd-9hpgf)
Mirrors upstream #4716. ManageLeaseOnUpdate armed a 5-minute lease
whenever a generic update left an issue in_progress+assigned, so a plain
interactive claim (bd update -s in_progress -a <who>) silently entered
the heartbeat/reclaim protocol nobody was running for it. The lease
lapsed, bd reclaim reverted the bead out from under its owner, a
supervisor restore re-armed the lease, and the churn self-sustained —
until a headless fleet worker legitimately claimed a bead whose owner
was mid-implementation (observed live on the wyvern constellation).

Leases now arm ONLY via the lease-aware verbs (claim/heartbeat).
ManageLeaseOnUpdate is clear-only:

- leaving the claimed state (not in_progress, or unassigned) clears the
  lease, as before;
- changing who holds the claim (assignee transfer, or a fresh
  transition into in_progress) clears the previous owner's lease so it
  cannot count down against the new holder — the new holder gets a
  lease only by claiming or heartbeating through the lease-aware verbs;
- a same-claim edit (already in_progress, same assignee) leaves the
  lease columns untouched, so a worker's live lease survives unrelated
  edits to its issue.

A real worker restored by a supervisor self-heals: its next heartbeat
re-arms the lease. Interactive hand-dole claims stay durable until the
actor releases them or a human reclaims.

Flips TestUpdateIssueMaintainsLeaseOwnership (which pinned the old
transfer-stamps-fresh-lease behavior), adds the bd-9hpgf regression
guard TestBareUpdateClaimDoesNotArmLease plus
TestUpdatePreservesLeaseOnSameClaim, and a pure unit table-test for the
clear-only contract.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01U5mtSXJuNGs4tmeKDbwNif
2026-07-10 19:38:01 -07:00
..
as_of.go /{cmd,internal}: bd show proxied-server mode 2026-06-17 13:29:24 -07:00
batching.go /{cmd,internal}: cleanup 2026-05-22 13:04:38 -07:00
batching_test.go fix(storage): preserve mixed issue and wisp reads (#3991) 2026-05-21 06:50:42 -07:00
blocked.go /{cmd,internal}: bd ready proxied-server 2026-06-18 13:00:57 -07:00
blocked_consistency.go fix(is_blocked): cross-mode full recompute repair for stale is_blocked (bd-6dnrw.37) (#4423) 2026-06-19 23:14:09 -07:00
blocked_merge.go fix(is_blocked): cross-mode full recompute repair for stale is_blocked (bd-6dnrw.37) (#4423) 2026-06-19 23:14:09 -07:00
blocked_state.go fix(backends): maintainer fixup — CI repair + adoption review fixes 2026-07-10 17:44:37 +00:00
bulk_ops.go fix(storage): set explicit app-side ids at every events/comments insert site (bd-6dnrw.18) 2026-06-11 01:46:52 -04:00
child_id.go /internal/storage: remove dual tx 2026-05-15 12:07:41 -07:00
claim.go feat: add bd unclaim command to release stuck issues (replaces #3694) (#4614) 2026-07-06 22:51:35 -07:00
close.go feat(lease): land the leasing stack + schema v54 (claim-TTL, heartbeat, reclaim) (#4537) 2026-07-03 23:28:55 -07:00
comments.go /{cmd,internal}: reopen 2026-06-17 16:56:56 -07:00
commit_pending.go /{cmd,internal}: refactor again 2026-03-17 18:11:37 -07:00
compaction.go fix(compact): archive content before destructive compaction; make restore work (#4464) 2026-06-20 14:12:07 -07:00
config_helpers.go /{cmd,internal}: bd ready proxied-server 2026-06-18 13:00:57 -07:00
config_helpers_test.go feat(storage): honor .beads/config.yaml types.custom in server-side validation (#4024) (#4026) 2026-05-21 10:26:53 -07:00
config_metadata.go /{cmd,internal}: bd ready proxied-server 2026-06-18 13:00:57 -07:00
count.go feat: choose your own storage backend (Postgres / MySQL / SQLite) — rebased on main 2026-07-10 17:44:37 +00:00
create.go fix(backends): green up #4601 CI — pg counter ambiguity, dolt wisp order, embedded timeout 2026-07-10 17:44:38 +00:00
create_test.go fix(import): honor imported dependency created_by (#4432) 2026-06-22 13:34:33 -07:00
cycles.go /{cmd,internal}: bd ready proxied-server 2026-06-18 13:00:57 -07:00
cycles_test.go fix(deps): bulk cycle gate blocks only cycles that traverse a new edge (bd-578h9.9) 2026-06-11 15:21:33 -04:00
delete.go feat(storage): backend-agnostic conformance test suite (#4414) 2026-07-01 22:25:45 -07:00
dep_counts.go /{cmd,internal}: bd show proxied-server mode 2026-06-17 13:29:24 -07:00
dependencies.go /{cmd,internal}: bd show proxied-server mode 2026-06-17 13:29:24 -07:00
dependencies_test.go fix(deps): deterministic dependency primary keys for cross-clone merge-safety (#4259) 2026-06-07 14:47:58 -07:00
dependency_queries.go fix: prefer wisp on cross-table dup; add CGO-free duplicate check (be-iabdi) (#4163) 2026-06-19 10:49:30 -07:00
dependency_queries_test.go fix(storage): preserve mixed issue and wisp reads (#3991) 2026-05-21 06:50:42 -07:00
dependency_tree.go /{cmd,internal}: bd dep proxied-server 2026-06-18 15:44:45 -07:00
dependency_tree_test.go fix(dep): keep relates-to out of dependency tree 2026-05-27 12:39:37 -07:00
diff.go /internal/storage/{dolt,embeddeddolt,issueops}: implement methods 2026-03-20 11:46:28 -07:00
epic_closure.go /{cmd,internal}: cleanup 2026-05-22 13:04:38 -07:00
events.go /{cmd,internal}: wip sync and data EmbeddedDoltStore methods 2026-03-24 12:01:16 -07:00
federation.go /{cmd,internal}: wip sync and data EmbeddedDoltStore methods 2026-03-24 12:01:16 -07:00
filters.go refactor(storage): extract shared SQL builders into internal/storage/sqlbuild (bd-6dnrw.46) 2026-06-12 15:56:23 -04:00
filters_test.go refactor(storage): extract shared SQL builders into internal/storage/sqlbuild (bd-6dnrw.46) 2026-06-12 15:56:23 -04:00
get_issue.go /{cmd,internal}: bd close proxied-server 2026-06-17 15:05:41 -07:00
helpers.go feat: choose your own storage backend (Postgres / MySQL / SQLite) — rebased on main 2026-07-10 17:44:37 +00:00
helpers_test.go feat(create): add status flag for initial issue status (#4536) 2026-07-05 11:15:48 -07:00
history.go /internal/storage/{dolt,embeddeddolt,issueops}: implement methods 2026-03-20 11:46:28 -07:00
labels.go fix: keep dolt label path raw 2026-07-10 17:44:38 +00:00
lease.go fix(backends): address red-team review findings before merge 2026-07-10 18:58:00 +00:00
molecule.go /{cmd,internal}: remove depends_on_id 2026-05-19 10:17:49 -07:00
promote.go fix(import): stale-rejected rows no longer persist aux data or count as Created (bd-578h9.8) 2026-06-11 15:12:10 -04:00
ready_work.go perf(ready): page-push ready-work counts and size the total with cheap COUNT(*)s (#4679) 2026-07-08 18:07:41 -07:00
ready_work_counts.go perf(ready): page-push ready-work counts and size the total with cheap COUNT(*)s (#4679) 2026-07-08 18:07:41 -07:00
ready_work_test.go fix: prefer wisp on cross-table dup; add CGO-free duplicate check (be-iabdi) (#4163) 2026-06-19 10:49:30 -07:00
reopen.go /{cmd,internal}: reopen 2026-06-17 16:56:56 -07:00
scan.go feat(lease): land the leasing stack + schema v54 (claim-TTL, heartbeat, reclaim) (#4537) 2026-07-03 23:28:55 -07:00
search.go perf(id_parser): narrow fallback search to id-only projection (#4150) 2026-07-04 13:45:38 -07:00
search_counts.go perf(ready): page-push ready-work counts and size the total with cheap COUNT(*)s (#4679) 2026-07-08 18:07:41 -07:00
search_counts_test.go fix(list): counts path honors SkipWisps and SortBy (bd-6dnrw.42, bd-6dnrw.43) 2026-06-11 22:01:22 -04:00
stale.go perf(storage): amortize per-ID wisp routing via WispIDSetInTx (#3453) 2026-04-24 13:39:42 -07:00
statistics.go feat: choose your own storage backend (Postgres / MySQL / SQLite) — rebased on main 2026-07-10 17:44:37 +00:00
unclaim.go feat: add bd unclaim command to release stuck issues (replaces #3694) (#4614) 2026-07-06 22:51:35 -07:00
update.go fix(lease): stop arming worker leases on bare status/assignee updates (bd-9hpgf) 2026-07-10 19:38:01 -07:00
update_test.go fix(lease): stop arming worker leases on bare status/assignee updates (bd-9hpgf) 2026-07-10 19:38:01 -07:00
wisp_filter_convert.go feat: add ListWisps method to Storage interface (fix-merge PR #2783) 2026-03-26 19:33:28 -07:00
wisp_routing.go /{cmd,internal}: bd close proxied-server 2026-06-17 15:05:41 -07:00
wisp_routing_test.go perf(storage): amortize per-ID wisp routing via WispIDSetInTx (#3453) 2026-04-24 13:39:42 -07:00