Skip to content

Vela 26.3 - #306

Merged
noctarius merged 9 commits into
mainfrom
vela-26.3
Apr 1, 2026
Merged

noctarius merged 9 commits into
mainfrom
vela-26.3

Conversation

@noctarius

Copy link
Copy Markdown
Collaborator

Release Vela-26.3 release PR

@noctarius noctarius self-assigned this Apr 1, 2026
Copilot AI review requested due to automatic review settings April 1, 2026 09:50

Copilot AI 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.

Pull request overview

Release PR for Vela 26.3, primarily adding branch-level SMTP auth configuration support in Studio while also standardizing byte formatting across the UI (binary vs decimal units).

Changes:

  • Add branch auth SMTP config endpoint/types and wire up Studio query/mutation + SMTP settings form.
  • Update formatBytes to support explicit binary vs decimal modes and update call sites across charts/usage/storage/backups UI.
  • Refactor several resource/usage displays to rely on formatBytes for consistent unit rendering.

Reviewed changes

Copilot reviewed 31 out of 32 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
packages/api-types/types/platform.d.ts Adds /auth/config/smtp/ platform path plus BranchAuthSmtpConfig schema + operations.
apps/studio/pages/org/[slug]/project/[ref]/branch/[branch]/reports/database.tsx Updates byte formatting calls to use decimal mode.
apps/studio/pages/api/platform/organizations/[slug]/projects/[ref]/branches/[branch]/auth/config/smtp.ts New API route to GET/PUT branch realm SMTP settings via Vela client.
apps/studio/lib/helpers.ts Changes formatBytes signature to require mode and updates units logic.
apps/studio/lib/helpers.test.ts Updates/expands tests for formatBytes binary/decimal behavior.
apps/studio/data/reports/database-charts.ts Updates chart tick formatters to specify byte mode explicitly.
apps/studio/data/auth/keys.ts Adds react-query key for branch SMTP config.
apps/studio/data/auth/auth-smtp-update-mutation.ts New mutation for updating branch SMTP config via platform endpoint.
apps/studio/data/auth/auth-smtp-query.ts New query + prefetch helper for branch SMTP config.
apps/studio/components/ui/Charts/ComposedChart.utils.tsx Updates tooltip byte formatting to use decimal mode.
apps/studio/components/ui/Charts/ComposedChart.tsx Updates y-axis formatting to use decimal mode.
apps/studio/components/ui/Charts/ChartHeader.tsx Updates header value formatting to use decimal mode.
apps/studio/components/layouts/AuthLayout/AuthLayout.utils.ts Adds SMTP item into Auth configuration menu.
apps/studio/components/layouts/AuthLayout/AuthEmailsLayout.tsx Alters emails layout navigation handling (currently commented out).
apps/studio/components/interfaces/UnifiedLogs/ServiceFlow/config/serviceFlowFields.ts Updates content-length formatting to decimal mode.
apps/studio/components/interfaces/Storage/StorageSettings/StorageSettings.tsx Updates max upload size display to decimal mode.
apps/studio/components/interfaces/Storage/StorageExplorer/PreviewPane.tsx Updates file size formatting to decimal mode.
apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerRow.tsx Updates list row file size formatting to decimal mode.
apps/studio/components/interfaces/Storage/StorageExplorer/FileExplorerColumn.tsx Updates footer total size formatting to decimal mode.
apps/studio/components/interfaces/ProjectAPIDocs/Content/Bucket.tsx Updates API docs max file size display to decimal mode.
apps/studio/components/interfaces/Project/utils.tsx Refactors resource formatting to use formatBytes for GB/GiB.
apps/studio/components/interfaces/Organization/Usage/UsageSection/DatabaseSizeUsage.tsx Updates database usage display formatting to decimal mode.
apps/studio/components/interfaces/Organization/Backups/RestoreBackupDialog.tsx Updates backup size display formatting to decimal mode.
apps/studio/components/interfaces/Organization/Backups/BackupsTable.tsx Updates backup storage used formatting to decimal mode.
apps/studio/components/interfaces/Organization/Backups/BackupsHistoryDialog.tsx Updates backup history size formatting to decimal mode.
apps/studio/components/interfaces/DiskManagement/ui/DiskSpaceBar.tsx Updates disk breakdown formatting to use formatBytes (decimal).
apps/studio/components/interfaces/Database/Backups/Branch/BranchBackups.tsx Updates backup size formatting to decimal mode.
apps/studio/components/interfaces/Branch/utils.ts Refactors branch resource unit formatting to use formatBytes.
apps/studio/components/interfaces/Branch/ResizeBranchModal.tsx Adds helper to format current resource values using formatBytes.
apps/studio/components/interfaces/Branch/NewBranchForm.tsx Adjusts branch creation options (incl. PITR gating) and formatting/UX tweaks.
apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.utils.ts Updates SMTP form mapping/enablement logic for branch SMTP config schema.
apps/studio/components/interfaces/Auth/SmtpForm/SmtpForm.tsx Switches SMTP settings UI to use new branch SMTP query/mutation + encryption select.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +134 to +137
const i =
size !== undefined
? sizes.indexOf(size)
: Math.min(Math.floor(Math.log(absBytes) / Math.log(k)), sizes.length - 1)

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

