From 59fa2d8d10938f8bf3dd66a757c27b8f2a9aa6ad Mon Sep 17 00:00:00 2001 From: Steve Yegge Date: Sat, 27 Dec 2025 21:49:38 -0800 Subject: [PATCH] bd sync: 2025-12-27 21:49:38 --- .beads/issues.jsonl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.beads/issues.jsonl b/.beads/issues.jsonl index eef3c91d..c79d9d78 100644 --- a/.beads/issues.jsonl +++ b/.beads/issues.jsonl @@ -521,7 +521,7 @@ {"id":"bd-pzw7","title":"gt handoff deadlock at handoff.go:125","notes":"When running 'gt handoff -m \"message\"' after successful MR submit, go panics with 'fatal error: all goroutines are asleep - deadlock\\!' at handoff.go:125. The shutdown request still appears to be sent successfully but the command crashes. Stack trace shows issue is in runHandoff select statement.","status":"closed","priority":2,"issue_type":"bug","created_at":"2025-12-19T23:22:12.46315-08:00","updated_at":"2025-12-21T17:51:25.817355-08:00","closed_at":"2025-12-21T17:51:25.817355-08:00","close_reason":"Moved to gastown: gt-dich"} {"id":"bd-qioh","title":"Standardize error handling: replace direct fmt.Fprintf+os.Exit with FatalError","description":"Standardize error handling in cmd/bd/ using FatalError pattern.\n\n## Current State\n~200+ instances of direct `fmt.Fprintf(os.Stderr, ...) + os.Exit(1)` pattern scattered across cmd/bd/*.go files.\n\n## Target Pattern\n\nUse existing FatalError helper (or create if missing):\n\n```go\n// In cmd/bd/helpers.go or similar\nfunc FatalError(format string, args ...interface{}) {\n fmt.Fprintf(os.Stderr, \"Error: \"+format+\"\\n\", args...)\n os.Exit(1)\n}\n\nfunc FatalErrorf(err error, context string) {\n fmt.Fprintf(os.Stderr, \"Error: %s: %v\\n\", context, err)\n os.Exit(1)\n}\n```\n\n## Transformation\n\n```go\n// Before\nfmt.Fprintf(os.Stderr, \"Error: %v\\n\", err)\nos.Exit(1)\n\n// After\nFatalError(\"%v\", err)\n\n// Before\nfmt.Fprintf(os.Stderr, \"Error: invalid --since duration: %v\\n\", err)\nos.Exit(1)\n\n// After\nFatalError(\"invalid --since duration: %v\", err)\n```\n\n## Files to Update (by occurrence count)\nRun: `grep -c \"os.Exit(1)\" cmd/bd/*.go | sort -t: -k2 -rn | head -20`\n\nPriority files (highest occurrence):\n- close.go\n- show.go\n- sync.go\n- init.go\n- list.go\n- create.go\n- update.go\n\n## Implementation Steps\n\n1. **Check if FatalError exists** in cmd/bd/helpers.go or create it\n2. **Create migration script** or use sed:\n ```bash\n # Find patterns to replace\n grep -rn \"fmt.Fprintf(os.Stderr.*Error.*\\n.*os.Exit(1)\" cmd/bd/\n ```\n3. **Replace systematically** file by file\n4. **Run tests** after each file to verify behavior unchanged\n5. **Run linter** to catch any missed patterns\n\n## Verification\n```bash\n# Count remaining direct exits (should be near zero)\ngrep -c \"os.Exit(1)\" cmd/bd/*.go | awk -F: \"{sum+=\\$2} END {print sum}\"\n\n# Run tests\ngo test -short ./cmd/bd/...\n```\n\n## Success Criteria\n- All error exits use FatalError/FatalErrorf\n- Consistent \"Error: \" prefix on all error messages\n- Tests pass\n- No behavior changes (exit codes remain 1)","notes":"## Progress (Dec 2025)\n\nStandardized error handling in 3 major files:\n- compact.go: All 48 os.Exit(1) calls converted to FatalError\n- sync.go: All error patterns converted (kept 1 valid summary exit)\n- migrate.go: 4 patterns converted\n\n## Remaining Work\n~326 fmt.Fprintf(os.Stderr, \"Error:\") patterns remain across ~30 files.\nHigh-count files remaining: show.go (16), dep.go (14), gate.go (28), init.go (11).\n\n## Verification\n- Build compiles successfully\n- Tests pass","status":"closed","priority":2,"issue_type":"task","assignee":"beads/Errata","created_at":"2025-12-16T18:17:19.309394-08:00","updated_at":"2025-12-23T14:14:37.939802-08:00","closed_at":"2025-12-23T14:14:37.939802-08:00","close_reason":"Error handling standardization - polecat completed, MR submitted","dependencies":[{"issue_id":"bd-qioh","depends_on_id":"bd-iz5t","type":"parent-child","created_at":"2025-12-23T12:44:07.43514-08:00","created_by":"daemon"}]} {"id":"bd-qkw9","title":"Run bump-version.sh {{version}}","description":"Run ./scripts/bump-version.sh {{version}} to update version in all files","status":"closed","priority":1,"issue_type":"task","created_at":"2025-12-19T22:55:58.841424-08:00","updated_at":"2025-12-20T17:59:26.262877-08:00","closed_at":"2025-12-20T01:18:48.99813-08:00","dependencies":[{"issue_id":"bd-qkw9","depends_on_id":"bd-6s61","type":"parent-child","created_at":"2025-12-19T22:56:14.786027-08:00","created_by":"daemon"}]} -{"id":"bd-qph3","title":"Consolidate git context into single cached struct","description":"Code review finding from bd-7di fix.\n\nCurrently there are 3 separate caches:\n- isWorktreeOnce/isWorktreeResult\n- mainRepoRootOnce/mainRepoRootResult/mainRepoRootErr \n- repoRootOnce/repoRootResult\n\nThese have redundant git calls - e.g. both isWorktreeUncached() and getMainRepoRootUncached() call getGitDirNoError(\"--git-common-dir\").\n\nCould consolidate into a single cached struct:\n```go\ntype gitContext struct {\n gitDir string\n commonDir string\n repoRoot string\n isWorktree bool\n}\n```\n\nThis would reduce git calls further and simplify ResetCaches().\n\nFile: internal/git/gitdir.go","status":"pinned","priority":4,"issue_type":"task","assignee":"beads/crew/dave","created_at":"2025-12-25T22:08:53.829215-08:00","updated_at":"2025-12-26T23:53:22.618605-08:00"} +{"id":"bd-qph3","title":"Consolidate git context into single cached struct","description":"Code review finding from bd-7di fix.\n\nCurrently there are 3 separate caches:\n- isWorktreeOnce/isWorktreeResult\n- mainRepoRootOnce/mainRepoRootResult/mainRepoRootErr \n- repoRootOnce/repoRootResult\n\nThese have redundant git calls - e.g. both isWorktreeUncached() and getMainRepoRootUncached() call getGitDirNoError(\"--git-common-dir\").\n\nCould consolidate into a single cached struct:\n```go\ntype gitContext struct {\n gitDir string\n commonDir string\n repoRoot string\n isWorktree bool\n}\n```\n\nThis would reduce git calls further and simplify ResetCaches().\n\nFile: internal/git/gitdir.go","status":"closed","priority":4,"issue_type":"task","assignee":"beads/crew/dave","created_at":"2025-12-25T22:08:53.829215-08:00","updated_at":"2025-12-27T21:49:38.611332-08:00","closed_at":"2025-12-27T21:49:38.611332-08:00","close_reason":"Consolidated into single gitContext struct with one git call"} {"id":"bd-qqc","title":"Release v{{version}}","description":"SUPERSEDED by bd-7bs4. Use the new proto for releases.\n\n","status":"tombstone","priority":1,"issue_type":"epic","created_at":"2025-12-18T12:59:00.610371-08:00","updated_at":"2025-12-24T16:25:31.181723-08:00","labels":["template"],"deleted_at":"2025-12-24T16:25:31.181723-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"epic"} {"id":"bd-qqc.1","title":"Update version to {{version}} in version.go","description":"Edit cmd/bd/version.go line 17:\n\n```go\nVersion = \"{{version}}\"\n```\n\nVerify with: `grep 'Version =' cmd/bd/version.go`","status":"tombstone","priority":1,"issue_type":"task","created_at":"2025-12-18T12:59:13.887087-08:00","updated_at":"2025-12-24T16:25:31.10856-08:00","dependencies":[{"issue_id":"bd-qqc.1","depends_on_id":"bd-qqc","type":"parent-child","created_at":"2025-12-18T12:59:13.887655-08:00","created_by":"stevey"}],"deleted_at":"2025-12-24T16:25:31.10856-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"task"} {"id":"bd-qqc.10","title":"Upgrade local Homebrew installation","description":"Upgrade bd via Homebrew:\n\n```bash\nbrew update\nbrew upgrade bd\n/opt/homebrew/bin/bd version # Verify shows {{version}}\n```\n\n**Note**: If `brew upgrade` fails with CLT (Command Line Tools) errors on bleeding-edge macOS versions (e.g., Tahoe 26.x):\n\n```bash\n# Reinstall CLT\nsudo rm -rf /Library/Developer/CommandLineTools\nxcode-select --install\n# Wait for GUI installer to complete, then retry brew upgrade\n```\n\nAlternative: Skip Homebrew and use go install:\n```bash\ngo install ./cmd/bd\n~/go/bin/bd version # Verify shows {{version}}\n```","status":"tombstone","priority":1,"issue_type":"task","created_at":"2025-12-18T22:42:37.60241-08:00","updated_at":"2025-12-24T16:25:30.444675-08:00","dependencies":[{"issue_id":"bd-qqc.10","depends_on_id":"bd-qqc","type":"parent-child","created_at":"2025-12-18T22:42:37.603893-08:00","created_by":"daemon"},{"issue_id":"bd-qqc.10","depends_on_id":"bd-qqc.9","type":"blocks","created_at":"2025-12-18T22:43:21.458817-08:00","created_by":"daemon"}],"deleted_at":"2025-12-24T16:25:30.444675-08:00","deleted_by":"daemon","delete_reason":"delete","original_type":"task"}