From 537f09be0f3e454bab38eeade42aa7bac4794335 Mon Sep 17 00:00:00 2001 From: Jordi Enric <37541088+jordienr@users.noreply.github.com> Date: Mon, 31 Aug 2026 10:55:23 +0200 Subject: [PATCH] fix(studio): label omitted worker runtime as custom FE-4314 (#49757) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Problem Workers with an omitted runtime are displayed as Unknown, even though an omitted runtime represents a custom worker image. ## Fix Display Custom when the runtime is omitted. Preserve friendly labels for known runtimes and raw values for explicit unrecognized runtimes. ## How to test - Run `node_modules/.bin/vitest --run components/interfaces/Workers/Workers.utils.test.ts` from `apps/studio`. - Open a worker whose API response omits `spec.runtime`. - Expected result: the runtime badge displays Custom. ## Summary by CodeRabbit - **Bug Fixes** - Worker runtimes without available metadata are now labeled **“Custom”** instead of **“Unknown.”** - Updated the related behavior validation to reflect the corrected runtime label. --- .../components/interfaces/Workers/Workers.utils.test.ts | 4 ++-- apps/studio/components/interfaces/Workers/Workers.utils.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/studio/components/interfaces/Workers/Workers.utils.test.ts b/apps/studio/components/interfaces/Workers/Workers.utils.test.ts index da791ba0349..735d86fe26c 100644 --- a/apps/studio/components/interfaces/Workers/Workers.utils.test.ts +++ b/apps/studio/components/interfaces/Workers/Workers.utils.test.ts @@ -112,8 +112,8 @@ describe('formatRuntime', () => { expect(formatRuntime('rust')).toBe('rust') }) - it('reports unknown when the API omits the runtime', () => { - expect(formatRuntime(undefined)).toBe('Unknown') + it('labels an omitted runtime as custom', () => { + expect(formatRuntime(undefined)).toBe('Custom') }) }) diff --git a/apps/studio/components/interfaces/Workers/Workers.utils.ts b/apps/studio/components/interfaces/Workers/Workers.utils.ts index ddbcae1ee20..11678149636 100644 --- a/apps/studio/components/interfaces/Workers/Workers.utils.ts +++ b/apps/studio/components/interfaces/Workers/Workers.utils.ts @@ -42,7 +42,7 @@ export const getRuntimeMeta = (runtime: string | undefined): RuntimeMeta | undef runtime === undefined ? undefined : RUNTIMES[runtime] export const formatRuntime = (runtime: string | undefined): string => - getRuntimeMeta(runtime)?.label ?? runtime ?? 'Unknown' + getRuntimeMeta(runtime)?.label ?? runtime ?? 'Custom' // The API reports size as e.g. "2gb-1vcpu"; render the parts when they parse, the raw value if not. export const formatSize = (size: string): string => {