Skip to content

fix(console): accept null from nullable SDK model fields - #14693

Merged
Meldiron merged 1 commit into
mainfrom
fix/console-nullable-sdk-types
Oct 20, 2026
Merged

Meldiron merged 1 commit into
mainfrom
fix/console-nullable-sdk-types

Conversation

@Meldiron

@Meldiron Meldiron commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

What

Console code now type-checks against Console SDKs that type nullable model fields as T | null.

appwrite/sdk-generator 5.7.3 started emitting T | null for nullable model properties (appwrite/sdk-generator#2023). Main picked up 5.13.0 in 47e8aa1, so every preview SDK from bun run sdk:preview now has 387 | null fields that the pinned 19.1.0-rc.1 doesn't. A PR that pins one of these builds, as apps/console/AGENTS.md asks, fails lint:types with 89 errors in 40 files that have nothing to do with the PR. #14351 is the first PR to hit it. The next Console SDK release built with the new generator would hit the same errors.

  • Helper inputs that take API fields accept null: payment method summaries and the brand avatar, plan records and location-gated plans, downgrade target plans, dedicated database link inputs and engine matchers, impersonation checks, MCP OAuth token sets, analytics trend and traffic helpers, function schedule mode, message schedule defaults, backup size formatting, and the create-database backupsEnabled props.
  • Mappers into local shapes coalesce with ?? undefined: domain price quotes and dedicated database ports.
  • Usage merging skips data points without a time. Before, they were keyed under undefined or parsed to NaN.
  • sites.create takes typed params instead of as unknown, following the pattern of SiteUpdateParams.
  • types-baseline.json drops 15 errors these changes fix.

Verification

  • With @appwrite.io/[email protected], lint:types reports 1,806 known errors and no new ones.
  • With the 5.13.0 preview build from feat: strip image metadata on upload with a per-bucket stripMetadata … #14351 (pkg.pr.new/.../@appwrite.io/console@79eecfa) installed, lint:types reports no new errors. The only failure is 17 errors in react-query/hooks/databases.ts that disappear because the nullable request types accept them. A PR on a preview runs lint:types --update to drop them.
  • bun run test:unit: 611 pass.

Unblocks #14351.

🤖 Generated with Claude Code

appwrite/sdk-generator 5.7.3 types nullable model properties as `T | null`,
and 5.13.0 landed on main in 47e8aa1. Any preview Console SDK built with
`bun run sdk:preview` now carries those types, so a PR that pins one fails
`lint:types` with errors across billing, analytics, databases and usage.

Widen the console helpers that take these fields to accept null, coalesce
at the few boundaries that map into local shapes, and skip usage points
without a time. Type-checks cleanly against both 19.1.0-rc.1 and a 5.13.0
preview; the baseline shrinks by 15 errors.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@luxor-code-review

luxor-code-review Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Review complete. No issues found — approved ✅.


The change is a type-level nullability migration: SDK-generated model fields that may arrive as null from the API are now typed | null instead of relying on ?/undefined, and every consumer is updated to handle that state deliberately. No behavior, routing, or auth flows change.

Files Change
analytics/View.tsx, BreakdownPanel.tsx, TrafficSplit.tsx, SiteAnalyticsCard.tsx, report-pdf.ts Widen trend/format helpers to accept number | null | undefined and coalesce null stats to 0 in has-traffic and card rendering paths.
usage-events-common.ts, usage-gauges-common.ts Add group.time guards before parseISO so null-time buckets are skipped instead of producing NaN map keys.
PaymentMethodBrandAvatar.tsx, billing/BudgetCapSection.tsx, billing/utils.ts, downgrade-plan-losses.ts, start-plan.ts, plan-filter.ts Handle nullable card brand, billing budget, and plan capability flags (backupsEnabled, dedicated support) with strict === true/=== false and fallbacks.
Backups.tsx, CreateDatabase.tsx, CreateDatabaseBackupPolicies.tsx, CreateDatabaseSummary.tsx, DedicatedDatabasesSection.tsx Propagate nullable backupsEnabled and engine fields through the create-database and restore flows with explicit null handling.
dedicated-engine.ts, native-database-engines.ts, database-routes.ts, mysql-databases.ts, postgres-databases.ts Widen engine-detection helpers and route builders to accept string | null | undefined; normalize connectionPort null to undefined.
BuyDomainWizard.tsx, domains.ts, sites.ts Normalize nullable domain quote prices to undefined to preserve the map contract; narrow the site-create payload cast.
mcp-oauth.ts, console-impersonation.ts, openai-ads.ts, function-interval.ts Widen idToken/impersonatorUserId/interval to nullable with truthy/?? consumers unchanged.
types-baseline.json Remove baseline entries for the now-fixed type errors.

Reviewed commit: f7c5501

@appwrite

appwrite Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

New Console

Project ID: new-console

Sites (1)
Site Status Logs Preview QR
 New Console
new-console
Ready Ready View Logs Preview URL QR Code

Tip

Messaging handles push notifications, emails, and SMS through one unified API

@ghost

ghost commented Oct 19, 2026 •

Copy link
Copy Markdown

🟢 Tier S · Ready to merge

The Console now accepts nullable SDK model fields across billing, analytics, database, messaging, and plan helpers, coalescing nullable values when mapping into local shapes. Usage aggregation skips points without timestamps, site creation uses an SDK-derived parameter type, and the type-error baseline drops resolved entries.

Verdict New comments Fixed Still open
✅ Approved 0 0 0
📂 Walkthrough · 15
File Change
apps/console/src/components/global/shared/PaymentMethodBrandAvatar.tsx; apps/console/src/components/pages/organizations/$orgId/billing/BudgetCapSection.tsx; apps/console/src/components/pages/organizations/$orgId/billing/utils.ts Accept nullable payment-method fields and handle a nullable billing budget.
apps/console/src/components/pages/organizations/$orgId/domains/_components/BuyDomainWizard.tsx; apps/console/src/lib/react-query/hooks/domains.ts Normalize nullable domain quote prices when storing local quote state.
apps/console/src/components/pages/projects/$projectId/analytics/View.tsx; apps/console/src/components/pages/projects/$projectId/analytics/_components/BreakdownPanel.tsx; apps/console/src/components/pages/projects/$projectId/analytics/_components/TrafficSplit.tsx; apps/console/src/lib/analytics/export/report-pdf.ts Allow nullable analytics dimensions and metrics in analytics helpers.
apps/console/src/components/pages/projects/$projectId/sites/_components/SiteAnalyticsCard.tsx Handle nullable pageview counts and analytics change inputs.
apps/console/src/components/pages/projects/$projectId/databases/Backups.tsx Allow nullable backup sizes in formatting callbacks.
apps/console/src/components/pages/projects/$projectId/databases/CreateDatabase.tsx; apps/console/src/components/pages/projects/$projectId/databases/_components/CreateDatabaseBackupPolicies.tsx; apps/console/src/components/pages/projects/$projectId/databases/_components/CreateDatabaseSummary.tsx Accept nullable backup-enabled flags in database creation props.
apps/console/src/components/pages/projects/$projectId/databases/_components/DedicatedDatabasesSection.tsx; apps/console/src/lib/database-routes.ts; apps/console/src/lib/databases/dedicated-engine.ts; apps/console/src/lib/databases/native-database-engines.ts; apps/console/src/lib/react-query/hooks/mysql-databases.ts; apps/console/src/lib/react-query/hooks/postgres-databases.ts Handle nullable dedicated-database engine and port fields across routing and mapping helpers.
apps/console/src/components/pages/projects/$projectId/messaging/_components/MessageDeliveryDialogs.tsx Allow nullable message schedule defaults.
apps/console/src/lib/assistant/mcp-oauth.ts Allow a nullable MCP OAuth ID token.
apps/console/src/lib/billing/downgrade-plan-losses.ts; apps/console/src/lib/pricing/start-plan.ts; apps/console/src/lib/utils/plan-filter.ts Accept nullable billing-plan properties.
apps/console/src/lib/console-impersonation.ts; apps/console/src/lib/openai-ads.ts Accept nullable impersonator IDs in account payloads.
apps/console/src/lib/function-interval.ts Accept a nullable function schedule interval.
apps/console/src/lib/react-query/hooks/sites.ts Use an SDK-derived parameter type for site creation.
apps/console/src/lib/usage/usage-events-common.ts; apps/console/src/lib/usage/usage-gauges-common.ts Skip usage datapoints without timestamps during merging and gauge processing.
apps/console/types-baseline.json Remove resolved type-check errors from the baseline.

Reviewed f7c5501 · Details · Comment @hansi-codes review to re-run, or mention @hansi-codes with a question.

@ghost ghost left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟢 Tier S · Looks good to merge. Summary

@Meldiron
Meldiron merged commit dee30ab into main Oct 20, 2026
38 checks passed
@ChiragAgg5k ChiragAgg5k mentioned this pull request Oct 21, 2026
6 tasks
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