From a3536cd934ce7a71480909485dc4d9dd880e809b Mon Sep 17 00:00:00 2001 From: Berk Demirci <145930752+demirciberk@users.noreply.github.com> Date: Wed, 18 Mar 2026 17:52:54 +0300 Subject: [PATCH] Fix undefined parsing error on languages missing from call routers (#364) * fix: mapping all supported languages to callRouters to fix undefined apply error (#352) * fix(cli): remove duplicate Swift/Kotlin keys in callRouters causing TS1117 * refactor: remove runtime callRouter fallbacks, rely on Record compile-time enforcement * refactor: use 'satisfies' keyword for callRouters compile-time enforcement --- gitnexus-web/src/config/supported-languages.ts | 1 + gitnexus-web/src/core/ingestion/call-routing.ts | 5 +++-- gitnexus/src/core/ingestion/call-routing.ts | 4 ++-- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/gitnexus-web/src/config/supported-languages.ts b/gitnexus-web/src/config/supported-languages.ts index 9282f16ed..4c51b56ab 100644 --- a/gitnexus-web/src/config/supported-languages.ts +++ b/gitnexus-web/src/config/supported-languages.ts @@ -10,5 +10,6 @@ export enum SupportedLanguages { Rust = 'rust', PHP = 'php', Ruby = 'ruby', + Kotlin = 'kotlin', Swift = 'swift', } \ No newline at end of file diff --git a/gitnexus-web/src/core/ingestion/call-routing.ts b/gitnexus-web/src/core/ingestion/call-routing.ts index 96a9d54fd..5a112aca1 100644 --- a/gitnexus-web/src/core/ingestion/call-routing.ts +++ b/gitnexus-web/src/core/ingestion/call-routing.ts @@ -27,7 +27,7 @@ export type CallRouter = ( const noRouting: CallRouter = () => null; /** Per-language call routing. noRouting = no special routing (normal call processing) */ -export const callRouters: Record = { +export const callRouters = { [SupportedLanguages.JavaScript]: noRouting, [SupportedLanguages.TypeScript]: noRouting, [SupportedLanguages.Python]: noRouting, @@ -40,7 +40,8 @@ export const callRouters: Record = { [SupportedLanguages.CPlusPlus]: noRouting, [SupportedLanguages.C]: noRouting, [SupportedLanguages.Ruby]: routeRubyCall, -}; + [SupportedLanguages.Kotlin]: noRouting, +} satisfies Record; // ── Result types ──────────────────────────────────────────────────────────── diff --git a/gitnexus/src/core/ingestion/call-routing.ts b/gitnexus/src/core/ingestion/call-routing.ts index 50a91d29b..8916d2a11 100644 --- a/gitnexus/src/core/ingestion/call-routing.ts +++ b/gitnexus/src/core/ingestion/call-routing.ts @@ -27,7 +27,7 @@ export type CallRouter = ( const noRouting: CallRouter = () => null; /** Per-language call routing. noRouting = no special routing (normal call processing) */ -export const callRouters: Record = { +export const callRouters = { [SupportedLanguages.JavaScript]: noRouting, [SupportedLanguages.TypeScript]: noRouting, [SupportedLanguages.Python]: noRouting, @@ -41,7 +41,7 @@ export const callRouters: Record = { [SupportedLanguages.CPlusPlus]: noRouting, [SupportedLanguages.C]: noRouting, [SupportedLanguages.Ruby]: routeRubyCall, -}; +} satisfies Record; // ── Result types ────────────────────────────────────────────────────────────