beads/internal/storage/sqlite
Daniel Sauer 4fffdb7fae
fix(sqlite): add missing agent fields to scanIssues and related queries (#1176)
The scanIssues() function and multiple SQL queries were not selecting or
scanning agent-related fields (hook_bead, role_bead, agent_state, last_activity,
role_type, rig, mol_type) and time-based scheduling fields (due_at, defer_until).

This caused bd list --json to return null for last_activity even when the
database contained valid timestamps, preventing proper agent health monitoring.

Updated files:
- dependencies.go: scanIssues() variable declarations, scan calls, assignments
- queries.go: SearchIssues query
- labels.go: GetIssuesByLabel query
- ready.go: GetReadyWork and GetNewlyUnblockedByClose queries
- transaction.go: GetIssue query, SearchIssues query, scanIssueRow()

Fixes steveyegge/beads#1175
2026-01-19 10:11:03 -08:00
..
migrations fix: add TypeRig constant and IsBuiltIn method (GH#1002) 2026-01-10 23:46:44 -08:00
adaptive_e2e_test.go test: Tag 16 slow integration tests with build tags 2025-11-21 14:40:22 -05:00
adaptive_length.go Switch from hex to Base36 encoding for issue IDs (GH #213) 2025-11-03 12:02:15 -08:00
adaptive_length_test.go fix: resolve test failures from speedup changes 2025-11-04 01:08:21 -08:00
batch_ops.go fix(storage): use strict INSERT for batch issue creation (GH#956) 2026-01-12 19:42:04 -08:00
batch_ops_test.go fix(sqlite): prevent FK constraint failure on batch create (GH#956) 2026-01-10 22:02:03 -08:00
batch_test.go Fix N+1 query pattern in export operations (bd-rcmg) 2025-11-23 19:53:44 -08:00
bench_helpers_test.go fix: Remove duplicate context variable declarations in benchmark tests 2025-11-23 19:35:52 -08:00
blocked_cache.go feat: Add 'hooked' status for GUPP work assignment (bd-s00m) 2025-12-28 22:37:04 -08:00
blocked_cache_test.go feat: add session_id field to issue close/update mutations (bd-tksk) 2025-12-31 13:14:15 -08:00
child_counters_migration_test.go Extract SQLite migrations into separate files (bd-fb95094c.7) 2025-11-06 20:06:45 -08:00
child_counters_test.go fix(sqlite): update child_counters when explicit child IDs are created (GH#728) 2025-12-24 13:22:55 -08:00
child_id_test.go fix: respect hierarchy.max-depth config setting (GH#995) (#997) 2026-01-10 13:36:52 -08:00
collision.go Document external_ref in content hash behavior (bd-9f4a) 2025-11-08 02:22:15 -08:00
collision_test.go Document external_ref in content hash behavior (bd-9f4a) 2025-11-08 02:22:15 -08:00
comments.go fix(storage): add reconnectMu RLock protection to prevent race condition (#1054) 2026-01-12 18:29:42 -08:00
comments_test.go fix: replace string(rune()) with strconv.Itoa in tests (bd-fmc) 2025-12-02 22:41:07 -08:00
compact.go feat: Add 'hooked' status for GUPP work assignment (bd-s00m) 2025-12-28 22:37:04 -08:00
compact_bench_test.go fix: replace string(rune()) with strconv.Itoa in tests (bd-fmc) 2025-12-02 22:41:07 -08:00
compact_test.go Fix FK constraint failures in AddComment and ApplyCompaction (bd-5arw) 2025-11-20 18:55:10 -05:00
config.go fix(storage): add reconnectMu RLock protection to prevent race condition (#1054) 2026-01-12 18:29:42 -08:00
cycle_bench_test.go perf(sqlite): replace O(2^n) cycle detection with O(V+E) DFS 2025-12-28 06:04:05 -08:00
cycle_detection_test.go fix(deps): exclude relates-to from cycle detection (fixes #661) 2025-12-20 13:33:15 -08:00
delete_test.go fix: Mark dependent issues dirty when deleting to prevent orphan deps in JSONL 2026-01-16 12:27:36 -08:00
dependencies.go fix(sqlite): add missing agent fields to scanIssues and related queries (#1176) 2026-01-19 10:11:03 -08:00
dependencies_test.go refactor: add testEnv helpers, reduce SQLite test file sizes (bd-4opy) 2025-12-23 01:30:06 -08:00
dirty.go fix(storage): add reconnectMu RLock protection to prevent race condition (#1054) 2026-01-12 18:29:42 -08:00
dirty_helpers.go Refactor: consolidate ID generation and shared helpers (bd-0702, bd-1445) 2025-11-02 14:49:27 -08:00
dirty_test.go fix: Remove unsafe ClearDirtyIssues() method (bd-b6xo) 2025-12-17 19:10:13 -08:00
epics.go Enable errcheck linter and fix all production code warnings 2025-10-25 18:44:38 -07:00
epics_test.go feat: add session_id field to issue close/update mutations (bd-tksk) 2025-12-31 13:14:15 -08:00
errors.go Centralize error handling patterns in storage layer (bd-bwk2) 2025-11-20 19:17:57 -05:00
errors_test.go Centralize error handling patterns in storage layer (bd-bwk2) 2025-11-24 00:59:49 -08:00
events.go fix(storage): add reconnectMu RLock protection to prevent race condition (#1054) 2026-01-12 18:29:42 -08:00
events_helpers.go Refactor: consolidate ID generation and shared helpers (bd-0702, bd-1445) 2025-11-02 14:49:27 -08:00
events_test.go feat: add session_id field to issue close/update mutations (bd-tksk) 2025-12-31 13:14:15 -08:00
external_deps.go fix(lint): address gosec, misspell, and unparam warnings 2026-01-05 22:06:52 -08:00
external_ref_test.go Add external_ref UNIQUE constraint and validation 2025-11-02 16:27:42 -08:00
freshness.go fix: Windows build + gosec lint errors (#585) 2025-12-16 13:26:51 -08:00
freshness_test.go fix(ci): address Windows test failures and timeout 2026-01-06 12:59:26 -08:00
freshness_unix.go fix: Windows build + gosec lint errors (#585) 2025-12-16 13:26:51 -08:00
freshness_windows.go fix: Windows build + gosec lint errors (#585) 2025-12-16 13:26:51 -08:00
gate_no_daemon_test.go feat(types): remove Gas Town types from core built-in types 2026-01-17 05:07:11 -08:00
graph_links_test.go feat: add session_id field to issue close/update mutations (bd-tksk) 2025-12-31 13:14:15 -08:00
hash.go fix(storage): add reconnectMu RLock protection to prevent race condition (#1054) 2026-01-12 18:29:42 -08:00
hash_id_test.go Context propagation with graceful cancellation (bd-rtp, bd-yb8, bd-2o2) 2025-11-20 21:57:23 -05:00
hash_ids.go fix(storage): add reconnectMu RLock protection to prevent race condition (#1054) 2026-01-12 18:29:42 -08:00
ids.go fix(sqlite): update child_counters when explicit child IDs are created (GH#728) 2025-12-24 13:22:55 -08:00
ids_test.go fix(orphan): handle prefixes with dots in orphan detection (GH#508) 2025-12-14 17:23:46 -08:00
inode_unix.go fix(ci): address Windows test failures and timeout 2026-01-06 12:59:26 -08:00
inode_windows.go fix(ci): address Windows test failures and timeout 2026-01-06 12:59:26 -08:00
issues.go fix(storage): use strict INSERT for batch issue creation (GH#956) 2026-01-12 19:42:04 -08:00
labels.go fix(sqlite): add missing agent fields to scanIssues and related queries (#1176) 2026-01-19 10:11:03 -08:00
labels_test.go fix: Remove unsafe ClearDirtyIssues() method (bd-b6xo) 2025-12-17 19:10:13 -08:00
migration_invariants.go fix: Add pre-migration orphan cleanup to avoid chicken-and-egg failure (bd-eko4) 2025-12-29 13:47:04 -08:00
migration_invariants_test.go fix: Add pre-migration orphan cleanup to avoid chicken-and-egg failure (bd-eko4) 2025-12-29 13:47:04 -08:00
migrations.go feat: consolidate schema changes from crew directories 2026-01-10 22:38:04 -08:00
migrations_template_pinned_regression_test.go refactor: remove unused bd pin/unpin/hook commands (bd-x0zl) 2025-12-27 16:02:15 -08:00
migrations_test.go fix: add missing crystallizes column to SELECT queries and remove duplicate 2026-01-10 23:55:16 -08:00
multirepo.go feat(multirepo): trust non-built-in types during hydration (bd-9ji4z) 2026-01-09 14:12:48 -08:00
multirepo_export.go feat(context): centralize RepoContext API for git operations (#1102) 2026-01-15 07:55:08 -08:00
multirepo_test.go feat(context): centralize RepoContext API for git operations (#1102) 2026-01-15 07:55:08 -08:00
orphan_handling_test.go fix: orphan detection false positive with dots in directory name 2025-12-16 01:06:14 -08:00
prefix_validation_test.go Context propagation with graceful cancellation (bd-rtp, bd-yb8, bd-2o2) 2025-11-20 21:57:23 -05:00
queries.go fix(sqlite): add missing agent fields to scanIssues and related queries (#1176) 2026-01-19 10:11:03 -08:00
readonly_test.go fix: read operations no longer modify database file (GH#804) 2025-12-30 16:47:38 -08:00
ready.go fix(sqlite): add missing agent fields to scanIssues and related queries (#1176) 2026-01-19 10:11:03 -08:00
ready_test.go fix: prevent closing issues with open blockers (GH#962) 2026-01-09 22:57:07 -08:00
rename_dependency_prefix_test.go fix(storage): implement RenameDependencyPrefix to preserve dependencies (#642) 2025-12-19 17:52:44 -08:00
resurrection.go fix(sqlite): handle dots in prefix for extractParentChain (GH#664) 2025-12-24 14:39:30 -08:00
resurrection_test.go fix(sqlite): handle dots in prefix for extractParentChain (GH#664) 2025-12-24 14:39:30 -08:00
schema.go fix: add missing crystallizes column to SELECT queries and remove duplicate 2026-01-10 23:55:16 -08:00
schema_probe.go fix(schema): add pinned column to schema compatibility checks 2025-12-19 19:57:14 -08:00
schema_probe_test.go Add schema compatibility probe to prevent silent migration failures (bd-ckvw) 2025-11-08 15:40:19 -08:00
sqlite.go refactor: Split monolithic sqlite.go into focused files (bd-0a43) 2025-11-23 19:04:34 -08:00
sqlite_bench_test.go bench(sqlite): add isolated cache rebuild benchmarks (bd-zw72) 2026-01-02 17:30:58 -08:00
sqlite_test.go feat(types): remove Gas Town types from core built-in types 2026-01-17 05:07:11 -08:00
store.go fix: SQLite uses DELETE mode on WSL2 Windows filesystem (GH#920) 2026-01-09 23:03:03 -08:00
test_helpers.go feat: add session_id field to issue close/update mutations (bd-tksk) 2025-12-31 13:14:15 -08:00
tombstone_test.go fix(create): allow creating issues with explicit ID that matches tombstone (bd-0gm4r) 2026-01-14 20:36:47 -08:00
transaction.go fix(sqlite): add missing agent fields to scanIssues and related queries (#1176) 2026-01-19 10:11:03 -08:00
transaction_test.go feat: add session_id field to issue close/update mutations (bd-tksk) 2025-12-31 13:14:15 -08:00
underlying_db_test.go Context propagation with graceful cancellation (bd-rtp, bd-yb8, bd-2o2) 2025-11-20 21:57:23 -05:00
util.go fix: resolve golangci-lint errors 2025-11-24 22:21:55 -08:00
util_test.go Implement transaction retry logic for SQLITE_BUSY (bd-ola6) 2025-11-24 01:10:16 -08:00
validators.go feat(types): add "enhancement" as alias for "feature" type 2026-01-16 15:44:33 -08:00
validators_test.go fix: repair test build failures in types and sqlite packages 2026-01-10 22:00:32 -08:00