Conversation
Console (appwrite/console)Project ID: Tip Dynamic API keys are generated automatically for each function execution |
|
Warning Rate limit exceeded
⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. WalkthroughAdds four new text column types (varchar, text, mediumtext, longtext) across types, helpers, stores, row renderers, and UI editors with create/update SDK handlers; preserves a deprecated String option. Extends faker and filter operator type support for these types. Replaces IndexOrder with OrderBy in index flows. Replaces literal service and resource strings with BackupServices and Resources enums in backups and migration logic. Tightens numerous function/API scope typings to Scopes. Updates the Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes 🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ 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.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/empty.svelte (2)
999-1082:⚠️ Potential issue | 🔴 CriticalAdd handlers for new text column types (text, varchar, mediumtext, longtext) in
createColumns.The new text types are available for selection in the column picker via
basicColumnOptions, but thisswitchstatement has no cases for them. If a user selects one of these types and clicks "Apply", the switch falls through silently —columnResultremainsundefined, gets pushed toresults, and the column is never created on the backend.Add cases for each type:
Proposed fix
case 'polygon': columnResult = await client.tablesDB.createPolygonColumn(baseParams); break; + + case 'text': + columnResult = await client.tablesDB.createTextColumn({ + ...baseParams, + xdefault: (column.default as string) || null + }); + break; + + case 'varchar': + columnResult = await client.tablesDB.createVarcharColumn({ + ...baseParams, + size: column.size || 255, + xdefault: (column.default as string) || null + }); + break; + + case 'mediumtext': + columnResult = await client.tablesDB.createMediumtextColumn({ + ...baseParams, + xdefault: (column.default as string) || null + }); + break; + + case 'longtext': + columnResult = await client.tablesDB.createLongtextColumn({ + ...baseParams, + xdefault: (column.default as string) || null + }); + break; }
1114-1128:⚠️ Potential issue | 🟠 MajorUpdate placeholder columns to use
type: 'text'instead oftype: 'string'.The placeholder columns use
type: 'string', but this type does not exist incolumnOptions—available database types are 'text', 'mediumtext', 'longtext', 'varchar', 'integer', 'double', 'boolean', 'datetime', and 'point'. WhengetColumnOption('string')is called, it returnsundefined, causing the UI to fall back to 'Text'. Change the placeholder type to'text'to match the first available option and ensure consistency with the type system. Additionally, verify thatmockSuggestions.columnsin the store also uses valid database types.
🤖 Fix all issues with AI agents
In
`@src/routes/`(console)/project-[region]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte:
- Around line 35-37: The prop type for column needs to include all string-like
column models; update the column prop union to add Models.ColumnVarchar,
Models.ColumnText, Models.ColumnMediumtext, and Models.ColumnLongtext so the
component accepts the types mapped by column.svelte, and change the cast at the
size expression (currently "(column as Models.ColumnString).size") to a broader
union that includes Models.ColumnVarchar (e.g., cast to Models.ColumnString |
Models.ColumnVarchar or a union of all string-like models exposing .size) so the
.size access is type-safe.
🧹 Nitpick comments (2)
src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/settings/displayName.svelte (1)
48-53: Consider extracting thetextTypesarray to a shared constant.The same
['string', 'varchar', 'text', 'mediumtext', 'longtext']array is defined in multiple places (here,rows/store.ts, and likely others). Extracting it to a shared utility (e.g., alongsideisTextTypeinrows/store.tsor in a common helpers file) would keep the list in sync as types evolve.src/routes/(console)/project-[region]-[project]/databases/database-[database]/table-[table]/columns/varchar.svelte (1)
93-96: Consider disabling submit when row size is exceeded.
exceedsLimitis used only for a visual warning (Lines 147-151), but nothing prevents the user from actually submitting a column that exceeds the row size limit. The server will reject it, but the UX would be smoother if the form submit were also disabled whenexceedsLimitis true.
...gion]-[project]/databases/database-[database]/table-[table]/rows/columns/types/string.svelte
Show resolved
Hide resolved
…ckupServices - Replace IndexOrder enum with SDK's OrderBy enum in indexes-related files - Cast scopes arrays to Scopes[] type in function settings files - Use Resources enum values in migration store and forms - Use BackupServices enum in database backup operations - Update migrations pages to use Scopes enum instead of string literals Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (2)
src/routes/(console)/project-[region]-[project]/functions/create-function/template-[template]/+page.svelte (1)
1-1:⚠️ Potential issue | 🟡 MinorFix Prettier formatting issues flagged by CI.
The pipeline reports code style issues found by Prettier for this file. Please run
prettier --writeon this file to resolve.src/lib/stores/migration.ts (1)
140-158:⚠️ Potential issue | 🔴 CriticalShallow copy mutates
initialFormData— this corrupts subsequent calls.
{ ...initialFormData }is a shallow copy. The nested objects (users,databases,functions,storage) are still shared references. When you setformData.users.root = trueon Line 143, you mutate the originalinitialFormData.usersobject. After the firstselectAll()call,initialFormDatais permanently tainted, breakingdeselectAll()and store resets.The same shallow-copy pattern exists in
createMigrationFormStore(Line 27–29).🐛 Proposed fix — use a deep-clone helper
+const cloneFormData = (): MigrationFormData => JSON.parse(JSON.stringify(initialFormData)); + export const createMigrationFormStore = () => { - const store = writable({ ...initialFormData }); + const store = writable(cloneFormData()); const reset = () => { - store.set({ ...initialFormData }); + store.set(cloneFormData()); }; return { ...store, reset }; };-export const resourcesToMigrationForm = (resources: Resources[]): MigrationFormData => { - const formData = { ...initialFormData }; +export const resourcesToMigrationForm = (resources: Resources[]): MigrationFormData => { + const formData = cloneFormData(); if (resources.includes(Resources.User)) {
🤖 Fix all issues with AI agents
In `@src/routes/`(console)/(migration-wizard)/resource-form.svelte:
- Around line 100-102: The alert about functions is now unreachable because
shouldRenderGroup('functions') always returns false; update the UI by removing
the unreachable <Alert.Inline> or change its copy/placement to reflect reality:
either delete the functions-specific alert block (the conditional that renders
the Alert.Inline for "Functions not available for import") or move it outside
the functions group check and change the message to a generic "Functions import
is not currently supported" so it no longer implies provider/version-specific
behavior; search for shouldRenderGroup('functions') and the Alert.Inline that
references functions to locate the code to update.
In
`@src/routes/`(console)/project-[region]-[project]/functions/function-[function]/settings/updateScopes.svelte:
- Line 42: The scopes field currently sends "functionScopes as ScopesType[]"
which can be null; change the payload to pass "functionScopes as ScopesType[] ||
undefined" (or equivalent) so null is converted to undefined before the API
call. Locate the code in updateScopes.svelte where scopes is assigned
(reference: functionScopes and ScopesType) and add the || undefined fallback to
match the pattern used in updateRuntime.svelte/updateName.svelte and ensure the
API never receives a null scopes value.
🧹 Nitpick comments (6)
src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateBuildCommand.svelte (1)
16-16: Pre-existing: function nameupdateLoggingdoesn't match its purpose.This function updates the build command (per the notification message and analytics event), but is named
updateLogging— likely a copy-paste artifact. Consider renaming toupdateBuildCommandfor clarity.✏️ Suggested rename
- async function updateLogging() { + async function updateBuildCommand() {And on line 58:
-<Form onSubmit={updateLogging}> +<Form onSubmit={updateBuildCommand}>src/routes/(console)/project-[region]-[project]/functions/function-[function]/settings/updateLogging.svelte (1)
34-34: Cast is acceptable but lacks runtime validation unlikeRuntime.The
as Scopes[]cast safely bridges thestring[]model type to the expectedScopes[]parameter type. Since scopes originate from the server, they should always be valid enum members, making this reasonable.Worth noting:
Runtimeis validated at runtime viaisValueOfStringEnum(line 19), butscopesis not. If you ever want parity, a similar guard could be added. This is a minor inconsistency and not blocking, especially since this pattern is applied consistently across all function settings files.src/routes/(console)/project-[region]-[project]/functions/create-function/template-[template]/+page.svelte (1)
143-143: Cast looks correct; consider declaringselectedScopesasScopes[]at the source.The
as Scopes[]cast is safe here given the values originate from thePermissionscomponent. However, declaringselectedScopesasScopes[](line 65) instead ofstring[]would push type safety upstream and eliminate the need for this assertion entirely.- let selectedScopes: string[] = []; + let selectedScopes: Scopes[] = [];src/lib/stores/migration.ts (2)
55-56:Object.values(Resources)auto-includes any future enum members.This is likely intentional for Appwrite-to-Appwrite migrations (all resources should be migratable), but worth noting: if the upstream
Resourcesenum gains values that the migration backend doesn't support yet, this will silently pass unsupported resource types. A brief inline comment confirming the intent would help future maintainers.
148-153: Unnecessaryas Resources[]casts.The array literals already contain
Resourcesenum values, so TypeScript infers the type correctly. Theas Resources[]casts are redundant.Proposed cleanup
if ( - includesAll(resources, [Resources.Table, Resources.Column, Resources.Row] as Resources[]) + includesAll(resources, [Resources.Table, Resources.Column, Resources.Row]) ) { formData.databases.rows = true; } - if (includesAll(resources, [Resources.Bucket, Resources.File] as Resources[])) { + if (includesAll(resources, [Resources.Bucket, Resources.File])) { formData.storage.root = true; }src/routes/(console)/project-[region]-[project]/settings/migrations/exportModal.svelte (1)
94-112: Scopes list is duplicated with+page.svelte'sdeployToCloud.Lines 94–112 define the exact same scopes array as
deployToCloudin+page.svelte(Lines 92–110). Consider extracting a sharedmigrationScopesconstant (e.g., in$lib/stores/migration.tsalongside the other migration utilities) to keep both call sites in sync.
...nsole)/project-[region]-[project]/functions/function-[function]/settings/updateScopes.svelte
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ColumnVarchar, ColumnText, ColumnMediumtext, ColumnLongtext to string.svelte column prop type - Update type cast to include ColumnVarchar for size property access - Remove unreachable functions migration alert (shouldRenderGroup always returns false for functions) - Add || undefined fallback to scopes in updateScopes.svelte for consistency Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
...es/(console)/project-[region]-[project]/databases/database-[database]/(suggestions)/store.ts
Show resolved
Hide resolved
...nsole)/project-[region]-[project]/databases/database-[database]/(suggestions)/indexes.svelte
Show resolved
Hide resolved
...t-[region]-[project]/databases/database-[database]/table-[table]/settings/displayName.svelte
Outdated
Show resolved
Hide resolved
...nsole)/project-[region]-[project]/functions/create-function/template-[template]/+page.svelte
Outdated
Show resolved
Hide resolved
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Move casts to the model boundary (where SDK models return string[]) and remove unnecessary casts at SDK call sites. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
| import { Fieldset, Layout, Selector } from '@appwrite.io/pink-svelte'; | ||
| import type { Scopes } from '@appwrite.io/console'; | ||
|
|
||
| export let templateScopes: string[]; |
| entrypoint: $func.entrypoint, | ||
| commands: $func.commands || undefined, | ||
| scopes: $func.scopes || undefined, | ||
| scopes: ($func.scopes as Scopes[]) || undefined, |
There was a problem hiding this comment.
might need the sdk model to return func.scopes as Scopes and not string[] later. Not a blocker for this one for now 👍

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
Changes
Chores