Skip to content

Conversation

@ItzNotABug
Copy link
Member

@ItzNotABug ItzNotABug commented Nov 27, 2025

What does this PR do?

(Provide a description of what this PR does.)

Test Plan

(Write your test plan here. If you changed any code, please provide us with clear instructions on how you verified your changes work.)

Related PRs and Issues

(If this PR is related to any other PR or resolves any issue or related to any issue link all related PR and issues here.)

Have you read the Contributing Guidelines on issues?

(Write your answer here.)

Summary by CodeRabbit

  • New Features

    • Organization plan information is now available and accessible within the project context.
  • Chores

    • Updated console package dependency to the latest version.
    • Improved internal consistency through platform value standardization across organization and domain queries.

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

@ItzNotABug ItzNotABug self-assigned this Nov 27, 2025
@appwrite
Copy link

appwrite bot commented Nov 27, 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

JWT tokens let functions act on behalf of users while preserving their permissions

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 27, 2025

Walkthrough

This pull request updates the @appwrite.io/console dependency to a new version and refactors platform comparisons across the codebase. The primary change replaces hardcoded string literal 'appwrite' with a typed Platform.Appwrite enum constant imported from the updated dependency in Query.equal() calls across eight route files. Additionally, src/routes/(console)/project-[region]-[project]/+layout.ts restructures organizationPlan loading to be null-safe by deferring its computation after Promise.all completes, and exposes it as currentPlan in the load function's return value.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • src/routes/(console)/project-[region]-[project]/+layout.ts: This file contains the most complex changes—restructured organizationPlan loading logic that defers computation after Promise.all, introduces null-safe access patterns, and adds a new currentPlan property to the public return value. Verify the null-safety implementation and confirm the new return value doesn't break downstream consumers.
  • Repetitive enum replacements: Seven other files follow a consistent pattern of importing Platform and replacing string literals with Platform.Appwrite. Verify the import statement and the replacement pattern are consistent across all files.
  • Dependency update: Confirm that the version bump for @appwrite.io/console is intentional and that Platform is properly exported from the new version.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
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.
Title check ❓ Inconclusive The title 'Fix filtering' is vague and does not clearly convey the main changes; it lacks specifics about what filtering is being fixed or which components are affected. Consider using a more descriptive title that specifies the filtering change, such as 'Replace hard-coded platform strings with Platform enum' or 'Use Platform.Appwrite enum for platform filtering queries'.
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
✨ 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-filtering

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.

@appwrite appwrite locked and limited conversation to collaborators Nov 27, 2025
@appwrite appwrite unlocked this conversation Nov 27, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

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

41-47: Unnecessary optional chaining after organization is guaranteed to exist.

After line 39, organization is guaranteed to be defined (assigned from org if it was null). The optional chaining on lines 44 and 46 is unnecessary and inconsistent with line 70 which correctly uses organization.billingPlan without optional chaining.

     // fetch if not available in `plansInfo`.
     // out of promise.all because we filter orgs based on platform now!
     const organizationPlan = includedInBasePlans
-        ? plansInfo.get(organization?.billingPlan)
+        ? plansInfo.get(organization.billingPlan)
         : isCloud
