Understand any codebase instantly. System intelligence for codebases, built for humans and AI.
TypeScript aiai-memoryclaude-codeclicode-analysiscode-mappingcode-memorycodebase-understandingcodexdeveloper-toolsllmopenclawpersistent-memoryprogram-analysissoftware-architecturesystem-intelligencesystem-mapping
fix(resolve): let a same-stem file join the exact-name set, not choose it
KageBinary573c6780b2b8
diff --git a/ix-cli/src/cli/__tests__/resolver-definitions-first.test.ts b/ix-cli/src/cli/__tests__/resolver-definitions-first.test.tsindex e895f333..2ff3f3cd 100644--- a/ix-cli/src/cli/__tests__/resolver-definitions-first.test.ts+++ b/ix-cli/src/cli/__tests__/resolver-definitions-first.test.ts@@ -52,6 +52,16 @@ describe("resolver: definitions over imports", () => {], "parseConfig")).toBe("fn");});+ it("resolves a lowercase term to the PascalCase class, not the same-stem file (django paginator)", async () => {+ // No entity is named exactly `paginator`: the case-insensitive fallback+ // finds the class, and the file must not pre-empt that fallback just+ // because its stem matches case-sensitively.+ expect(await resolvedId([+ n("cls", "Paginator", "class", "django/core/paginator.py", { line_end: 200 }),+ n("file", "paginator.py", "file", "django/core/paginator.py", { line_end: 200 }),+ ], "paginator")).toBe("cls");+ });+it("still prefers a same-named function over a same-stem file", async () => {expect(await resolvedId([n("file", "debounce.js", "file", "src/debounce.js"),diff --git a/ix-cli/src/cli/resolve.ts b/ix-cli/src/cli/resolve.tsindex 425528d0..2b56eeeb 100644--- a/ix-cli/src/cli/resolve.ts+++ b/ix-cli/src/cli/resolve.ts@@ -416,13 +416,17 @@ export async function resolveEntityFull(// aliases before finding the actual 'Apply' method entities.// A file whose stem is the symbol counts as an exact name: it is the only// definition an anonymous default export has, and scoring then puts it- // behind a same-named symbol but ahead of an import of the name.- const exactCaseName = filteredNodes.filter((n: any) => {- const name = (n.name || n.attrs?.name || "");- return name === symbol || (isFileStemMatch(n, symbol) && name.startsWith(symbol));- });- const exactName = exactCaseName.length > 0- ? exactCaseName+ // behind a same-named symbol but ahead of an import of the name. It joins+ // whichever set the NAMES chose and never chooses it: `paginator` must fall+ // back to the class `Paginator`, not stop at `paginator.py` because only+ // the file's stem matched case-sensitively.+ const exactCaseSymbols = filteredNodes.filter((n: any) => (n.name || n.attrs?.name || "") === symbol);+ const exactName = exactCaseSymbols.length > 0+ ? [+ ...exactCaseSymbols,+ ...filteredNodes.filter((n: any) =>+ isFileStemMatch(n, symbol) && (n.name || n.attrs?.name || "").startsWith(symbol)),+ ]: filteredNodes.filter((n: any) => {const name = (n.name || n.attrs?.name || "").toLowerCase();return name === symbolLower || isFileStemMatch(n, symbol);