feat(storage): add pinned field to issues schema

Add pinned column to the issues table to support persistent context markers
that should not be treated as work items (bd-7h5).

Changes:
- Add pinned column to schema.go CREATE TABLE
- Add migration 023_pinned_column.go for existing databases
- Update all issue queries to include pinned column
- Update scanIssues and scanIssuesWithDependencyType to handle pinned field
- Add Pinned field to types.Issue struct with JSON serialization
- Fix migrations_test.go to include pinned in legacy schema test

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-19 00:08:12 -08:00
parent 8e6462d44c
commit b1ba1c5315
12 changed files with 149 additions and 29 deletions

View File

@@ -45,6 +45,9 @@ type Issue struct {
Ephemeral bool `json:"ephemeral,omitempty"` // Can be bulk-deleted when closed
// NOTE: RepliesTo, RelatesTo, DuplicateOf, SupersededBy moved to dependencies table
// per Decision 004 (Edge Schema Consolidation). Use dependency API instead.
// Pinned field (bd-7h5): persistent context markers
Pinned bool `json:"pinned,omitempty"` // If true, issue is a persistent context marker, not a work item
}
// ComputeContentHash creates a deterministic hash of the issue's content.
@@ -76,7 +79,11 @@ func (i *Issue) ComputeContentHash() string {
if i.ExternalRef != nil {
h.Write([]byte(*i.ExternalRef))
}
h.Write([]byte{0})
if i.Pinned {
h.Write([]byte("pinned"))
}
return fmt.Sprintf("%x", h.Sum(nil))
}
@@ -435,6 +442,9 @@ type IssueFilter struct {
// Ephemeral filtering (bd-kwro.9)
Ephemeral *bool // Filter by ephemeral flag (nil = any, true = only ephemeral, false = only non-ephemeral)
// Pinned filtering (bd-7h5)
Pinned *bool // Filter by pinned flag (nil = any, true = only pinned, false = only non-pinned)
}
// SortPolicy determines how ready work is ordered