Commit Graph

245 Commits

Author SHA1 Message Date
Steve Yegge
8bf6f20387 File bd-5ots: SearchIssues N+1 query bug 2025-11-05 19:12:08 -08:00
Steve Yegge
019c34029f removed bogus old issues file 2025-11-04 22:50:36 -08:00
Steve Yegge
ba325a2931 Remove spurious test issues from issues.jsonl
These test issues (Frontend task, Backend task, Test Epic, etc.) were
accidentally committed during template feature development and kept
getting re-imported by auto-sync.

Restores issues.jsonl to the state before commit eb434dd.

Amp-Thread-ID: https://ampcode.com/threads/T-29a525fd-6b2d-4601-99ea-fce8c5cf6b13
Co-authored-by: Amp <amp@ampcode.com>
2025-11-04 11:26:21 -08:00
Steve Yegge
eb434dd08c Add template support for issue creation (bd-164b)
- Built-in templates: epic, bug, feature (embedded in binary)
- Custom templates in .beads/templates/ (override built-ins)
- Commands: bd template list/show/create
- Flag: bd create --from-template <name> "Title"
- Template fields: description, type, priority, labels, design, acceptance
- Security: sanitize template names to prevent path traversal
- Flag precedence: explicit flags override template defaults
- Tests: template loading, security, flag precedence
- Docs: commands/template.md and README.md updated

Closes bd-164b

Amp-Thread-ID: https://ampcode.com/threads/T-118fe54f-b112-4f99-a3d9-b7df53fb7284
Co-authored-by: Amp <amp@ampcode.com>
2025-11-03 20:31:11 -08:00
Steve Yegge
e07e3a7833 bd sync: 2025-11-03 12:30:28 2025-11-03 12:30:28 -08:00
Steve Yegge
613f0dfff4 removed obsolete/wrong database file 2025-10-30 22:47:49 -07:00
Steve Yegge
71fc67f4e3 bd sync: 2025-10-30 19:57:06 2025-10-30 19:57:06 -07:00
Steve Yegge
cd7bdb301d Generate 6-char hash IDs with progressive 7/8-char fallback on collision (bd-7c87cf24)
- Changed generateHashID to start with 6 chars (3 bytes), expand to 7/8 on collision
- Updated both CreateIssue and CreateIssues (batch) to use progressive length fallback
- Updated tests to accept 9-11 char IDs (bd- + 6-8 hex chars)
- All new issues now generate with shorter, more readable IDs
- Existing 8-char IDs preserved (no migration needed)

Amp-Thread-ID: https://ampcode.com/threads/T-8a6058af-9f42-4bff-be02-8c8bce41eeb5
Co-authored-by: Amp <amp@ampcode.com>
2025-10-30 18:16:24 -07:00
Steve Yegge
edd39ef4a3 Remove polluted issues.jsonl (beads.jsonl is the real database)
Amp-Thread-ID: https://ampcode.com/threads/T-f6b7244f-58ec-4b8b-b54d-fe8b6d59f398
Co-authored-by: Amp <amp@ampcode.com>
2025-10-30 14:27:23 -07:00
Steve Yegge
9d0d6648bd Close bd-99 2025-10-28 20:47:34 -07:00
Steve Yegge
402931b081 Clean up database split: remove bd.jsonl and issues.jsonl duplicates
- Removed stale bd.jsonl (old data before compaction)
- Removed stale issues.jsonl (old data before compaction)
- Added config.json to track canonical JSONL filename (beads.jsonl)
- Database now has single source of truth: beads.jsonl (167 issues)
- No code changes needed - FindJSONLPath() glob correctly finds existing beads.jsonl

Amp-Thread-ID: https://ampcode.com/threads/T-f25fe193-4185-40be-b5bc-e5725a3dbf1b
Co-authored-by: Amp <amp@ampcode.com>
2025-10-27 18:23:29 -07:00
Steve Yegge
36fc8a19e6 Restore clean issue state after database corruption recovery
- Removed 173 duplicate beads- prefix issues
- Database now contains 165 clean bd- issues
- Fixed database prefix config from beads- to bd-
- All data recovered successfully from .beads/beads.db

Amp-Thread-ID: https://ampcode.com/threads/T-229f87e4-f015-4284-8568-9069cfae4fda
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 21:35:12 -07:00
Steve Yegge
c91e83e993 Add bd sync --import-only flag and git pull integration test (bd-124, bd-125)
- Add --import-only flag to bd sync command for manual JSONL import after git pull
- Show import summary output instead of suppressing it
- Add comprehensive integration test for git pull sync scenario
- Test covers non-daemon auto-import and bd sync command
- Verify performance of import operations

Closes bd-123, bd-114, bd-124, bd-125, bd-136, bd-137

Amp-Thread-ID: https://ampcode.com/threads/T-7d8dc20f-baf2-4d1d-add1-57fa67028c15
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 12:37:46 -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
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
57809ee2b0 Close bd-2: Verified daemon RPC sync support fix 2025-10-22 00:09:18 -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
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
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