Skip to content

Fix/GitHub token error details#112

Closed
HarshMN2345 wants to merge 2 commits into
mainfrom
fix/github-token-error-details
Closed

Fix/GitHub token error details#112
HarshMN2345 wants to merge 2 commits into
mainfrom
fix/github-token-error-details

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

No description provided.

@HarshMN2345 HarshMN2345 deleted the fix/github-token-error-details branch June 16, 2026 11:48
@HarshMN2345

Copy link
Copy Markdown
Member Author

closed with respect to this #113

@greptile-apps

greptile-apps Bot commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

  • Adds GitHub status code and response body details to access-token retrieval errors.
  • Reworks GitHub branch listing to use GraphQL refs pagination.
  • Updates GitHub branch tests for cursor pagination, total counts, search support, and the new result shape.

Confidence Score: 4/5

Not merge-safe until the GitHub branch listing return shape is reconciled with the shared adapter contract.

The changed files are focused and tests cover the new pagination behavior, but the branch listing API now returns a metadata wrapper where callers expect plain branch names, which can break generic adapter code.

src/VCS/Adapter/Git/GitHub.php

T-Rex T-Rex Logs

What T-Rex did

  • Created a reproducible PHP script that exercises GitHub::listBranches() with a mocked GraphQL response to verify the branch contract.
  • Ran the repro and observed that listBranches() returns an associative wrapper with items, total, and nextCursor instead of a string[] of branch names.
  • Compared adapters and confirmed the mismatch is GitHub-specific, since GitLab, Gitea, and Gogs return a flat string[].
  • Validated the updated error-message behavior for failed GitHub API token retrieval, showing the head version includes status and body in the message.
  • Executed the updated scenario and confirmed both runs completed with exit code 0.

View all artifacts

T-Rex Ran code and verified through T-Rex

Reviews (1): Last reviewed commit: "fix: include status code and response bo..." | Re-trigger Greptile

* @return array{items: array<string>, total: int, nextCursor: string|null}
*/
public function listBranches(string $owner, string $repositoryName, int $perPage = 100, int $page = 1): array
public function listBranches(string $owner, string $repositoryName, int $perPage = 100, string|null $cursor = null, string $search = ''): array

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P1 Preserve branch contract

listBranches() is part of the shared adapter API and is documented as returning an array of branch names. This GitHub implementation now returns a wrapper with items, total, and nextCursor, with the final shape assembled later around lines 807-811, while the other adapters still return plain branch-name arrays. Code written against Adapter can iterate this result or call in_array($branch, $adapter->listBranches(...), true) and fail only for GitHub because it receives metadata keys instead of branch names. Please keep listBranches() returning branch names and move the paginated/search shape to a separate method, or update the abstract contract and all adapters/callers together.

Artifacts

Repro: PHP script exercising GitHub::listBranches() with mocked GraphQL response

  • Contains supporting evidence from the run (text/x-php; charset=utf-8).

Repro: failing output showing wrapper shape and broken in_array/foreach behavior

  • Keeps the command output available without making the summary code-heavy.

View artifacts

T-Rex Ran code and verified through T-Rex

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.

1 participant