Commit graph

85 commits

Author SHA1 Message Date
Steven Syrek
f0057c7828
ci: install dolt binary on Linux and macOS test runners (#3440)
* ci: install dolt binary on Linux and macOS test runners

Install dolt via the official install.sh on Linux and via Homebrew on
macOS so the main test job can exercise the ~24 test gates that
previously silently skipped on every PR when dolt was absent from PATH.

Matches the installation pattern already used by nightly.yml.
Docker-testcontainer gates (testDoltServerPort == 0 skips) remain
skipped — a known GitHub Actions hang documented in
scripts/repro-dolt-hang/INCIDENT-REPORT.md and nightly.yml:37-41
prevents enabling testcontainers here.

* test: require dolt binary under GITHUB_ACTIONS

Add testutil.RequireDoltBinary: skips when the dolt CLI is absent
locally but fails the test under GITHUB_ACTIONS. Replace bare
exec.LookPath("dolt") skip-gates with the helper so ~24 tests that
previously fell through silently in CI now run — and hard-fail if
the CI workflow ever drops the dolt install step.

tests/regression/regression_test.go uses an inline variant because
its gate lives in TestMain, and internal/remotecache/cache_test.go
duplicates the helper inline to avoid an import cycle
(testutil -> doltutil -> remotecache).
2026-04-24 06:58:40 -07:00
coffeegoddd☕️✨
50f715b124 /{cmd,internal}: move local only state to dolt ignored tables 2026-04-14 14:47:30 -07:00
matt wilkie
66af62221e
fix(ci): drop ICU linkage from test jobs, use -tags gms_pure_go everywhere (#3240)
* fix(ci): drop ICU linkage from Linux/macOS test jobs (bd-sz5, GH#3506)

Align the CI test matrix with how we ship: all Go build/test invocations
now use -tags gms_pure_go, matching the Windows job, goreleaser, and the
install scripts. Remove libicu-dev / icu4c installs and CGO_* env setup
from ubuntu-latest and macos-latest jobs in ci.yml, plus nightly,
migration-test, and cross-version-smoke workflows.

Upstream dolthub/go-mysql-server#3506 confirmed -tags=gms_pure_go is the
sanctioned escape hatch; testing an ICU-linked config nobody installs was
wasting CI minutes and producing spurious duplicate-rpath / malformed
LC_DYSYMTAB linker warnings on macOS.

Update docs/ICU-POLICY.md to reflect that the CI matrix no longer
intentionally omits the tag; scripts/test-cgo.sh remains as the local
developer tool for exercising the ICU code path on demand.

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

* fix(ci): add -tags gms_pure_go to test-helper go build shell-outs (bd-sz5)

Addresses review feedback on 7b36ab653. Several integration tests shell
out to `go build ./cmd/bd` (or `go build .`) from TestMain / t.Helper
setup functions. The outer `go test -tags 'integration gms_pure_go'`
tag does not propagate into these subprocesses, so the inner builds were
still trying to link ICU and failing with
`unicode/uregex.h: No such file or directory` in the nightly workflow.

Repo-wide audit of `exec.Command("go", "build", ...)` test helpers:
- internal/beads/beads_hash_multiclone_test.go (reviewer's cite)
- tests/regression/regression_test.go
- cmd/bd/protocol/helpers_test.go
- cmd/bd/doctor/dolt_e2e_test.go
- cmd/bd/{scripttest,import_prefix,explicit_db_nodb,init_embedded,
  main,init,cli_fast,shared_server_integration,doctor_repair,
  dolt_autostart_lifecycle_integration}_test.go

All 15 call sites now pass `-tags gms_pure_go`. `cmd/bd/preflight.go`
is production code (`bd preflight` user command), not a test helper,
and is intentionally left as-is.

Also narrow docs/ICU-POLICY.md "Common Mistakes" #3 -- libicu-dev is
needed only for local on-demand testing via scripts/test-cgo.sh, not
for CI test workflows (which no longer exercise the ICU path).

Verified: `go test -tags 'integration gms_pure_go' -run '^$' ./...`
passes cleanly from the worktree root (previously failed in
internal/beads).

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

* fix(preflight): add -tags gms_pure_go to test/lint shell-outs (bd-sz5)

preflight is a beads-maintainer pre-PR tool. On dev machines without
ICU dev libraries installed, `bd preflight --check` was failing at the
`go test -short ./...` step with the same `unicode/uregex.h` error we
fixed in nightly CI (bd13871bd).

Apply the gms_pure_go tag consistently:
- runTestCheck: `go test -tags gms_pure_go -short ./...`
- runLintCheck: `golangci-lint run --build-tags=gms_pure_go ./...`
- Update the user-visible Command labels to match
- Update the static checklist printed by `bd preflight` (no --check)
  so copy-pasted commands work on no-ICU machines

Matches the tag golangci-lint is now passed in CI, keeping local and
CI runs consistent.

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-14 10:01:46 -07:00
Fredrik Källström
63c7a2601d
fix: adopt existing project_id when init --database targets shared server (#2925)
When a second user runs bd init --database against an existing remote
Dolt database, adopt the server's _project_id instead of generating a
new one. Prevents PROJECT IDENTITY MISMATCH errors in team workflows.

Fixes #2922
2026-04-02 20:28:49 -07:00
matt wilkie
ca1ae15d02
Fix init leaving beads.role unset in edge cases (GH#2950) (#2964)
Root cause: multiple code paths in bd init could skip setting beads.role:
- BEADS_DIR set → git init skipped → isGitRepo() false → role block skipped
- promptContributorMode() fails → role never set
- Non-interactive without explicit --role → only sets if not already present

Fix: Add safety net at end of init that checks isGitRepo() && !hasRole
and defaults to 'maintainer' (or --role value). This guarantees every
init leaves beads.role configured.

Also:
- Improve routing.go warning to show one-command fix
- Update doctor check fix to use 'git config' directly (simpler)
- Add TestInitNonInteractiveAlwaysSetsRole regression test

Amp-Thread-ID: https://ampcode.com/threads/T-019d4a99-63c8-779f-bb8e-ee8522b61cdf

Co-authored-by: Amp <amp@ampcode.com>
2026-04-01 17:00:41 -07:00
matt wilkie
dbcc2db0a9
[codex] Fix installer ICU/CGO fallback handling (#2965)
* Fix shared-server init mode selection

* Warn on shared-server embedded metadata mismatch

* Fix installer ICU/CGO fallback handling
2026-04-01 16:52:53 -07:00
coffeegoddd☕️✨
44c764e5a3 /{cmd,docs,internal}: more cleanup 2026-03-31 12:33:52 -07:00
coffeegoddd☕️✨
a44d4f9d58 fix(init): replace 'bd onboard' references with 'bd prime' in AGENTS.md (#2902)
bd init creates a complete AGENTS.md but tells users to "Run bd onboard
to get started", which suggests different/conflicting content. Replace
with "Run bd prime" which is the correct entry point for workflow context.

Also migrates the Claude settings prompt from bd onboard to bd prime,
with backward-compatible detection of existing onboard references.

Closes #2902

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-30 10:42:50 -07:00
matt wilkie
f0c35b94bd fix(init): reset git caches after auto-init and skip .beads/dolt/ in embedded mode
Fixes two init-flow friction points:

- #2899: After bd init auto-creates a git repo, the internal/git
  package's sync.Once cache still holds a stale "not a git repository"
  error. Subsequent hook installation calls git.GetRepoRoot() which
  returns the cached error, causing "failed to configure git hooks
  path: not in a git repository". Fix: call git.ResetCaches() after
  successful git init to allow hook installation to see the new repo.

- #2903: bd init unconditionally creates .beads/dolt/ even in embedded
  mode where the actual database lives under .beads/embeddeddolt/.
  The empty directory is a server-mode artifact that confuses users.
  Fix: only create the server storage directory when --server is passed.

Closes #2899
Closes #2903
2026-03-29 14:02:50 -07:00
Osamu Okano
32ed0bb876 Support bare-parent worktree beads fallback 2026-03-15 15:04:43 -07:00
beads/crew/emma
84494b7e1a cleanup: remove daemon infrastructure remnants (GH#2431)
Remove all BEADS_NO_DAEMON env var handling from test files (dead code
since daemon removal in v0.50.0), delete stopRepoDaemon() and daemon
file guards from test setup, remove no-daemon config key from tests,
and update daemon→server wording in docs and comments.

37 files changed, -193 lines net.

Co-Authored-By: davetashner <davetashner@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-10 15:24:27 -07:00
matt wilkie
cd2f5003f7 fix: replace stale bd migrate --to-dolt with bd init --from-jsonl (GH#2333)
Amp-Thread-ID: https://ampcode.com/threads/T-019cce5b-39df-740f-a8e1-5c6b3e389519
Co-authored-by: Amp <amp@ampcode.com>
Amp-Thread-ID: https://ampcode.com/threads/T-019cce5b-39df-740f-a8e1-5c6b3e389519
Co-authored-by: Amp <amp@ampcode.com>
2026-03-08 10:01:32 -07:00
obsidian
89569b914e feat: add --backend flag to bd init with SQLite deprecation notice (bd-7xj5)
Dolt is now the default (and only) storage backend for bd init. Add a
--backend flag that accepts "dolt" (default) or "sqlite" (prints a
deprecation notice with migration instructions and exits). Unknown
backends produce a clear error.

Update QUICKSTART.md and DOLT-BACKEND.md to reflect that SQLite is no
longer supported and Dolt is the sole backend.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 18:33:12 -08:00
Osamu Okano
b21a38e2b8
fix(init): set beads.role=contributor in contributor setup 2026-03-02 20:25:51 +09:00
Tim Visher
04a28487c3 fix(init): skip git/worktree guards when BEADS_DIR is explicitly set
When BEADS_DIR is set via environment variable, bd init now:
- Skips the worktree guard that blocks init from git worktrees
- Skips auto-running git init when not in a git repo
- Skips project .gitignore updates when BEADS_DIR is external to CWD

PersistentPreRun now uses doltserver.DefaultConfig() for port resolution
instead of cfg.GetDoltServerPort() which falls back to 3307. This
ensures standalone BEADS_DIR directories get hash-derived ports matching
what doltserver.Start() and EnsureRunning() use.

Adds a test that creates a real git worktree, sets BEADS_DIR externally,
and verifies init succeeds with the database at BEADS_DIR.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-02-27 01:06:28 -05:00
obsidian
5d9788a3e7 fix: remove stale stderr assertion in TestInitDoltMetadataNoGit
TestInitDoltMetadataNoGit expected a warning about "upstream" or
"repository ID" when running bd init in a non-git directory. However,
bd init intentionally skips the upstream warning for brand-new repos
with no remotes (not noise-worthy), and ComputeRepoID() succeeds even
without remotes. The test still verifies the important behavior: dolt
directory created and no SQLite database created.

TestInitDatabaseFlag already passes (the --database flag exists).

Closes: bd-e0i1

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

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-25 17:00:21 -08:00
darcy
a30e02a5ee feat(init): add --database flag to configure existing server database (#2102)
Add --database flag to bd init so callers can specify a pre-existing server
database name, overriding prefix-based naming. Prevents orphan database creation
when an external tool (e.g. gastown) has already created the database.

Also fixes display bug showing storage path instead of DB name in server mode,
and exports ValidateDatabaseName for use by init validation.

Co-Authored-By: Peter Chanthamynavong <peterkc@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-24 22:26:07 -08:00
onyx
6a21757419 fix(init): use prefix directly as database name instead of beads_ prefix
bd init --prefix was creating databases named beads_<prefix> (e.g.,
beads_sky, beads_gt). Convention should use the rig name directly as
the database name. This aligns with gastown doltserver.go which
already uses just the rig name.

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

Executed-By: beads/polecats/onyx
Rig: beads
Role: polecats
2026-02-24 14:57:01 -08:00
beads/crew/elinor
9dfac4f405 fix: remove JSONL gitignore rules, merge driver, and issues tracking check (bd-9ni.6)
Remove JSONL merge driver from .gitattributes, JSONL artifact patterns
from .gitignore files, deprecated SyncMode constants (git-portable,
belt-and-suspenders), CheckIssuesTracking doctor check, and JSONL lock/
sync_base patterns from GitignoreTemplate and requiredPatterns.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:50:17 -08:00
beads/crew/darcy
b69ae5b208 fix: remove JSONL references from core Go files (bd-9ni.2)
Surgical removal of ~1050 lines of JSONL-related code from core Go files:

- Remove FindJSONLPath/FindJSONLInDir/findMoleculesJSONLInDir functions
- Remove JSONLExport config field and JSONLPath method
- Remove JSONL bootstrap detection and auto-bootstrap logic from main.go
- Remove noDb mode flag and related context plumbing
- Remove JSONL import from post-merge git hook
- Remove CheckIssuesTracking doctor check
- Remove .jsonl.lock and sync_base.jsonl from gitignore template
- Remove findActualJSONLFile version tracking helper
- Remove JSONL config validation from doctor checks
- Update hook descriptions to remove JSONL references
- Update JSONL-specific comments in types.go
- Update tests to match code removals

Compiles clean. All non-pre-existing tests pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:46:49 -08:00
beads/crew/emma
191eed82ad fix(test): skip Dolt-dependent tests when server not available
- Improve skipIfNoDolt to also check testDoltServerPort (handles macOS
  where dolt binary exists but no server is running)
- Change t.Fatalf to t.Skipf for dolt.New() failures in:
  - migrate_dolt_metadata_test.go (setupDoltMigrateWorkspace helper)
  - mol_ready_gated_test.go (setupGatedTestDB helper)
  - mol_test.go (24 inline dolt.New calls across bond/squash tests)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:46:03 -08:00
beads/crew/emma
ef4c85cf9e fix(test): add skipIfNoDolt guard to all init tests that need Dolt
Add skipIfNoDolt helper and apply it to 10 test functions in
init_test.go that call rootCmd.Execute with "init" args or open
Dolt stores directly. Fixes CI failures on all platforms.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:35:47 -08:00
beads/crew/emma
69400752cf fix(test): skip TestInitCommand when dolt not installed
TestInitCommand runs bd init which requires a Dolt server connection.
Add exec.LookPath skip guard so CI passes without Dolt.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 21:27:35 -08:00
gastown/crew/george
1e1568fafa refactor(jsonl): remove JSONL plumbing — Dolt-native only (gt-vemg9q Phase 1)
Delete 21 files and gut JSONL code paths from 13 more, removing ~6,400
lines of JSONL import/export/sync/integrity infrastructure that is
superseded by Dolt git remotes for sync and portability.

Deleted: import.go, export.go, sync_helpers.go, integrity.go, hook.go,
events_export.go, stubs.go, doctor checks (jsonl_integrity, sync_divergence),
and all associated tests. Removed .beads-hooks/ legacy hook templates.

Gutted: hooks.go (now chain-only), sync.go (Dolt push only), repo.go
(Dolt push), restore.go (stubbed for dolt_history_), delete.go, init.go,
rename_prefix.go, doctor.go, doctor_fix.go (removed JSONL registrations).

Phase 2 TODOs remain for: bootstrap clone, restore via dolt_history_,
doctor recovery, create/rename flush, git-portable mode removal.

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

Executed-By: gastown/crew/george
Rig: gastown
Role: crew
2026-02-21 17:49:37 -08:00
beads/crew/wickham
dc5ff705ba perf(tests): replace direct git init with newGitRepo template in init_test.go, consolidate template_test.go (bd-ktng)
init_test.go: 6 direct git init calls → newGitRepo template copies.
template_test.go: 4 DB-using tests merged into TestTemplateSuite (5→2 stores).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-21 15:16:53 -08:00
obsidian
e2f54c7fe4 fix(test): resolve 5 pre-existing test failures and Dolt panic (bd-iqsw6v)
- doctor_test: update version threshold (0.43→0.50) for 10-minor-version check
- hooks_test: read expected shim versions from templates instead of hardcoding v1
- info: add third v0.54.0 changelog entry (macOS netgo tag fix)
- init_test: accept "upstream" warning when bd init creates git repo in non-git dir
- main_test: use t.TempDir() to fix Dolt panic from premature os.RemoveAll cleanup
- completions_test: reset caches to prevent stale worktree state in flaky test

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

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-19 18:52:04 -08:00
beads/crew/emma
ff7244b619 feat: remove JSONL sync-branch pipeline, replace with Dolt-in-Git
Remove 10,955 lines of dead code from the JSONL sync-branch pipeline,
now replaced by native Dolt push/pull via git remotes.

Deleted:
- internal/syncbranch/ (5,720 lines: worktree management, integrity checks)
- cmd/bd/deletion_tracking.go (3-way JSONL merge)
- cmd/bd/snapshot_manager.go (JSONL snapshot tracking)
- cmd/bd/doctor/sync_branch_jsonl.go (JSONL validation)
- cmd/bd/doctor/fix/sync_branch.go (sync branch repair)
- All associated test files

Preserved:
- bd export / bd import (manual tools)
- isGitRepo(), gitHasUpstream() (still have callers)
- Doctor check stubs (return StatusOK N/A)

Added:
- BootstrapFromGitRemote() for Dolt-in-Git bootstrap
- Dolt push in bd sync via store.Push()
- sync.git-remote config key
- HasRemote() on DoltStore

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-18 20:13:55 -08:00
collins
87eab16982 chore: remove 3-way merge engine remnants (bd-aswyy)
Delete merge_driver.go no-op stub, remove attemptAutoMerge,
merge3WayAndPruneDeletions, applyDeletionsFromMerge, isIssueNotFoundError,
CheckMergeDriver doctor check, checkMergeDriverConfig warning, and all
associated tests. Update stale comments referencing 3-way merge. Simplify
import conflict detection to just error and exit.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-18 19:05:16 -08:00
quartz
817efc9363 fix: read Dolt database name from metadata.json in embedded mode (bd-pqn2e)
NewFromConfigWithOptions only read the database name (e.g. beads_test)
from metadata.json when in server mode, causing embedded-mode reopens to
fall back to the default beads database. This meant prefix-specific
config (issue_prefix) was invisible after init.

Also update BEADS_DIR tests to check for dolt directory instead of the
obsolete beads.db SQLite file, and skip BEADS_DB_OverridesBeadsDir
which does not apply to Dolt.

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

Executed-By: beads/polecats/quartz
Rig: beads
Role: polecats
2026-02-16 01:18:40 -08:00
jasper
dc0dc1c8f4 fix: serialize dolt.New() and stdio redirection to eliminate test race conditions (bd-cqjoi)
The Dolt embedded engine's InitStatusVariables() has an internal race
when called concurrently. Add doltNewMutex to serialize store creation
in tests. Also add stdioMutex for captureStdout/captureStderr, move
BEADS_TEST_MODE to TestMain, and replace os.Stderr redirect in
TestSearchCommand_MissingQueryShowsHelp with cobra's SetErr().

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

Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
2026-02-16 01:07:37 -08:00
emma
d6a8462a73 refactor: make bd sync a no-op, fix test suite for Dolt-only backend (bd-h0zvj.4)
- bd sync is now a silent no-op (Dolt persists writes immediately).
  All legacy flags preserved for backward compat since models have
  "bd sync" in muscle memory from the JSONL era.

- Fix Dolt lock contention in routing tests: reuse existing store
  instead of opening same DB path twice (embedded Dolt MaxOpenConns=1).

- Skip two routing tests that do write-after-write via routed stores
  (hangs due to embedded Dolt single-connection limit).

- Fix init test: don't reopen DB for verification (embedded Dolt
  Close() can timeout leaving file locks held). Init's internal logic
  already verifies writes succeed.

- Fix init command: add defer store.Close() to prevent leaked Dolt
  stores after bd init completes.

- Update test paths from beads.db to dolt/ throughout.
- Fix openExistingTestDB to work with Dolt stores.
- Reset doltAutoCommit in tips tests to prevent interference.
- Skip removed features (BEADS_DB env, no-db mode).

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 20:23:01 -08:00
beads/crew/emma
dd01a655b9 fix: repair test suite for Dolt-only backend (bd-h0zvj.4)
Fix pre-existing test failures from Dolt-Native Pruning phases 1-8.
All internal/* packages and cmd/bd/doctor now pass. Remaining 19
failures in cmd/bd are routing (9), init path checks (7), and tips (3).

Key fixes:
- Remove type assertions on concrete *dolt.DoltStore (not an interface)
- Fix DATETIME timezone bug: normalize timestamps to UTC before storage
- Replace SQLite datetime() syntax with MySQL DATE_SUB() in stale tests
- Remove --backend flag from init test invocations (flag removed)
- Update doctor tests for Dolt-only backend behavior
- Skip/remove tests for removed features (CompactableStorage,
  FederatedStorage, ExportToMultiRepo, merge driver, no-db mode)
- Add issue_prefix config in test stores that create issues
- Fix export_hashes → interactions table reference in schema test

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 18:17:16 -08:00
beads/crew/emma
a5da57e39b refactor: remove storage factory, memory backend, and provider abstraction (Phase 7)
Strip out the multi-backend storage layer: factory pattern, memory/in-memory
provider, connection string parsing, local provider, and associated tests.
Inline Dolt as the sole storage backend. Part of Dolt-Native Beads v2 epic.

WIP - SQLite removal in progress, more cleanup phases to follow.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 11:27:39 -08:00
beads/crew/emma
a3bf3ee381 refactor: remove SQLite backend (Phase 6)
Delete internal/storage/sqlite/ entirely (131 files, ~40K LOC). Update
factory to route all backends through Dolt registry. Rewrite SQLite
migration reader with raw database/sql. Remove to-SQLite escape hatch.
Update all production and test code to use Dolt or memory stores.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-15 10:57:05 -08:00
beads/crew/emma
5102512917 refactor: remove 3-way merge engine (Phase 3)
Delete internal/merge/ (3,958 LOC), cmd/bd/merge.go, cmd/bd/resolve_conflicts.go
and all related tests. Stub callers: deletion_tracking returns no-op,
git/worktree uses local-wins, syncbranch/worktree uses remote-wins.
Make mergeDriverInstalled/installMergeDriver no-ops. Update 11 test files.

Dolt handles sync natively, eliminating the need for JSONL-level 3-way merge.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-14 20:31:29 -08:00
Peter Chanthamynavong
f7311e9136
fix: reliable metadata writes for Dolt backend (bd_version, repo_id, clone_id) (#1741)
* fix(init): add belt-and-suspenders metadata verification for Dolt backend

bd init --backend dolt silently swallowed metadata write failures for
bd_version, repo_id, and clone_id. Doctor and daemon then failed with
confusing errors about missing metadata.

Add verifyMetadata() helper that writes each field then reads it back,
emitting a specific warning with "bd doctor --fix" guidance on failure.
Init continues (non-fatal) but failures are now visible and actionable.

- Add verifyMetadata() write+verify helper to init.go
- Replace Pattern B (warn-and-swallow) with belt-and-suspenders pattern
- Handle non-git environments gracefully (skip repo_id with warning)
- Add function-level tests for all 3 fields, failure paths, and edge cases
- Add e2e test for init→doctor roundtrip validation

Refs: steveyegge/beads#1725

* fix(doctor): add FixMissingMetadata for Dolt databases and update fix messages

Add doctor --fix metadata remediation for existing Dolt databases missing
bd_version, repo_id, or clone_id. Wire into both Database and Repo Fingerprint
doctor check cases. Update fix messages to suggest 'bd doctor --fix' instead
of 'bd migrate'.

* fix(migrate): set repo_id and clone_id when version is current

Problem:
- Migration skipped repo_id and clone_id when bd_version matched
- Missing identity fields left Dolt metadata incomplete

Solution:
- Extend Dolt metadata migration to set repo_id and clone_id
- Cover migration paths with unit and e2e tests

Impact:
- Repositories keep identity fields even when version is current
- Metadata migration behaves consistently across scenarios

* fix(init): remove unused quiet parameter from verifyMetadata

golangci-lint flagged the quiet parameter as unused (unparam). The
function always prints warnings on failure, and callers already gate
success messages externally. Metadata write warnings should always
be visible regardless of quiet mode.
2026-02-14 14:50:31 -08:00
mayor
32e3e832eb fix(ci): remove dead RPC test code and fix CI failures for v0.50.0
- Delete integration_test_stubs_test.go which imported removed internal/rpc
  package, causing goreleaser's `go mod tidy` to fail
- Delete periodic_remote_sync_test.go which tested removed daemon functionality
- Fix Windows smoke test: use --backend sqlite and temp dir to avoid Dolt
  dependency and conflict with repo's existing .beads/
- Add fmt.Fprintf/Fprintln to errcheck exclusions (standard for CLI help output)
- Add gosec exclusions for doctor/dolt.go (G104) and doctor/sync_branch_jsonl.go (G304)
- Apply gofmt to 3 files (init_test.go, main.go, sync_git_remote_test.go)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:20:43 -08:00
mayor
349a57e5fa chore: bump version to 0.50.0
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:08:19 -08:00
gastown/crew/mel
f55b562e84 fix(test): remove t.Parallel() from graph tests that capture os.Stdout
The 6 tests using captureGraphOutput race on the global os.Stdout
when run in parallel, causing one test to capture another's output.

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

Executed-By: gastown/crew/mel
Rig: gastown
Role: crew
2026-02-14 14:05:04 -08:00
mayor
3db9d8de2b feat: change default backend from SQLite to Dolt for new projects
bd init now defaults to Dolt backend for new project initializations.
Existing projects with no explicit backend in metadata.json continue
to use SQLite (backward compatible). BEADS_DB env var auto-detects
SQLite since it always points to a .db file.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-14 14:00:59 -08:00
beads/crew/emma
e8edba13e4 revert: restore SQLite backend and JSONL sync layer (premature dolt-test-woho transition)
The Dolt transition epic (dolt-test-woho) was executed on Feb 10, 11 days
before Phase 2 planned date of ~Feb 21, and before the upstream blocker
(dolt-test-djfr: Dolt-in-Git lands upstream) was resolved.

This reverts the premature removal of SQLite backend (42K+ lines) and JSONL
sync layer (9K+ lines) while preserving all non-transition changes merged
since the transition (PRs #1655, #1660, #1670, #1675, #1680, #1684, #1689).

Restored:
- internal/storage/sqlite/ (131 files, full SQLite storage backend)
- internal/importer/ (7 files, JSONL import engine)
- internal/storage/dolt/dirty.go (dirty tracking for Dolt)
- cmd/bd/autoflush.go, autoimport.go, export.go (JSONL sync layer)
- Storage interface dirty tracking methods
- Factory defaults to SQLite (Dolt available via registry)
- Test helpers create SQLite stores instead of Dolt

Removed transition-only files:
- cmd/bd/config_local.go, import_engine.go, jsonl_bootstrap.go, jsonl_path.go

Applied PR #1680 retry logic to restored internal/importer/importer.go.

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-11 15:19:16 -08:00
collins
237f47ba7e feat: delete SQLite storage backend (Phase 2 of Dolt transition)
Remove the entire internal/storage/sqlite/ package (~43K lines) and update
all 80+ files that imported it to use either the Dolt backend directly
(test files) or the storage factory (production files).

Key changes:
- Delete internal/storage/sqlite/ directory (150+ files)
- Update factory to make Dolt the sole backend, treating "sqlite" as alias for "dolt"
- Replace sqlite.New() calls with dolt.New() in tests, factory.New() in production
- Replace *sqlite.SQLiteStorage with storage.Storage interface throughout
- Replace :memory: SQLite URIs with t.TempDir() for Dolt compatibility
- Inline sqlite.GenerateIssueID() as SHA-256 content hashing where needed
- Fix import cycle in routing/routes.go (routing→factory→dolt→routing)
- Preserve backward-compatible beads.NewSQLiteStorage() wrapper in public API

228 files changed, 605 insertions, 43,821 deletions.
go vet ./... passes clean.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 12:23:15 -08:00
darcy
4480faf737 fix: remove/fix 14 broken tests after JSONL/daemon deletion (-2,782 lines)
Tests were calling stubbed JSONL functions (writeJSONLAtomic, autoImportIfNewer,
validateJSONLIntegrity, etc.) that now return nil/empty after the JSONL sync
removal. Also fixes: --no-daemon flag re-registered as hidden no-op for backward
compat, getProjectRoot uses runtime.Caller to avoid CWD sensitivity, removed
--no-daemon from init test args, added v0.49.6 changelog entries.

Deleted: direct_mode_test.go, jsonl_integrity_test.go, jsonl_lock_test.go,
rename_prefix_jsonl_update_test.go. Trimmed: main_test.go, nodb_test.go,
show_watch_test.go, staleness_test.go.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 12:10:35 -08:00
beads/crew/elinor
d6690dc898 perf(tests): speed up cmd/bd test suite from ~158s to ~50s (bd-1rh)
Consolidate show_test.go to build bd binary once instead of 3 times.
Group 12 init_test.go tests into 3 parent functions (sync-branch,
BEADS_DIR, redirect) sharing setup helpers. Add t.Parallel() to 38
test functions across 8 files that use isolated temp dirs and no
shared global state.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 18:12:48 -08:00
beads/crew/jane
5d813290a1 fix(tests): extract initConfigForTest helper to prevent config state pollution
Tests using config.Initialize() pick up the real .beads/config.yaml
(e.g., sync.mode=dolt-native) which leaks into JSONL export tests.
Extract initConfigForTest(t) with t.Cleanup(config.ResetForTesting)
to isolate test config state. Also fix Result -> BatchResult type
rename in compactor_unit_test.go.

Fixes 17 pre-existing test failures caused by config bleed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 16:31:32 -08:00
beads/crew/emma
761d2e7637 Merge pull request #1186 from peterkc/feature/contributor-prompt-recovery
feat(init): add contributor prompt and push-fail recovery

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-01-29 20:05:53 -08:00
Peter Chanthamynavong
b7d650bd8e
fix(init): respect BEADS_DIR environment variable (#1273)
* fix(sync): read sync.mode from yaml first, then database

bd config set sync.mode writes to config.yaml (because sync.* is a
yaml-only prefix), but GetSyncMode() only read from the database.

This caused dolt-native mode to be ignored - JSONL export still
happened because the database had no sync.mode value.

Now GetSyncMode() checks config.yaml first (via config.GetSyncMode()),
falling back to database for backward compatibility.

Fixes: oss-5ca279

* fix(init): respect BEADS_DIR environment variable

Problem:
- `bd init` ignored BEADS_DIR when checking for existing data
- `bd init` created database at CWD/.beads instead of BEADS_DIR
- Contributor wizard used ~/.beads-planning as default, ignoring BEADS_DIR

Solution:
- Add BEADS_DIR check in checkExistingBeadsData() (matches FindBeadsDir pattern)
- Compute beadsDirForInit early, before initDBPath determination
- Use BEADS_DIR as default in contributor wizard when set
- Preserve precedence: --db > BEADS_DB > BEADS_DIR > default

Impact:
- Users with BEADS_DIR set now get consistent behavior across all bd commands
- ACF-style fork tracking (external .beads directory) now works correctly

Fixes: steveyegge/beads#???

* fix(doctor): respect BEADS_DIR environment variable

Also updates documentation to reflect BEADS_DIR support in init and doctor.

Changes:
- doctor.go: Check BEADS_DIR before falling back to CWD
- doctor_test.go: Add tests for BEADS_DIR path resolution
- WORKTREES.md: Document simplified BEADS_DIR+init workflow
- CONTRIBUTOR_NAMESPACE_ISOLATION.md: Note init/doctor BEADS_DIR support

* test(init): add BEADS_DB > BEADS_DIR precedence test

Verifies that BEADS_DB env var takes precedence over BEADS_DIR
when both are set, ensuring the documented precedence order:
--db > BEADS_DB > BEADS_DIR > default

* chore: fill in GH#1277 placeholder in sync_mode comment
2026-01-24 17:10:05 -08:00
Peter Chanthamynavong
d5a8e0f236
feat(init): add interactive contributor role prompt
- Implement interactive prompt for contributor roles
- Persist role selection in local git configuration
- Add unit tests for prompting logic and config storage

Ensures project contributors are correctly configured from the start.
2026-01-20 20:53:00 -08:00
joshuavial
cf6356b98a fix(init): error when redirect target already has database
When running `bd init` from a directory with a .beads/redirect file
pointing to a canonical .beads/ that already has a database, init
now errors instead of silently overwriting the existing database.

This prevents accidental data loss when:
- A project uses redirect to share a canonical database
- Someone runs `bd init` from the redirected location
- The canonical database was already initialized

The error message clearly explains:
- What happened (redirect target already has database)
- Where the redirect points to
- How to use the existing database (just run bd commands normally)
- How to reinitialize if needed (rm the database first)

Adds test: TestInitWithRedirectToExistingDatabase

Part of GH#bd-0qel

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 20:03:28 -08:00
joshuavial
d41fb30720 fix(redirect): follow redirect when creating database (GH#bd-0qel)
When bd runs with --no-daemon or during init in a directory that has a
.beads/redirect file, it now correctly follows the redirect to create
the database in the target location instead of locally.

The bug occurred because:
1. init.go hardcoded .beads/beads.db without checking for redirects
2. main.go's fallback path for auto-bootstrap also used local .beads

Both code paths now call beads.FollowRedirect() to resolve the correct
.beads directory before constructing the database path.

Added TestInitWithRedirect to verify the fix.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-20 20:02:56 -08:00