Skip to content

test(proxy): isolate deployment archives in parallel tests - #13507

Merged
ChiragAgg5k merged 2 commits into
mainfrom
fix/proxy-e2e-flake
Sep 6, 2026
Merged

ChiragAgg5k merged 2 commits into
mainfrom
fix/proxy-e2e-flake

Conversation

@ChiragAgg5k

Copy link
Copy Markdown
Member

Summary

Fix the Proxy E2E archive race by giving each site/function package a unique temporary path, following the existing SitesBase::packageSite and FunctionsBase::packageFunction pattern.

  • Keep archives outside shared fixture directories.
  • Retain them through upload and remove them at process shutdown.
  • Preserve the multipart filename code.tar.gz, archive exclusions, and size limit.
  • No production changes, retries, longer timeouts, or weakened assertions.

Root cause

Failing Proxy job on #13506

ProxyConsoleClientTest::testCreateRedirectRule waited for a deployment that had already failed. Its sidecar log identifies the actual failure:

pre-job artifact processing failed: archive source.tar.gz is empty

CI runs Proxy with four-process functional ParaTest. Both Proxy classes use ProxyHelpers, whose packaging methods overwrote the same tests/resources/sites/static/code.tar.gz (and equivalent function archive). A second tar can truncate that file after the first caller packages it but before its CURLFile upload reads it. The resulting empty upload causes a real build failure, not slow deployment activation.

Local E2E verification

Isolated dedicated-PostgreSQL Docker stack with the real API, worker, Redis, ClickHouse, DNS fixture, executor, orchestrator 2.1.0, and static/node build runtimes. Source baseline: bd66764e20.

Check Result
Unmodified full Proxy suite, normal four-process functional ParaTest Pass: 34 tests / 902 assertions
Unmodified redirect tests, controlled concurrent archive truncation Reproduced CI: 1 failure out of 2 tests, failed deployment, sidecar reports archive source.tar.gz is empty
Fixed redirect tests, identical controlled interleaving Initial pass, then 3/3 repeat passes; 2 tests each
Fixed function-rule tests, same controlled interleaving 3/3 passes; 2 tests each
Fixed full Proxy suite, normal four-process functional ParaTest 3/3 passes: 34 tests each, 871 / 852 / 851 assertions; no skips
Temporary archive cleanup Zero matching site/function archives remain after the runs
Pint, PHP syntax, git diff --check Pass

Full-suite command:

docker compose -f /tmp/proxy-compose.json exec -T appwrite \
  vendor/bin/paratest --processes 4 --functional tests/e2e/Services/Proxy \
  --exclude-group abuseEnabled --exclude-group screenshots --exclude-group antivirus

Controlled reproduction

A temporary tar wrapper was placed on only the test process's PATH, not in the source tree or build runtimes. It forces the problematic interleaving:

  1. The first packaging process finishes its archive, then waits.
  2. The second truncates its output archive and pauses for two seconds before writing it.
  3. The first returns to the real upload while the second output is empty.

Both the baseline and fix ran --processes 2 --functional --filter=testCreateRedirectRule through the real API/build pipeline. The baseline shares the path and fails with the exact CI sidecar error. The fix uses different paths, so the first archive stays intact. Function-rule verification used --filter=testCreateFunctionRule. Normal full-suite verification ran without the wrapper.

Local runtime: ARM64 PHP 8.5.9; CI used PHP 8.5.10. Locked dependencies were installed with --ignore-platform-req=ext-mongodb because the cached development image contains MongoDB extension 2.3.3 instead of 2.1.x. MongoDB was not used for these PostgreSQL tests.

@greptile-apps

greptile-apps Bot commented Sep 6, 2026 •

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR prevents parallel Proxy E2E tests from truncating one another’s deployment archives.

  • Creates unique temporary archives for site and function fixtures.
  • Preserves archive exclusions, size limits, and the multipart filename code.tar.gz.
  • Retains each archive through upload and removes it during process shutdown.

Confidence Score: 5/5

The PR appears safe to merge, with the archive isolation implemented consistently with existing E2E packaging helpers.

No actionable regressions or outstanding repository-rule violations were identified in the current change.

Important Files Changed

Filename Overview
tests/e2e/Services/Proxy/ProxyHelpers.php Replaces shared fixture-local deployment archives with isolated temporary archives for parallel site and function tests.

Reviews (2): Last reviewed commit: "Merge branch 'main' into fix/proxy-e2e-f..." | Re-trigger Greptile

@github-actions

github-actions Bot commented Sep 6, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/proxy-e2e-flake (after).

Metric Before After Change
🚀 Requests/sec 211.09 218.58 ⚪ +3.5%
⏱️ Latency P50 85.37 ms 83.65 ms ⚪ -2%
⏱️ Latency P95 180.26 ms 174.17 ms ⚪ -3.4%
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 83.65 174.17 13,680 218.58 -6.09
Account 140.03 250.18 720 12.23 -28.65
TablesDB 85.31 151.78 7,440 122.31 +0.25
Storage 68.56 149.75 3,600 61.19 -7.08
Functions 108.51 194.86 1,920 33.25 -11.04

Top API waits (after)

API request Max wait (ms)
storage.buckets.create 496.47
tablesdb.rows.increment 387.77
account.prefs.update 377.42
account.name.update 361.8
functions.create 352.55

}

return new CURLFile($tarPath, 'application/x-gzip', \basename($tarPath));
register_shutdown_function(static function () use ($tarPath) {

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.

Does this play nice with swoole?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

yeah the test here doesnt use swoole, its phpunit

@ChiragAgg5k
ChiragAgg5k merged commit 4729c7b into main Sep 6, 2026
49 checks passed
@ChiragAgg5k
ChiragAgg5k deleted the fix/proxy-e2e-flake branch September 6, 2026 19:41
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