Skip to content

test(general): assert web redirects from Appwrite instead of following them - #13712

Merged
HarshMN2345 merged 3 commits into
mainfrom
test/general-web-redirects
Sep 21, 2026
Merged

HarshMN2345 merged 3 commits into
mainfrom
test/general-web-redirects

Conversation

@HarshMN2345

@HarshMN2345 HarshMN2345 commented Sep 15, 2026

Copy link
Copy Markdown
Member

What does this PR do?

Since #13689, /, /auth/* and the other legacy console paths return a 301 to the console URL. The General e2e tests for the OAuth2 callbacks and the web hooks (project=console, unknown project, blocked user) called http://appwrite.test and followed the redirect. In appwrite CI that landed on the console container behind Traefik, so the 200 never came from Appwrite. In cloud CI it ran into the redirect loop guard instead (see appwrite-labs/cloud#5856).

The tests now call Appwrite directly on http://localhost with Host: appwrite.test, without following redirects, and assert the 301 status and Location that Appwrite returns. testConsoleServed is intentionally unchanged.

Test Plan

  • Tests / E2E / General

testConsoleServed is tagged consoleProxy: it checks that a proxy serves the console at /, so stacks without one (appwrite-labs/cloud CI) can exclude it by group instead of by method name.

…nsole

Call Appwrite directly with the API host and without following redirects, so
the OAuth2 callback, root and blocked-user web requests assert the 301 and
Location Appwrite returns rather than the console served behind the proxy.
@github-actions

github-actions Bot commented Sep 15, 2026

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → test/general-web-redirects (after).

Metric Before After Change
🚀 Requests/sec 202.66 207.25 +2.3%
⏱️ Latency P50 86.32 ms 83.35 ms -3.4%
⏱️ Latency P95 199.45 ms 194.26 ms -2.6%
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.35 194.26 12,996 207.25 -5.2
Account 159.56 302.42 684 11.37 -22.94
TablesDB 79.91 142.86 7,068 114.95 -19.47
Storage 77.33 167.94 3,420 57.41 +11.06
Functions 120.09 245.82 1,824 31.3 +13.7

Top API waits (after)

API request Max wait (ms)
account.name.update 475.91
account.prefs.update 422.31
functions.create 354.14
functions.variables.create 350.36
functions.variables.update 345.47

@HarshMN2345 HarshMN2345 changed the title test(general): assert console web redirects instead of the proxied console test(general): assert web redirects from Appwrite instead of following them Sep 15, 2026
@HarshMN2345
HarshMN2345 marked this pull request as ready for review September 15, 2026 17:43
@greptile-apps

greptile-apps Bot commented Sep 15, 2026

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

The PR has no newly introduced blocking issue, but the non-blocking implementation-coupled redirect assertions reported in the previous review remain outstanding.

Fix All in Claude CodeFindings

  1. P2 Configured Origin Is Hardcoded
Fix with agent prompt
### Issue 1
tests/e2e/General/HooksTest.php:undefined-63
This exact `http://localhost` assertion mirrors the test deployment’s configured console URL instead of isolating the observable redirect behavior. The console origin and scheme can come from `_APP_CONSOLE_URL` or related environment settings, so a valid configuration change can fail this test even when Appwrite still redirects correctly. This violates the repository directive not to mirror configuration in assertions and must be fixed before merging. Assert the redirect semantics and preserved path/query without hardcoding the configured origin. The same coupling appears in the other hook and OAuth callback assertions.

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

This PR changes the General E2E tests to connect directly to Appwrite, disable redirect following, and verify redirects for legacy console paths. It also marks the proxy-dependent console test with a dedicated PHPUnit group.

  • OAuth callback tests now inspect Appwrite’s redirect responses directly.
  • Web-hook tests now assert redirects instead of accepting the proxy or console response.
  • testConsoleServed is grouped as consoleProxy so environments without that proxy can exclude it.

Reviews (3) · Last reviewed commit: "Merge branch 'main' into test/general-we..."


$this->assertEquals(200, $response['headers']['status-code']);
$this->assertEquals(301, $response['headers']['status-code']);
$this->assertEquals('http://localhost/?project=console', $response['headers']['location']);

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 Configured Origin Is Hardcoded

This exact http://localhost assertion mirrors the test deployment’s configured console URL instead of isolating the observable redirect behavior. The console origin and scheme can come from _APP_CONSOLE_URL or related environment settings, so a valid configuration change can fail this test even when Appwrite still redirects correctly. This violates the repository directive not to mirror configuration in assertions and must be fixed before merging. Assert the redirect semantics and preserved path/query without hardcoding the configured origin. The same coupling appears in the other hook and OAuth callback assertions.

Context Used: Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: tests/e2e/General/HooksTest.php
Line: 63

Comment:
**Configured Origin Is Hardcoded**

This exact `http://localhost` assertion mirrors the test deployment’s configured console URL instead of isolating the observable redirect behavior. The console origin and scheme can come from `_APP_CONSOLE_URL` or related environment settings, so a valid configuration change can fail this test even when Appwrite still redirects correctly. This violates the repository directive not to mirror configuration in assertions and must be fixed before merging. Assert the redirect semantics and preserved path/query without hardcoding the configured origin. The same coupling appears in the other hook and OAuth callback assertions.

**Context Used:** Call out and harshly judge implementation-coupled tests. We don't mirror source code, configuration, or version pins in assertions. We test observable behavior; use linters for syntax and schema checks. ([source](https://app.greptile.com/review/custom-context?memory=instruction-0))

---

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 95ef1a3 into main Sep 21, 2026
50 checks passed
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.

1 participant