Skip to content

fix(console): resolve the organization header on organization routes only - #13993

Merged
Meldiron merged 2 commits into
mainfrom
fix/console-organization-header
Sep 29, 2026
Merged

Meldiron merged 2 commits into
mainfrom
fix/console-organization-header

Conversation

@Meldiron

@Meldiron Meldiron commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

The X-Appwrite-Organization header belongs to the Organization API (/v1/organization/*), which is the only place the console SDK sends it. The console team resource was resolving the header for every console route; it now does so only for routes in the organization group (the same group the Organization module's init hook keys on), so every other console route keeps naming its own team. The console admin branch in shared/api.php gets a comment stating which team it reads.

Test Plan

  • New console e2e coverage in TeamsConsoleClientTest: team routes behave the same with and without the header, both for a member of the team and for a member of another team.
  • Existing tests/e2e/Services/Organization/* keep covering the header on organization routes.
  • composer lint and composer analyze on the touched files, composer refactor:check.

Related PRs and Issues

  • None

Checklist

  • Have you read the Contributing Guidelines on issues?
  • If the PR includes a change to an API's metadata (desc, label, params, etc.), does it also include updated API specs and example docs? (no metadata changed)

🤖 Generated with Claude Code

…only

The X-Appwrite-Organization header belongs to the Organization API, which
is where the console SDK sends it. The console team resource resolved it
for every console route; it now does so on organization routes only, so
every other console route keeps naming its own team.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@ghost

ghost commented Sep 29, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The group-based check matches the group that all 11 Organization routes declare, and I found nothing that needs fixing.

On the console project, the team resource now uses the X-Appwrite-Organization header only for routes in the organization group. Every other console route goes back to naming its own team. The PR also adds a comment in shared/api.php about which team the console admin branch reads. It adds two console e2e tests in TeamsConsoleClientTest showing team routes behave the same with the header present, for a team member and for a member of another team.

Latest changes: The header check moved from a /v1/organization/ path-prefix test to a check for the organization route group. This is the same group the Organization module's init hook uses.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 3
File Change
app/init/resources/request.php Console team resource honors the organization header only for routes in the organization group.
app/controllers/shared/api.php Comment stating which team the console admin branch reads.
tests/e2e/Services/Teams/TeamsConsoleClientTest.php E2E tests showing team routes ignore the organization header, for a team member and for a member of another team.

Reviewed the commits since d3acf4b · 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 S · Looks good to merge. Summary

@greptile-apps

greptile-apps Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerConfidence Score: 5/5

[Critical risk] Changes how the organization header resolves on console routes.

The PR appears safe to merge.

Summary

The PR limits console organization-header resolution to routes in the organization group and adds observable team-route authorization coverage.

  • Organization routes retain header-based team selection.
  • Other console routes no longer select a team from that header.

Reviews (2) · Last reviewed commit: "fix(console): key the organization heade..."

The Organization module already declares its routes with the organization
group, and its init hook requires the team on that same group. Resolve the
header by the group rather than by path prefix, so the two sides of the
contract read the same declaration.

Co-Authored-By: Claude Fable 5.1 <[email protected]>
@github-actions

github-actions Bot commented Sep 29, 2026 •

Copy link
Copy Markdown

✨ Benchmark results

Comparing main (before) → fix/console-organization-header (after).

Metric Before After Change
🚀 Requests/sec 167.74 174.06 ⚪ +3.8%
⏱️ Latency P50 99.78 ms 99.34 ms ⚪ -0.4%
⏱️ Latency P95 250.55 ms 233.91 ms 🟢 -6.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 99.34 233.91 11,343 174.06 -16.64
Account 187.54 380.51 597 9.9 +28.79
TablesDB 96.13 185.44 6,169 97.37 -12.16
Storage 89.65 192.62 2,985 48.36 -26.84
Functions 142.04 289.79 1,592 26.44 -5.28

Top API waits (after)

API request Max wait (ms)
account.name.update 601.37
account.prefs.update 541.13
functions.variables.update 483.54
functions.create 459.33
tablesdb.rows.delete 454.64

@Meldiron
Meldiron merged commit 06de6e4 into main Sep 29, 2026
51 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.

2 participants