Repository navigation
fix(vcs): skip builds for repositories a function or site no longer links to - #13974
Conversation
🔵 Tier A · Mergeable after minor fixes
The shared VCS deployment handler now checks that a function or site still points to the repository row before processing a webhook deployment. This applies to the Git provider handlers that use the trait and skips stale repository rows after a disconnect or reconnect.
📂 Walkthrough · 1
Reviewed |
| if ($resource->getAttribute('repositoryId', '') !== $repositoryId) { | ||
| Span::add("{$logBase}.build.skipped.reason", 'repository not connected'); | ||
| Span::add("{$logBase}.build.skipped", 'true'); | ||
| continue; | ||
| } |
There was a problem hiding this comment.
Cover stale repository rows with a webhook regression test
tests/e2e/Services/VCSGitHub/VCSGitHubConsoleClientTest.php already sends push webhooks and checks deployments, but nothing exercises this new mismatch branch. A test that leaves a stale row after disconnecting or reconnecting, sends a push, and asserts that only the currently linked resource receives a deployment would catch a regression of the reported issue.
🟡 Minor · testing · Reply if this doesn't apply.
|
| } | ||
|
|
||
| // Stale repository rows can outlive a disconnect, so only build for the repository the resource still links to. | ||
| if ($resource->getAttribute('repositoryId', '') !== $repositoryId) { |
There was a problem hiding this comment.
Disconnected push behavior lacks coverage
This guard is meant to stop a stale repository row from triggering a deployment after a function or site disconnects. The existing push test checks only a connected function, while the deleted-function test checks the webhook response without checking for deployments. Add a test that sends a push with a stale repository row and asserts that no deployment is created; otherwise, this behavior could regress without a test failing.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php
Line: 108
Comment:
**Disconnected push behavior lacks coverage**
This guard is meant to stop a stale repository row from triggering a deployment after a function or site disconnects. The existing push test checks only a connected function, while the deleted-function test checks the webhook response without checking for deployments. Add a test that sends a push with a stale repository row and asserts that no deployment is created; otherwise, this behavior could regress without a test failing.
---
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!
✨ Benchmark resultsComparing
Per-scenario breakdown & investigation detailsMetrics below reflect the current branch (after). Δ P95 compares against the base.
Top API waits (after)
|
Pushes could still build a function or site after its Git repository was disconnected, because the webhook handler builds for every matching repositories row, including stale ones left behind. createGitDeployments now skips a row unless the resource's repositoryId still points at it. All providers share this trait, so it covers every webhook handler, and it also stops the extra deployments per push that came from duplicate rows.
Fixes #9318