Skip to content

fix: get_discussion graphQL invalid field #648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Jul 7, 2025
Merged

Conversation

LuluBeatson
Copy link
Contributor

@LuluBeatson LuluBeatson commented Jul 7, 2025

Fixes bug in get_discussion which caused tool error and returned:

Field 'state' doesn't exist on type 'Discussion'

  • Removed "state" field from query and response
  • Used github.Discussion object instead of github.Issue
  • Corrected "labels" to "category" in response
  • Tool arguments and descriptions unchanged.
Before with bug image

Now fixed:

image

@LuluBeatson LuluBeatson changed the title Lulu/get discussion fix: get_discussion graphQL invalid field Jul 7, 2025
@LuluBeatson LuluBeatson marked this pull request as ready for review July 7, 2025 12:45
@Copilot Copilot AI review requested due to automatic review settings July 7, 2025 12:45
@LuluBeatson LuluBeatson requested a review from a team as a code owner July 7, 2025 12:45
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

The PR fixes the GraphQL query and response handling in get_discussion by removing the invalid state field and replacing the old labels approach with a proper category mapping.

  • Removed state from both query and response struct.
  • Switched from github.Issue to github.Discussion return type and updated corresponding fields.
  • Updated tests to reflect the new DiscussionCategory field instead of labels and state.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
pkg/github/discussions.go Removed State field, switched to github.Discussion, and mapped Category directly.
pkg/github/discussions_test.go Updated test expectations: changed type to Discussion, removed State, and asserted on DiscussionCategory.
Comments suppressed due to low confidence (2)

pkg/github/discussions.go:215

  • The function doc comment still refers to returning an issue. Please update any surrounding comments or docs to reflect that this now returns a Discussion struct rather than an Issue.
			discussion := &github.Discussion{

pkg/github/discussions_test.go:270

  • [nitpick] Consider using a pointer (var out *github.Discussion) when unmarshalling JSON into a pointer type; this aligns with your expected pointer and avoids extra dereferencing in assertions.
			var out github.Discussion

@LuluBeatson LuluBeatson merged commit 3730b84 into main Jul 7, 2025
16 checks passed
@LuluBeatson LuluBeatson deleted the lulu/get-discussion branch July 7, 2025 13:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants