fix: correct GraphQL field name in AddBlockedBy/RemoveBlockedBy mutations

The AddBlockedByPayload and RemoveBlockedByPayload types expose
the result as 'issue', not 'blockedIssue'. Found during live spec
testing against github.com — the mutations returned empty responses.

Updated mutation queries and corresponding test fixtures.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Kynan Ware 2026-03-29 18:27:21 -06:00
parent e3b0d9dec3
commit 6e76f11dec
3 changed files with 10 additions and 10 deletions

View file

@ -549,7 +549,7 @@ func AddBlockedBy(client *Client, hostname string, issueID string, blockingIssue
query := `
mutation AddBlockedBy($input: AddBlockedByInput!) {
addBlockedBy(input: $input) {
blockedIssue { id }
issue { id }
}
}`
variables := map[string]interface{}{
@ -560,7 +560,7 @@ func AddBlockedBy(client *Client, hostname string, issueID string, blockingIssue
}
var result struct {
AddBlockedBy struct {
BlockedIssue struct{ ID string }
Issue struct{ ID string }
}
}
return client.GraphQL(hostname, query, variables, &result)
@ -571,7 +571,7 @@ func RemoveBlockedBy(client *Client, hostname string, issueID string, blockingIs
query := `
mutation RemoveBlockedBy($input: RemoveBlockedByInput!) {
removeBlockedBy(input: $input) {
blockedIssue { id }
issue { id }
}
}`
variables := map[string]interface{}{
@ -582,7 +582,7 @@ func RemoveBlockedBy(client *Client, hostname string, issueID string, blockingIs
}
var result struct {
RemoveBlockedBy struct {
BlockedIssue struct{ ID string }
Issue struct{ ID string }
}
}
return client.GraphQL(hostname, query, variables, &result)

View file

@ -1492,7 +1492,7 @@ func Test_createRun_issuesV2(t *testing.T) {
r.Register(
httpmock.GraphQL(`mutation AddBlockedBy\b`),
httpmock.GraphQLMutation(`
{ "data": { "addBlockedBy": { "blockedIssue": { "id": "ISSUE_ID_123" } } } }`,
{ "data": { "addBlockedBy": { "issue": { "id": "ISSUE_ID_123" } } } }`,
func(inputs map[string]interface{}) {
assert.Equal(t, "ISSUE_ID_123", inputs["issueId"])
assert.Equal(t, "BLOCKER_ID_200", inputs["blockingIssueId"])
@ -1506,7 +1506,7 @@ func Test_createRun_issuesV2(t *testing.T) {
r.Register(
httpmock.GraphQL(`mutation AddBlockedBy\b`),
httpmock.GraphQLMutation(`
{ "data": { "addBlockedBy": { "blockedIssue": { "id": "BLOCKED_ID_300" } } } }`,
{ "data": { "addBlockedBy": { "issue": { "id": "BLOCKED_ID_300" } } } }`,
func(inputs map[string]interface{}) {
assert.Equal(t, "BLOCKED_ID_300", inputs["issueId"])
assert.Equal(t, "ISSUE_ID_123", inputs["blockingIssueId"])

View file

@ -1048,7 +1048,7 @@ func Test_editRun(t *testing.T) {
reg.Register(
httpmock.GraphQL(`mutation AddBlockedBy\b`),
httpmock.GraphQLMutation(`
{ "data": { "addBlockedBy": { "blockedIssue": { "id": "123" } } } }`,
{ "data": { "addBlockedBy": { "issue": { "id": "123" } } } }`,
func(inputs map[string]interface{}) {
assert.Equal(t, "123", inputs["issueId"])
assert.Equal(t, "BLOCKING_200_ID", inputs["blockingIssueId"])
@ -1063,7 +1063,7 @@ func Test_editRun(t *testing.T) {
reg.Register(
httpmock.GraphQL(`mutation RemoveBlockedBy\b`),
httpmock.GraphQLMutation(`
{ "data": { "removeBlockedBy": { "blockedIssue": { "id": "123" } } } }`,
{ "data": { "removeBlockedBy": { "issue": { "id": "123" } } } }`,
func(inputs map[string]interface{}) {
assert.Equal(t, "123", inputs["issueId"])
assert.Equal(t, "BLOCKING_201_ID", inputs["blockingIssueId"])
@ -1094,7 +1094,7 @@ func Test_editRun(t *testing.T) {
reg.Register(
httpmock.GraphQL(`mutation AddBlockedBy\b`),
httpmock.GraphQLMutation(`
{ "data": { "addBlockedBy": { "blockedIssue": { "id": "BLOCKED_300_ID" } } } }`,
{ "data": { "addBlockedBy": { "issue": { "id": "BLOCKED_300_ID" } } } }`,
func(inputs map[string]interface{}) {
// --add-blocking swaps: OTHER issue is blocked BY this issue
assert.Equal(t, "BLOCKED_300_ID", inputs["issueId"])
@ -1126,7 +1126,7 @@ func Test_editRun(t *testing.T) {
reg.Register(
httpmock.GraphQL(`mutation RemoveBlockedBy\b`),
httpmock.GraphQLMutation(`
{ "data": { "removeBlockedBy": { "blockedIssue": { "id": "BLOCKED_300_ID" } } } }`,
{ "data": { "removeBlockedBy": { "issue": { "id": "BLOCKED_300_ID" } } } }`,
func(inputs map[string]interface{}) {
// --remove-blocking swaps: OTHER issue is no longer blocked BY this issue
assert.Equal(t, "BLOCKED_300_ID", inputs["issueId"])