From 890bb66b35d5f9f8ee54ff0049bf7dc7b82b2480 Mon Sep 17 00:00:00 2001 From: morluto <76467478+morluto@users.noreply.github.com> Date: Sat, 10 Oct 2026 04:58:24 +0800 Subject: [PATCH] fix(ida): compare admitted document paths consistently --- src/ida/IdaSessionClient.test.ts | 19 +++++++++++++++++++ src/ida/IdaSessionClient.ts | 6 ++++-- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/ida/IdaSessionClient.test.ts b/src/ida/IdaSessionClient.test.ts index 2b6783c1c..f1bb05467 100644 --- a/src/ida/IdaSessionClient.test.ts +++ b/src/ida/IdaSessionClient.test.ts @@ -1,4 +1,5 @@ import { readFile, readdir, rm } from "node:fs/promises"; +import { sep } from "node:path"; import { afterEach, describe, expect, it } from "vitest"; import { z } from "zod"; import { @@ -111,6 +112,24 @@ describe("headless IDA producer pagination", () => { }); describe("attached IDA observation semantics", () => { + it("accepts a normalized spelling of the bound document path", async () => { + const { target, producer, client } = await fixture(); + const equivalent = + process.platform === "win32" + ? target.path.toLowerCase().replaceAll("\\", "/") + : target.path.split(sep).join(`${sep}.${sep}`); + + const result = await client.execute("list_procedures", { + document: equivalent, + }); + + expect(result.ok).toBe(true); + expect(producer.calls.some(({ name }) => name === "list_functions")).toBe( + true, + ); + await client.close(); + }); + it("rejects an unrelated document before connecting or opening a provider", async () => { const { producer, client } = await fixture(); const result = await client.execute("list_procedures", { diff --git a/src/ida/IdaSessionClient.ts b/src/ida/IdaSessionClient.ts index 5fac9e18e..db6301c0c 100644 --- a/src/ida/IdaSessionClient.ts +++ b/src/ida/IdaSessionClient.ts @@ -165,8 +165,10 @@ export class IdaSessionClient implements AnalysisClient { const document = parameters.document; if ( document !== undefined && - document !== this.target.path && - document !== this.target.sourcePath + (typeof document !== "string" || + (!sameIdaHostPath(document, this.target.path) && + (this.target.sourcePath === undefined || + !sameIdaHostPath(document, this.target.sourcePath)))) ) return err( new AnalysisInputError(operation, undefined, [