Fix widespread double JSON encoding bug in daemon RPC calls (bd-1048, bd-4ec8)
Multiple CLI commands had a systematic bug where ResolveID responses were
incorrectly converted using string(resp.Data) instead of json.Unmarshal.
Since resp.Data is json.RawMessage (already JSON-encoded), this preserved
the JSON quotes, causing IDs to become "bd-1048" instead of bd-1048.
When re-marshaled for subsequent RPC calls, these became double-quoted
("\"bd-1048\""), causing database lookups to fail.
Bugs fixed:
1. Nil pointer dereference in handleShow - added nil check after GetIssue
2. Double JSON encoding in 12 locations across 4 commands:
- bd show (3 instances in show.go)
- bd dep add/remove/tree (5 instances in dep.go)
- bd label add/remove/list (3 instances in label.go)
- bd reopen (1 instance in reopen.go)
All instances replaced string(resp.Data) with proper json.Unmarshal.
Removed debug logging added during investigation.
Tested: All affected commands now work correctly with daemon mode.
This commit is contained in:
@@ -103,8 +103,6 @@ func (s *Server) validateDatabaseBinding(req *Request) error {
|
||||
}
|
||||
|
||||
func (s *Server) handleRequest(req *Request) Response {
|
||||
fmt.Fprintf(os.Stderr, "Debug: handleRequest called for operation: %s (bd-1048)\n", req.Operation)
|
||||
|
||||
// Track request timing
|
||||
start := time.Now()
|
||||
|
||||
@@ -112,7 +110,6 @@ func (s *Server) handleRequest(req *Request) Response {
|
||||
defer func() {
|
||||
latency := time.Since(start)
|
||||
s.metrics.RecordRequest(req.Operation, latency)
|
||||
fmt.Fprintf(os.Stderr, "Debug: handleRequest completed for operation: %s in %v (bd-1048)\n", req.Operation, latency)
|
||||
}()
|
||||
|
||||
// Validate database binding (skip for health/metrics to allow diagnostics)
|
||||
|
||||
Reference in New Issue
Block a user