beads/internal/storage/embeddeddolt
Harry be65f59cd0 fix(dolt): batch wisp-ID partition in bulk hydrators (GH#3414)
Every mutating bd command against a remote Dolt backend hung ~10–15s
with `auto-export failed: ... hydrate labels: ... context canceled`.

Root cause: five bulk fetchers in internal/storage/issueops partitioned
IDs into wisp vs permanent buckets by calling IsActiveWispInTx once per
ID, and each call is a round-trip to the SQL server. With ~600 issues
over WAN latency that's ~12s of sequential SELECTs *before* the real
label query runs — blowing past the context deadline.

Fix:
- Add PartitionWispIDsInTx that batches the check into one
  `SELECT id FROM wisps WHERE id IN (...)` per queryBatchSize chunk,
  reducing cost from O(N) to O(1 + N/200) round-trips. Falls back to
  "no wisps" when the wisps table is absent (pre-migration dbs).
- Rewrite GetLabelsForIssuesInTx, GetCommentsForIssuesInTx,
  GetDependencyRecordsForIssuesInTx, GetBlockingInfoForIssuesInTx, and
  DeleteIssuesInTx to use it.
- Add fast-path helpers GetLabelsForIssuesFromTableInTx and
  GetDependencyRecordsForIssuesFromTableInTx for callers (searchTableInTx)
  that already know every ID is in a single table, skipping the partition
  round-trip entirely on the hot auto-export path.

Tests:
- New wisp_partition_test.go covering the partitioner directly: empty,
  all-perm, all-wisp, mixed-with-unknown, input-order preservation, and
  a 450-ID large-batch case crossing the queryBatchSize boundary.
- End-to-end mixed-routing regression tests for GetCommentsForIssues,
  GetDependencyRecordsForIssues, and a 250-ID GetLabelsForIssues case
  that crosses the chunk boundary.

Made-with: Cursor
2026-05-02 13:27:24 -07:00
..
cmd /{beads_cgo,cmd,internal}: cache open embedded stores deterministically to prevent deadlocking when multiple store open attempts are made against an opened store 2026-04-29 15:49:51 -07:00
cache.go :remove uneccessary locking 2026-05-01 17:46:37 -07:00
cache_cleanup.go fix(ci): unblock main — gosec G122 + credentials_test signatures (#3389) 2026-04-20 19:02:11 -07:00
cache_cleanup_test.go Fix git-remote-cache tmp_pack file leak in embedded mode (#3355) 2026-04-20 17:49:49 -07:00
cache_test.go /{cmd,internal}: some cleanup 2026-04-30 12:46:54 -07:00
child_id.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
child_id_test.go fix: add missing //go:build cgo tags to embedded test files and cmd 2026-04-01 07:08:41 -07:00
compat_migrations_test.go /{cmd,internal}: some cleanup 2026-04-30 12:46:54 -07:00
concurrency_test.go :remove uneccessary locking 2026-05-01 17:46:37 -07:00
config_metadata.go /{cmd,internal}: move local only state to dolt ignored tables 2026-04-14 14:47:30 -07:00
create_issue.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
create_issue_test.go /{cmd,internal}: some cleanup 2026-04-30 12:46:54 -07:00
dependencies.go perf(storage): amortize per-ID wisp routing via WispIDSetInTx (#3453) 2026-04-24 13:39:42 -07:00
dependencies_test.go fix: add missing //go:build cgo tags to embedded test files and cmd 2026-04-01 07:08:41 -07:00
federation.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
flock.go :remove uneccessary locking 2026-05-01 17:46:37 -07:00
flock_stub.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
get_issue.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
get_issue_test.go fix: add missing //go:build cgo tags to embedded test files and cmd 2026-04-01 07:08:41 -07:00
issues.go Add atomic ready claim (GH-3570) 2026-04-28 07:11:13 -07:00
labels.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
list_queries.go fix(dolt): batch wisp-ID partition in bulk hydrators (GH#3414) 2026-05-02 13:27:24 -07:00
merge_slot.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
new_methods_test.go fix: prefer bootstrap for missing database recovery (#2940) 2026-04-02 19:52:58 -07:00
open.go fix: auto-sanitize hyphenated dolt_database on embedded-mode upgrade (#3231) (#3232) 2026-04-20 13:17:26 -07:00
open_stub.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
open_test.go fix: preserve spaces in embedded Dolt paths 2026-04-02 21:22:45 -07:00
queries.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
schema.go /internal/storage/schema: use shared schema package 2026-04-06 15:03:20 -07:00
schema_test.go /{cmd,internal}: some cleanup 2026-04-30 12:46:54 -07:00
slots.go fix: prefer bootstrap for missing database recovery (#2940) 2026-04-02 19:52:58 -07:00
statistics.go fix(release): add CGO build constraints for embeddeddolt, bump to v0.63.2 2026-03-29 16:57:50 -07:00
store.go :remove uneccessary locking 2026-05-01 17:46:37 -07:00
store_stub.go :remove uneccessary locking 2026-05-01 17:46:37 -07:00
transaction.go feat: add JSONL bulk dep add (#3530) 2026-04-27 04:51:46 -07:00
version_control.go fix remote sync follow-ups 2026-04-24 11:36:22 -07:00