* Fix rig bead durability (bds-vwz)
* fix: keep rig beads out of infra migration
* fix: repair durable rig wisps
Restore migration 0035 to its frozen upstream shape and add a forward repair migration for existing type=rig rows that were routed into wisps.
Keep type=rig durable while excluding it from ready work, and cover the repair path with CLI-backed schema tests plus Dolt-server tests where available.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of matt wilkie
* fix: make rig wisp repair migration upgrade-safe
Guard migration 0053 so older workspaces without local wisp tables no-op instead of failing, while keeping the fresh-Dolt CLI migration bundle able to exercise rig wisp repair fixtures.
Regenerate CLI reference docs for the updated infra type help text.
Agent-Signature: codex-gpt-5.5-high on behalf of matt wilkie
---------
Co-authored-by: silvanshade <silvanshade@users.noreply.github.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
_codex-gpt-5.5-xhigh on behalf of CI Bot_
Agent-Signature: codex-gpt-5.5-medium on behalf of matt wilkie
Agent-Signature: claude-unknown-model-high on behalf of matt wilkie
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of matt wilkie
bd admin compact --tier 2 hard-errors "not yet implemented", yet the command
help, --stats output, and several docs advertised "Tier 2: Ultra compression
(90 days closed, 95% reduction)" as if it worked. Make the surface honest:
- Reject --tier != 1 early with a clear "not yet implemented; only --tier 1 is
available" message instead of failing deep inside a mode.
- --stats labels Tier 2 "not yet implemented" and drops the bogus 95% savings
estimate; the JSON tier2 block gains "implemented": false.
- Update command/flag help, the plugin skill doc, and the examples README;
regenerate the generated CLI reference.
New embedded e2e asserts --tier 2 errors and --stats no longer advertises 95%.
No attempt to implement Tier 2 (semantics undefined); only the false
advertising is removed.
Refs #4463
Agent-Signature: claude-opus-4-8-high on behalf of maphew
Content compaction (bd admin compact) overwrote an issue's description and
cleared design/notes/acceptance_criteria in place with no archive, while the
issue_snapshots/compaction_snapshots tables built to hold that archive were
dead code (never written). The only recovery, bd restore, was display-only and
relied on a largest-history-row heuristic that dolt gc / history-squash can
erase. Net: compaction was effectively irreversible.
Wire the existing compaction_snapshots table: archive the full pre-compaction
content (snapshot_json BLOB) before the destructive overwrite, aborting if the
archive fails; add SnapshotIssue/GetCompactionSnapshot/RestoreFromSnapshot to
the CompactionStore interface on both Dolt and embedded stores; and rework
bd restore to restore from the snapshot (--apply writes it back; default stays
read-only display, with the old Dolt-history reconstruction as fallback).
Unit tests assert snapshot-before-overwrite ordering and abort-on-archive-
failure; an integration test covers the snapshot -> overwrite -> restore round
trip against a real Dolt store. CLI reference docs regenerated for the new flag.
Refs #4463
Agent-Signature: claude-opus-4-8-high on behalf of maphew
* 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>
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
--offset flag.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
* feat(init): add --init-if-missing for idempotent init (#3490)
bd init aborts with exit 1 when the workspace is already initialized,
forcing scaffold scripts to pre-stat .beads/embeddeddolt/<prefix> to tell
"already initialized" (benign) apart from real errors. Add an opt-in
--init-if-missing flag: when the workspace already exists, init prints a
benign "Skipping init: workspace already initialized." to stderr and exits 0.
Default behavior (flag absent) is unchanged - exit 1 with the existing
"already initialized ... Aborting" message.
The flag is intercepted only at the existing checkExistingBeadsData guard
call site; detection logic and the --force/--reinit-local paths are untouched.
Docs regenerated via scripts/generate-cli-docs.sh and generate-llms-full.sh.
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(init): abort --init-if-missing on explicit prefix mismatch
--init-if-missing silently skipped whenever a workspace already existed,
even if the caller passed an explicit --prefix that differed from the
existing workspace. That masked a real mismatch: `bd init --prefix bar
--init-if-missing` against an existing `foo` workspace exited 0 and
ignored the requested prefix.
Now, when --prefix is set explicitly (and --database is not), compare the
requested prefix against the existing workspace's recorded DoltDatabase
and abort on a genuine mismatch; matching or undeterminable cases still
skip benignly. Extracts the prefix->dbName normalization into shared
helpers so the guard derives exactly the same name init records, and
factors the decision into a pure, unit-tested helper.
Refs #3490
Co-authored-by: Cursor <cursoragent@cursor.com>
* fix(init): don't mask operational errors or --database mismatch under --init-if-missing
Two idempotent-init correctness fixes on top of #4332 (reviewer Bernoulli):
1. checkExistingBeadsData now distinguishes the benign "already initialized"
outcome (errWorkspaceAlreadyInitialized, carried by a workspaceExistsError
that keeps the user-facing message) from operational errors such as an
unreadable .beads/embeddeddolt directory. --init-if-missing skips only the
benign case; an operational error still aborts instead of being masked as a
successful idempotent skip.
2. An explicit --database mismatch now aborts --init-if-missing, mirroring the
existing --prefix guard. --database is the authoritative database selector,
so it is checked even when --prefix is also set.
Tests: initIfMissingDatabaseMismatch table; checkExistingBeadsDataAt returns a
sentinel-matching error for an existing database and a non-matching
(operational) error when embeddeddolt is unreadable.
Agent-Signature: claude-opus-4-8-high on behalf of maphew
---------
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: matt wilkie <maphew@gmail.com>
Why: #4365 reports two documented CLI affordances that either fail or require a second command. children advertised --pretty but rejected it, and defer had no way to capture the reason at deferral time.
What: add the children --pretty flag by delegating to list's existing tree renderer, add defer --reason by appending to notes during the status update, and refresh generated CLI docs.
Agent-Signature: codex-unknown-model-unknown-reasoning on behalf of matt wilkie
* feat(count): add --include-infra for exact bd list cardinality parity
bd count hardcoded filter.SkipWisps=true (9a29a158f, Q2 SQL-COUNT rewrite),
so it only counted the durable issues table. bd list --include-infra merges
the wisps table — including no_history beads, which are durable work — so no
count invocation could match a list cardinality. On the production gascity
rig store that meant bd count --type task = 23,777 vs a list --include-infra
cardinality of 33,601: a 29% undercount that blocks Gas City from
implementing an exact Counter over the bd CLI (its bounded-read pagination
needs Total to be exact).
Changes:
- cmd/bd/count.go: new --include-infra flag mirroring bd list's flag.
applyCountIncludeInfra reproduces the buildListFilter defaults that
determine list's cardinality under --include-infra: wisps merge
(SkipWisps=false), template exclusion (IsTemplate=false), default gate
exclusion unless --type gate, and infra-type routing to the ephemeral
tier using the store-configured infra set. Without the flag the filter
construction is unchanged (SkipWisps=true), keeping the widely-scripted
default byte-identical.
- internal/storage/{dolt,embeddeddolt}/counts.go: CountIssues now delegates
to issueops.CountIssuesInTx (extended with the query param) instead of a
hardcoded SELECT COUNT(*) FROM issues, so SkipWisps/Ephemeral routing
matches SearchIssuesInTx. CountIssuesInTx previously had no production
callers.
- internal/storage/issueops/count.go: CountIssuesByGroupInTx now honors
SkipWisps/Ephemeral with the same merge semantics, so --by-* grouped
counts under --include-infra report merged buckets instead of
silently-wrong durable-only numbers.
- Tests (TDD): cmd/bd/count_filter_test.go pins the count filter against
buildListFilter field-by-field; internal/storage/dolt/
count_include_wisps_test.go asserts CountIssues == len(SearchIssues) for
the trap filters (templates, no_history, ephemeral) and merged grouped
counts; cmd/bd/count_embedded_test.go adds CLI-level count==list parity.
- Docs: regenerated CLI reference (also picks up pre-existing dep/import
help-text drift so scripts/check-doc-flags.sh passes) and one pre-existing
gofmt fix in issueops/search.go for ci-pr-lint.
Verification on the production gascity rig store (read-only):
bd count --include-infra --type task = 33,601
bd list --include-infra --type task --all --json --limit 0 | len = 33,601
bd count --include-infra = 42,631 (list equivalent: 42,631)
bd count --include-infra --status open = 1,969 (list equivalent: 1,969)
bd count --include-infra --by-type : total 42,631, task bucket 33,601
bd count --type task (no flag) = 23,777 (stock bd 1.0.5: 23,777)
Gates: make ci-pr-core (go test -race -short), ci-pr-policy, ci-pr-lint,
go vet ./..., embedded count/list suites, full dolt + embeddeddolt
storage packages.
Fixes#4387
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(cli): write-intent routing for all mutating commands; count ephemeral parity; pin bulk dep cycle gate
Adopt-PR review fixes for PR #4389 on top of the pre-review CI repair.
Routed write surface (#4141, bd-6dnrw.32, GH#3231): bd-6dnrw.32 gave
read-only opens a real read-only path, which silently broke routed sibling
writes -- prefix-routed resolution opened the target read-only, so a mutating
command on a routes.jsonl-routed ID failed with "store is read-only". The
earlier CI repair restored update/comment/comments add/note/reopen; review
found the rest of the mutating surface still broken. Write intent now covers
every prefix-routed mutating command: assign, priority, tag, edit, delete
(single + batch), close (resolveCloseTargets), human respond/dismiss, link,
and dep add/--blocks/remove/bulk (via a new resolveIDWithRoutingForWrite).
The source issue's store opens writable so the write commits on the target
head; read paths, dependency-target ID resolution, dep tree, and contributor
auto-routing stay read-only, preserving the bd-6dnrw.32/GH#3231 guarantee
that routed reads never mutate a foreign project's history. Regression test
TestEmbeddedRoutedMutatingSiblingWritesCommitTargetHead pins assign/tag/
dep add/delete/close routed writes committing on the target head.
Count ephemeral parity (GH#4387): CountIssuesInTx returned the wisps count
unconditionally for an Ephemeral=true filter, while SearchIssuesInTx falls
through to the durable issues table when the wisps tier is empty. The scalar
fall-through landed first, but review (attempt 2) found the same fall-through
missing from the two sibling functions, so grouped counts and count-projection
searches still dropped a durable issues-table row flagged ephemeral=1:
CountIssuesByGroupInTx returned empty buckets while the scalar Total fell
through (sum(groups) != Total), and SearchIssuesWithCountsInTx returned nil
where SearchIssues returned the row. CountIssuesByGroupInTx and
SearchIssuesWithCountsInTx now mirror the scalar/list fall-through, so
bd count --include-infra --by-* and bd search --counts --include-infra match
bd list cardinality when only durable rows match. The scalar fall-through
comment is corrected to describe the durable ephemeral=1 defensive state
(a promoted bead carries ephemeral=0, so it never reaches this branch).
Regression tests TestCountIssuesEphemeralFallsThroughToDurable (scalar),
TestCountIssuesByGroupEphemeralFallsThroughToDurable (grouped), and
TestSearchIssuesWithCountsEphemeralFallsThroughToDurable (counts projection)
pin count==len(list) for that case; the merge path documents that list is the
disjoint-table corruption detector.
Bulk dep cycle gate (bd-6dnrw.8): unchanged from the pre-review repair --
TestEmbeddedDepBulkNoCycleCheckKeepsWholeGraphGate pins the whole-graph
cycle gate on bulk --no-cycle-check adds.
Validation (worktree, BEADS_TEST_EMBEDDED_DOLT=1, -tags gms_pure_go):
routed-write and count-parity regression tests pass; TestEmbeddedDep*,
cross-rig routing, dep/close/delete/link CLI suites, and the count
CLI/issueops suites pass; go build, go vet, gofmt, git diff --check clean.
Validation (attempt 2, grouped + counts-projection fall-through): go build
(issueops, dolt, cmd/bd) and go vet (issueops, dolt) clean; git diff --check
clean. The Dolt count/list parity suite passes against an isolated Dolt test
container (TestCountIssuesMergedMatchesSearch, the three ephemeral
fall-through regressions, TestCountIssuesByGroupIncludesWisps,
TestPR4107SearchIssuesWithCountsEphemeralFalseIncludesNoHistoryOnly); all
three fall-through regressions were verified failing on the pre-fix tree.
Embedded-engine fixtures that need the CGO/ICU build are exercised by the
GitHub PR workflow.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
---------
Co-authored-by: CI Bot <ci@beads.test>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
The v1.0.5 tag shipped with cmd/bd/version.go bumped to 1.0.5 but without
the Docusaurus version snapshot, so check-version-consistency (via
scripts/check-docs-version.sh) went red on main: versions.json and
docusaurus.config.ts lastVersion were still 1.0.4 and
website/versioned_docs/version-1.0.5 was missing.
Create the 1.0.5 docs snapshot to restore consistency:
- docusaurus docs:version 1.0.5 (versions.json + versioned_docs + sidebar)
- set docusaurus.config.ts lastVersion to 1.0.5
- regenerate versioned CLI reference (stamps "Reference for bd v1.0.5")
- regenerate website/static/llms-full.txt
Verified: scripts/check-versions.sh and scripts/check-doc-flags.sh pass.
Refs: mybd-4qku
Agent-Signature: claude-opus-4-8-medium on behalf of matt wilkie