Fix daemon/direct mode inconsistency in graph commands (bd-fu83)

Commands relate, unrelate, duplicate, and supersede now properly
use RPC Update when daemonClient is available, instead of always
calling store.UpdateIssue() directly and bypassing the daemon.

Added RelatesTo, DuplicateOf, and SupersededBy fields to UpdateArgs
in the RPC protocol, and updated server_issues_epics.go to handle them.

🤖 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-18 01:34:14 -08:00
parent 5d7187f29b
commit 3ec517cc1b
4 changed files with 116 additions and 30 deletions

View File

@@ -112,13 +112,25 @@ func runDuplicate(cmd *cobra.Command, args []string) error {
}
// Update the duplicate issue with duplicate_of and close it
updates := map[string]interface{}{
"duplicate_of": canonicalID,
"status": string(types.StatusClosed),
}
if err := store.UpdateIssue(ctx, duplicateID, updates, actor); err != nil {
return fmt.Errorf("failed to mark as duplicate: %w", err)
closedStatus := string(types.StatusClosed)
if daemonClient != nil {
// Use RPC for daemon mode (bd-fu83)
_, err := daemonClient.Update(&rpc.UpdateArgs{
ID: duplicateID,
DuplicateOf: &canonicalID,
Status: &closedStatus,
})
if err != nil {
return fmt.Errorf("failed to mark as duplicate: %w", err)
}
} else {
updates := map[string]interface{}{
"duplicate_of": canonicalID,
"status": closedStatus,
}
if err := store.UpdateIssue(ctx, duplicateID, updates, actor); err != nil {
return fmt.Errorf("failed to mark as duplicate: %w", err)
}
}
// Trigger auto-flush
@@ -199,13 +211,25 @@ func runSupersede(cmd *cobra.Command, args []string) error {
}
// Update the old issue with superseded_by and close it
updates := map[string]interface{}{
"superseded_by": newID,
"status": string(types.StatusClosed),
}
if err := store.UpdateIssue(ctx, oldID, updates, actor); err != nil {
return fmt.Errorf("failed to mark as superseded: %w", err)
closedStatus := string(types.StatusClosed)
if daemonClient != nil {
// Use RPC for daemon mode (bd-fu83)
_, err := daemonClient.Update(&rpc.UpdateArgs{
ID: oldID,
SupersededBy: &newID,
Status: &closedStatus,
})
if err != nil {
return fmt.Errorf("failed to mark as superseded: %w", err)
}
} else {
updates := map[string]interface{}{
"superseded_by": newID,
"status": closedStatus,
}
if err := store.UpdateIssue(ctx, oldID, updates, actor); err != nil {
return fmt.Errorf("failed to mark as superseded: %w", err)
}
}
// Trigger auto-flush