Commit Graph

3 Commits

Author SHA1 Message Date
Steve Yegge
4ea347e08a Fix all test failures from bd-166 (missing issue_prefix)
Completed bd-167: Fixed all tests that failed with 'database not initialized: issue_prefix config is missing' error.

Changes:
- Created test helper functions in 3 locations:
  * cmd/bd/test_helpers_test.go (already existed)
  * internal/rpc/test_helpers.go (new)
  * internal/storage/sqlite/test_helpers.go (new)

- Updated all affected test files to use newTestStore():
  * cmd/bd: comments, export, git_sync, label, list, reopen, direct_mode
  * internal/rpc: rpc_test, version_test
  * internal/storage/sqlite: sqlite_test, underlying_db_test

- Fixed config test: updated flush-debounce default from 5s to 30s

- Removed unused sqlite imports from test files

All tests now passing 

Also:
- Closed bd-167, bd-170 (cleanup of beads-* duplicates)
- Removed corrupt backup files

Amp-Thread-ID: https://ampcode.com/threads/T-4a8c6002-9384-45b6-81f6-2907d1e4c6c2
Co-authored-by: Amp <amp@ampcode.com>
2025-10-26 22:31:24 -07:00
Steve Yegge
3fae41cb35 Add UnderlyingConn(ctx) for safer scoped DB access
- Add UnderlyingConn method to Storage interface
- Implement in SQLiteStorage for scoped connection access
- Useful for migrations and DDL operations
- Add comprehensive tests for basic access, DDL, context cancellation, and concurrent connections
- Closes bd-66, bd-22, bd-24, bd-38, bd-39, bd-56

Amp-Thread-ID: https://ampcode.com/threads/T-e47963af-4ace-4914-a0ae-4737f77be6ff
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 22:05:58 -07:00
Steve Yegge
6829372c39 Add UnderlyingDB() method for extension database access
Implements database platform layer for extensions like VC to create
their own tables in the same SQLite database.

Changes:
- Add UnderlyingDB() *sql.DB to Storage interface
- Implement in SQLiteStorage to expose underlying connection
- Add comprehensive test suite (5 tests, -race clean)
- Tests cover: basic access, extension tables, concurrency,
  lifecycle safety, and transaction behavior

This allows VC to host its executor_instances and other tables
alongside beads core tables with proper FK enforcement.

Related issues: bd-57, bd-64, bd-65, bd-66

Amp-Thread-ID: https://ampcode.com/threads/T-a6715beb-fe92-4dee-b931-3c9327124875
Co-authored-by: Amp <amp@ampcode.com>
2025-10-22 17:19:57 -07:00