beads/internal
Bee f7ecd0fc93
perf(issueops): batched is_blocked mark/unmark decide membership through the batch-scoped should-be-blocked union (#6291)
* perf(issueops): batched is_blocked mark/unmark decide membership through the batch-scoped should-be-blocked union

The four batched templates (issues/wisps x mark/unmark) spelled out five
correlated EXISTS per outer row; the engine re-executed them per candidate
row — ~1.5–4.7 s per 200-id batch on committed data and unbounded over a
large uncommitted working set (>69 min observed on dolt 2.1.8 during a
proxied-server import, gastownhall/beads#6288).

They now decide membership through the same uncorrelated union the full
repair and the doctor count already use (shouldBeBlockedIDsUnionSQL,
bd-t9ypt), scoped to the batch: shouldBeBlockedIDsUnionScopedSQL(depTable,
scope) splices `AND d.issue_id IN (batch)` into every leg, and
expandBatchTemplate repeats the IN-list placeholders and bound ids for every
%s in the template (outer filter + 5 legs).

The waits-for leg wraps its dependency rows in a derived table BEFORE the
gate predicate is applied: flat, the planner pushed the gate's correlated
EXISTS ahead of the type filter and evaluated them against the whole overlay
per candidate row (436 s for zero rows); barriered, 0.01 s.

dolt 2.1.8, real 19k-issue db, one 200-id batch: committed 1.5–4.7 s → 0.04–0.08 s;
uncommitted overlay >24.6 min → 3–8 s (box load dependent).

Statement prefixes, the fixpoint loop, the updated_at self-assignment and
the error strings are unchanged. Proof: sqlmock issueops suite, container-
backed dolt Blocked|IsBlocked suite, golangci-lint clean, 8/8 mutants killed.

* test(issueops): pin expandBatchTemplate's percent budget at the fast tier

Maintainer review fixups for #6291. No production logic changes — one new
fast-tier test plus three comment corrections.

The batched mark/unmark templates reach the engine through
expandBatchTemplate, which decides how many IN-lists to splice by counting
"%s" textually. Nothing pinned that at the fast tier: the sqlmock
expectations in blocked_state_result_test.go match an unanchored statement
prefix and never call WithArgs, so they stay green against a miscounted
template, and a break surfaces only in the container-backed dolt suite.

go vet catches a stray percent only when it sits in the Sprintf format
literal. waitsForGateBlockedSQL is spliced in as an argument, so a future
LIKE 'x%' there is invisible to vet and to sqlmock both — verified by
counterfactual: injecting one leaves %s at 6 while total % goes to 7, vet
stays clean, the sqlmock suite stays green, and only the new
TestBatchedTemplatePercentBudget fires. The stray-percent guard, not the %s
count, is the assertion that bites.

Comment corrections, all pre-existing drift this change is the natural
moment to fix:

- dolt/store.go recomputeAllBlocked justified openLongTimeoutConn with "the
  full pass's batched UPDATEs carry five correlated EXISTS subqueries each".
  Wrong twice over: the full pass runs unbatched whole-table semi-join
  UPDATEs (see recomputeIsBlockedCounting) and has used the decorrelated
  union since bd-t9ypt. Load/deadline rationale kept verbatim.
- CountIsBlockedInconsistenciesInTx said detection and repair "share no
  SQL"; countStaleIsBlockedSQL has built on shouldBeBlockedIDsUnionSQL
  since bd-t9ypt, and this PR's own comment 60 lines above now says all
  three consumers share the one definition.
- blocked_full_repair_test.go's header claimed the differential half
  cross-checks the write path against the full repair on every leg. Both
  sides now render from one builder, so it validates scope-splicing and the
  waits-for barrier; per-leg semantics are pinned by the absolute fixture
  expectations, now called out so they are not dropped as redundant.

Validation: issueops suite green; go vet clean; the container-backed dolt
blocked family green on the real engine, 27/27 PASS with zero skips,
including TestRecomputeAllIsBlocked_FullRepairAllLegsDifferential.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>

---------

Co-authored-by: Eddie the Engineer <julianknutsen@users.noreply.github.com>
Co-authored-by: Claude Opus 5 <noreply@anthropic.com>
2026-09-12 06:03:19 -07:00
..
ado fix(ado): map parent-child deps to hierarchy links (not Related) (#5129) 2026-07-31 01:45:16 -07:00
atomicfile /internal/atomicfile/atomicfile.go: use io.Copy 2026-05-01 17:03:30 -07:00
audit fix(audit): make JSONL sidecar opt-in (#4688) 2026-07-11 00:09:17 -07:00
beads chore: retire a zombie test, drop a dead field, true up two leaf docs (#5492) 2026-08-09 10:42:34 -07:00
compact feat: add MiniMax provider support via Anthropic-compatible API (#3610) 2026-08-02 22:23:37 -07:00
config feat(lint): configurable per-type lint sections via lint.sections.<type> (#5855) 2026-08-19 11:23:33 -07:00
configfile Guard and qualify historical upgrades to v1.2 (#4907) 2026-08-06 18:45:04 -07:00
creds chore(creds): drop the two unreferenced credential rungs (#5379) 2026-08-06 07:03:09 -07:00
debug feat(verbosity): wire --quiet into create/close/update (bd-au0.10) (#4058) 2026-07-06 22:35:42 -07:00
doltremote fix(doltremote): fold host case, strip creds, recognize user-less SCP in CanonicalForComparison (#4576) 2026-07-07 12:59:18 -07:00
doltserver fix(dolt): explicit ServerPort must outrank ambient BEADS_DOLT_SERVER_PORT env var (#5835) 2026-08-20 05:43:57 -07:00
doltversion feat(doltversion): dolt CLI discovery, hardened version probe, and warn-only version policy (contract part 1) (#5092) 2026-08-12 21:18:24 -07:00
eventsjournal feat(events-journal): record the mutating actor on every journal row (#5908) 2026-08-23 13:55:59 -07:00
fdhygiene fix(doltserver): stop detached children inheriting the caller's fds (#4634) (#5184) 2026-07-31 08:41:41 -07:00
formula fix(cook/pour): honor declared formula step types instead of squashing them to task (#5520) 2026-08-10 05:36:33 -07:00
git test(git): restore cwd before temp cleanup (#4935) (#4936) 2026-07-23 18:40:44 -07:00
githooksenv fix(dolt): scrub stderr-directed git tracing before git-remote transfers (#5323) 2026-08-10 05:25:15 -07:00
github fix(github): content-based dedup on push to stop re-PATCHing every issue (#4214) (#4329) 2026-08-02 22:53:06 -07:00
gitlab feat(gitlab): sync issue dependency links on push (#4294) 2026-07-08 08:00:41 -07:00
gittraceenv fix(dolt): scrub stderr-directed git tracing before git-remote transfers (#5323) 2026-08-10 05:25:15 -07:00
hooks Make wasm hook refusals observable (#5607) 2026-08-10 21:01:31 -07:00
httpapi feat(count): support --metadata-field filtering (#6024) 2026-09-02 17:25:57 -07:00
idgen fix(idgen): correct test vectors in hash_test.go 2025-12-19 18:13:56 -08:00
jira Add issueops.GraphCounter: how many edges, in one named direction (ga-itny5) (#5485) 2026-08-09 11:29:32 -07:00
linear fix(windows): detect exited processes in liveness helpers (#4980) (#4981) 2026-07-23 18:24:49 -07:00
lockfile Triage and clean up an unreviewed automated commit stream on main (#4418) 2026-06-15 20:24:57 -07:00
memoryapi Put the memory plane behind memoryops, conformance-tested at three backends (#5387) 2026-08-07 03:57:04 -07:00
metrics fix(metrics): stop failing the reap test on a transient zombie (#6262) 2026-09-08 18:16:35 -07:00
migration bd: honor MIGRATION-FREEZE sentinel on write commands (#5826) 2026-08-27 05:51:32 -07:00
molecules refactor: delete the dead orphan-handling capability (bd-gwryr) (#5497) 2026-08-09 12:03:18 -07:00
notion test: replace Notion config fixtures with recorder (bd-b51np) (#5256) 2026-08-01 19:49:57 -07:00
procid fix(build): restore freebsd compilation with unsupported-platform stubs for procid + unverified-process (release v1.2.0 blocker) (#5661) 2026-08-11 14:03:44 -07:00
query fix(query): make slash and mixed-case metadata keys queryable (#4896) 2026-07-24 17:52:22 -07:00
recipes [codex] Add Kiro setup recipe (#4535) 2026-07-27 22:28:43 -07:00
remotecache fix(dolt): scrub stderr-directed git tracing before git-remote transfers (#5323) 2026-08-10 05:25:15 -07:00
routing fix(routing): warn when contributor auto-routing swaps bd list/ready to the planning store (#4866) 2026-07-25 22:31:03 -07:00
storage perf(issueops): batched is_blocked mark/unmark decide membership through the batch-scoped should-be-blocked union (#6291) 2026-09-12 06:03:19 -07:00
telemetry docs: the ext-api-store documentation tranche — post-#5516 auth sweep, wave doc coherence, role checklist refresh (#5545) 2026-08-10 08:05:07 -07:00
templates fix(cli): printed doc paths point at the new docs locations 2026-07-12 10:37:17 -07:00
testutil fix(doctor): reap leaked test dolt sql-servers from CGO_ENABLED=0 suites (#5917) 2026-09-02 18:11:33 -07:00
timeparsing fix: normalize parsed timestamps to UTC (#5295) 2026-08-07 07:03:43 -07:00
tracker fix(github): content-based dedup on push to stop re-PATCHing every issue (#4214) (#4329) 2026-08-02 22:53:06 -07:00
types fix(deps): enforce external capability blockers across ready/claim/close (#4769) (#4753) 2026-09-02 16:56:23 -07:00
ui fix(ui): stop using blocked ● for priority in CLI output (#5511) 2026-08-10 06:19:51 -07:00
uimd fix(show): stop bd show corrupting shell globs in descriptions (#5799) 2026-08-20 07:54:36 -07:00
utils feat(issueops): add the Reader role and wire both front doors through it 2026-07-31 18:37:25 +00:00
validation fix: canonicalActor collapses the --/__ axes correctly; claim-verify uses ActorMatches (be-p7dzx, bundled be-vc51) (#5856) 2026-08-19 13:23:35 -07:00
workapi fix(list): honor --status when combined with --ready (#5924) 2026-09-02 18:12:07 -07:00
workspacegate feat(workspacegate): shared physical-root resolver, beads.OpenGated, and CLI gate wiring (part 2) (#5093) 2026-07-31 01:41:20 -07:00
worktreeremove test: replace worktree removal process matrix (bd-kuqlg.2) (#5280) 2026-08-02 09:34:29 -07:00