Skip to content

Fix undefined parsing error on languages missing from call routers#364

Merged
magyargergo merged 4 commits into
abhigyanpatwari:mainfrom
demirciberk:fix-issue-352
Mar 18, 2026
Merged

Fix undefined parsing error on languages missing from call routers#364
magyargergo merged 4 commits into
abhigyanpatwari:mainfrom
demirciberk:fix-issue-352

Conversation

@demirciberk

Copy link
Copy Markdown
Contributor

This PR fixes #352 ("Cannot read properties of undefined (reading 'apply')").

The root cause was that newer languages like Kotlin (used heavily in the Lynx repository referenced in the issue) were added to the SupportedLanguages enum but omitted from the CLI and Web parsing callRouters mappings. When the parser encountered a Kotlin file, it accessed an undefined call router, crashing the process.

This PR adds the missing languages mapping to both CLI and Web callRouters implementations and embeds a generic noRouting fallback handler for additional safety. Impact analysis confirms this has zero negative blast radius.

@vercel

vercel Bot commented Mar 18, 2026

Copy link
Copy Markdown

@demirciberk is attempting to deploy a commit to the NexusCore Team on Vercel.

A member of the Team first needs to authorize it.

@magyargergo

Copy link
Copy Markdown
Collaborator

Can you fix this tsc error?

Error: src/core/ingestion/call-routing.ts(44,3): error TS1117: An object literal cannot have multiple properties with the same name.

@demirciberk

Copy link
Copy Markdown
Contributor Author

I fixed it. Thanks.

Comment thread gitnexus-web/src/core/ingestion/call-processor.ts Outdated
Comment thread gitnexus/src/core/ingestion/workers/parse-worker.ts Outdated
Comment thread gitnexus-web/src/core/ingestion/call-routing.ts Outdated
Comment thread gitnexus-web/src/config/supported-languages.ts
Comment thread gitnexus-web/src/core/ingestion/call-routing.ts Outdated
@demirciberk

Copy link
Copy Markdown
Contributor Author

Sorry for the inconvention. Is it OK now?

@github-actions

Copy link
Copy Markdown
Contributor

CI Report

All checks passed

Pipeline Status

Stage Status Details
✅ Typecheck success tsc --noEmit
✅ Unit Tests success 3 platforms
✅ Integration success 3 OS x 4 groups = 12 jobs

Test Results

Suite Tests Passed Failed Skipped Duration
Unit 1571 1500 0 1 9s
Integration 1207 1187 0 19 52s
Total 2778 2687 0 20 61s

✅ All 2687 tests passed

20 test(s) skipped — expand for details

Integration:

  • Python match/case as-pattern type binding > resolves u.save() to User#save via match/case as-pattern binding
  • Python match/case as-pattern type binding > does NOT resolve u.save() to Repo#save (negative disambiguation)
  • Swift constructor-inferred type resolution > detects User and Repo classes, both with save methods
  • Swift constructor-inferred type resolution > resolves user.save() to Models/User.swift via constructor-inferred type
  • Swift constructor-inferred type resolution > resolves repo.save() to Models/Repo.swift via constructor-inferred type
  • Swift constructor-inferred type resolution > emits exactly 2 save() CALLS edges (one per receiver type)
  • Swift self resolution > detects User and Repo classes, each with a save function
  • Swift self resolution > resolves self.save() inside User.process to User.save, not Repo.save
  • Swift parent resolution > detects BaseModel and User classes plus Serializable protocol
  • Swift parent resolution > emits EXTENDS edge: User → BaseModel
  • Swift parent resolution > emits IMPLEMENTS edge: User → Serializable (protocol conformance)
  • Swift cross-file User.init() inference > resolves user.save() via User.init(name:) inference
  • Swift cross-file User.init() inference > resolves user.greet() via User.init(name:) inference
  • Swift return type inference > detects User class and getUser function
  • Swift return type inference > detects save function on User (Swift class methods are Function nodes)
  • Swift return type inference > resolves user.save() to User#save via return type of getUser() -> User
  • Swift return-type inference via function return type > resolves user.save() to User#save via return type of getUser()
  • Swift return-type inference via function return type > user.save() does NOT resolve to Repo#save
  • Swift return-type inference via function return type > resolves repo.save() to Repo#save via return type of getRepo()

