Fix pointer dereferencing in Update RPC handler (#223)

- Dereference Design, AcceptanceCriteria, Notes, and Assignee pointers in updatesFromArgs
- Fixes EOF errors when using --notes, --design, --assignee, or --acceptance-criteria flags
- Enhance TestUpdateIssue to verify all pointer-dereferenced fields are correctly stored
This commit is contained in:
Ben Lovell
2025-11-05 07:10:56 +01:00
committed by GitHub
parent 318709414e
commit b92e79f98e
2 changed files with 27 additions and 6 deletions

View File

@@ -213,9 +213,18 @@ func TestUpdateIssue(t *testing.T) {
json.Unmarshal(createResp.Data, &issue)
newTitle := "Updated Title"
notes := "Some important notes"
design := "Design details"
assignee := "alice"
acceptance := "Acceptance criteria"
updateArgs := &UpdateArgs{
ID: issue.ID,
Title: &newTitle,
ID: issue.ID,
Title: &newTitle,
Notes: &notes,
Design: &design,
Assignee: &assignee,
AcceptanceCriteria: &acceptance,
}
updateResp, err := client.Update(updateArgs)
@@ -229,6 +238,18 @@ func TestUpdateIssue(t *testing.T) {
if updatedIssue.Title != newTitle {
t.Errorf("Expected title %s, got %s", newTitle, updatedIssue.Title)
}
if updatedIssue.Notes != notes {
t.Errorf("Expected notes %s, got %s", notes, updatedIssue.Notes)
}
if updatedIssue.Design != design {
t.Errorf("Expected design %s, got %s", design, updatedIssue.Design)
}
if updatedIssue.Assignee != assignee {
t.Errorf("Expected assignee %s, got %s", assignee, updatedIssue.Assignee)
}
if updatedIssue.AcceptanceCriteria != acceptance {
t.Errorf("Expected acceptance criteria %s, got %s", acceptance, updatedIssue.AcceptanceCriteria)
}
}
func TestCloseIssue(t *testing.T) {

View File

@@ -50,16 +50,16 @@ func updatesFromArgs(a UpdateArgs) map[string]interface{} {
u["priority"] = *a.Priority
}
if a.Design != nil {
u["design"] = a.Design
u["design"] = *a.Design
}
if a.AcceptanceCriteria != nil {
u["acceptance_criteria"] = a.AcceptanceCriteria
u["acceptance_criteria"] = *a.AcceptanceCriteria
}
if a.Notes != nil {
u["notes"] = a.Notes
u["notes"] = *a.Notes
}
if a.Assignee != nil {
u["assignee"] = a.Assignee
u["assignee"] = *a.Assignee
}
return u
}