fix(github-client): use buildHeaders() in graphql() to eliminate duplicated header logic#121
Merged
xlabtg merged 3 commits intoxlabtg:mainfrom Apr 9, 2026
Merged
Conversation
Adding .gitkeep for PR creation (default mode). This file will be removed when the task is complete. Issue: xlabtg#116
…ating header logic Resolves xlabtg#116: graphql() was manually constructing headers (including Authorization) instead of calling the shared buildHeaders() helper. This meant any future change to buildHeaders() (new headers, auth scheme, API version) would silently not apply to GraphQL requests. Also adds a dedicated test suite (tests/github-client-graphql.test.js) that verifies graphql() sends the correct Authorization header, standard GitHub headers, omits Authorization when no token is set, and serializes query/variables correctly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Author
🤖 Solution Draft LogThis log file contains the complete execution trace of the AI solution draft process. 💰 Cost estimation:
📊 Context and tokens usage:
Total: 29.7K + 668.4K cached input tokens, 5.2K output tokens, $0.389981 cost 🤖 Models used:
📎 Log file uploaded as Gist (426KB)Now working session is ended, feel free to review and add any feedback on the solution draft. |
Author
✅ Ready to mergeThis pull request is now ready to be merged:
Monitored by hive-mind with --auto-restart-until-mergeable flag |
This reverts commit d06d4f2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #116
graphql()inlib/github-client.jsbuildHeaders()helper that already exists in the same closurebuildHeaders()(new headers, auth scheme changes, API version bumps) will now automatically apply to GraphQL requestsChanges
plugins/github-dev-assistant/lib/github-client.js—graphql()now callsbuildHeaders()instead of manually constructing headersplugins/github-dev-assistant/tests/github-client-graphql.test.js— new regression test suite verifying thatgraphql()sends correct Authorization header, all standard GitHub headers, omits Authorization when no token set, and serializes query/variables correctlyHow to reproduce the issue
Before this fix, updating
buildHeaders()(e.g. changing the API version or adding a new required header) would have no effect ongraphql()requests since it had its own copy of the header logic.Test plan
graphql()sendsAuthorization: Bearer <token>fromsdk.secretsgraphql()sends all standard GitHub API headers viabuildHeaders()graphql()omitsAuthorizationwhen no token is configuredgraphql()posts tohttps://api.github.com/graphqlwith correct bodynpm test: 219 pass, 0 fail)npm run lint: 0 errors)🤖 Generated with Claude Code