Feat/normalize adapter behavior#108
Conversation
…atus error handling
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 6fb650bac0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| $this->markTestSkipped('GitHub adapter does not support getUser by username'); | ||
| } | ||
|
|
||
| public function testGetOwnerName(): void |
There was a problem hiding this comment.
Remove duplicate GitHub owner-name test
This adds a second testGetOwnerName() method to GitHubTest while the same method already exists earlier in the class, so PHP cannot even load the test file (php -l tests/VCS/Adapter/GitHubTest.php reports Cannot redeclare Utopia\Tests\Adapter\GitHubTest::testGetOwnerName()). Any PHPUnit run that includes this file will fail before executing tests until one of the duplicate methods is removed or renamed.
Useful? React with 👍 / 👎.
Greptile SummaryThis PR normalizes adapter behavior across GitHub and GitLab to enable shared base integration tests. It fixes
Confidence Score: 4/5The core adapter fixes are correct and the shared test infrastructure is well-structured; two localized inconsistencies in error handling are worth addressing before merge. The src/VCS/Adapter/Git/GitHub.php (paginated search path still throws on unexpected response) and src/VCS/Adapter/Git/GitLab.php (null-repositoryId path in Important Files Changed
|
| if ($repositoryId === null || $repositoryId <= 0) { | ||
| throw new Exception("repositoryId is required for this adapter"); | ||
| } |
There was a problem hiding this comment.
Silent breaking change: removal of the
/user fallback in getOwnerName
The previous implementation fell back to GET /user when $repositoryId was null, allowing callers to resolve the current authenticated user's namespace without a repository ID. That code path is now replaced with an unconditional exception. Any existing call site that relied on getOwnerName($installationId) without a $repositoryId will fail at runtime with no compile-time warning. The change is intentional based on the test removal, but there is no deprecation notice or migration path in the PR description.
There was a problem hiding this comment.
This is intentional. The previous fallback to GET /user was returning the authenticated username rather than the repository owner/namespace — semantically incorrect behavior. All internal call sites within Appwrite pass a repositoryId. External callers relying on the old fallback should update to pass a valid repositoryId. The PR description has been updated to document this breaking change.
Normalizes adapter behavior to enable shared Base tests:
Adapter fixes:
GitLab::searchRepositories — was returning flat array, now returns {items, total} consistent with Gitea/GitHub
GitLab::searchRepositories — was returning [] for invalid owner, now returns {items: [], total: 0}
GitHub::searchRepositories — was throwing for invalid owner, now returns empty results
GitHub::updateCommitStatus — was silently ignoring API errors, now throws on failure
Tests moved to Base:
testUpdateCommitStatusWithInvalidCommit
testUpdateCommitStatusWithNonExistingRepository
testSearchRepositoriesNoResults
testSearchRepositoriesInvalidOwner
Depends on: feat/unified-base-tests