formatBytes can produce an invalid index when size isn’t present in the sizes array for the selected mode (e.g. passing size: 'bytes' or 'KiB' while mode === 'decimal' yields indexOf(size) === -1). That results in sizes[i] being undefined and Math.pow(k, i) using i = -1, producing incorrect output (e.g. NaN undefined). Consider validating i (fallback to auto selection when indexOf returns -1) and/or using overloads so the allowed size literals depend on mode (and keeping the decimal base unit consistent, e.g. 'B' vs 'bytes').

Suggested change
const i =
size !== undefined
? sizes.indexOf(size)
: Math.min(Math.floor(Math.log(absBytes) / Math.log(k)), sizes.length - 1)
const autoIndex = Math.min(Math.floor(Math.log(absBytes) / Math.log(k)), sizes.length - 1)
let i: number
if (size !== undefined) {
const explicitIndex = sizes.indexOf(size)
i = explicitIndex === -1 ? autoIndex : explicitIndex
} else {
i = autoIndex
}

Copilot uses AI. Check for mistakes.
Comment on lines +60 to +65
return useCallback(() => {
if (projectId) {
client.prefetchQuery(authKeys.authSmtp(orgId, projectId, branchId), ({ signal }) =>
getBranchAuthSmtp({ orgId, projectId, branchId }, signal)
)
}

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

useAuthSmtpPrefetch only checks projectId before calling getBranchAuthSmtp, but getBranchAuthSmtp uses non-null assertions (orgId!, branchId!). If projectId is set while orgId or branchId is still undefined, this will throw at runtime during prefetch. Update the guard to require all required path params (orgId, projectId, branchId) before prefetching.

Copilot uses AI. Check for mistakes.
const REQUIRED_RESOURCES: ResourceType[] = ['milli_vcpu', 'ram', 'database_size', 'iops']

const isNonProdEnv = process.env.NEXT_PUBLIC_ENVIRONMENT !== 'prod'
const isNonProdEnv = false //window === undefined ? false : window.location.hostname.toLowerCase() !== 'demo.vela.run';

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

isNonProdEnv is now hardcoded to false, which changes runtime behavior (e.g. PITR is always disabled and the payload always omits pitrEnabled even in local/staging). This looks like a debug stub left in the code and will prevent enabling PITR outside prod. Restore environment gating (the codebase commonly uses process.env.NEXT_PUBLIC_ENVIRONMENT) or otherwise implement the intended non-prod detection without hardcoding.

Suggested change
const isNonProdEnv = false //window === undefined ? false : window.location.hostname.toLowerCase() !== 'demo.vela.run';
const appEnvironment = process.env.NEXT_PUBLIC_ENVIRONMENT ?? 'prod'
const isNonProdEnv = appEnvironment !== 'prod'

Copilot uses AI. Check for mistakes.
title="Emails"
subtitle="Configure what emails your users receive and how they are sent"
navigationItems={navItems}
//navigationItems={navItems}

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

navigationItems has been commented out, leaving navItems declared but unused and removing the emails navigation UI. This is likely to trigger lint/TS unused-local checks and also breaks expected navigation for the Emails section. Either pass navigationItems={navItems} (as in the other Auth layouts) or remove the navItems block entirely if navigation is intentionally not shown.

Suggested change
//navigationItems={navItems}
navigationItems={navItems}

Copilot uses AI. Check for mistakes.
Comment on lines +78 to +87
if (!success) return

// Determine if SMTP should be disabled (all fields null)
const allNull = Object.values(body).every((v) => v === null || v === undefined)

let updatedSmtpServer: Record<string, string>

if (allNull) {
updatedSmtpServer = {}
} else {

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

allNull is computed as Object.values(body).every(...). If the request body is an empty object ({}), Object.values is empty and .every(...) returns true, which will unintentionally clear/disable SMTP by setting smtpServer = {}. Consider explicitly handling the empty-body case (e.g. treat as 400 Bad Request or a no-op), and only clear SMTP when all expected keys are present and null (or when an explicit "disable" flag is sent).

Copilot uses AI. Check for mistakes.
Comment on lines +9 to +11
// Trailing slash is required by the Vela API; cast to suppress TS schema mismatch
const AUTH_PATH =
'/organizations/{organization_id}/projects/{project_id}/branches/{branch_id}/auth/' as any

Copilot AI Apr 1, 2026

Copy link

Choose a reason for hiding this comment

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

AUTH_PATH is cast to any to bypass the OpenAPI client’s path typing. This removes compile-time safety for params/response shape and makes it easier to silently break the proxy if the backend path changes. Prefer adding the missing /auth/ (realm) endpoint to vela-schema (or using an existing typed endpoint) so getOrFail/putOrFail remain type-checked, and the trailing-slash requirement is encoded in the schema rather than suppressed.

Suggested change
// Trailing slash is required by the Vela API; cast to suppress TS schema mismatch
const AUTH_PATH =
'/organizations/{organization_id}/projects/{project_id}/branches/{branch_id}/auth/' as any
// Trailing slash is required by the Vela API; schema may not yet include this exact path
const AUTH_PATH =
'/organizations/{organization_id}/projects/{project_id}/branches/{branch_id}/auth/'

Copilot uses AI. Check for mistakes.
@noctarius
noctarius merged commit e5ba136 into main Apr 1, 2026
7 checks passed
@noctarius
noctarius deleted the vela-26.3 branch April 1, 2026 10:07
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