Repository navigation
Fix repository listing for private GitHub profiles - #263
Conversation
|
| $this->assertSame('/installation/repositories', $adapter->requests[3]['path']); | ||
| $this->assertSame(['page' => 2, 'per_page' => 1], $adapter->requests[3]['params']); |
There was a problem hiding this 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)
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!
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
0filters 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.