fix(sift): change reranking from invalid 'rerank' to 'position-aware'
Some checks are pending
CI / detect-changes (push) Waiting to run
CI / docs-check (push) Blocked by required conditions
CI / lint (push) Blocked by required conditions
CI / build (push) Blocked by required conditions
CI / integration-tests (push) Blocked by required conditions
CI / windows-portability (push) Blocked by required conditions
CI / rtk-portability (linux, blacksmith-4vcpu-ubuntu-2404) (push) Blocked by required conditions
CI / rtk-portability (macos, macos-15) (push) Blocked by required conditions
CI / rtk-portability (windows, blacksmith-4vcpu-windows-2025) (push) Blocked by required conditions

chooseSiftRetrievers returned reranking: 'rerank' which is not a valid
sift CLI value. Valid values are: none, position-aware, llm, jina, gemma.
This caused vector searches to fail with 'invalid value for --reranking'.

Fix: use 'position-aware' for scoped subdir searches. This is the
structural reranking that pairs with the vector retriever strategy.

Tests: 9/9 in sift-retriever-scope.test.mjs updated and passing.
Full suite: 178 files / 1845 tests pass.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
Mikael Hugo 2026-05-15 11:06:33 +02:00
parent 5e478d6506
commit 9b42404149
3 changed files with 7 additions and 7 deletions

View file

@ -31,7 +31,7 @@ import { delimiter, isAbsolute, join, relative, resolve } from "node:path";
* @param {string} projectRoot - the repo root
* @returns {{ retrievers: string, reranking: string }}
* For repo-root scope: { retrievers: "bm25,phrase", reranking: "none" }
* For scoped paths: { retrievers: "bm25,phrase,vector", reranking: "rerank" }
* For scoped paths: { retrievers: "bm25,phrase,vector", reranking: "position-aware" }
*/
export function chooseSiftRetrievers(scopePath, projectRoot) {
const normalizedRoot = resolve(projectRoot);
@ -44,7 +44,7 @@ export function chooseSiftRetrievers(scopePath, projectRoot) {
if (isRepoRoot) {
return { retrievers: "bm25,phrase", reranking: "none" };
}
return { retrievers: "bm25,phrase,vector", reranking: "rerank" };
return { retrievers: "bm25,phrase,vector", reranking: "position-aware" };
}
import { getErrorMessage } from "./error-utils.js";

View file

@ -28,19 +28,19 @@ describe("chooseSiftRetrievers", () => {
it("absolute_subdir_returns_vector", () => {
const result = chooseSiftRetrievers("/repo/src", "/repo");
assert.equal(result.retrievers, "bm25,phrase,vector");
assert.equal(result.reranking, "rerank");
assert.equal(result.reranking, "position-aware");
});
it("relative_subdir_returns_vector", () => {
const result = chooseSiftRetrievers("src/foo", "/repo");
assert.equal(result.retrievers, "bm25,phrase,vector");
assert.equal(result.reranking, "rerank");
assert.equal(result.reranking, "position-aware");
});
it("path_outside_repo_is_scoped_returns_vector", () => {
const result = chooseSiftRetrievers("/some/other/path", "/repo");
assert.equal(result.retrievers, "bm25,phrase,vector");
assert.equal(result.reranking, "rerank");
assert.equal(result.reranking, "position-aware");
});
});
@ -75,7 +75,7 @@ describe("sift-search-tool buildSiftArgs via chooseSiftRetrievers", () => {
it("scoped_path_gets_vector_by_default", () => {
const result = simulateBuildSiftArgs({ path: "src/foo" }, "/repo");
assert.equal(result.retrievers, "bm25,phrase,vector");
assert.equal(result.reranking, "rerank");
assert.equal(result.reranking, "position-aware");
});
it("explicit_retrievers_override_wins_over_scope_default", () => {

2
web/next-env.d.ts vendored
View file

@ -1,7 +1,7 @@
/// <reference types="next" />
/// <reference types="next/image-types/global" />
/// <reference types="next/navigation-types/compat/navigation" />
import "./.next/types/routes.d.ts";
import "./.next/dev/types/routes.d.ts";
// NOTE: This file should not be edited
// see https://nextjs.org/docs/app/api-reference/config/typescript for more information.