feat: add session_id field to issue close/update mutations (bd-tksk)

Adds closed_by_session tracking for entity CV building per Gas Town
decision 009-session-events-architecture.md.

Changes:
- Add ClosedBySession field to Issue struct
- Add closed_by_session column to issues table (migration 034)
- Add --session flag to bd close command
- Support CLAUDE_SESSION_ID env var as fallback
- Add --session flag to bd update for status=closed
- Display closed_by_session in bd show output
- Update Storage interface to include session parameter in CloseIssue

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

Executed-By: beads/crew/dave
Rig: beads
Role: crew
This commit is contained in:
beads/crew/dave
2025-12-31 13:13:49 -08:00
committed by Steve Yegge
parent 7c9b975436
commit b362b36824
42 changed files with 165 additions and 82 deletions

View File

@@ -640,7 +640,7 @@ func TestCloseIssue(t *testing.T) {
t.Fatalf("CreateIssue failed: %v", err)
}
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user")
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user", "")
if err != nil {
t.Fatalf("CloseIssue failed: %v", err)
}
@@ -717,7 +717,7 @@ func TestClosedAtInvariant(t *testing.T) {
}
// Close the issue
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user")
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user", "")
if err != nil {
t.Fatalf("CloseIssue failed: %v", err)
}
@@ -812,7 +812,7 @@ func TestSearchIssues(t *testing.T) {
}
// Close the third issue
if issue.Title == "Another bug" {
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user")
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user", "")
if err != nil {
t.Fatalf("CloseIssue failed: %v", err)
}
@@ -977,7 +977,7 @@ func TestGetStatistics(t *testing.T) {
}
// Close the one that should be closed
if issue.Title == "Closed task" {
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user")
err = store.CloseIssue(ctx, issue.ID, "Done", "test-user", "")
if err != nil {
t.Fatalf("CloseIssue failed: %v", err)
}
@@ -1532,7 +1532,7 @@ func TestConvoyReactiveCompletion(t *testing.T) {
}
// Close first issue - convoy should still be open
err = store.CloseIssue(ctx, issue1.ID, "Done", "test-user")
err = store.CloseIssue(ctx, issue1.ID, "Done", "test-user", "")
if err != nil {
t.Fatalf("CloseIssue issue1 failed: %v", err)
}
@@ -1546,7 +1546,7 @@ func TestConvoyReactiveCompletion(t *testing.T) {
}
// Close second issue - convoy should auto-close now
err = store.CloseIssue(ctx, issue2.ID, "Done", "test-user")
err = store.CloseIssue(ctx, issue2.ID, "Done", "test-user", "")
if err != nil {
t.Fatalf("CloseIssue issue2 failed: %v", err)
}