Skip to content

fix(vcs): skip builds for repositories a function or site no longer links to - #13974

Merged
HarshMN2345 merged 1 commit into
mainfrom
fix/vcs-skip-disconnected-repositories
Sep 29, 2026
Merged

HarshMN2345 merged 1 commit into
mainfrom
fix/vcs-skip-disconnected-repositories

Conversation

@HarshMN2345

Copy link
Copy Markdown
Member

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

@ghost

ghost commented Sep 29, 2026

Copy link
Copy Markdown

🔵 Tier A · Mergeable after minor fixes

The guard matches the resource-linking contract, but the new stale-row behavior lacks a regression test.

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.

Verdict New comments Fixed Still open
✅ Approved 1 0 0
Finding Where
🟡 Cover stale repository rows with a webhook regression test src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php:108
📂 Walkthrough · 1
File Change
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php Skips webhook deployment processing when the resource's repository ID differs from the repository row's ID.

Reviewed 8112413 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔵 Tier A · Looks good to merge. Summary

Comment on lines +108 to +112
if ($resource->getAttribute('repositoryId', '') !== $repositoryId) {
Span::add("{$logBase}.build.skipped.reason", 'repository not connected');
Span::add("{$logBase}.build.skipped", 'true');
continue;
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

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.

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 4/5

[Medium risk] Adds a guard to skip builds for disconnected repositories.

The change appears safe to merge, though the disconnected-resource behavior should have a regression test.

Fix All in Claude CodeFindings

  1. P2 Disconnected push behavior lacks coverage ▶
Fix with agent prompt
### Issue 1
src/Appwrite/Platform/Modules/VCS/Http/GitHub/Deployment.php:108
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.

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

The PR checks a function’s or site’s current repository link before creating a VCS deployment from a matching repository row.

  • Stale rows are skipped across callers of the shared deployment trait.
  • The disconnected-resource behavior lacks an observable regression test.

Reviews (1) · Last reviewed commit: "fix(vcs): skip deployments for repositor..."

}

// Stale repository rows can outlive a disconnect, so only build for the repository the resource still links to.
if ($resource->getAttribute('repositoryId', '') !== $repositoryId) {

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 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!

Fix in Claude Code Fix in Codex

@HarshMN2345
HarshMN2345 merged commit ab44710 into main Sep 29, 2026
53 of 54 checks passed
@github-actions

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/vcs-skip-disconnected-repositories (after).

Metric Before After Change
🚀 Requests/sec 172.75 195.09 🟢 +12.9%
⏱️ Latency P50 97.14 ms 89.58 ms 🟢 -7.8%
⏱️ Latency P95 239.38 ms 203.91 ms 🟢 -14.8%
Per-scenario breakdown & investigation details

Metrics below reflect the current branch (after). Δ P95 compares against the base.

Scenario P50 (ms) P95 (ms) Requests RPS Δ P95 (ms)
API total 89.58 203.91 12,426 195.09 -35.48
Account 164.93 317.38 654 10.92 -49.74
TablesDB 87.66 161.41 6,758 108.99 -24.73
Storage 80.99 169.88 3,270 54.22 -24.78
Functions 127.12 243.95 1,744 29.48 -31.16

Top API waits (after)

API request Max wait (ms)
account.name.update 478.66
account.prefs.update 442.41
tablesdb.rows.delete 433.65
functions.variables.update 378.32
functions.create 365.61

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.

🐛 Bug Report: Functions build automatically after disconnecting Git

1 participant