From f699ec92cf3139dca041081cea4fbc3f0f985156 Mon Sep 17 00:00:00 2001 From: OpenClaw Date: Tue, 7 Apr 2026 17:41:55 +0530 Subject: [PATCH] fix: filter HTTP client calls from Express route detection --- .../core/ingestion/workers/parse-worker.ts | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/gitnexus/src/core/ingestion/workers/parse-worker.ts b/gitnexus/src/core/ingestion/workers/parse-worker.ts index 58689478d..103b0a5de 100644 --- a/gitnexus/src/core/ingestion/workers/parse-worker.ts +++ b/gitnexus/src/core/ingestion/workers/parse-worker.ts @@ -1569,6 +1569,25 @@ const processFileGroup = ( const method = captureMap['express_route.method'].text; const routePath = captureMap['express_route.path'].text; if (EXPRESS_ROUTE_METHODS.has(method) && routePath.startsWith('/')) { + // Extract the receiver (the object the method is called on) to filter out + // HTTP client calls like axios.get('/api/users') that match the same pattern + // as Express route registrations. + const callNode = captureMap['express_route']; + const funcNode = callNode.childForFieldName?.('function') ?? callNode.children?.[0]; + const receiverNode = funcNode?.childForFieldName?.('object') ?? funcNode?.children?.[0]; + const receiverText = receiverNode?.text?.toLowerCase() ?? ''; + + // Known HTTP client receivers u2014 skip these, they're API consumers not routes + const HTTP_CLIENT_RECEIVERS = new Set([ + 'axios', 'request', 'fetch', 'http', 'https', 'got', 'ky', + 'superagent', 'needle', 'undici', 'apiclient', 'client', 'httpclient', + ]); + + if (HTTP_CLIENT_RECEIVERS.has(receiverText)) { + // This is an HTTP client call, not a route definition u2014 skip it + continue; + } + const httpMethod = method === 'all' || method === 'use' || method === 'route' ? 'GET'