diff --git a/internal/storage/sqlite/issues.go b/internal/storage/sqlite/issues.go index 13b622fd..c59fe8d4 100644 --- a/internal/storage/sqlite/issues.go +++ b/internal/storage/sqlite/issues.go @@ -56,7 +56,7 @@ func insertIssue(ctx context.Context, conn *sql.Conn, issue *types.Issue) error await_type, await_id, timeout_ns, waiters, mol_type, event_kind, actor, target, payload, due_at, defer_until - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `, issue.ID, issue.ContentHash, issue.Title, issue.Description, issue.Design, issue.AcceptanceCriteria, issue.Notes, issue.Status, @@ -118,7 +118,7 @@ func insertIssueStrict(ctx context.Context, conn *sql.Conn, issue *types.Issue) await_type, await_id, timeout_ns, waiters, mol_type, event_kind, actor, target, payload, due_at, defer_until - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `, issue.ID, issue.ContentHash, issue.Title, issue.Description, issue.Design, issue.AcceptanceCriteria, issue.Notes, issue.Status, @@ -150,7 +150,7 @@ func insertIssues(ctx context.Context, conn *sql.Conn, issues []*types.Issue) er await_type, await_id, timeout_ns, waiters, mol_type, event_kind, actor, target, payload, due_at, defer_until - ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + ) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) `) if err != nil { return fmt.Errorf("failed to prepare statement: %w", err) diff --git a/internal/storage/sqlite/labels.go b/internal/storage/sqlite/labels.go index 25b841af..544db309 100644 --- a/internal/storage/sqlite/labels.go +++ b/internal/storage/sqlite/labels.go @@ -159,7 +159,7 @@ func (s *SQLiteStorage) GetIssuesByLabel(ctx context.Context, label string) ([]* i.status, i.priority, i.issue_type, i.assignee, i.estimated_minutes, i.created_at, i.created_by, i.owner, i.updated_at, i.closed_at, i.external_ref, i.source_repo, i.close_reason, i.deleted_at, i.deleted_by, i.delete_reason, i.original_type, - i.sender, i.ephemeral, i.pinned, i.is_template, + i.sender, i.ephemeral, i.pinned, i.is_template, i.crystallizes, i.await_type, i.await_id, i.timeout_ns, i.waiters FROM issues i JOIN labels l ON i.id = l.issue_id diff --git a/internal/storage/sqlite/migrations_test.go b/internal/storage/sqlite/migrations_test.go index 5a340500..8bd782fe 100644 --- a/internal/storage/sqlite/migrations_test.go +++ b/internal/storage/sqlite/migrations_test.go @@ -491,6 +491,7 @@ func TestMigrateContentHashColumn(t *testing.T) { ephemeral INTEGER DEFAULT 0, pinned INTEGER DEFAULT 0, is_template INTEGER DEFAULT 0, + crystallizes INTEGER DEFAULT 0, await_type TEXT DEFAULT '', await_id TEXT DEFAULT '', timeout_ns INTEGER DEFAULT 0, @@ -510,7 +511,7 @@ func TestMigrateContentHashColumn(t *testing.T) { defer_until DATETIME, CHECK ((status = 'closed') = (closed_at IS NOT NULL)) ); - INSERT INTO issues SELECT id, title, description, design, acceptance_criteria, notes, status, priority, issue_type, assignee, estimated_minutes, created_at, '', '', updated_at, closed_at, '', external_ref, compaction_level, compacted_at, original_size, compacted_at_commit, source_repo, '', NULL, '', '', '', '', 0, 0, 0, '', '', 0, '', '', '', '', NULL, '', '', '', '', '', '', '', NULL, NULL FROM issues_backup; + INSERT INTO issues SELECT id, title, description, design, acceptance_criteria, notes, status, priority, issue_type, assignee, estimated_minutes, created_at, '', '', updated_at, closed_at, '', external_ref, compaction_level, compacted_at, original_size, compacted_at_commit, source_repo, '', NULL, '', '', '', '', 0, 0, 0, 0, '', '', 0, '', '', '', '', NULL, '', '', '', '', '', '', '', NULL, NULL FROM issues_backup; DROP TABLE issues_backup; `) if err != nil { diff --git a/internal/storage/sqlite/ready.go b/internal/storage/sqlite/ready.go index 2ca5fb6f..aeb399d6 100644 --- a/internal/storage/sqlite/ready.go +++ b/internal/storage/sqlite/ready.go @@ -154,7 +154,7 @@ func (s *SQLiteStorage) GetReadyWork(ctx context.Context, filter types.WorkFilte i.status, i.priority, i.issue_type, i.assignee, i.estimated_minutes, i.created_at, i.created_by, i.owner, i.updated_at, i.closed_at, i.external_ref, i.source_repo, i.close_reason, i.deleted_at, i.deleted_by, i.delete_reason, i.original_type, - i.sender, i.ephemeral, i.pinned, i.is_template, + i.sender, i.ephemeral, i.pinned, i.is_template, i.crystallizes, i.await_type, i.await_id, i.timeout_ns, i.waiters FROM issues i WHERE %s @@ -746,7 +746,7 @@ func (s *SQLiteStorage) GetNewlyUnblockedByClose(ctx context.Context, closedIssu i.status, i.priority, i.issue_type, i.assignee, i.estimated_minutes, i.created_at, i.created_by, i.owner, i.updated_at, i.closed_at, i.external_ref, i.source_repo, i.close_reason, i.deleted_at, i.deleted_by, i.delete_reason, i.original_type, - i.sender, i.ephemeral, i.pinned, i.is_template, + i.sender, i.ephemeral, i.pinned, i.is_template, i.crystallizes, i.await_type, i.await_id, i.timeout_ns, i.waiters FROM issues i JOIN dependencies d ON i.id = d.issue_id diff --git a/internal/storage/sqlite/schema.go b/internal/storage/sqlite/schema.go index a790b808..04cbd064 100644 --- a/internal/storage/sqlite/schema.go +++ b/internal/storage/sqlite/schema.go @@ -45,8 +45,6 @@ CREATE TABLE IF NOT EXISTS issues ( work_type TEXT DEFAULT 'mutex', -- HOP quality score field (0.0-1.0, set by Refineries on merge) quality_score REAL, - -- Work economics field (Decision 006) - compounds vs evaporates - crystallizes INTEGER DEFAULT 0, -- Federation source system field source_system TEXT DEFAULT '', -- Event fields (bd-ecmd) diff --git a/internal/storage/sqlite/transaction.go b/internal/storage/sqlite/transaction.go index 44ed0690..7474e860 100644 --- a/internal/storage/sqlite/transaction.go +++ b/internal/storage/sqlite/transaction.go @@ -1259,7 +1259,7 @@ func (t *sqliteTxStorage) SearchIssues(ctx context.Context, query string, filter created_at, created_by, owner, updated_at, closed_at, external_ref, compaction_level, compacted_at, compacted_at_commit, original_size, source_repo, close_reason, deleted_at, deleted_by, delete_reason, original_type, - sender, ephemeral, pinned, is_template, + sender, ephemeral, pinned, is_template, crystallizes, await_type, await_id, timeout_ns, waiters FROM issues %s