Skip to content

Fix repository listing for private GitHub profiles - #263

Merged
HarshMN2345 merged 3 commits into
mainfrom
codex/fix-vcs-private-profile-repositories
Sep 15, 2026
Merged

HarshMN2345 merged 3 commits into
mainfrom
codex/fix-vcs-private-profile-repositories

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 14, 2026 •

Copy link
Copy Markdown
Member

GitHub returns HTTP 422 for repository searches scoped to an owner whose profile is private, even when the GitHub App installation can list that owner's repositories. searchRepositories() currently turns this into an empty result.

On search 422, verify that the requested owner matches the installation owner, then use the existing installation-repository listing and filtering path. Unknown owners still return no results, while authorization, rate-limit, and server errors retain their existing exceptions. Successful searches continue using GitHub search. The installation listing now treats only an empty search as unfiltered, so a search for 0 filters by name like any other term.

Validation: two unit tests in tests/Unit/GitHubTest.php, using the file's existing anonymous-adapter fake, cover the private-profile listing (fails against main) and an unknown owner. The unit suite passes: 90 tests, 379 assertions, one existing skip. bin/monorepo check vcs (Pint, PHPStan, Rector) passes. Provider E2E tests did not run: the GitHub authentication preflight in CI rejects the configured app identifier with HTTP 401, the same as on main.

Addresses appwrite/appwrite#7352.
Addresses appwrite/appwrite#8347.

Appwrite must adopt a released package version to receive this change.

@greptile-apps

greptile-apps Bot commented Sep 15, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The implementation appears safe to merge, although the existing non-blocking feedback about implementation-coupled tests remains unresolved.

Fix All in Claude CodeFindings

  1. P2 Tests Mirror Implementation Details ▶
Fix with agent prompt
### Issue 1
packages/vcs/tests/Unit/GitHubRepositoriesTest.php:26-27
These assertions hard-code the provider endpoint and internal pagination strategy rather than testing observable search behavior. The same problem appears at lines 48–49. This violates the repository directive that tests must not mirror source code or configuration, so these implementation-coupled assertions must be replaced before merging.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Summary

This PR adds a GitHub repository-search fallback for private installation owners when GitHub returns HTTP 422.

  • Verifies that the requested owner matches the installation owner before using installation repository listing.
  • Preserves normal search results and existing error handling for non-422 failures.
  • Corrects literal "0" searches so they use repository-name filtering rather than returning an unfiltered page.
  • Replaces the earlier focused tests with two fallback cases in the existing GitHub unit-test class.

Reviews (2) · Last reviewed commit: "test(vcs): cover private-profile search ..."

Comment on lines +26 to +27
$this->assertSame('/installation/repositories', $adapter->requests[3]['path']);
$this->assertSame(['page' => 2, 'per_page' => 1], $adapter->requests[3]['params']);

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.

P2 Tests Mirror Implementation Details

These assertions hard-code the provider endpoint and internal pagination strategy rather than testing observable search behavior. The same problem appears at lines 48–49. This violates the repository directive that tests must not mirror source code or configuration, so these implementation-coupled assertions must be replaced before merging.

Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/vcs/tests/Unit/GitHubRepositoriesTest.php
Line: 26-27

Comment:
**Tests Mirror Implementation Details**

These assertions hard-code the provider endpoint and internal pagination strategy rather than testing observable search behavior. The same problem appears at lines 48–49. This violates the repository directive that tests must not mirror source code or configuration, so these implementation-coupled assertions must be replaced before merging.

**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

---

For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.

Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

Fix in Claude Code Fix in Codex

@HarshMN2345
HarshMN2345 merged commit 21bc681 into main Sep 15, 2026
5 of 6 checks passed

This branch had an error being deployed

1 failed deployment
vcs — 8c974ff6 Deployed Sep 15, 2026 by HarshMN2345 via test (vcs) #940
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