From 98d8369e34c0343ec84b1073d7094779ef7bc64e Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Wed, 25 Mar 2026 22:59:11 -0600 Subject: [PATCH 1/2] fix(bench): repair benchmark workflow broken by TypeScript migration MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The TS migration renamed src/cli.js → src/cli.ts and all src/ files from .js to .ts, but the benchmark workflow and srcImport helper were not updated: - embedding-benchmark "Build graph" step referenced `node src/cli.js` which no longer exists — now uses strip-types + ts-resolve-loader - srcImport() constructed file:// URLs with .js extensions pointing at files that only exist as .ts — now checks for .ts on disk first - HuggingFace cache key referenced stale `src/embeddings/**` path, updated to `src/domain/search/**` - Removed `2>/dev/null` from benchmark runner commands so failures produce visible error output in CI logs --- .github/workflows/benchmark.yml | 14 ++++++++------ scripts/lib/bench-config.ts | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 8 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index 736fb7cb..940a03b9 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -94,7 +94,7 @@ jobs: if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then ARGS="$ARGS --npm" fi - node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/benchmark.ts $ARGS 2>/dev/null > benchmark-result.json + node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/benchmark.ts $ARGS > benchmark-result.json - name: Update build report if: steps.existing.outputs.skip != 'true' @@ -231,12 +231,14 @@ jobs: uses: actions/cache@v5 with: path: ~/.cache/huggingface - key: hf-models-${{ runner.os }}-${{ hashFiles('src/embeddings/**') }} + key: hf-models-${{ runner.os }}-${{ hashFiles('src/domain/search/**') }} restore-keys: hf-models-${{ runner.os }}- - name: Build graph if: steps.existing.outputs.skip != 'true' - run: node src/cli.js build . + run: | + STRIP_FLAG=$(node -e "const [M]=process.versions.node.split('.').map(Number); console.log(M>=23?'--strip-types':'--experimental-strip-types')") + node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js src/cli.ts build . - name: Run embedding benchmark if: steps.existing.outputs.skip != 'true' @@ -248,7 +250,7 @@ jobs: if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then ARGS="$ARGS --npm" fi - node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/embedding-benchmark.ts $ARGS 2>/dev/null > embedding-benchmark-result.json + node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/embedding-benchmark.ts $ARGS > embedding-benchmark-result.json - name: Update embedding report if: steps.existing.outputs.skip != 'true' @@ -388,7 +390,7 @@ jobs: if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then ARGS="$ARGS --npm" fi - node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/query-benchmark.ts $ARGS 2>/dev/null > query-benchmark-result.json + node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/query-benchmark.ts $ARGS > query-benchmark-result.json - name: Update query report if: steps.existing.outputs.skip != 'true' @@ -528,7 +530,7 @@ jobs: if [ "${{ steps.mode.outputs.source }}" = "npm" ]; then ARGS="$ARGS --npm" fi - node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/incremental-benchmark.ts $ARGS 2>/dev/null > incremental-benchmark-result.json + node $STRIP_FLAG --import ./scripts/ts-resolve-loader.js scripts/incremental-benchmark.ts $ARGS > incremental-benchmark-result.json - name: Update incremental report if: steps.existing.outputs.skip != 'true' diff --git a/scripts/lib/bench-config.ts b/scripts/lib/bench-config.ts index 55306e70..074ad578 100644 --- a/scripts/lib/bench-config.ts +++ b/scripts/lib/bench-config.ts @@ -183,10 +183,20 @@ export async function resolveBenchmarkSource() { /** * Build a file:// URL suitable for dynamic import. * + * After the TypeScript migration, src/ contains .ts files while the .js + * extension is still used in import specifiers. This helper checks for the + * .ts variant first (matching the actual source) and falls back to .js so it + * works in both local-dev and npm-published layouts. + * * @param {string} srcDir Absolute path to the codegraph src/ directory - * @param {string} file Relative filename within src/ (e.g. 'builder.js') + * @param {string} file Relative filename within src/ (e.g. 'domain/queries.js') * @returns {string} file:// URL string */ export function srcImport(srcDir, file) { - return pathToFileURL(path.join(srcDir, file)).href; + const full = path.join(srcDir, file); + if (file.endsWith('.js')) { + const tsVariant = full.replace(/\.js$/, '.ts'); + if (fs.existsSync(tsVariant)) return pathToFileURL(tsVariant).href; + } + return pathToFileURL(full).href; } From 8c41d469edb79000b6453cb696c09f5911524a0f Mon Sep 17 00:00:00 2001 From: carlos-alm <127798846+carlos-alm@users.noreply.github.com> Date: Wed, 25 Mar 2026 23:15:33 -0600 Subject: [PATCH 2/2] fix(bench): add explicit TypeScript parameter types to srcImport Impact: 1 functions changed, 26 affected --- scripts/lib/bench-config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/lib/bench-config.ts b/scripts/lib/bench-config.ts index 074ad578..613224b2 100644 --- a/scripts/lib/bench-config.ts +++ b/scripts/lib/bench-config.ts @@ -192,7 +192,7 @@ export async function resolveBenchmarkSource() { * @param {string} file Relative filename within src/ (e.g. 'domain/queries.js') * @returns {string} file:// URL string */ -export function srcImport(srcDir, file) { +export function srcImport(srcDir: string, file: string): string { const full = path.join(srcDir, file); if (file.endsWith('.js')) { const tsVariant = full.replace(/\.js$/, '.ts');