feat: Add 'bd stale' command to show and release orphaned executor claims

- Implements bd stale command to show issues with execution_state where executor is dead/stopped
- Adds --release flag to automatically release orphaned issues
- Adds --threshold flag to customize heartbeat staleness threshold (default: 300s/5min)
- Handles missing executor instances (LEFT JOIN) for cases where executor was deleted
- Adds QueryContext and BeginTx helper methods to SQLiteStorage for advanced queries
- Fixes ExternalRef comparison bug in import_shared.go (pointer vs string)
- Removes unused imports in import.go

Resolves vc-124
This commit is contained in:
Steve Yegge
2025-10-18 17:14:21 -07:00
parent a143efbd0e
commit 790233f748
7 changed files with 674 additions and 543 deletions

View File

@@ -0,0 +1,18 @@
package sqlite
import (
"context"
"database/sql"
)
// QueryContext exposes the underlying database QueryContext method for advanced queries
// This is used by commands that need direct SQL access (e.g., bd stale)
func (s *SQLiteStorage) QueryContext(ctx context.Context, query string, args ...interface{}) (*sql.Rows, error) {
return s.db.QueryContext(ctx, query, args...)
}
// BeginTx starts a new database transaction
// This is used by commands that need to perform multiple operations atomically
func (s *SQLiteStorage) BeginTx(ctx context.Context) (*sql.Tx, error) {
return s.db.BeginTx(ctx, nil)
}