Commit Graph

438 Commits

Author SHA1 Message Date
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
Steve Yegge
656ee6b65d Update issues.jsonl after bd init fix 2025-10-21 20:39:27 -07:00
Steve Yegge
7f82708b90 Fix bd init to auto-import issues from git on fresh clone
Prevents agents from creating duplicate low-numbered issues when starting
with a fresh git clone that already has issues.jsonl in git history.

Changes:
- bd init now checks for existing issues in git after DB creation
- Auto-imports with collision resolution if found
- Updates AGENTS.md to simplify onboarding (just 'bd init')

Fixes the scenario where:
1. Fresh clone has .beads/issues.jsonl in git (212 issues)
2. Agent runs bd init (creates empty DB)
3. Agent starts creating bd-1, bd-2, etc (collisions with git)

Now bd init automatically imports all issues from git on first run.

Amp-Thread-ID: https://ampcode.com/threads/T-8a41f14d-d4c3-4c50-a18b-5f112110f138
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:38:35 -07:00
Steve Yegge
36bd877e7c Renumber issues to compact ID space (bd-1 to bd-212) 2025-10-21 20:37:38 -07:00
Steve Yegge
2f9bac9b3e Sync issues after daemon work 2025-10-21 20:36:04 -07:00
Steve Yegge
645d268e43 Implement database handshake protocol in RPC layer
- Add ExpectedDB field to RPC Request
- Server validates client's expected DB matches daemon's DB
- Return clear error on mismatch with both paths
- Old clients (no ExpectedDB) still work with warning
- Add Path() method to storage.Storage interface
- Tests verify cross-database connections rejected

Prevents database pollution when client connects to wrong daemon.

Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:35:55 -07:00
Steve Yegge
e1a445afd2 Remove global socket fallback, enforce local-only daemons
- Remove ~/.beads/bd.sock fallback in getSocketPath()
- Always return local socket path (.beads/bd.sock)
- Add migration warning if old global socket exists
- Update AGENTS.md to remove global daemon references
- Document breaking change in CHANGELOG.md
- Fix test isolation: tests now use temp .beads dir and chdir

Prevents cross-project daemon connections and database pollution.
Each project must use its own local daemon.

Amp-Thread-ID: https://ampcode.com/threads/T-c4454192-39c6-4c67-96a9-675cbfc4db92
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:35:55 -07:00
Steve Yegge
3e44951f15 Add prefix validation on bulk import
- Detects prefix mismatches during import
- Shows warning with mismatched prefixes and counts
- Added --rename-on-import flag to automatically fix prefixes
- Auto-import is lenient about prefixes (doesn't enforce)
- All tests passing
2025-10-21 20:34:37 -07:00
Steve Yegge
aba982f785 Update issues.jsonl and documentation
Amp-Thread-ID: https://ampcode.com/threads/T-fea21f01-c136-437f-a61f-226872ae7a38
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 20:29:10 -07:00
Steve Yegge
7fc65c0f26 Sync issue tracking after merge work 2025-10-21 19:57:24 -07:00
Steve Yegge
2de58621a7 Fix misleading 'bd ready' message when all issues closed
Now distinguishes between:
- 'No open work found (all issues are closed)' - when everything is done
- 'No ready work found (all issues have blocking dependencies)' - when work exists but is blocked
2025-10-21 19:54:01 -07:00
Steve Yegge
7ae148cf2b Add --id flag to bd list for filtering by specific issue IDs
- Add --id flag accepting comma-separated IDs
- Implements ID filtering at CLI, RPC, and storage layers
- Normalizes IDs (trim, dedupe, remove empty) like labels
- Guards against excessive ID lists (max 1000)
- Works with other filters (status, priority, etc.)

Closes bd-200

Amp-Thread-ID: https://ampcode.com/threads/T-377464f2-1e7f-46f9-b23e-1e3cfd611061
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:53:27 -07:00
Steve Yegge
edd4ec95c5 Implement bd merge command with dependency migration and text references
- Add performMerge() with dependency migration in both directions
- Implement updateMergeTextReferences() for text reference updates
- Close source issues with 'Merged into bd-X' reason
- Fix store initialization panic by checking daemon mode earlier
- Add TODO for transaction support (deferred, see bd-215 for idempotency approach)

Closes bd-202, bd-193, bd-194, bd-195, bd-196
Related: bd-190 (merge epic), bd-215 (idempotency enhancement)

Amp-Thread-ID: https://ampcode.com/threads/T-30fe297d-4713-4f84-abc9-3bd264caa4c6
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:39:22 -07:00
Steve Yegge
0921cb7eaa Update issues
Amp-Thread-ID: https://ampcode.com/threads/T-887df83f-0ef0-45ee-82ac-776e43e01095
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 19:24:54 -07:00
Steve Yegge
272c56a9b7 Database recovery: Remove 9k test issues, restore clean state
Restored to commit ce13140 (196 legitimate issues) + today's work:
- bd-192: Closed (merge validation implemented)
- bd-191: Updated with simplified approach notes
- bd-200: Created (--id flag feature request from filter-flag-design.md)

Test pollution analysis:
- 3:28pm (743f64d): 186 issues (clean baseline)
- 4:47pm (ce13140): 196 issues (+10 merge epic work) ✓
- 5:48pm (6e29eef): 9365 issues (+9169 test pollution) ✗
- Now: 198 issues (196 + bd-192 closed + bd-200 created) ✓

The 9k test issues (bd-1000 through bd-9169) were accidentally
committed from ~/src/vc test workers that bypassed isolation.

Amp-Thread-ID: https://ampcode.com/threads/T-22945597-9f4f-413b-afde-dcf3099eb2f0
Co-authored-by: Amp <amp@ampcode.com>
2025-10-21 18:34:28 -07:00