beads/website/versioned_docs/version-1.0.0/cli-reference/index.md
Steve Yegge 4e460b427b
fix(is_blocked): cross-mode full recompute repair for stale is_blocked (bd-6dnrw.37) (#4423)
* fix(is_blocked): cross-mode full recompute repair for stale is_blocked (bd-6dnrw.37)

The post-pull is_blocked recompute (bd-6dnrw.3) is scoped to the merge diff and
skips when a re-pull merges nothing (HEAD unchanged), so a recompute that failed
AFTER its merge committed — or a conflicted pull resolved by hand (which skips
the recompute) — left is_blocked stale with no repair: rerunning bd dolt pull
merged nothing and recomputed nothing. bd ready trusts is_blocked, so stale
values silently hide ready work or surface blocked work.

Core (internal/storage/issueops/blocked_consistency.go):
- RecomputeAllIsBlockedInTx: full mark/unmark fixpoint over every issue+wisp,
  returns rows corrected. Idempotent. Reuses the existing pass functions.
- CountIsBlockedInconsistenciesInTx: read-only COUNT of stale rows for detection.
  Its predicate mirrors the mark/unmark templates and is pinned to the repair by
  the dolt-package lockstep tests (a converged DB counts 0; any counted row is
  one a recompute pass flips), so detection cannot silently drift from repair.

Cross-mode repair:
- storage.BlockedRecomputer capability; DoltStore + EmbeddedDoltStore
  RecomputeAllBlocked (stage issues-only, matching the post-pull recompute).
- New 'bd recompute-blocked' command — works in BOTH embedded and server mode.
  bd doctor is server-mode only, so embedded users need a non-doctor entry point.
- bd doctor (server mode) gains a read-only "Blocked State" check and a
  'bd doctor --fix' dispatch running the same repair. Warn-only (does not fail
  OverallOK): new check shipping in a patch, is_blocked self-heals via the fix.

Secondary item (server recomputeBlockedAfterPull commits via s.Commit, which can
sweep a concurrent writer's changes) split to bd-6y5hx (P3, deferred): it is
subtle (after an auto-resolved merge the working set holds the whole merge
result, so a naive issues-only narrowing would drop merge results). The embedded
path already stages issues-only; the new repair path stages issues-only too.

Tests: 3 dolt lockstep tests (detect==repair, stuck-blocked, parent-child
cascade) + embedded wiring test. Smoke-tested on a real ~2000-issue embedded DB:
0 false positives. build/vet/gofmt/golangci-lint all clean.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

* docs: regenerate CLI reference for `bd recompute-blocked`

Run ./scripts/generate-cli-docs.sh + ./scripts/generate-llms-full.sh with
the canonical CGO_ENABLED=0 gms_pure_go build to pick up the new
`bd recompute-blocked` command. The adopted PR added the command but did
not regenerate the CLI docs, failing the PR doc-flags freshness checks.

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

* fix(is_blocked): guard full recompute against dirty graph; pin doctor blocked-state last

Maintainer adoption fixes for PR #4423 review (bd-6dnrw.37):

- Refuse a full is_blocked recompute when the committable graph tables
  (issues, dependencies) carry uncommitted working-set changes, across the
  server, embedded, and doctor-fix paths. The recompute derives flags from
  the current graph and stages only `issues`, so running it dirty would
  sweep unrelated issue edits into the repair commit or publish is_blocked
  derived from uncommitted dependency state. Dolt-ignored wisp tables are
  deliberately excluded from the guard: they are never committed and show
  as perpetually modified in dolt_status, so guarding on them would refuse
  the recompute in any workspace that uses wisps.

- Pin the doctor "Blocked State" fix to an explicit terminal priority so it
  provably runs after every graph-mutating fix (Dependency Keys,
  Orphaned/Child-Parent Dependencies, Cross-Table Duplicates) instead of
  relying on check-append order. This fixes a stale is_blocked left after
  `bd doctor --fix --fix-child-parent` removed a child-parent edge.

- Surface (no longer swallow) the doctor-fix Dolt stage/commit errors, and
  tolerate only the benign nothing-to-commit case.

Tests: dirty-issues and dirty-dependencies refusal, dirty-wisps still
repairs, clean repair+commit idempotence (dolt server-mode); fix-ordering
regression covering the --fix-child-parent case (cmd/bd); embedded wiring
test now commits its seed to match the fresh-process clean-tree precondition.

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

---------

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Eddie the Engineer <ci@beads.test>
2026-06-19 23:14:09 -07:00

3.4 KiB