Skip to content

make sure only Appwrite projects are fetched on self-hosted#2696

Merged
stnguyen90 merged 1 commit intomainfrom
fix-selfhosted-queries
Dec 12, 2025
Merged

make sure only Appwrite projects are fetched on self-hosted#2696
stnguyen90 merged 1 commit intomainfrom
fix-selfhosted-queries

Conversation

@atharvadeosthale
Copy link
Copy Markdown
Member

@atharvadeosthale atharvadeosthale commented Dec 10, 2025

Summary by CodeRabbit

  • Bug Fixes
    • Fixed organization filtering to properly differentiate between cloud and non-cloud deployments, ensuring the correct organizations are displayed in each environment.
    • Corrected platform validation logic to skip unnecessary redirects in non-cloud deployments while maintaining proper routing for cloud environments.

✏️ Tip: You can customize this high-level summary in your review settings.

@appwrite
Copy link
Copy Markdown

appwrite Bot commented Dec 10, 2025

Console (appwrite/console)

Project ID: 688b7bf400350cbd60e9

Sites (1)
Site Status Logs Preview QR
 console-stage
688b7cf6003b1842c9dc
Ready Ready View Logs Preview URL QR Code

Tip

Custom domains work with both CNAME for subdomains and NS records for apex domains

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Dec 10, 2025

Walkthrough

The pull request refactors platform-related checks and filters across four route and utility files to distinguish between cloud and non-cloud deployments. Changes include replacing a hardcoded platform string with a Platform enum constant, conditionally applying platform filters only when isCloud is true, and adding early returns in redirect logic to skip platform-based redirects in non-cloud environments. The modifications alter how organizations are queried and how users are redirected based on deployment context.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

  • Homogeneous pattern: All changes follow a consistent theme of gating platform-related logic with isCloud conditionals
  • Single enum constant substitution in one file; straightforward conditional additions across others
  • No complex logic density or structural refactoring
  • Key areas to verify:
    • Ensure non-cloud deployments correctly omit platform filtering in organization queries
    • Confirm redirect logic properly skips platform-based redirects when not in cloud mode
    • Validate that early return in checkPlatformAndRedirect doesn't inadvertently skip necessary logic for cloud deployments

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: ensuring only Appwrite projects are fetched in self-hosted deployments by adding platform filters and conditional logic across multiple routes.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-selfhosted-queries

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 6c838e3 and ab99fb8.

📒 Files selected for processing (4)
  • src/lib/commandCenter/searchers/organizations.ts (1 hunks)
  • src/routes/(console)/account/organizations/+page.ts (1 hunks)
  • src/routes/(console)/organization-[organization]/+layout.ts (1 hunks)
  • src/routes/(console)/project-[region]-[project]/+layout.ts (1 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{ts,tsx,js,jsx,svelte}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx,js,jsx,svelte}: Import reusable modules from the src/lib directory using the $lib alias
Use minimal comments in code; reserve comments for TODOs or complex logic explanations
Use $lib, $routes, and $themes aliases instead of relative paths for module imports

Files:

  • src/routes/(console)/project-[region]-[project]/+layout.ts
  • src/lib/commandCenter/searchers/organizations.ts
  • src/routes/(console)/organization-[organization]/+layout.ts
  • src/routes/(console)/account/organizations/+page.ts
**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

**/*.ts: Define types inline or in .d.ts files, avoid creating separate .types.ts files
Use TypeScript in non-strict mode; any type is tolerated in this project

Files:

  • src/routes/(console)/project-[region]-[project]/+layout.ts
  • src/lib/commandCenter/searchers/organizations.ts
  • src/routes/(console)/organization-[organization]/+layout.ts
  • src/routes/(console)/account/organizations/+page.ts
**/*.{ts,tsx,js,jsx,svelte,json}

📄 CodeRabbit inference engine (AGENTS.md)

Use 4 spaces for indentation, single quotes, 100 character line width, and no trailing commas per Prettier configuration

Files:

  • src/routes/(console)/project-[region]-[project]/+layout.ts
  • src/lib/commandCenter/searchers/organizations.ts
  • src/routes/(console)/organization-[organization]/+layout.ts
  • src/routes/(console)/account/organizations/+page.ts
src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

Configure dynamic routes using SvelteKit convention with [param] syntax in route directory names

Files:

  • src/routes/(console)/project-[region]-[project]/+layout.ts
  • src/routes/(console)/organization-[organization]/+layout.ts
  • src/routes/(console)/account/organizations/+page.ts
🧠 Learnings (2)
📓 Common learnings
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2670
File: src/routes/(console)/organization-[organization]/+layout.ts:134-150
Timestamp: 2025-12-05T09:24:15.846Z
Learning: In the Appwrite console codebase, `prefs.organization` is maintained to always reference an organization with Platform.Appwrite, so when using preferences.organization as a fallback in redirect logic, no additional platform validation is required.
📚 Learning: 2025-12-05T09:24:15.846Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2670
File: src/routes/(console)/organization-[organization]/+layout.ts:134-150
Timestamp: 2025-12-05T09:24:15.846Z
Learning: In the Appwrite console codebase, `prefs.organization` is maintained to always reference an organization with Platform.Appwrite, so when using preferences.organization as a fallback in redirect logic, no additional platform validation is required.

Applied to files:

  • src/routes/(console)/project-[region]-[project]/+layout.ts
  • src/lib/commandCenter/searchers/organizations.ts
  • src/routes/(console)/organization-[organization]/+layout.ts
  • src/routes/(console)/account/organizations/+page.ts
🧬 Code graph analysis (4)
src/routes/(console)/project-[region]-[project]/+layout.ts (2)
src/lib/system.ts (1)
  • isCloud (26-26)
src/lib/stores/organization.ts (1)
  • organization (63-63)
src/lib/commandCenter/searchers/organizations.ts (2)
src/lib/system.ts (1)
  • isCloud (26-26)
src/lib/stores/sdk.ts (1)
  • sdk (173-196)
src/routes/(console)/organization-[organization]/+layout.ts (1)
src/lib/system.ts (1)
  • isCloud (26-26)
src/routes/(console)/account/organizations/+page.ts (1)
src/lib/system.ts (1)
  • isCloud (26-26)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: build
  • GitHub Check: e2e
🔇 Additional comments (5)
src/lib/commandCenter/searchers/organizations.ts (2)

6-6: LGTM: Using Platform enum constant.

Good refactor from hard-coded string to typed enum constant.


11-13: LGTM: Platform filter correctly applied for cloud deployments.

The cloud path now uses Platform.Appwrite constant for filtering, consistent with the typed enum approach.

src/routes/(console)/account/organizations/+page.ts (1)

17-17: LGTM: Conditional platform filter correctly implemented.

The conditional spread ensures platform filtering is only applied in cloud deployments, aligning with the PR objective to fetch all organizations in self-hosted environments.

src/routes/(console)/project-[region]-[project]/+layout.ts (1)

45-52: LGTM: Platform-based redirect correctly gated for cloud only.

The redirect now only executes in cloud deployments when the organization platform doesn't match Appwrite, which aligns with the PR objective to skip platform-specific logic in self-hosted environments.

src/routes/(console)/organization-[organization]/+layout.ts (1)

116-117: LGTM: Clean early return for self-hosted deployments.

The early return efficiently bypasses all platform-based redirect logic in self-hosted environments, which is the core objective of this PR.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@stnguyen90 stnguyen90 merged commit 7269eff into main Dec 12, 2025
4 checks passed
@stnguyen90 stnguyen90 deleted the fix-selfhosted-queries branch December 12, 2025 23:24
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