fix: resolve short IDs in comments add/list daemon mode (#1070)
Add daemonClient.ResolveID() calls before AddComment and ListComments operations in daemon mode, following the pattern from update.go. Previously, short IDs (e.g., "5wbm") worked with most bd commands but failed with `comments add` and `comments list` when using the daemon. The short ID was passed directly to the RPC server which expected full IDs (e.g., "prefix-5wbm"). Changes: - cmd/bd/comments.go: Add ID resolution before daemon RPC calls - internal/rpc/comments_test.go: Update tests to reflect client-side resolution pattern (RPC server expects full IDs, CLI resolves first) Fixes: https://github.com/steveyegge/beads/issues/1070
This commit is contained in:
@@ -38,6 +38,18 @@ Examples:
|
||||
comments := make([]*types.Comment, 0)
|
||||
usedDaemon := false
|
||||
if daemonClient != nil {
|
||||
// Resolve short/partial ID to full ID before sending to daemon (#1070)
|
||||
resolveArgs := &rpc.ResolveIDArgs{ID: issueID}
|
||||
resolveResp, err := daemonClient.ResolveID(resolveArgs)
|
||||
if err != nil {
|
||||
FatalErrorRespectJSON("resolving ID %s: %v", issueID, err)
|
||||
}
|
||||
var resolvedID string
|
||||
if err := json.Unmarshal(resolveResp.Data, &resolvedID); err != nil {
|
||||
FatalErrorRespectJSON("unmarshaling resolved ID: %v", err)
|
||||
}
|
||||
issueID = resolvedID
|
||||
|
||||
resp, err := daemonClient.ListComments(&rpc.CommentListArgs{ID: issueID})
|
||||
if err != nil {
|
||||
if isUnknownOperationError(err) {
|
||||
@@ -145,6 +157,18 @@ Examples:
|
||||
|
||||
var comment *types.Comment
|
||||
if daemonClient != nil {
|
||||
// Resolve short/partial ID to full ID before sending to daemon (#1070)
|
||||
resolveArgs := &rpc.ResolveIDArgs{ID: issueID}
|
||||
resolveResp, err := daemonClient.ResolveID(resolveArgs)
|
||||
if err != nil {
|
||||
FatalErrorRespectJSON("resolving ID %s: %v", issueID, err)
|
||||
}
|
||||
var resolvedID string
|
||||
if err := json.Unmarshal(resolveResp.Data, &resolvedID); err != nil {
|
||||
FatalErrorRespectJSON("unmarshaling resolved ID: %v", err)
|
||||
}
|
||||
issueID = resolvedID
|
||||
|
||||
resp, err := daemonClient.AddComment(&rpc.CommentAddArgs{
|
||||
ID: issueID,
|
||||
Author: author,
|
||||
|
||||
Reference in New Issue
Block a user