Commit Graph

4203 Commits

Author SHA1 Message Date
Steve Yegge
aba2ee0d7c bd sync: 2025-12-26 19:28:54 2025-12-26 23:19:38 -08:00
Steve Yegge
88e76ec426 bd sync: 2025-12-26 17:38:21 2025-12-26 23:19:38 -08:00
Steve Yegge
7046e90ada bd sync: 2025-12-26 17:29:25 2025-12-26 23:19:38 -08:00
Steve Yegge
0a14abcef5 fix: migration 028 handles missing created_by column
The migration was using SELECT * which fails when migrating databases
that predate the created_by column (34 columns vs 35). Now explicitly
lists columns and provides empty default for created_by if missing.

Also fixes missed Wisp→Ephemeral rename in multirepo_test.go.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 23:18:04 -08:00
Eugene Sukhodolin
0575ca9bd9 fix(nodb): set storeActive when initializing no-db mode
The `bd comment --no-db` command was failing because
initializeNoDbMode() set the global `store` but never set
`storeActive = true`. When comments.go called ensureStoreActive(),
the guard check failed and it tried to find a SQLite database,
returning an ironic error telling the user to use --no-db.

Why only `comment` was affected:
- Commands like `create`, `update`, `close` use `store` directly
- The `comment` command calls `ensureStoreActive()` first as a safety check
- That function guards on `storeActive && store != nil`
- Since `storeActive` was never set, the guard failed and it looked for SQLite

The fix aligns no-db mode with what ensureStoreActive() expects.
2025-12-26 22:23:58 -08:00
Steve Yegge
ea8ae11002 feat: Rename 'wisp' to 'ephemeral' in beads API (bd-o18s)
BREAKING CHANGE: API field and CLI command renamed

- types.Issue.Wisp → types.Issue.Ephemeral
- JSON field: "wisp" → "ephemeral"
- CLI: bd wisp → bd ephemeral
- Flags: --wisp → --ephemeral
- ID prefix: wisp → eph

The SQLite column already uses 'ephemeral' so no schema migration needed.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 21:07:37 -08:00
Steve Yegge
89be2a9d7f fix: add idempotency check to migration 028 (tombstone_closed_at)
Migration 028 lacked an idempotency check, causing it to fail on databases
where the migration had already been applied. The migration would attempt
to copy data from issues to issues_new, but both tables had the same CHECK
constraint, causing the insert to fail.

