Commit Graph

452 Commits

Author SHA1 Message Date
Steve Yegge
e291f464ee Fix bd-54: Prevent multiple daemon instances via file locking
- Implemented daemon.lock using flock (Unix) and LockFileEx (Windows)
- Lock acquired before PID file, held for daemon lifetime
- Eliminates race conditions in concurrent daemon starts
- Backward compatible: falls back to PID check for old daemons
- Updated isDaemonRunning() to check lock availability
- All tests pass including new lock and backward compatibility tests

Amp-Thread-ID: https://ampcode.com/threads/T-0e2627f4-03f9-4024-bb4b-21d23d296300
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 13:59:58 -07:00
Steve Yegge
d1d3fcdf02 Rename issues.jsonl → beads.jsonl (fresh start after test pollution)
Amp-Thread-ID: https://ampcode.com/threads/T-b160879b-cb6f-4e4c-9348-abcc69ee5048
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 12:40:14 -07:00
Steve Yegge
1363ac74c8 Re-add .beads/issues.jsonl with clean state 2025-10-22 12:32:26 -07:00
Steve Yegge
edb6016949 Stop tracking .beads/issues.jsonl - reset due to test pollution 2025-10-22 12:30:34 -07:00
Steve Yegge
d9e1ee9dd6 Make merge command idempotent for safe retry after partial failures (bd-26)
- Added mergeResult struct to track operations (added vs skipped)
- Check if source issues already closed before attempting to close
- Track dependencies migrated vs already existed
- Count text references updated
- Display detailed breakdown of operations in output
- Updated help text to clarify idempotent behavior
- Added comprehensive tests for idempotent retry scenarios
2025-10-22 12:24:08 -07:00
Steve Yegge
bafc1a9ded Close bd-16, merge bd-53 into bd-26, start bd-26
- Close bd-16: transaction support superseded by idempotency approach
- Merge duplicate bd-53 into bd-26
- Start bd-26: Make merge command idempotent

Amp-Thread-ID: https://ampcode.com/threads/T-95a37593-fd67-4e99-bc84-ace580b4776d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 11:57:16 -07:00
Steve Yegge
4ef995b0e4 Document merge command and AI duplicate detection workflow (bd-29)
- Add comprehensive merge command documentation to README.md
- Add AI agent duplicate detection workflow to AGENTS.md
- Include command syntax, examples, and best practices
- Close bd-29

