-
Notifications
You must be signed in to change notification settings - Fork 188
fix push columns in tablesdb cli #1184
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
Conversation
Walkthrough
Possibly related PRs
Suggested reviewers
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 💡 Knowledge Base configuration:
You can enable these sources in your CodeRabbit configuration. 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ 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)
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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 (5)
example.php (1)
42-42
: Parameterize the spec platform via environment variable
Avoid hardcoding'console'
; use an env var with a fallback to preserve the current behavior. Verified that the default console spec URL returns HTTP 200.- $platform = 'console'; + $platform = getenv('APPWRITE_SPEC_PLATFORM') ?: 'console';templates/cli/lib/commands/push.js.twig (1)
921-939
: Await only created columns and report accurate count.Currently, you await all non-child
table.columns
and always logcolumns.length
, which may include child columns or columns not created in this batch. Awaiting just the created subset and logging its count makes the step faster and the message accurate.Apply:
const createColumns = async (columns, table) => { - for (let column of columns) { + for (let column of columns) { if (column.side !== 'child') { await createAttribute(table['databaseId'], table['$id'], column); } } - const result = await awaitPools.expectAttributes( - table['databaseId'], - table['$id'], - table.columns.filter(column => column.side !== 'child').map(column => column.key) - ); + const keysToAwait = columns + .filter(column => column.side !== 'child') + .map(column => column.key); + + const result = await awaitPools.expectAttributes( + table['databaseId'], + table['$id'], + keysToAwait + ); if (!result) { throw new Error(`Column creation timed out.`); } - success(`Created ${columns.length} columns`); + success(`Created ${keysToAwait.length} columns`); }templates/cli/lib/commands/generic.js.twig (3)
75-80
: Validate MFA factor before creating a challenge.Guard against unsupported factors to fail fast with a clear error.
const { factor } = mfa ? { factor: mfa } : await inquirer.prompt(questionsListFactors); + const allowedFactors = ['totp', 'email', 'phone', 'recoveryCode']; + if (!allowedFactors.includes(factor)) { + throw new Error(`Unsupported MFA factor: ${factor}`); + } + const challenge = await accountCreateMFAChallenge({ factor, parseOutput: false, sdk: client });
83-89
: Harden error handling for invalid/expired MFA codes.Wrap the update call to translate common OTP errors into a clearer message while preserving unexpected errors.
- await accountUpdateMFAChallenge({ - challengeId: challenge.$id, - otp, - parseOutput: false, - sdk: client - }); + try { + await accountUpdateMFAChallenge({ + challengeId: challenge.$id, + otp, + parseOutput: false, + sdk: client + }); + } catch (e) { + // Adjust conditions to your SDK's error codes if different + if (e?.response === 'user_mfa_challenge_invalid' || e?.response === 'user_mfa_code_invalid') { + throw new Error('Invalid or expired MFA code. Please try again.'); + } + throw e; + }
97-99
: Fix self-hosted hint condition (uses endpoint arg instead of effective endpoint).Using the raw
endpoint
arg can show the hint even when the default endpoint is in use (e.g., whenendpoint
is undefined). Base the check onconfigEndpoint
.- if (endpoint !== DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials') { - log('Use the --endpoint option for self-hosted instances') - } + if (configEndpoint === DEFAULT_ENDPOINT && error.response === 'user_invalid_credentials') { + hint('If you are using a self-hosted instance, pass --endpoint <url> to target your self-hosted Appwrite.') + }
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (6)
example.php
(1 hunks)templates/cli/lib/commands/generic.js.twig
(2 hunks)templates/cli/lib/commands/push.js.twig
(2 hunks)templates/cli/lib/questions.js.twig
(4 hunks)templates/react-native/src/models.ts.twig
(1 hunks)templates/web/src/models.ts.twig
(1 hunks)
⏰ 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). (17)
- GitHub Check: build (8.3, Python39)
- GitHub Check: build (8.3, WebChromium)
- GitHub Check: build (8.3, PHP83)
- GitHub Check: build (8.3, AppleSwift56)
- GitHub Check: build (8.3, Ruby31)
- GitHub Check: build (8.3, Python312)
- GitHub Check: build (8.3, Python311)
- GitHub Check: build (8.3, Swift56)
- GitHub Check: build (8.3, KotlinJava17)
- GitHub Check: build (8.3, DotNet60)
- GitHub Check: build (8.3, Deno1193)
- GitHub Check: build (8.3, DartBeta)
- GitHub Check: build (8.3, KotlinJava8)
- GitHub Check: build (8.3, FlutterStable)
- GitHub Check: build (8.3, FlutterBeta)
- GitHub Check: build (8.3, Android5Java17)
- GitHub Check: build (8.3, Android14Java17)
🔇 Additional comments (7)
templates/react-native/src/models.ts.twig (1)
14-14
: Revert confirmed—no lingeringreadonly
references in RN templates.
- Ensure release notes mention the mutability change.
- Update any docs/examples still referencing
readonly
properties.templates/web/src/models.ts.twig (1)
17-17
: No stalereadonly
in web models
Search intemplates/web
forreadonly
properties returned no matches; types are now mutable as intended.templates/cli/lib/commands/push.js.twig (1)
1825-1825
: Correct callsite update.Switching from
createAttributes
tocreateColumns
for TablesDB is the right mapping.templates/cli/lib/questions.js.twig (2)
8-8
: MFA identifier normalization verified
Ran the providedrg
search and found no occurrences ofaccountListMfaFactors
orquestionsMfaChallenge
.
909-922
: questionsMFAChallenge rename verified No remaining references toquestionsMfaChallenge
found across the codebase.templates/cli/lib/commands/generic.js.twig (2)
81-81
: Ensure OTP input is masked in the prompt.Confirm
questionsMFAChallenge
defines the OTP question with a password/masked input to avoid echoing secrets on screen.
9-10
: Renamed imports verified: no remaining references to old symbols.Confirmed there are no occurrences of
questionsMfaChallenge
,accountCreateMfaChallenge
,accountUpdateMfaChallenge
, oraccountListMfaFactors
in the codebase;../questions
and./account
export the updated identifiers.
Summary by CodeRabbit
New Features
Bug Fixes
Refactor
Chores