Skip to content

Commit 17f0f9b

Browse files
committed
fix: align show/snippet integration tests with lookup tiers
Lone name:Token without wildcards is fast-tier equality; substring and multi-field queries use slow-tier LIKE (kind:class name:Auth).
1 parent f0a317d commit 17f0f9b

2 files changed

Lines changed: 43 additions & 5 deletions

File tree

src/application/http-server.test.ts

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ describe("http-server — POST /tool/{other tools}", () => {
469469
expect(r.json.matches[0]).toHaveProperty("missing");
470470
});
471471

472-
it("show with query returns field-qualified matches", async () => {
472+
it("show with query fast tier returns exact name matches", async () => {
473473
const db = openDb();
474474
try {
475475
db.run(
@@ -480,7 +480,28 @@ describe("http-server — POST /tool/{other tools}", () => {
480480
closeDb(db);
481481
}
482482
serverHandle = await startServer();
483-
const r = await postTool(serverHandle.port, "show", { query: "name:Auth" });
483+
const r = await postTool(serverHandle.port, "show", {
484+
query: "name:AuthService",
485+
});
486+
expect(r.status).toBe(200);
487+
expect(r.json.matches).toHaveLength(1);
488+
expect(r.json.matches[0].name).toBe("AuthService");
489+
});
490+
491+
it("show with query returns field-qualified substring matches", async () => {
492+
const db = openDb();
493+
try {
494+
db.run(
495+
`INSERT INTO symbols (file_path, name, kind, line_start, line_end, signature, doc_comment)
496+
VALUES ('src/a.ts', 'AuthService', 'class', 1, 1, 'class AuthService', NULL)`,
497+
);
498+
} finally {
499+
closeDb(db);
500+
}
501+
serverHandle = await startServer();
502+
const r = await postTool(serverHandle.port, "show", {
503+
query: "kind:class name:Auth",
504+
});
484505
expect(r.status).toBe(200);
485506
expect(r.json.matches).toHaveLength(1);
486507
expect(r.json.matches[0].name).toBe("AuthService");
@@ -518,7 +539,7 @@ describe("http-server — POST /tool/{other tools}", () => {
518539
}
519540
serverHandle = await startServer();
520541
const r = await postTool(serverHandle.port, "snippet", {
521-
query: "name:Auth",
542+
query: "kind:class name:Auth",
522543
});
523544
expect(r.status).toBe(200);
524545
expect(r.json.matches).toHaveLength(1);

src/application/mcp-server.test.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1607,14 +1607,31 @@ describe("MCP server — show + snippet tools", () => {
16071607
}
16081608
});
16091609

1610+
it("show with query fast tier returns exact name matches", async () => {
1611+
seedSymbol({ file: "src/a.ts", name: "AuthService", kind: "class" });
1612+
seedSymbol({ file: "src/b.ts", name: "Other", kind: "class" });
1613+
const { client, server } = await makeClient();
1614+
try {
1615+
const r = await client.callTool({
1616+
name: "show",
1617+
arguments: { query: "name:AuthService" },
1618+
});
1619+
const json = readJson(r);
1620+
expect(json.matches).toHaveLength(1);
1621+
expect(json.matches[0].name).toBe("AuthService");
1622+
} finally {
1623+
await server.close();
1624+
}
1625+
});
1626+
16101627
it("show with query field search returns substring matches", async () => {
16111628
seedSymbol({ file: "src/a.ts", name: "AuthService", kind: "class" });
16121629
seedSymbol({ file: "src/b.ts", name: "Other", kind: "class" });
16131630
const { client, server } = await makeClient();
16141631
try {
16151632
const r = await client.callTool({
16161633
name: "show",
1617-
arguments: { query: "name:Auth" },
1634+
arguments: { query: "kind:class name:Auth" },
16181635
});
16191636
const json = readJson(r);
16201637
expect(json.matches).toHaveLength(1);
@@ -1637,7 +1654,7 @@ describe("MCP server — show + snippet tools", () => {
16371654
try {
16381655
const r = await client.callTool({
16391656
name: "snippet",
1640-
arguments: { query: "name:Auth" },
1657+
arguments: { query: "kind:class name:Auth" },
16411658
});
16421659
const json = readJson(r);
16431660
expect(json.matches).toHaveLength(1);

0 commit comments

Comments
 (0)