-
Notifications
You must be signed in to change notification settings - Fork 198
Fix filtering #2650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix filtering #2650
Conversation
Console (appwrite/console)Project ID: Tip JWT tokens let functions act on behalf of users while preserving their permissions |
WalkthroughThis pull request updates the Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes
Pre-merge checks and finishing touches❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this 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,
organizationis guaranteed to be defined (assigned fromorgif it was null). The optional chaining on lines 44 and 46 is unnecessary and inconsistent with line 70 which correctly usesorganization.billingPlanwithout 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
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis 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.tssrc/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.tssrc/lib/stores/billing.tssrc/routes/(console)/account/organizations/+page.tssrc/routes/(public)/template-[template]/+page.tssrc/routes/(public)/sites/deploy/+page.tssrc/routes/+layout.tssrc/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.tssrc/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.tssrc/lib/stores/billing.tssrc/routes/(console)/account/organizations/+page.tssrc/routes/(public)/template-[template]/+page.tssrc/routes/(public)/sites/deploy/+page.tssrc/routes/+layout.tssrc/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.tssrc/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.tssrc/lib/stores/billing.tssrc/routes/(console)/account/organizations/+page.tssrc/routes/(public)/template-[template]/+page.tssrc/routes/(public)/sites/deploy/+page.tspackage.jsonsrc/routes/+layout.tssrc/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.tssrc/routes/(console)/organization-[organization]/domains/domain-[domain]/settings/+page.tssrc/routes/(console)/account/organizations/+page.tssrc/routes/(public)/template-[template]/+page.tssrc/routes/(public)/sites/deploy/+page.tssrc/routes/+layout.tssrc/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.tssrc/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'toPlatform.Appwriteenum 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.Appwriteinstead 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
checkForMissingPaymentMethodfunction now uses the typedPlatform.Appwriteenum, 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.Appwriteenum 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.Appwriteconsistently, 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.Appwritein 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.Appwriteenum 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@406d8beis accessible, and the Platform enum is correctly imported and used insrc/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
organizationmay not be found in the filtered list at this point.
29-37: LGTM!The restructuring of Promise.all to exclude
organizationPlanand compute it separately is appropriate given the new platform-based filtering logic.
73-80: LGTM!The new
currentPlanproperty cleanly exposes the organization plan. Ensure downstream consumers handle thenullcase appropriately when not in cloud mode.

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
Chores
✏️ Tip: You can customize this high-level summary in your review settings.