-          ? await sdk.forConsole.billing.getOrganizationPlan(organization?.$id)
+          ? await sdk.forConsole.billing.getOrganizationPlan(organization.$id)
           : null;
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 7a00fac and 71cad9b.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (9)
  • package.json (1 hunks)
  • src/lib/stores/billing.ts (2 hunks)
  • src/routes/(console)/account/organizations/+page.ts (2 hunks)
  • src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts (1 hunks)
  • src/routes/(console)/project-[region]-[project]/+layout.ts (1 hunks)
  • src/routes/(public)/functions/deploy/+page.ts (3 hunks)
  • src/routes/(public)/sites/deploy/+page.ts (3 hunks)
  • src/routes/(public)/template-[template]/+page.ts (2 hunks)
  • src/routes/+layout.ts (2 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/(public)/functions/deploy/+page.ts
  • src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts
  • src/lib/stores/billing.ts
  • src/routes/(console)/account/organizations/+page.ts
  • src/routes/(public)/template-[template]/+page.ts
  • src/routes/(public)/sites/deploy/+page.ts
  • src/routes/+layout.ts
  • src/routes/(console)/project-[region]-[project]/+layout.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/(public)/functions/deploy/+page.ts
  • src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts
  • src/lib/stores/billing.ts
  • src/routes/(console)/account/organizations/+page.ts
  • src/routes/(public)/template-[template]/+page.ts
  • src/routes/(public)/sites/deploy/+page.ts
  • src/routes/+layout.ts
  • src/routes/(console)/project-[region]-[project]/+layout.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/(public)/functions/deploy/+page.ts
  • src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts
  • src/lib/stores/billing.ts
  • src/routes/(console)/account/organizations/+page.ts
  • src/routes/(public)/template-[template]/+page.ts
  • src/routes/(public)/sites/deploy/+page.ts
  • package.json
  • src/routes/+layout.ts
  • src/routes/(console)/project-[region]-[project]/+layout.ts
src/routes/**

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • src/routes/(public)/functions/deploy/+page.ts
  • src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts
  • src/routes/(console)/account/organizations/+page.ts
  • src/routes/(public)/template-[template]/+page.ts
  • src/routes/(public)/sites/deploy/+page.ts
  • src/routes/+layout.ts
  • src/routes/(console)/project-[region]-[project]/+layout.ts
🧠 Learnings (4)
📚 Learning: 2025-10-26T10:21:24.499Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2509
File: src/routes/(console)/project-[region]-[project]/auth/user-[user]/identities/table.svelte:24-39
Timestamp: 2025-10-26T10:21:24.499Z
Learning: SDK methods from `sdk.forProject(...).users`, `sdk.forProject(...).teams`, and other Appwrite SDK endpoints always throw `AppwriteException` from `appwrite.io/console`, so caught errors can be returned directly without normalization in deletion handlers.

Applied to files:

  • src/lib/stores/billing.ts
  • src/routes/+layout.ts
📚 Learning: 2025-11-25T03:15:27.539Z
Learnt from: CR
Repo: appwrite/console PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T03:15:27.539Z
Learning: Applies to **/*.{ts,tsx,js,jsx,svelte} : Use $lib, $routes, and $themes aliases instead of relative paths for module imports

Applied to files:

  • src/routes/(public)/template-[template]/+page.ts
📚 Learning: 2025-11-25T03:15:27.539Z
Learnt from: CR
Repo: appwrite/console PR: 0
File: AGENTS.md:0-0
Timestamp: 2025-11-25T03:15:27.539Z
Learning: Applies to src/routes/**/*.svelte : Use SvelteKit file conventions: +page.svelte for components, +page.ts for data loaders, +layout.svelte for wrappers, +error.svelte for error handling, and dynamic route params in square brackets like [param]

Applied to files:

  • src/routes/(public)/template-[template]/+page.ts
📚 Learning: 2025-09-26T06:48:57.938Z
Learnt from: ItzNotABug
Repo: appwrite/console PR: 2373
File: src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte:629-631
Timestamp: 2025-09-26T06:48:57.938Z
Learning: In the Appwrite console codebase using appwrite.io/pink-svelte, the Icon component automatically handles CSS variable names passed to its color prop by internally wrapping them with var(). Therefore, passing '--some-css-variable' as a string to the Icon color prop works correctly without needing to manually wrap it with var().

Applied to files:

  • package.json
🧬 Code graph analysis (2)
src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts (7)
src/routes/(console)/account/organizations/+page.ts (1)
  • load (8-29)
src/routes/(public)/functions/deploy/+page.ts (1)
  • load (12-111)
src/routes/(public)/sites/deploy/+page.ts (1)
  • load (12-128)
src/routes/(public)/template-[template]/+page.ts (1)
  • load (10-66)
src/routes/+layout.ts (1)
  • load (17-71)
src/lib/system.ts (1)
  • isCloud (26-26)
src/lib/stores/sdk.ts (1)
  • sdk (173-196)
src/routes/(console)/project-[region]-[project]/+layout.ts (4)
src/lib/stores/billing.ts (1)
  • plansInfo (75-75)
src/lib/stores/organization.ts (2)
  • organization (62-62)
  • Organization (16-38)
src/routes/(console)/project-[region]-[project]/store.ts (2)
  • regionalConsoleVariables (34-39)
  • project (11-11)
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: e2e
  • GitHub Check: build
🔇 Additional comments (11)
src/routes/+layout.ts (1)

11-11: LGTM! Type-safe platform filtering.

The migration from string literal 'appwrite' to Platform.Appwrite enum improves type safety and maintainability.

Also applies to: 46-46

src/routes/(public)/functions/deploy/+page.ts (1)

6-6: LGTM! Consistent enum usage.

Both organization queries correctly use Platform.Appwrite instead of the string literal, maintaining consistency throughout the function flow.

Also applies to: 70-70, 94-94

src/lib/stores/billing.ts (1)

27-27: LGTM! Consistent platform filtering.

The checkForMissingPaymentMethod function now uses the typed Platform.Appwrite enum, maintaining consistency with the platform filtering changes across the codebase.

Also applies to: 561-561

src/routes/(public)/template-[template]/+page.ts (1)

3-3: LGTM! Type-safe platform query.

The platform filter correctly uses Platform.Appwrite enum in the cloud path organization query.

Also applies to: 43-45

src/routes/(public)/sites/deploy/+page.ts (1)

6-6: LGTM! Consistent refactoring.

Both organization queries use Platform.Appwrite consistently, matching the pattern in the functions deployment route.

Also applies to: 87-87, 112-112

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

1-1: LGTM! Correct enum usage in queries array.

The platform filter correctly uses Platform.Appwrite in the queries array for paginated organization listing.

Also applies to: 17-17

src/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.ts (1)

4-4: LGTM! Type-safe platform filtering.

The platform query correctly uses Platform.Appwrite enum and maintains consistent array formatting with other routes.

Also applies to: 11-13

package.json (1)

25-25: Dependency version update verified and Platform enum is properly exported.

The package at https://pkg.vc/-/@appwrite/@appwrite.io/console@406d8be is accessible, and the Platform enum is correctly imported and used in src/lib/stores/billing.ts (line 27 import, line 561 usage: Query.equal('platform', Platform.Appwrite)). The version update is valid and supports the Platform enum used throughout the codebase.

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

26-27: LGTM!

The null-safe check with optional chaining is appropriate here since organization may not be found in the filtered list at this point.


29-37: LGTM!

The restructuring of Promise.all to exclude organizationPlan and compute it separately is appropriate given the new platform-based filtering logic.


73-80: LGTM!

The new currentPlan property cleanly exposes the organization plan. Ensure downstream consumers handle the null case appropriately when not in cloud mode.

@ItzNotABug ItzNotABug merged commit c09e82d into main Nov 27, 2025
4 checks passed
@ItzNotABug ItzNotABug deleted the fix-filtering branch November 27, 2025 08:20
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.

3 participants