Unit:

  • parser-loader > loadLanguage > loads C++ language
  • parser-loader > loadLanguage > loads C# language
  • parser-loader > loadLanguage > loads Go language
  • parser-loader > loadLanguage > loads Rust language
  • parser-loader > loadLanguage > loads PHP language
  • parser-loader > loadLanguage > loads TSX grammar for .tsx files
  • parser-loader > loadLanguage > loads TS grammar for .ts files
  • parser-loader > loadLanguage > loads Ruby language
  • parser-loader > loadLanguage > throws for unsupported language
  • parser-loader > Swift optional dependency > handles Swift loading gracefully
  • buildTypeEnv > for-loop element type inference (Tier 1c) — C# > still resolves explicit type foreach (regression)
  • buildTypeEnv > for-loop element type inference (Tier 1c) — C# > does not infer type when iterable has no annotation
  • buildTypeEnv > for-loop element type inference (Tier 1c) — Kotlin > infers loop variable from unannotated for with List parameter
  • buildTypeEnv > for-loop element type inference (Tier 1c) — Kotlin > still resolves explicit type annotation (regression)
  • buildTypeEnv > for-loop element type inference (Tier 1c) — Kotlin > does not infer type when iterable has no annotation
  • buildTypeEnv > for-loop element type inference (Tier 1c) — Java > still resolves explicit type enhanced-for (regression)
  • buildTypeEnv > for-loop element type inference (Tier 1c) — Java > does not infer type when iterable has no annotation
  • buildTypeEnv > previously-skipped limitations (now resolved) > TS destructured for-of: for (const [k, v] of entries) — last-child heuristic
  • buildTypeEnv > previously-skipped limitations (now resolved) > Python tuple unpacking: for key, value in dict.items() — call iterable + pattern_list
  • buildTypeEnv > previously-skipped limitations (now resolved) > Python enumerate(dict.items()): for i, k, v — skips int index, binds value var to User
  • buildTypeEnv > previously-skipped limitations (now resolved) > Python enumerate(dict.items()) with nested tuple: for i, (k, v) — binds v to User
  • buildTypeEnv > previously-skipped limitations (now resolved) > Python enumerate with parenthesized tuple: for (k, v) in enumerate(users) — binds v to User
  • buildTypeEnv > previously-skipped limitations (now resolved) > TS instanceof narrowing: if (x instanceof User) — first-writer-wins, not block-scoped
  • buildTypeEnv > previously-skipped limitations (now resolved) > Rust for with .iter(): for user in users.iter() — call_expression iterable
  • buildTypeEnv > method-aware type arg selection (.keys() vs .values()) > TS for-of map.values() resolves to value type (User)
  • buildTypeEnv > method-aware type arg selection (.keys() vs .values()) > TS for-of map.keys() resolves to key type (string)
  • buildTypeEnv > method-aware type arg selection (.keys() vs .values()) > Python for key in data.keys() resolves to key type (str)
  • buildTypeEnv > method-aware type arg selection (.keys() vs .values()) > Python for user in data.values() resolves to value type (User)
  • buildTypeEnv > method-aware type arg selection (.keys() vs .values()) > Rust for key in map.keys() resolves to key type (String)
  • buildTypeEnv > method-aware type arg selection (.keys() vs .values()) > Rust for user in map.values() resolves to value type (User)
  • buildTypeEnv > container descriptor-aware type arg selection > HashMap.keys() resolves to key type (String) via descriptor
  • buildTypeEnv > container descriptor-aware type arg selection > HashMap.values() resolves to value type (User) via descriptor
  • buildTypeEnv > container descriptor-aware type arg selection > Vec.iter() resolves to element type (User) — arity 1 always returns last
  • buildTypeEnv > container descriptor-aware type arg selection > unknown container falls back to last-arg heuristic
  • buildTypeEnv > for-loop Phase 2 enhancements > TS object destructuring skip: for (const { id, name } of users) — no binding produced
  • buildTypeEnv > for-loop Phase 2 enhancements > TS member access: for (const user of this.users) with users: User[] param — resolves
  • buildTypeEnv > for-loop Phase 2 enhancements > Python member access: for user in self.users with users: List[User] param — resolves
  • buildTypeEnv > for-loop Phase 2 enhancements > C++ structured bindings: for (auto& [key, value] : map) with map<string, User> param — binds value
  • buildTypeEnv > for-loop Phase 2 enhancements > C++ structured bindings: exact App.cpp fixture — binds user and repo
  • buildTypeEnv > known limitations (documented skip tests) > Ruby block parameter: users.each { |user| } — closure param inference, different feature
  • buildTypeEnv > Kotlin when/is pattern binding (Phase 6) > when (x) { is User -> } binds x to User
  • buildTypeEnv > Kotlin when/is pattern binding (Phase 6) > when (x) { is User -> ...; is Admin -> ... } — last arm overwrites (allowPatternBindingOverwrite)
  • buildTypeEnv > Kotlin when/is pattern binding (Phase 6) > when (x) { else -> } — no type check, no pattern binding produced
  • buildTypeEnv > Kotlin for-loop HashMap.values resolution (Phase 6) > for (user in data.values) binds user to User via HashMap<String, User>
  • buildTypeEnv > Kotlin for-loop HashMap.values resolution (Phase 6) > for (user in users) binds user to User via List param
  • buildTypeEnv > Java switch pattern variable (Phase 6) > switch (obj) { case User u -> } binds u to User
  • buildTypeEnv > Java switch pattern variable (Phase 6) > switch (obj) { case User u -> ...; case Admin a -> ... } — both bind
  • buildTypeEnv > Java switch pattern variable (Phase 6) > switch (x) { case 42 -> ... } — no pattern variable, no binding
  • buildTypeEnv > Java switch pattern variable (Phase 6) > obj instanceof User user — regression: still works after type_pattern addition
  • buildTypeEnv > new container descriptors (Phase 6.1) > Collection resolves element type via descriptor (arity 1)
  • buildTypeEnv > new container descriptors (Phase 6.1) > MutableMap<String, User>.values() resolves to User via descriptor (arity 2)
  • buildTypeEnv > new container descriptors (Phase 6.1) > MutableList resolves element type via descriptor
  • buildTypeEnv > new container descriptors (Phase 6.1) > SortedSet resolves element type via descriptor (C#)
  • buildTypeEnv > new container descriptors (Phase 6.1) > Stream resolves element type via descriptor (Java)
  • buildTypeEnv > C# recursive_pattern binding (Phase 6.1) > obj is User { Name: "Alice" } u — binds u to User
  • buildTypeEnv > C# recursive_pattern binding (Phase 6.1) > switch expression with recursive_pattern — binds r to Repo
  • buildTypeEnv > C# recursive_pattern binding (Phase 6.1) > recursive_pattern without designation — no pattern binding produced
  • buildTypeEnv > C# await foreach (Phase 6.1) > await foreach (var user in users) — same node type as foreach, resolves element type
  • buildTypeEnv > C# await foreach (Phase 6.1) > foreach (var user in this.data.Values) — nested member access with container property
  • buildTypeEnv > TypeScript class field declaration (Phase 6.1) > class field with array type — for-loop resolves element type via declarationTypeNodes
  • buildTypeEnv > TypeScript class field declaration (Phase 6.1) > class field with generic type annotation — binds field name to base type
  • buildTypeEnv > PHP foreach $this->property (Phase 7.4 — Strategy C) > resolves loop variable from @var User[] property without @param workaround
  • buildTypeEnv > PHP foreach $this->property (Phase 7.4 — Strategy C) > does not bind from unknown $this->property (conservative)
  • buildTypeEnv > PHP foreach $this->property (Phase 7.4 — Strategy C) > multi-class file: resolves correct property for each class
  • buildTypeEnv > match arm scoping — first-writer-wins regression > Rust: first match arm binding wins, later arms do not overwrite
  • buildTypeEnv > performance optimizations — coverage for new code paths > fastStripNullable: passes through simple identifier without stripping
  • buildTypeEnv > performance optimizations — coverage for new code paths > fastStripNullable: strips nullable union type via full stripNullable
  • buildTypeEnv > performance optimizations — coverage for new code paths > fastStripNullable: rejects bare nullable keyword
  • buildTypeEnv > performance optimizations — coverage for new code paths > fastStripNullable: strips optional type suffix
  • buildTypeEnv > performance optimizations — coverage for new code paths > SKIP_SUBTREE_TYPES: string literal subtrees do not affect type extraction
  • buildTypeEnv > performance optimizations — coverage for new code paths > interestingNodeTypes: non-declaration nodes skip extractTypeBinding

Code Coverage

Combined (Unit + Integration)

Metric Coverage Covered Base Delta Status
Statements 59.17% 6726/11366 47.27% 📈 +11.9 🟢 ███████████░░░░░░░░░
Branches 53.46% 4608/8619 42.26% 📈 +11.2 🟢 ██████████░░░░░░░░░░
Functions 57.37% 568/990 46.38% 📈 +11.0 🟢 ███████████░░░░░░░░░
Lines 60.93% 5999/9845 48.88% 📈 +12.0 🟢 ████████████░░░░░░░░
Coverage breakdown by test suite

Unit Tests

Metric Coverage Covered Base Delta Status
Statements 44.84% 5097/11366 47.27% 📉 -2.4 🔴 ████████░░░░░░░░░░░░
Branches 40.01% 3449/8619 42.26% 📉 -2.2 🔴 ████████░░░░░░░░░░░░
Functions 42.92% 425/990 46.38% 📉 -3.5 🔴 ████████░░░░░░░░░░░░
Lines 46.26% 4555/9845 48.88% 📉 -2.6 🔴 █████████░░░░░░░░░░░

Integration Tests

Metric Coverage Covered Base Delta Status
Statements 46.95% 5337/11366 47.27% 📉 -0.3 🔴 █████████░░░░░░░░░░░
Branches 44.21% 3811/8619 42.26% 📈 +2.0 🟢 ████████░░░░░░░░░░░░
Functions 44.34% 439/990 46.38% 📉 -2.0 🔴 ████████░░░░░░░░░░░░
Lines 48.08% 4734/9845 48.88% 📉 -0.8 🔴 █████████░░░░░░░░░░░

📋 View full run · Generated by CI

@magyargergo magyargergo merged commit e0a6c40 into abhigyanpatwari:main Mar 18, 2026
20 of 21 checks passed
@magyargergo

Copy link
Copy Markdown
Collaborator

Thank you for your contribution!

motolese pushed a commit to motolese/datamoto-gitnexus that referenced this pull request Apr 23, 2026
…bhigyanpatwari#364)

* fix: mapping all supported languages to callRouters to fix undefined apply error (abhigyanpatwari#352)

* fix(cli): remove duplicate Swift/Kotlin keys in callRouters causing TS1117

* refactor: remove runtime callRouter fallbacks, rely on Record<SupportedLanguages> compile-time enforcement

* refactor: use 'satisfies' keyword for callRouters compile-time enforcement
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.

Cannot read properties of undefined (reading 'apply')

2 participants