feat: consolidate schema changes from crew directories
Merges schema additions from crew/fang, crew/giles, crew/grip, and crew/wolf: - crystallizes: bool field for work economics (compounds vs evaporates) - work_type: WorkType field for assignment model (mutex vs open_competition) - source_system: string field for federation adapter tracking - quality_score: *float32 for aggregate quality (0.0-1.0) - delegated-from: new dependency type for work delegation chains Migrations properly sequenced as 037-040 (after existing 036 owner_column). Also fixes test compilation errors for removed TypeRig and IsBuiltIn references. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> Executed-By: beads/crew/dave Rig: beads Role: crew
This commit is contained in:
committed by
Steve Yegge
parent
8942261a12
commit
f79e636000
@@ -157,7 +157,7 @@ func (s *SQLiteStorage) GetIssuesByLabel(ctx context.Context, label string) ([]*
|
||||
rows, err := s.db.QueryContext(ctx, `
|
||||
SELECT i.id, i.content_hash, i.title, i.description, i.design, i.acceptance_criteria, i.notes,
|
||||
i.status, i.priority, i.issue_type, i.assignee, i.estimated_minutes,
|
||||
i.created_at, i.created_by, i.updated_at, i.closed_at, i.external_ref, i.source_repo, i.close_reason,
|
||||
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.await_type, i.await_id, i.timeout_ns, i.waiters
|
||||
|
||||
@@ -53,6 +53,10 @@ var migrationsList = []Migration{
|
||||
{"closed_by_session_column", migrations.MigrateClosedBySessionColumn},
|
||||
{"due_defer_columns", migrations.MigrateDueDeferColumns},
|
||||
{"owner_column", migrations.MigrateOwnerColumn},
|
||||
{"crystallizes_column", migrations.MigrateCrystallizesColumn},
|
||||
{"work_type_column", migrations.MigrateWorkTypeColumn},
|
||||
{"source_system_column", migrations.MigrateSourceSystemColumn},
|
||||
{"quality_score_column", migrations.MigrateQualityScoreColumn},
|
||||
}
|
||||
|
||||
// MigrationInfo contains metadata about a migration for inspection
|
||||
@@ -113,6 +117,10 @@ func getMigrationDescription(name string) string {
|
||||
"closed_by_session_column": "Adds closed_by_session column for tracking which Claude Code session closed an issue",
|
||||
"due_defer_columns": "Adds due_at and defer_until columns for time-based task scheduling (GH#820)",
|
||||
"owner_column": "Adds owner column for human attribution in HOP CV chains (Decision 008)",
|
||||
"crystallizes_column": "Adds crystallizes column for work economics (compounds vs evaporates) per Decision 006",
|
||||
"work_type_column": "Adds work_type column for work assignment model (mutex vs open_competition per Decision 006)",
|
||||
"source_system_column": "Adds source_system column for federation adapter tracking",
|
||||
"quality_score_column": "Adds quality_score column for aggregate quality (0.0-1.0) set by Refineries",
|
||||
}
|
||||
|
||||
if desc, ok := descriptions[name]; ok {
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MigrateCrystallizesColumn adds the crystallizes column to the issues table.
|
||||
// Crystallizes tracks whether work compounds over time (true: code, features)
|
||||
// or evaporates (false: ops, support). Per Decision 006, this affects CV weighting.
|
||||
// Default is false (conservative - work evaporates unless explicitly marked).
|
||||
func MigrateCrystallizesColumn(db *sql.DB) error {
|
||||
// Check if column already exists
|
||||
var columnExists bool
|
||||
err := db.QueryRow(`
|
||||
SELECT COUNT(*) > 0
|
||||
FROM pragma_table_info('issues')
|
||||
WHERE name = 'crystallizes'
|
||||
`).Scan(&columnExists)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check crystallizes column: %w", err)
|
||||
}
|
||||
|
||||
if columnExists {
|
||||
// Column already exists (e.g. created by new schema)
|
||||
return nil
|
||||
}
|
||||
|
||||
// Add the crystallizes column
|
||||
_, err = db.Exec(`ALTER TABLE issues ADD COLUMN crystallizes INTEGER DEFAULT 0`)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to add crystallizes column: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
34
internal/storage/sqlite/migrations/038_work_type_column.go
Normal file
34
internal/storage/sqlite/migrations/038_work_type_column.go
Normal file
@@ -0,0 +1,34 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MigrateWorkTypeColumn adds work_type column to the issues table.
|
||||
// This field distinguishes work assignment models per Decision 006.
|
||||
// Values: 'mutex' (one worker, exclusive - default) or 'open_competition' (many submit, buyer picks)
|
||||
func MigrateWorkTypeColumn(db *sql.DB) error {
|
||||
// Check if column already exists
|
||||
var columnExists bool
|
||||
err := db.QueryRow(`
|
||||
SELECT COUNT(*) > 0
|
||||
FROM pragma_table_info('issues')
|
||||
WHERE name = 'work_type'
|
||||
`).Scan(&columnExists)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check work_type column: %w", err)
|
||||
}
|
||||
|
||||
if columnExists {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Add the column with default 'mutex'
|
||||
_, err = db.Exec(`ALTER TABLE issues ADD COLUMN work_type TEXT DEFAULT 'mutex'`)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to add work_type column: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MigrateSourceSystemColumn adds the source_system column to the issues table.
|
||||
// This tracks which adapter/system created the issue for federation support.
|
||||
func MigrateSourceSystemColumn(db *sql.DB) error {
|
||||
// Check if column already exists
|
||||
var columnExists bool
|
||||
err := db.QueryRow(`
|
||||
SELECT COUNT(*) > 0
|
||||
FROM pragma_table_info('issues')
|
||||
WHERE name = 'source_system'
|
||||
`).Scan(&columnExists)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check source_system column: %w", err)
|
||||
}
|
||||
|
||||
if columnExists {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Add the source_system column
|
||||
_, err = db.Exec(`ALTER TABLE issues ADD COLUMN source_system TEXT DEFAULT ''`)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to add source_system column: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package migrations
|
||||
|
||||
import (
|
||||
"database/sql"
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// MigrateQualityScoreColumn adds the quality_score column to the issues table.
|
||||
// This stores an aggregate quality score (0.0-1.0) set by Refineries on merge.
|
||||
// NULL indicates no score has been assigned yet.
|
||||
func MigrateQualityScoreColumn(db *sql.DB) error {
|
||||
// Check if column already exists
|
||||
var columnExists bool
|
||||
err := db.QueryRow(`
|
||||
SELECT COUNT(*) > 0
|
||||
FROM pragma_table_info('issues')
|
||||
WHERE name = 'quality_score'
|
||||
`).Scan(&columnExists)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to check quality_score column: %w", err)
|
||||
}
|
||||
|
||||
if columnExists {
|
||||
return nil
|
||||
}
|
||||
|
||||
// Add the quality_score column (REAL, nullable - no default)
|
||||
_, err = db.Exec(`ALTER TABLE issues ADD COLUMN quality_score REAL`)
|
||||
if err != nil {
|
||||
return fmt.Errorf("failed to add quality_score column: %w", err)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
@@ -39,6 +39,14 @@ CREATE TABLE IF NOT EXISTS issues (
|
||||
is_template INTEGER DEFAULT 0,
|
||||
-- Molecule type field (bd-oxgi)
|
||||
mol_type TEXT DEFAULT '',
|
||||
-- Work type field (Decision 006: mutex vs open_competition)
|
||||
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)
|
||||
event_kind TEXT DEFAULT '',
|
||||
actor TEXT DEFAULT '',
|
||||
|
||||
Reference in New Issue
Block a user