Amp-Thread-ID: https://ampcode.com/threads/T-95a37593-fd67-4e99-bc84-ace580b4776d
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 11:48:12 -07:00
Steve Yegge
a7ce986555 Update issues: closed bd-18 2025-10-22 11:31:14 -07:00
Zoe Gagnon
fb2881c47b Break out nix package definition into a default.nix (#105)
* Fix autostart test to work in nix sandbox

* Break out a default.nix to make consuming this package easier

The flake is great for local development, but creates overhead and
duplication when pulling it in on another machine. With the default.nix,
the flake continues to work as before, but consumers can callPackage directly
with their own nixpkgs.

* Break out a default.nix to make consuming this package easier

The flake is great for local development, but creates overhead and
duplication when pulling it in on another machine. With the default.nix,
the flake continues to work as before, but consumers can callPackage directly
with their own nixpkgs.
2025-10-22 11:30:57 -07:00
Steve Yegge
7e2acb0237 Fix flaky compactor tests due to timestamp race condition
The createClosedIssue helper was setting ClosedAt to time.Now(), but the
eligibility check uses '<= datetime(now, -0 days)'. This created a race
condition where if nanoseconds elapsed between issue creation and the
query, the issue would fail eligibility checks.

Changed to now.Add(-1*time.Second) to ensure issues are always eligible
when compact_tier1_days is set to 0 for testing.

Fixes bd-18

Amp-Thread-ID: https://ampcode.com/threads/T-bc303dd9-f0e7-4d52-8908-e433d429ac4a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 10:00:36 -07:00
Steve Yegge
a578e16de3 Remove critical warning banners - issues fixed in 0.11.0 2025-10-22 01:22:59 -07:00
Steve Yegge
2a032ae3ba chore: Bump version to 0.11.0
Updated all component versions:
- bd CLI: 0.10.1 → 0.11.0
- Plugin: 0.10.1 → 0.11.0
- MCP server: 0.10.1 → 0.11.0
- Documentation: 0.10.1 → 0.11.0

Generated by scripts/bump-version.sh
2025-10-22 01:09:25 -07:00
Steve Yegge
37cd5a5330 Update CHANGELOG for 0.11.0 release 2025-10-22 01:09:14 -07:00
Steve Yegge
cbe5daae1f Close completed merge tasks and test pollution issues 2025-10-22 01:08:24 -07:00
Steve Yegge
47b892731a Auto-sync after renumber: remove deleted issues, add comment
Amp-Thread-ID: https://ampcode.com/threads/T-5ad38d33-28ba-4f47-997a-b0d7e0331c26
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:56:33 -07:00
Steve Yegge
6571e31063 Renumber issues from bd-1070 to bd-26
Counter now reset to 26. Next issue will be bd-27 instead of bd-1071.

Amp-Thread-ID: https://ampcode.com/threads/T-5ad38d33-28ba-4f47-997a-b0d7e0331c26
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:55:04 -07:00
Steve Yegge
d665882041 Mark bd-19 as open 2025-10-22 00:50:15 -07:00
Steve Yegge
3b782a8e24 Delete test pollution and renumber issues (151→55) 2025-10-22 00:48:46 -07:00
Steve Yegge
75844586ce Update issues: close bd-1 2025-10-22 00:45:08 -07:00
Steve Yegge
97e5df1180 Fix bd-1: Prevent test database pollution
Tests were connecting to test daemon but daemon routed to production DB via
findDatabaseForCwd(). Fixed by ensuring tests use isolated .beads directories
and change working directory to tmpDir.

Changes:
- bench_test.go: Added .beads subdir, chdir, and client.dbPath to setupBenchServer
- bench_test.go: Set dbPath for goroutine clients in BenchmarkConcurrentAgents
- comments_test.go: Refactored to use setupTestServer
- version_test.go: Fixed 4 tests to use setupTestServerIsolated with proper isolation
- rpc_test.go: Added setupTestServerIsolated() helper for custom test setup

Verified: RPC test suite runs with no database pollution (151→151 issues)
Amp-Thread-ID: https://ampcode.com/threads/T-348b7ba8-4292-4ed3-b143-0ad07d226c21
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:43:42 -07:00
Steve Yegge
78e8cb914c Bulk delete 1044 closed test pollution issues
Deleted all closed issues (mostly test pollution from benchmarks).
Database now clean: 26 total issues (25 open, 1 in-progress).
Removed 3286 events and 2 labels associated with deleted issues.

Amp-Thread-ID: https://ampcode.com/threads/T-5ad38d33-28ba-4f47-997a-b0d7e0331c26
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:42:57 -07:00
Steve Yegge
d2e965e022 Quarantine RPC benchmarks to prevent DB pollution
Add //go:build bench tag to bench_test.go so benchmarks NEVER run
during normal 'go test'. They've polluted production DB multiple times.
Benchmarks only run with: go test -tags=bench -bench=.

Cleaned up 1013 test pollution issues (Agent X Issue Y, Version tests).
Back to 18 real open issues.

Amp-Thread-ID: https://ampcode.com/threads/T-5ad38d33-28ba-4f47-997a-b0d7e0331c26
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:37:04 -07:00
Steve Yegge
2bb6165202 Close bd-228: Normalize acceptance criteria flag
PR #102 merged and backward-compatible alias added

Amp-Thread-ID: https://ampcode.com/threads/T-5ad38d33-28ba-4f47-997a-b0d7e0331c26
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:23:23 -07:00
Steve Yegge
5d33b9208d Add backward-compatible --acceptance-criteria alias
Keep the old flag as a hidden, deprecated alias to prevent breaking
existing scripts. The new --acceptance flag takes precedence when both
are provided. Follows Oracle recommendation from PR #102 review.

Amp-Thread-ID: https://ampcode.com/threads/T-5ad38d33-28ba-4f47-997a-b0d7e0331c26
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:17:45 -07:00
mountaintopsolutions
0f044117b4 Normalize --acceptance flag for bd update command (#102)
- Update bd update to use --acceptance instead of --acceptance-criteria
- Update MCP client to use --acceptance flag
- Simplify SKILL.md documentation now that both commands use same flag

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

Co-authored-by: Claude <noreply@anthropic.com>
2025-10-22 00:15:54 -07:00
Steve Yegge
57809ee2b0 Close bd-2: Verified daemon RPC sync support fix 2025-10-22 00:09:18 -07:00
Steve Yegge
49ed3e74f0 Fix bd-2: Add daemon RPC support for sync export operations
- Added OpExport/OpImport to RPC protocol
- Implemented handleExport() in daemon to export via RPC
- Modified sync command to use daemon export when available
- Prevents nil pointer dereference when daemon is running
- Falls back to direct mode if daemon unavailable
2025-10-22 00:07:55 -07:00
Steve Yegge
e691fa00b1 bd sync: 2025-10-21 23:50:42 2025-10-22 00:07:55 -07:00
Steve Yegge
dd2dcdbdcb Close bd-50 and bd-51: Counter sync verification and test pollution cleanup
bd-50: Verified all counter sync fixes already implemented
- Import calls SyncAllCounters() after batch operations
- Delete operations sync counters properly
- Renumber resets and syncs counters correctly
- Daemon cache detects external DB changes via mtime
- Added comprehensive tests: TestCounterSyncAfterImport

bd-51: Cleaned up test pollution from production database
- Deleted bd-52 through bd-58 (manual test issues)
- Root cause was user error, not auto-flush bug
- Auto-flush working as designed
- Go tests properly isolated in temp directories

Amp-Thread-ID: https://ampcode.com/threads/T-9dcbc4bb-76fb-4696-a3f4-4af560da6d6c
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 00:07:00 -07:00
Steve Yegge
bb03ce8f6f Add issues bd-50 and bd-51
- bd-50: Counter not synced after import on existing DB
- bd-51: Auto-flush writes test pollution to git

Both discovered during database cleanup/resync session

Amp-Thread-ID: https://ampcode.com/threads/T-b3e81b42-2498-45b5-9c8b-beb27f7e9550
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 23:58:58 -07:00
Steve Yegge
a44ddf5cfc Fix autoimport test failures and cleanup test issues
This commit fixes all 7 failing autoimport tests by correcting a bug
in import_shared.go where the function returned early when no issue
prefix was configured, preventing any imports from happening.

Changes:
- Fix early return bug in importIssuesCore (import_shared.go:85-121)
- Now continues with import even when prefix is not configured
- Only validates prefixes when a prefix is actually set
- Delete test issues bd-50 through bd-63 (14 cleanup issues)

All tests now pass:
 TestAutoImportMultipleCollisionsRemapped
 TestAutoImportAllCollisionsRemapped
 TestAutoImportExactMatchesOnly
 TestAutoImportNewIssuesOnly
 TestAutoImportIfNewer
 TestAutoImportNoCollision
 TestAutoImportClosedAtInvariant

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

Co-Authored-By: Claude <noreply@anthropic.com>
2025-10-21 23:43:04 -07:00
Steve Yegge
582bd6e183 Fix bd-49: Sync counters after deletions to prevent desync
- Call SyncAllCounters() after DeleteIssue and DeleteIssues
- Change SyncAllCounters to use excluded.last_id (allows counter to decrease)
- Delete orphaned counter rows when no issues remain for a prefix
- Add comprehensive tests in counter_sync_test.go

Fixes the issue where deleting issues left counters at high values, causing
new issues to skip IDs. Now counters accurately reflect the max existing ID.

Closes bd-49

Amp-Thread-ID: https://ampcode.com/threads/T-c3bdb8b9-d67b-4de5-901e-7ea76fc9e399
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 23:33:01 -07:00
Steve Yegge
2aeaa283d4 Add database isolation canary test
- Created TestDatabaseIsolation in internal/rpc/isolation_test.go
- Single-issue test verifies test DB isolation works correctly
- Prevents repeat of stress test pollution incident
- Test passes cleanly without polluting production database

Closes bd-44

Amp-Thread-ID: https://ampcode.com/threads/T-b3e81b42-2498-45b5-9c8b-beb27f7e9550
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 22:44:45 -07:00
Steve Yegge
1bf9c13dc6 finally scrubbed the database to 48 issues after removing thousands of test issues 2025-10-21 22:38:07 -07:00
Steve Yegge
e95a1b8069 Clean up remaining 51 test issues (Version/Comment tests) 2025-10-21 22:37:11 -07:00
Steve Yegge
ed7f5a9386 Remove stress tests and clean up 1000+ polluted test issues
- Deleted internal/rpc/stress_test.go (was polluting production DB)
- Removed 1002 test issues (Agent X Issue Y, Multi-ID tests)
- Back to 99 real issues from 1101 total
- Closes bd-48
2025-10-21 22:35:05 -07:00
Steve Yegge
5aa5940147 Add multi-ID support to update, show, and label commands
Implements GitHub issue #58: Allow multiple issue IDs for batch operations.

Changes:
- update: Now accepts multiple IDs for batch status/priority updates
- show: Displays multiple issues with separators between them
- label add/remove: Apply labels to multiple issues at once
- All commands return arrays in JSON mode for consistency

Commands already supporting multiple IDs:
- close (already implemented)
- reopen (already implemented)

Updated AGENTS.md with correct multi-ID syntax examples.

Amp-Thread-ID: https://ampcode.com/threads/T-518a7593-6e16-4b08-8cf8-741992b5e3b6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 22:18:22 -07:00
Steve Yegge
16f53c99a2 Fix stress test polluting project database
The TestStressNoUniqueConstraintViolations test was creating 1000 test
issues in the project's real database instead of its temp database.

Root cause: The RPC client automatically sets req.Cwd to os.Getwd() when
not explicitly provided. The server's getStorageForRequest() then uses
findDatabaseForCwd() to locate and open the database for that working
directory. Since the test ran from the project directory, it discovered
and used .beads/bd.db instead of the temp database.

Fix: Change working directory to the temp directory before running the
test, so the client's automatic Cwd detection points to the temp .beads/
directory instead of the project's.

Also ensures .beads subdirectory exists in temp dir for proper discovery.
2025-10-21 22:17:15 -07:00
Steve Yegge
5ab0f996b9 Clean up 1000 test issues created by stress tests 2025-10-21 22:10:30 -07:00
Steve Yegge
399fc73913 Fix labels and dependencies not saved in daemon mode (fixes #101)
The daemon's handleCreate function was ignoring createArgs.Labels and
createArgs.Dependencies, causing labels and deps specified during issue
creation to be lost when using daemon mode.

Added label and dependency processing after issue creation to match
the direct mode behavior in cmd/bd/main.go.

Fixes: #101
Amp-Thread-ID: https://ampcode.com/threads/T-cc80f8d7-264c-446e-b34f-79c4a7713b77
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 22:05:01 -07:00
Steve Yegge
473650f3ed Update issues.jsonl - close bd-49 2025-10-21 21:59:38 -07:00
Steve Yegge
d4e7af99a1 Fix bd-49: Daemon detects external DB modifications via mtime check
- Add dbMtime field to StorageCacheEntry to track DB file modification time
- Check mtime on cache hits and evict stale entries if DB changed externally
- Close and reopen storage when external modifications detected
- Fixes issue where daemon served stale data after direct DB operations

Amp-Thread-ID: https://ampcode.com/threads/T-631d5cca-0b26-47cb-b633-118b788483cf
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 21:55:23 -07:00
Steve Yegge
a8abc07e17 Sync beads database
Amp-Thread-ID: https://ampcode.com/threads/T-809fdd68-f777-4cd1-8653-b1c32a56e064
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 21:45:59 -07:00
Steve Yegge
eccd6012ec Delete 4 duplicate merge-related issues, renumber to bd-1 through bd-44 2025-10-21 21:09:54 -07:00
Steve Yegge
d582bd9cca Sync issues.jsonl after cleanup 2025-10-21 21:08:03 -07:00
Steve Yegge
2c4033ed91 Clean up issue database: delete 166 old/closed issues, keep 48, renumber bd-1 to bd-48
Amp-Thread-ID: https://ampcode.com/threads/T-fe7e9e31-d738-459b-b518-c8ebd3fd708a
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 21:01:36 -07:00
Steve Yegge
d2caceb11e Export issues from clean database 2025-10-21 20:52:51 -07:00
Steve Yegge
2426f556d4 Fix prefix validation critical bugs from oracle review
- Boundary-aware ID replacement (prevents wy-1 corrupting wy-10)
- Sort IDs by length descending before replacement
- Validate configured prefix is not empty
- Validate ID format before renaming (numeric suffix required)
- All critical issues from oracle review addressed
2025-10-21 20:49:03 -07:00
Steve Yegge
7072531843 Document stress test pollution investigation (vc-248) 2025-10-21 20:47:57 -07:00
Steve Yegge
3fda1b803b Update issue status: close bd-188 2025-10-21 20:43:54 -07:00