Skip to content

fix(deletes): keep deployments behind custom domains during retention - #14663

Merged
ChiragAgg5k merged 2 commits into
mainfrom
fix/retention-keeps-custom-domains
Oct 19, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
fix/retention-keeps-custom-domains

Conversation

@ChiragAgg5k

@ChiragAgg5k ChiragAgg5k commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Deployment retention deletes every non-active deployment past the window, and deleting a deployment deletes the rules pointing at it. A custom domain pinned to a branch serves that branch's latest build, usually not the active deployment, so retention took the domain down with it.

site: production = main, custom domain staging.example.com → branch "staging"
staging not pushed for > retention days
  before: staging build deleted → staging.example.com rule + certificate deleted
  after:  staging build kept (manual rule points at it)

Kept: the active deployment and any deployment a trigger = manual rule points at. Previews (per-deployment, branch, commit) still expire with their deployment.

Test: VCSGiteaConsoleClientTest::testDeploymentRetentionKeepsTheBuildBehindABranchDomain pins a custom domain to main, builds main without activating (the domain moves to that build), builds feature, time-travels both, runs maintenance: the feature build goes, the domain's build and the domain stay. Red without the fix: #14664.

Retention deleted every non-active deployment past its window, and deleting
a deployment deletes the rules pointing at it. A custom domain pinned to a
branch points at that branch's latest build, which is rarely the active
deployment, so retention removed the user's domain along with the build.

Previews still expire with their deployment; only manual rules protect one.
@luxor-code-review

luxor-code-review Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


This PR extends the project-deletion cleanup worker so that deployments past their retention window are removed, while deployments still referenced by custom-domain rules (manual trigger) and each resource's active deployment are preserved and excluded from deletion via a notEqual query. Unit coverage is added for the retention deletion path.

Files Change
src/Appwrite/Platform/Workers/Deletes.php Adds deployment-retention collection to the delete worker: queries domain rules per resource, builds a keep-set, and enqueues deletion of expired deployments.
tests/unit/Platform/Workers/DeletesTest.php Adds unit tests covering the retention cleanup and rule-based keep logic.

Reviewed commit: 9544e45

@ghost

ghost commented Oct 19, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

No confirmed defects were found in the changed retention logic or its regression test.

Deployment retention now preserves both active deployments and deployments referenced by manual proxy rules, including branch-pinned custom domains. An E2E regression test ages a pinned branch build and an unrelated build, then verifies that maintenance removes only the unrelated one.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 2
File Change
src/Appwrite/Platform/Workers/Deletes.php Collects deployment IDs referenced by manual rules for each function or site and excludes them from retention deletion.
tests/e2e/Services/VCSGitea/VCSGiteaConsoleClientTest.php Adds an E2E test for retaining a branch-pinned function deployment through maintenance.

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

@ChiragAgg5k ChiragAgg5k self-assigned this Oct 19, 2026
@github-actions

Copy link
Copy Markdown

Security rules

No new WARNING or ERROR findings from security rules.

19 existing findings tracked in .semgrep/baseline.json
  • php.appwrite.guest-write-without-abuse-limit (12)
  • php.appwrite.secret-compare-timing (5)
  • php.appwrite.weak-secret-env-default (2)

Posted by Checks / Rules. Re-runs update this comment in place. Rule details and baseline: .semgrep/README.md.

@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

@github-actions

github-actions Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/retention-keeps-custom-domains (after).

Metric Before After Change
🚀 Requests/sec 214.02 221.41 ⚪ +3.4%
⏱️ Latency P50 79.98 ms 78.42 ms ⚪ -1.9%
⏱️ Latency P95 187.37 ms 181.46 ms ⚪ -3.2%
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 78.42 181.46 13,680 221.41 -5.9
Account 152.64 274.3 720 12.47 +14.09
TablesDB 76.89 145.92 7,440 124.29 +8.41
Storage 70.66 161.23 3,600 61.5 -35.42
Functions 109.68 206.78 1,920 33.43 -21.49

Top API waits (after)

API request Max wait (ms)
account.name.update 446.17
account.prefs.update 370.34
storage.files.create 367.69
tablesdb.rows.create 342.74
tablesdb.rows.list 334.15

Workers are covered by e2e, not unit tests. The Gitea suite can pin a
custom domain to a branch build that is not the active deployment, which
is the state retention used to break.

@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 S · Looks good to merge. Summary

@ChiragAgg5k

Copy link
Copy Markdown
Member Author

@hansi-codes review

@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 S · Looks good to merge. Summary

@ChiragAgg5k
ChiragAgg5k merged commit ea52796 into main Oct 19, 2026
169 of 173 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/retention-keeps-custom-domains branch October 19, 2026 14:57
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