Commit graph

40 commits

Author SHA1 Message Date
sms
7d4bf5a0f0 fix(makefile): use /dev/null instead of nul to silence stderr on windows
The Windows-detection block at Makefile:6 used cmd.exe's `2>nul`
convention to silence stderr from `where git`. But GNU Make's
$(shell ...) on Windows + Git Bash uses /bin/sh (MSYS bash) as its
subshell, where `nul` is NOT a special device — it's treated as a
literal file path. So every `make <target>` invocation evaluated this
line, ran the subshell, and created a zero-byte file named `nul` in
the project root.

Switch to `2>/dev/null`:
  - MSYS bash / git bash (the affected env): /dev/null is the bit
    bucket. No file created.
  - Pure cmd.exe make (rare; mostly hypothetical for this project
    since git bash is required for the next line's SHELL switch):
    /dev/null is not recognized as a special path; the redirect
    attempts to write to <cwd>/dev/null. <cwd>/dev/ doesn't exist,
    redirect fails harmlessly, stderr leaks to terminal. No file
    created either way — strictly better than the prior behavior.

Verified empirically: pre-fix, nul mtime updated on every `make`
invocation; post-fix, mtime stays static and GIT_BASH still resolves
to git's path correctly.

Fixes #3513
2026-04-25 22:38:31 -04:00
matt wilkie
ecd2f7268c fix packaging and windows install regressions
Fixes #3388
Fixes #3399
Fixes #3404
Fixes #3454

Co-authored-by: jasononeil <315158+jasononeil@users.noreply.github.com>
Co-authored-by: seanmartinsmith <114885497+seanmartinsmith@users.noreply.github.com>
2026-04-24 11:48:39 -07:00
matt wilkie
2ade22e84c
chore(build): codify the gms_pure_go build-tag policy (GH#3303)
Converges the sprinkle of -tags=gms_pure_go fixes into a single source plus a source-time CI guard. .buildflags is now canonical (exports GOFLAGS, CGO_ENABLED), scripts source it, scripts/check-build-tags.sh runs in CI to catch bare go commands. Fixes 5 latent bugs the guard caught (regression.yml, Makefile bench/test-regression, devcontainer, embedded-test-shard fallback, smoke-test scripts).
2026-04-16 12:28:11 -07:00
matt wilkie
df25aa9229
Rename ICU-only test path to explicit opt-in workflow (bd-b18) (#3291) 2026-04-16 08:54:24 -07:00
matt wilkie
a61911f65b merge: resolve conflicts with main for PR #3146
- cross-version-smoke.yml: keep PR's matrix/PR-gate design over main's simpler version
- Makefile: incorporate main's test-cross-version and test-migration targets
- upgrade-smoke-test.sh: keep PR's Scenario 5 (mutation), SMOKE_VERSIONS multi-version mode, and gastownhall URL fix

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-04-10 11:30:03 -07:00
matt wilkie
7916e029bc
fix: remove ICU runtime dependency from release binaries (#3066)
The gms_pure_go build tag already tells go-mysql-server to use Go's
stdlib regex instead of ICU-backed go-icu-regex. However, .buildflags
and the Makefile were unconditionally injecting ICU linker flags
(including -licui18n -licuuc -licudata on Linux), which re-introduced
the ICU shared-library dependency at link time.

This caused release binaries to require a specific ICU version
(e.g., libicui18n.so.74), making them non-portable across Linux distros
with different ICU versions.

Changes:
- .buildflags: Remove ICU flag injection; only export CGO_ENABLED=1
- Makefile: Replace ICU4C detection block with BUILD_TAGS := gms_pure_go;
  use the tag for all platforms (not just Windows)
- scripts/verify-cgo.sh: Add readelf check to fail if ICU shared-library
  dependency is present in ELF binaries
- scripts/install.sh: Add -tags gms_pure_go to build_from_source()

CGO remains enabled for embedded Dolt support. Only the ICU regex
backend is swapped for Go's stdlib regex, which is sufficient since
bd does not use SQL REGEXP functions.

Amp-Thread-ID: https://ampcode.com/threads/T-019d6450-7b10-77ee-b3d0-58e9474e61da

Co-authored-by: Amp <amp@ampcode.com>
2026-04-07 09:48:44 -07:00
matt wilkie
e4fca03f6b
feat: add migration test harness for cross-era upgrade fidelity (#3067)
* wip: add migration test harness for cross-era upgrade fidelity

Rich dataset generator, field-level fidelity checker, and migration
recipes for SQLite/Dolt-server/embedded-Dolt eras. Addresses GH#2938
upgrade pain by testing and documenting working upgrade paths.

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

* fix: snapshot JSON format handling and self-test mode

- show --json returns array, not object — use jq array concatenation
- Field is issue_type not type in bd JSON output
- Normalize empty comment_count to 0 (show vs list field differences)
- Add --self-test flag for harness validation without old binaries
- Fix local variable outside function in self-test block

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

* ci: re-trigger Kilo Code Review

* address review: timeouts, env var docs, quoting

- Add BD_OP_TIMEOUT (30s) for bd operations via timeout(1)
- Add DOWNLOAD_TIMEOUT (60s) for curl binary downloads
- Document all environment variables in run.sh header
- Convert init_flags from word-split string to proper bash array

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

* fix: fall back to source build when release binary has missing shared libs

Downloaded release binaries dynamically link ICU (libicui18n.so.74),
which isn't available on all systems. Now download_binary verifies the
binary actually runs, and falls back to building from source with
gms_pure_go tag when it doesn't. Also applies gms_pure_go to
build_candidate for consistency.

Ref: gastownhall/beads#3065

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

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 14:30:35 -07:00
Dmitry Verkhoturov
48f611ab65
add cross-version smoke test for upgrade compatibility (GH#2968)
Tests that data created with old bd versions (epic, issues, dependencies)
is readable after upgrading to the candidate binary. Covers the last 30
release tags by default, with --from flag for broader sweeps.
2026-04-04 15:23:24 +00:00
matt wilkie
8e9120fad5 Add release stability gate for upgrade safety (GH#2951) (#2963)
- Add docs/RELEASE-STABILITY-GATE.md defining the upgrade matrix,
  verification criteria, and sign-off process
- Add scripts/upgrade-smoke-test.sh that tests data preservation,
  mode preservation, role preservation, and doctor health across
  upgrade scenarios (embedded maintainer, contributor, mode flip)
- Add 'make test-upgrade' target
- Update RELEASING.md checklist with upgrade smoke tests, regression
  tests, and breaking-change documentation requirements
- Links to #2764, #2765, #2949, #2950 for related test gap work

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

Co-authored-by: Amp <amp@ampcode.com>
2026-04-01 17:21:17 -07:00
matt wilkie
9d7882c049
Add release stability gate for upgrade safety (GH#2951) (#2963)
- Add docs/RELEASE-STABILITY-GATE.md defining the upgrade matrix,
  verification criteria, and sign-off process
- Add scripts/upgrade-smoke-test.sh that tests data preservation,
  mode preservation, role preservation, and doctor health across
  upgrade scenarios (embedded maintainer, contributor, mode flip)
- Add 'make test-upgrade' target
- Update RELEASING.md checklist with upgrade smoke tests, regression
  tests, and breaking-change documentation requirements
- Links to #2764, #2765, #2949, #2950 for related test gap work

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:25 -07:00
Amp
a333dcaa75 fix(docs): purge stale bd sync/import/--branch refs + add CI doc validation (GH#2522)
Systematic cleanup of stale documentation references left over from the
Dolt migration:

- Replace all 'bd sync' → 'bd dolt push' / 'bd dolt pull' across 40+ files
- Replace all 'bd import' → 'bd init --from-jsonl' or remove
- Replace 'bd init --branch' → note about refs/dolt/data separation
- Fix AGENT_INSTRUCTIONS.md (highest impact: agents read this directly)
- Fix npm-package, claude-plugin, integrations, examples, website docs

Add scripts/check-doc-flags.sh to catch stale doc references:
- Checks for removed commands (bd sync, bd import)
- Checks for removed flags (bd init --branch)
- Warns on legacy SQLite/beads.db references
- Compares CLI_REFERENCE.md against bd help --all

Add CI job (check-doc-flags) and Makefile target (check-docs) to gate
PRs against doc freshness.

Prior art: feat/help-doc-generator branch has bd help --doc/--list for
generating docs FROM CLI output. This script validates docs AGAINST CLI
output — complementary approaches.

Amp-Thread-ID: https://ampcode.com/threads/T-019cde77-0722-7353-b63a-1779a5773ca6
Co-authored-by: Amp <amp@ampcode.com>
2026-03-11 13:25:40 -07:00
beads/crew/wickham
20f2d190df feat: add gofmt + golangci-lint pre-commit hook (GH#2179)
Add .githooks/pre-commit that auto-formats staged Go files with gofmt
and runs golangci-lint --new-from-rev=HEAD --fix to catch lint issues
before they reach CI. The hook is auto-installed when running make install.

Closes #2179

Co-Authored-By: miteshashar <miteshashar@users.noreply.github.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-02 13:58:56 -08:00
mayor
ed5c02c375 fix: make install works on tag checkouts
Skip the up-to-date check when HEAD is detached (tag checkout or CI).
git symbolic-ref HEAD fails on detached HEAD, so we exit 0 early.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-01 22:30:43 -08:00
matt wilkie
32504ad38a fix: Makefile build and install fail on Windows when Make uses cmd.exe
GNU Make on Windows falls back to cmd.exe when sh.exe is not in PATH. cmd.exe does not support POSIX shell syntax (dollar-paren substitution, [ -n ] tests, etc.) used throughout the Makefile recipes.

Fixes: - Set SHELL to Git for Windows bash so all recipes use POSIX shell - Compute git hash via Make shell function (GIT_BUILD variable) for ldflags - Use USERPROFILE instead of HOME for INSTALL_DIR on Windows - Add install-force target to skip origin/main update check
Amp-Thread-ID: https://ampcode.com/threads/T-019ca03e-6b88-71b9-b86c-137df23f15b1
Co-authored-by: Amp <amp@ampcode.com>
2026-02-27 11:47:54 -07:00
Joseph Turian
f456a2667c
test(regression): Dolt migration regression discovery (long-lived branch) (#1906)
* feat(test): differential regression suite (v0.49.6 baseline)

Adds 53 regression test scenarios comparing current bd behavior against
v0.49.6 SQLite baseline. Tests run identical CLI scenarios against both
binaries in isolated workspaces, capture JSONL snapshots via bd export,
normalize volatile fields, and fail on any unexpected difference.

44 PASS, 9 SKIP (documenting known regressions/intentional changes), 0 FAIL.

Build-tagged `//go:build regression` so it never runs in normal `go test`.
Run with: `go test -tags=regression -timeout=10m -v ./tests/regression/...`

* test(regression): add 17 scenarios targeting recent open bugs

New scenarios covering subtle bugs found by surveying GH issues since v0.50:

Epic lifecycle (GH#1495):
- TestEpicAllChildrenClosedNotBlocked: epic with all children closed
  should not show as BLOCKED with "0 dependencies"
- TestBlockedEpicChildrenNotReady: children of blocked epic should not
  appear in bd ready

Dependency semantics (GH#1524, GH#1858):
- TestCloseGuardNonBlocksDepTypes: close guard should not reject close
  for non-blocks dep types (caused-by, validates, tracks)
- TestListResolvedBlockerAnnotation: bd list should not show "blocked by"
  after blocker is closed

CLI surface coverage (GH#1840, GH#1954):
- TestListAllOverridesLimitWithLabel: --all should override limit of 50
  when combined with --label filter
- TestDepTreeOutput: bd dep tree should show full parent-child hierarchy
- TestChildrenCommand: bd children parity between backends
- TestBlockedCommandParity: bd blocked --json agreement
- TestCountCommandParity: bd count agreement
- TestStaleCommandParity: bd stale agreement
- TestQueryDSLParity: bd query DSL returns same results

Data integrity (GH#1914, GH#1926, GH#1927, GH#1969, GH#1973):
- TestShowJSONFieldCompleteness: bd show --json includes all fields from
  baseline (catches scan projection drift)
- TestExportImportEpicTree: multi-level epic tree export → import round-trip
- TestRapidLabelAddRemoveStability: rapid label churn not silently rolled back
- TestRapidDepAddRemoveStability: rapid dep churn consistency
- TestRapidCommentAddStability: 10 rapid comments all survive
- TestLargeExportImportRoundTrip: 20 issues with deps/labels/comments
  round-trip at scale

* test(regression): add bug discovery tests and 14 confirmed bug reports

Systematic manual testing against current main (Dolt server mode) found
14 bugs and confirmed 23 protocol invariants. All tests require a running
Dolt server on :3307 and use unique prefixes for test isolation.

Bug reproduction tests (10 FAIL = confirmed bugs):
- BUG-2: dep tree shows no children (ParentID never set)
- BUG-3: dep tree shows [READY] on blocked root
- BUG-4: list --status blocked returns empty
- BUG-7: dep add silently overwrites dep type
- BUG-8: reparented child appears under both parents
- BUG-10: close guard / claim exit 0 on soft failure
- BUG-11: update --status accepts arbitrary values
- BUG-12: update --title "" stores empty title
- BUG-13: reopen of closed+deferred creates limbo state
- BUG-14: empty string label accepted

Protocol invariant tests (23 PASS):
Close guard, epic lifecycle, delete cleanup, reopen preservation,
transitive blocking, cycle detection, force close, defer/undefer,
claim semantics, notes, supersede, duplicate, count grouping,
special chars, SQL injection safety, dep remove, self-dep prevention,
status/type/due-date round-trips, label/comment round-trips.

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

* docs(regression): add audit verdicts and session log to DISCOVERY.md

Triage all 14 bugs: 5-6 clear fix PRs, 2 need design discussion,
5-6 wontfix/by-design. Add session log to avoid redoing work.

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

* docs(regression): revised audit, protocol test classifications, prior art

- Updated bug verdicts based on code review: BUG-4 upgraded to DOCS FIX,
  BUG-5 upgraded to INVESTIGATE (INSERT IGNORE is correct but concurrent
  Dolt working-set commits may race), BUG-7 downgraded to FILE ISSUE
  (upsert is intentionally coded, needs product decision)
- Tagged all 32 protocol test ideas as DATA INTEGRITY, POLICY/UX, or
  MESSAGE CONTRACT to distinguish hard invariants from policy decisions
- Added "Prior Art" section documenting key Dolt migration fixes already
  merged (PRs #1797, #1816, #1909, #1914, #1966-1969, #1948) and
  Dolt-specific constraints learned from them

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

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-22 15:18:56 -08:00
emma
85ba9bd49f cleanup: remove stale sqlite refs, fix lint warnings, update Makefile benchmarks
- Remove .golangci.yml rule for deleted internal/storage/sqlite/ files
- Update Makefile bench/bench-quick targets from sqlite to dolt backend
- Remove stale SQLite-only CGO comment in Makefile
- Update copilot-instructions.md: storage is now Dolt, not SQLite
- Update AGENT_INSTRUCTIONS.md: remove sqlite/ from directory layout
- Fix unparam lint: performContentMerge error return was always nil
- Fix gosec G204: annotate readFromGitRef exec.Command as safe

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-16 00:49:18 -08:00
maphew
87828cfb94 fix: support Linuxbrew ICU paths in Makefile
The ICU detection was macOS-only (Darwin check), but Linux users
with Homebrew/Linuxbrew have icu4c installed in the same keg-only
layout. This broadens the check to all non-Windows platforms.

Also sets CXX=g++ on Linux since Linuxbrew's gcc formula doesn't
create a 'c++' symlink that CGO expects.

Tested on Fedora Bluefin (rpm-ostree) with Linuxbrew icu4c@78.

Amp-Thread-ID: https://ampcode.com/threads/T-019c4cec-a601-7027-93bf-396eb21591bc
Co-authored-by: Amp <amp@ampcode.com>
2026-02-11 06:47:38 -07:00
beads/crew/lydia
f62065e847 fix: Makefile sets GOTOOLCHAIN to match go.mod version
When the locally installed Go (e.g. 1.25.5) is older than go.mod requires
(e.g. 1.25.6), GOTOOLCHAIN=auto downloads the right compiler but coverage
instrumentation still uses the local compile tool, causing version mismatch
errors. Force GOTOOLCHAIN from go.mod so all tools use the same version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-10 20:10:10 -08:00
Steve Yegge
c3cf76d0da
Merge pull request #1660 from davidahmann/codex/issue-1466-detect-stale-hooks
doctor: detect stale bd hook versions + standardize CGO test workflow
2026-02-10 12:24:38 -08:00
Matt Wilkie
5f2b767f5a fix: windows build recipe - move BINARY conditional inside targets
- Move global BINARY conditional into build/install targets where it works
- Hardcode bd.exe/bd in each target for clarity and correctness
- Fix Makefile parse error on Windows (BINARY not resolved in global scope)
- Update clean target to remove bd.exe
- Ensure install target works correctly on Windows with .exe extension

Amp-Thread-ID: https://ampcode.com/threads/T-019c4871-c0f1-7735-823a-e94bccb01e6c
Co-authored-by: Amp <amp@ampcode.com>
2026-02-10 09:51:33 -07:00
David Ahmann
10edfa9894 docs+tooling: standardize CGO test workflow and ICU setup 2026-02-10 10:56:12 -05:00
jasper
8202e55ac3 fix: remove unnecessary ICU dependency from Windows CI build (dolt-test-h7bp)
Windows builds do not require ICU libraries:
- go-mysql-server uses pure-Go regex via gms_pure_go build tag
- go-icu-regex has a Windows-specific pure-Go implementation (regex_windows.go)
- The only CGO deps on Windows are runtime/cgo and gozstd (bundled C source)

Changes:
- CI: Remove MSYS2/ICU setup, build with CGO_ENABLED=0 -tags gms_pure_go
- Makefile: Add Windows-specific comments clarifying ICU is not needed
- docs/INSTALLING.md: Clarify Windows build instructions and ICU requirements

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

Executed-By: beads/polecats/jasper
Rig: beads
Role: polecats
2026-02-07 22:47:08 -08:00
beads/crew/emma
2137693dad revert: restore embedded Dolt mode (was only supposed to be removed from Gas Town)
Revert commits e5330641 and 0df41523 which removed embedded Dolt mode
from the beads codebase. The embedded Dolt removal was only intended for
Gas Town, not for Beads.

Restores:
- dolthub/driver dependency and embedded connection path
- Advisory flock (AccessLock) for concurrent process protection
- Embedded connector lifecycle management in DoltStore
- All CGO build tags across ~45 files
- Vendored go-icu-regex library
- nocgo stub files for non-CGO builds
- Bootstrap and embedded_uow helpers
- factory_dolt_test.go and dolt_singleprocess_test.go

Merge conflict resolutions:
- store.go: TCP fail-fast check wrapped inside if cfg.ServerMode
- store.go: backtick-quoting for embedded CREATE DATABASE (prefix-based names)
- perf_dolt.go: port references updated from 3306 to 3307
- ci.yml: restored continue-on-error for Nix (dolthub/driver requires Go 1.25.6+)

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-07 21:21:24 -08:00
beads/crew/emma
0df415230f chore: clean up orphaned embedded Dolt references
Remove dead -tags gms_pure_go from Windows cross-compile, remove //go:build
cgo constraint from benchmarks, and remove CGO/ICU build dependencies from
INSTALLING.md that no longer apply after embedded Dolt driver removal.

Resolves merge conflicts from PR #1579 and applies changes to main.

Co-authored-by: turian <turian@users.noreply.github.com>

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-07 20:14:06 -08:00
beads/crew/lizzy
e54adddbb0 chore: add gofmt check to Makefile and CI pipeline (bd-nmk12)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-07 19:35:14 -08:00
matt wilkie
17e54c59a0 Enable Dolt on Windows via gms_pure_go build tag
- Add pure_go_windows.go with build constraint to auto-enable gms_pure_go tag
- Update Makefile to use -tags gms_pure_go on Windows builds
- Update INSTALLING.md to document Windows Dolt support via pure-Go regex

Uses upstream go-mysql-server's gms_pure_go build tag instead of vendoring.
This avoids ICU/CGO dependencies while keeping full functionality.

Fixes #1497

Amp-Thread-ID: https://ampcode.com/threads/T-019c3339-57d9-75b9-8d86-d5a79d77b9c6
Co-authored-by: Amp <amp@ampcode.com>
2026-02-06 15:32:14 -07:00
obsidian
e533064122 feat: remove embedded Dolt mode, keep server-only connections (bd-esqfe)
Remove the embedded Dolt driver (dolthub/driver) and all associated code,
keeping only server-mode connections via MySQL protocol to dolt sql-server.

Key changes:
- Remove dolthub/driver dependency and go-icu-regex vendored dep
- Remove embedded connection path, access locks, bootstrap, nocgo stubs
- Remove CGO build tags from all ~40 files
- Remove CGO/ICU settings from Makefile and scripts/test.sh
- Simplify configfile: Dolt is always server mode now
- Update doctor checks, factory, daemon guard for server-only
- Binary size reduced from ~120MB to ~44MB

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

Executed-By: beads/polecats/obsidian
Rig: beads
Role: polecats
2026-02-05 21:30:53 -08:00
gastown/crew/mel
8b24c125c0 feat(make): check repo is up-to-date before install
Prevents installing outdated bd binaries by checking HEAD against
origin/main before building. Use SKIP_UPDATE_CHECK=1 to override.

Closes bd-h0j0u

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

Executed-By: gastown/crew/mel
Rig: gastown
Role: crew
2026-02-05 10:08:54 -08:00
Steve Yegge
ffe728dedf
Merge pull request #1489 from paf0186/feat/beads-alias
feat: add 'beads' alias for bd command during installation
2026-02-05 08:43:55 -08:00
emma
d5d89d0921 docs: update Makefile CGO settings and DOLT.md env vars
- Makefile: Explicitly set CGO_ENABLED=1 for Dolt backend support
- DOLT.md: Update environment variable documentation to reflect
  current server mode settings (BEADS_DOLT_* vars)

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

Executed-By: beads/crew/emma
Rig: beads
Role: crew
2026-02-05 08:12:38 -08:00
Patrick Farrell
51dc5ffed6 feat: add 'beads' alias for bd command during installation
Add a 'beads' symlink/alias that points to the 'bd' binary across all
installation methods, allowing users to invoke the tool using either
'bd' or 'beads'.

Changes:
- Makefile: Create 'beads' symlink in install target
- scripts/install.sh: Add create_beads_alias function, call it in all
  three installation paths (release download, go install, build from source)
- flake.nix: Add 'beads' symlink in Nix package installPhase
- install.ps1: Add Create-BeadsAlias function for Windows (creates a copy
  since symlinks require admin privileges)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-04 15:19:00 +00:00
mayor
fe8d7c1f14 fix: eliminate dolt split-brain root cause (B1+B2) and fix CGO build
B1: DatabasePath() now always resolves to .beads/dolt/ for dolt backend,
ignoring stale Database field values like town, wyvern, beads_rig
that caused bd to look in the wrong directory.

B2: bootstrapEmbeddedDolt() now blocks JSONL auto-import in dolt-native
sync mode. If the dolt DB does not exist, it returns an error instead of
silently creating a new database from stale JSONL backup.

B-build: Makefile and scripts/test.sh now detect Homebrew keg-only
icu4c and export CGO_CFLAGS/CGO_CPPFLAGS/CGO_LDFLAGS so dolt
go-icu-regex dependency can compile and link.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-31 20:29:34 -08:00
mayor
20271a9a71 fix(build): make install now properly builds, signs, and installs to ~/.local/bin
Previously `make install` used `go install` which put the binary in ~/go/bin
without codesigning, while PATH used ~/.local/bin - causing chronic stale
binary issues. Now install depends on build (which codesigns on macOS) and
copies to the correct location.

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

Executed-By: mayor
Role: mayor
2026-01-25 13:55:02 -08:00
Steve Yegge
1611f16751 refactor: remove unused bd pin/unpin/hook commands (bd-x0zl)
Analysis found these commands are dead code:
- gt never calls `bd pin` - uses `bd update --status=pinned` instead
- Beads.Pin() wrapper exists but is never called
- bd hook functionality duplicated by gt mol status
- Code comment says "pinned field is cosmetic for bd hook visibility"

Removed:
- cmd/bd/pin.go
- cmd/bd/unpin.go
- cmd/bd/hook.go

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-27 16:02:15 -08:00
Steve Yegge
c8b912cbe6 bd sync: 2025-12-27 15:56:42 2025-12-27 15:56:42 -08:00
Jordan Hubbard
6c37a58148 test: report total coverage from make test
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 09:47:48 -04:00
Ryan Snodgrass
cafc0b9dfb refactor(doctor): consolidate maintenance commands + improve daemon startup
Consolidate clean, repair-deps, validate into bd doctor:
- Add validation checks to doctor (merge artifacts, orphaned deps, duplicates, test pollution, git conflicts)
- Add auto-fix for merge artifacts and orphaned dependencies
- Delete obsolete command files: clean.go, repair_deps.go, validate.go
- Delete orphaned test files: clean_security_test.go, validate_test.go

Improve daemon startup performance:
- Add fast-fail detection when daemon crashed (check lock before retrying)
- Reduce graceful shutdown timeout from 5s to 1s
- Skip daemon connection for root command (just shows help)
- Extract shutdown timeout as constants (daemonShutdownTimeout, daemonShutdownPollInterval)

Other changes:
- Move rename-prefix command to Maintenance group in help
- Fix Makefile to inject git commit hash via ldflags

New files:
- cmd/bd/doctor/validation.go (5 check functions)
- cmd/bd/doctor/fix/validation.go (2 fix functions)
2025-12-22 20:21:30 -08:00
matt wilkie
0423fc689f fix: Add commit and branch to bd version output (github #503)
- Update Makefile install target to extract and pass git commit/branch via ldflags
- Add -X main.Commit and -X main.Branch to all build configurations in .goreleaser.yml
- Create scripts/install.sh helper for explicit version control during installation
- Add comprehensive tests for commit/branch resolution and output formatting

Fixes github #503: 'bd version' now reports as-built commit hash and branch
information regardless of installation method (make install, go install, or
released binaries from goreleaser).
2025-12-13 10:04:01 +11:00
Steve Yegge
0040e8029b feat: Add test infrastructure with automatic skip list
Overview: Added comprehensive test infrastructure to handle the large
test suite (41K LOC, 313 tests in cmd/bd alone) with automatic skipping
of known broken tests.

Changes:
- .test-skip: List of broken tests to skip (with GH issue references)
- scripts/test.sh: Smart test runner that auto-skips broken tests
- docs/TESTING.md: Comprehensive testing guide
- .claude/test-strategy.md: Quick reference for AI agents
- Updated Makefile to use new test script

Known Issues Filed:
- GH #355: TestFallbackToDirectModeEnablesFlush (database deadlock)
- GH #356: TestFindJSONLPathDefault (wrong JSONL filename)

Performance: 3min total (180s compilation, 3.8s execution)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-21 22:43:04 -05:00
Ryan
690c73fc31
Performance Improvements (#319)
* feat: add performance testing framework foundation

Implements foundation for comprehensive performance testing and user
diagnostics for beads databases at 10K-20K scale.

Components added:
- Fixture generator (internal/testutil/fixtures/) for realistic test data
  * LargeSQLite/XLargeSQLite: 10K/20K issues with epic hierarchies
  * LargeFromJSONL/XLargeFromJSONL: test JSONL import path
  * Realistic cross-linked dependencies, labels, assignees
  * Reproducible with seeded RNG

- User diagnostics (bd doctor --perf) for field performance data
  * Collects platform info (OS, arch, Go/SQLite versions)
  * Measures key operation timings (ready, list, show, search)
  * Generates CPU profiles for bug reports
  * Clean separation in cmd/bd/doctor/perf.go

Test data characteristics:
- 10% epics, 30% features, 60% tasks
- 4-level hierarchies (Epic → Feature → Task → Subtask)
- 20% cross-epic blocking dependencies
- Realistic status/priority/label distributions

Supports bd-l954 (Performance Testing Framework epic)
Closes bd-6ed8, bd-q59i

* perf: optimize GetReadyWork with compound index (20x speedup)

Add compound index on dependencies(depends_on_id, type, issue_id) to
eliminate performance bottleneck in GetReadyWork recursive CTE query.

Performance improvements (10K issue database):
- GetReadyWork: 752ms → 36.6ms (20.5x faster)
- Target: <50ms ✓ ACHIEVED
- 20K database: ~1500ms → 79.4ms (19x faster)

Benchmark infrastructure enhancements:
- Add dataset caching in /tmp/beads-bench-cache/ to avoid regenerating
  10K-20K issues on every benchmark run (first run: ~2min, subsequent: <5s)
- Add progress logging during fixture generation (shows 10%, 20%... completion)
- Add database size logging (17.5 MB for 10K, 35.1 MB for 20K)
- Document rationale for only benchmarking large datasets (>10K issues)
- Add CPU/trace profiling with --profile flag for performance debugging

Schema changes:
- internal/storage/sqlite/schema.go: Add idx_dependencies_depends_on_type_issue

New files:
- internal/storage/sqlite/bench_helpers_test.go: Reusable benchmark setup with caching
- internal/storage/sqlite/sqlite_bench_test.go: Comprehensive benchmarks for critical operations
- Makefile: Convenient benchmark execution (make bench-quick, make bench)

Related:
- Resolves bd-5qim (optimize GetReadyWork performance)
- Builds on bd-6ed8 (fixture generator), bd-q59i (bd doctor --perf)

* perf: add WASM compilation cache to eliminate cold-start overhead

Configure wazero compilation cache for ncruces/go-sqlite3 to avoid
~220ms JIT compilation on every process start.

Cache configuration:
- Location: ~/.cache/beads/wasm/ (platform-specific via os.UserCacheDir)
- Automatic version management: wazero keys entries by its version
- Fallback: in-memory cache if directory creation fails
- No cleanup needed: old versions are harmless (~5-10MB each)

Performance impact:
- First run: ~220ms (populate cache)
- Subsequent runs: ~20ms (load from cache)
- Savings: ~200ms per cold start

Cache invalidation:
- Automatic when wazero version changes (upgrades use new cache dir)
- Manual cleanup: rm -rf ~/.cache/beads/wasm/ (safe to delete anytime)

This complements daemon mode:
- Daemon mode: eliminates startup cost by keeping process alive
- WASM cache: reduces startup cost for one-off commands or daemon restarts

Changes:
- internal/storage/sqlite/sqlite.go: Add init() with cache setup

* refactor: improve maintainability of performance testing code

Extract common patterns and eliminate duplication across benchmarks, fixture generation, and performance diagnostics. Replace magic numbers with explicit configuration to improve readability and make it easier to tune test parameters.

* docs: clarify profiling behavior and add missing documentation

Add explanatory comments for profiling setup to clarify why --profile
forces direct mode (captures actual database operations instead of RPC
overhead) and document the stopCPUProfile function's role in flushing
profile data to disk. Also fix gosec G104 linter warning by explicitly
ignoring Close() error during cleanup.

* fix: prevent bench-quick from running indefinitely

Added //go:build bench tags and skipped timeout-prone benchmarks to
prevent make bench-quick from running for hours.

Changes:
- Add //go:build bench tag to cycle_bench_test.go and compact_bench_test.go
- Skip Dense graph benchmarks (documented to timeout >120s)
- Fix compact benchmark prefix: bd- → bd (validation expects prefix without trailing dash)

Before: make bench-quick ran for 3.5+ hours (12,699s) before manual interrupt
After: make bench-quick completes in ~25 seconds

The Dense graph benchmarks are known to timeout and represent rare edge
cases that don't need optimization for typical workflows.
2025-11-15 12:46:13 -08:00