Added check for "status = 'tombstone'" in the table schema to detect if
the migration has already been applied and skip if so.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 20:57:57 -08:00
Steve Yegge
05b84c3925 fix: bd ready excludes ephemeral (wisp) issues (hq-t15s)
Wisps are ephemeral issues used for patrol/operational cycles and should
not appear in `bd ready` output as trackable work items. Added ephemeral
exclusion filter to both the GetReadyWork() function and ready_issues VIEW.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 20:51:51 -08:00
Steve Yegge
d623488d6b fix: add missing created_by column to migration 028 (GH#757)
Migration 028 (tombstone_closed_at) recreates the issues table but was
missing the created_by column that exists in schema.go. This caused
`SELECT * FROM issues` to fail with column count mismatch on fresh DBs.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 20:34:50 -08:00
matt wilkie
dae8a7aca9 feat: add comments display to bd show command (#177) 2025-12-26 21:30:37 -07:00
Steve Yegge
a642c5b16a fix: restore --resolution alias for bd close (GH#746)
The --resolution flag was accidentally removed by a bd sync commit.
This restores the hidden alias for --reason, following Jira CLI convention.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 20:16:32 -08:00
Steve Yegge
daf539397e feat: add town-level activity signal for Gas Town daemon (bd-v8ku)
Writes activity.json to ~/gt/daemon/ when bd runs inside a Gas Town
workspace. This enables the daemon to detect bd usage and adjust its
polling frequency with exponential backoff.

Best-effort: silently skips if not in Gas Town or on any error.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 19:28:39 -08:00
Steve Yegge
78b8134131 fix: bd graph works with daemon running (GH#751)
Add direct storage fallback when daemon is running but store is nil,
matching the pattern used by dep tree, blocked, and ready commands.
2025-12-26 19:15:23 -08:00
Steve Yegge
c87d3efe43 Merge pull request #754 from zjrosen/zack/fix-created-by-daemon
CI failures are pre-existing on main (Nix hash mismatch, lint errors in unrelated files). PR is clean and includes test coverage.
2025-12-26 18:08:29 -08:00
Zachary Rosen
f6eeb170ef fix: add missing CreatedBy in RPC path
created_by was recently added in c3ef1c3f38 but was missing support for passing in the CreatedBy through the RPC path so a create that was using the daemon was never having the created_by field set.
2025-12-26 20:44:53 -05:00
Steve Yegge
2c7d34a4c3 Merge pull request #752 from jordanhubbard/main
E2E / chaos testing - first PoC with just 48% code coverage
2025-12-26 17:38:01 -08:00
Steve Yegge
08cf4d4911 feat: add --run-chaos-tests flag to release script (bd-kx1j)
Adds chaos and E2E test running to the release process:
- New --run-chaos-tests flag runs chaos/corruption recovery tests
- Runs both chaos and e2e tagged tests before commit/tag
- Updated quick start to recommend chaos tests for releases
- Tests use 10m timeout for thorough coverage

Part of PR #752 integration.
2025-12-26 17:29:16 -08:00
Steve Yegge
dc890308bb Add chaos testing PR #752 review (bd-kx1j) 2025-12-26 17:25:37 -08:00
Steve Yegge
3b8e4db555 bd sync: 2025-12-26 17:25:21 2025-12-26 17:25:21 -08:00
Ryan Snodgrass
350a78f1ba fix: resolve all golangci-lint errors
Fixes 15 pre-existing lint issues:

errcheck (6 issues):
- mol_distill.go: Add _ = for f.Close() and os.Remove()
- routed.go: Add _ = for routedStorage.Close() (4 locations)

gosec (8 issues):
- maintenance.go, routes.go: Add nolint for G304 (file paths from known dirs)
- mol_distill.go: Add nolint for G304 (file creation in known search paths)
- formula.go: Change WriteFile permissions from 0644 to 0600 (G306)
- gate.go: Add nolint for G204 (exec.Command with trusted AwaitID fields)

misspell (1 issue):
- gate.go: Fix "cancelled" -> "canceled" in comment

unparam (2 issues):
- cook.go, controlflow.go: Add nolint for functions returning always-nil error

Also:
- Update pre-commit-hooks to v6.0.0
- Add lint step to "Landing the Plane" session-end protocol
2025-12-26 19:20:03 -05:00
Ryan Snodgrass
b977c1f947 chore: add pre-commit config for local lint enforcement
Adds .pre-commit-config.yaml with:
- golangci-lint v2.1.6 with 5m timeout
- Basic file hygiene hooks (trailing whitespace, EOF fixer, YAML check)

Install with: pre-commit install
2025-12-26 19:15:37 -05:00
Ryan Snodgrass
9c9f2f2ad8 fix(tests): use --initial-branch=main for modern git compatibility
Modern git (2.28+) uses 'main' as default branch, not 'master'.
Tests were failing because they assumed 'master' branch exists.

Changes:
- Use 'git init --initial-branch=main' instead of bare 'git init'
- Change 'git checkout master' to 'git checkout main'
- Add git.ResetCaches() after os.Chdir() to clear cached git state
- Ensures test isolation when changing directories
2025-12-26 19:09:41 -05:00
Ryan Snodgrass
252de1cdba feat(daemon): add sync backoff and consolidate hints into tips
Daemon sync improvements:
- Adds exponential backoff on sync failures (30s → 1m → 2m → 5m → 10m → 30m cap)
- Tracks sync state in .beads/sync-state.json (NeedsManualSync, FailureCount, BackoffUntil)
- Resets backoff on daemon start and manual bd sync
- Adds sync-state.json to default .gitignore

Tips consolidation (following ox-cli pattern):
- Moves sync conflict hint from hints.go into tips.go
- Proactive health checks trump educational tips
- Uses InjectTip() with high priority (200) and 100% probability for urgent warnings
- Removes deprecated hints.go
2025-12-26 19:09:31 -05:00
Ryan Snodgrass
721ae70ccb feat(doctor): add database corruption recovery to --fix
Adds automatic database recovery when bd doctor --fix detects corruption:
- Detects SQLite corruption (malformed database, SQLITE_CORRUPT errors)
- Backs up corrupted database before recovery attempt
- Rebuilds from JSONL if available (issues.jsonl, deletions.jsonl)
- Falls back to fresh database if JSONL unavailable
- Reports recovery results (issues imported, success/failure)

Recovery is triggered automatically by --fix when corruption is detected.
No manual intervention required.
2025-12-26 18:55:07 -05:00
Steve Yegge
9bc98cd778 bd sync: 2025-12-26 15:20:26 2025-12-26 15:20:35 -08:00
Steve Yegge
2a1c03a915 bd sync: 2025-12-26 14:54:51 2025-12-26 15:20:35 -08:00
Steve Yegge
9ec8fdd538 fix: close routed storage connections per iteration in show command
The defer-in-loop pattern was causing all routed storage connections
to accumulate until function exit. This could lead to resource leaks
when showing multiple routed issues. Now explicitly close each
connection after processing each issue.

(bd-uu8p)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 15:08:56 -08:00
Steve Yegge
a9237741d2 fix: Bypass daemon for routed IDs in show command (bd-uu8p)
When an ID needs routing to a different beads directory, the daemon
cannot resolve it. Now we check needsRouting() before daemon resolution
and handle routed IDs via direct mode with routing.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 14:54:44 -08:00
Steve Yegge
f11ad08ad9 bd sync: 2025-12-26 14:36:48 2025-12-26 14:36:48 -08:00
Steve Yegge
b9b2c826fd bd sync: 2025-12-26 14:36:25 2025-12-26 14:36:43 -08:00
Steve Yegge
f86a5187c2 bd sync: 2025-12-26 13:34:29 2025-12-26 14:36:43 -08:00
Steve Yegge
b71c06e954 bd sync: 2025-12-26 12:45:39 2025-12-26 14:36:43 -08:00
Steve Yegge
1583c57374 feat: Add prefix-based routing with routes.jsonl (bd-9gvf)
Enables cross-repo issue lookups via routes.jsonl configuration.
Running `bd show gt-xyz` from ~/gt now routes to the correct beads
directory based on the issue ID prefix.

- Add internal/routing/routes.go with routing logic
- Add cmd/bd/routed.go with routed storage helpers
- Update show command to use routed resolution in direct mode
- Support redirect files for canonical database locations
- Debug output available via BD_DEBUG_ROUTING=1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 14:36:20 -08:00
Jordan Hubbard
0b6ec57928 test: add cmd/bd helper coverage and stabilize test runner
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 17:55:51 -04:00
Steve Yegge
5c8d45aa49 fix(deps): Mark BurntSushi/toml as direct dependency (GH#749)
The toml package is imported directly in formula.go and
internal/formula/parser.go but was incorrectly marked as
indirect. This caused Nix builds to fail with vendor
inconsistency errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 13:46:40 -08:00
Steve Yegge
c3ef1c3f38 feat: Add created_by field to issues (GH#748)
Add a created_by field to track who created each issue, similar to how
comments have an author field.

- Add CreatedBy string field to Issue struct
- Add migration 029 to add created_by column to issues table
- Update all SELECT/INSERT/Scan statements across storage layer
- Populate created_by in bd create from actor chain
- Display created_by in bd show output

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 13:33:54 -08:00
Jordan Hubbard
28f2c76589 Merge branch 'steveyegge:main' into main 2025-12-26 17:22:14 -04:00
Steve Yegge
6862f6e35b chore(nix): Update version to 0.37.0 in default.nix (GH#749)
Version was stuck at 0.30.7. The vendorHash may need updating too -
if build fails with hash mismatch, use the "got:" value from the error.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 13:04:27 -08:00
Steve Yegge
d3e90225a0 fix(doctor): Preserve parent-child dependencies in child→parent check (GH#750)
The CheckChildParentDependencies detection and ChildParentDependencies fix
were flagging ALL child→parent dependencies, including legitimate
'parent-child' type structural hierarchy relationships.

Now only blocking types (blocks, conditional-blocks, waits-for) are
detected as anti-patterns. The 'parent-child' type is a legitimate
hierarchy marker used for:
- Tracking parent-child relationships
- Transitive block propagation (if parent blocked, children blocked)
- Hierarchy visualization in external tools

Changes:
- Add type filter to SELECT queries (only blocking types)
- Add type filter to DELETE statement (preserve parent-child)
- Add regression test TestChildParentDependencies_PreservesParentChildType

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 12:49:40 -08:00
Jordan Hubbard
f5ef444d15 cmd/bd: add unit coverage for show/update/close
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 12:33:59 -04:00
Jordan Hubbard
91285f87b9 test: cover show paths and stabilize debouncer
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 12:04:45 -04:00
Jordan Hubbard
59413baac2 sqlite: stop migrations clobbering pinned/template
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 12:04:06 -04:00
Jordan Hubbard
1f5ed550fe test: cover daemon autostart paths
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 10:45:42 -04:00
Jordan Hubbard
6790fb2f2d test: cover rpc client gate + shutdown
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 10:19:30 -04:00
Jordan Hubbard
eab0b3ac41 test: raise memory storage coverage 2025-12-26 10:14:28 -04: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
Jordan Hubbard
7af3106610 doctor: add fs fault injection and lock contention coverage
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 09:22:45 -04:00
Jordan Hubbard
8166207eb4 doctor: add JSONL integrity check/fix and harden repairs
Co-authored-by: factory-droid[bot] <138933559+factory-droid[bot]@users.noreply.github.com>
2025-12-26 08:18:25 -04:00
Steve Yegge
6a9e68630b chore: bump version to v0.37.0
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-26 01:29:30 -08:00
Steve Yegge
efe8180078 docs: Add 0.37.0 release notes
- Gate commands: bd gate create/eval/approve for async coordination
- New features: --suggest-next, --parent flag, TOML formulas, fork detection
- Fixes: gate await fields, tombstone timestamps, git caching, Windows support
2025-12-26 01:29:30 -08:00