diff --git a/gitnexus/src/core/ingestion/workers/parse-worker.ts b/gitnexus/src/core/ingestion/workers/parse-worker.ts index a096cf597..cbdca83fc 100644 --- a/gitnexus/src/core/ingestion/workers/parse-worker.ts +++ b/gitnexus/src/core/ingestion/workers/parse-worker.ts @@ -1,5 +1,6 @@ import { parentPort } from 'node:worker_threads'; import Parser from 'tree-sitter'; +import { encodeMessage, decodeMessage, MessageTag } from './protocol.js'; import JavaScript from 'tree-sitter-javascript'; import TypeScript from 'tree-sitter-typescript'; import Python from 'tree-sitter-python'; @@ -1390,7 +1391,7 @@ const processFileGroup = ( } catch (err) { const message = `Query compilation failed for ${language}: ${err instanceof Error ? err.message : String(err)}`; if (parentPort) { - parentPort.postMessage({ type: 'warning', message }); + parentPort.postMessage(encodeMessage(MessageTag.Warning, { type: 'warning', message })); } else { logger.warn(message); } @@ -1406,7 +1407,11 @@ const processFileGroup = ( // guessing from `items[lastProgress]` (which the language-grouped order // here would defeat). The pool gracefully ignores this when running an // older worker build that doesn't emit it. - if (parentPort) parentPort.postMessage({ type: 'starting-file', path: file.path }); + if (parentPort) { + parentPort.postMessage( + encodeMessage(MessageTag.StartingFile, { type: 'starting-file', path: file.path }), + ); + } // Vue SFC preprocessing: extract