code-search-mcp: keep solver-only markers out of the name-match transcript

find_usages with resolve=false never consults the solver, so the transcript
should not print '[not confirmed by the solver]' for it. UsageTest now passes
a flag, and output/03-usages.txt is regenerated.

Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_017ic4b6BHcz4muRH44T3br3
This commit is contained in:
Claude
2026-11-25 18:58:22 +05:30
parent e116c4d5a4
commit 1e8e90258a
2 changed files with 13 additions and 13 deletions
+3 -3
View File
@@ -1,11 +1,11 @@
# find_usages for OrderRepository#save: name match vs resolved # find_usages for OrderRepository#save: name match vs resolved
## name match only (resolve=false): 3 usages ## name match only (resolve=false): 3 usages
inventory/src/main/java/shop/inventory/InventoryService.java:18 in InventoryService#reserve [not confirmed by the solver] inventory/src/main/java/shop/inventory/InventoryService.java:18 in InventoryService#reserve
stock.save(new StockItem(sku, item.onHand() - units)); stock.save(new StockItem(sku, item.onHand() - units));
inventory/src/main/java/shop/inventory/InventoryService.java:24 in InventoryService#release [not confirmed by the solver] inventory/src/main/java/shop/inventory/InventoryService.java:24 in InventoryService#release
stock.save(new StockItem(sku, item.onHand() + units)); stock.save(new StockItem(sku, item.onHand() + units));
orders/src/main/java/shop/orders/OrderService.java:31 in OrderService#placeOrder [not confirmed by the solver] orders/src/main/java/shop/orders/OrderService.java:31 in OrderService#placeOrder
Order order = orders.save(new Order("ord-" + skus.hashCode(), customerId, skus, total)); Order order = orders.save(new Order("ord-" + skus.hashCode(), customerId, skus, total));
## resolved (resolve=true): 1 usage ## resolved (resolve=true): 1 usage
@@ -7,13 +7,13 @@ import org.junit.jupiter.api.Test;
/** find_usages: the name-only answer over-reports, the symbol-solved answer does not, and gaps are counted. */ /** find_usages: the name-only answer over-reports, the symbol-solved answer does not, and gaps are counted. */
class UsageTest { class UsageTest {
private static void print(Transcript t, UsageFinder.Result r) { private static void print(Transcript t, UsageFinder.Result r, boolean resolved) {
for (UsageFinder.Usage u : r.usages()) { for (UsageFinder.Usage u : r.usages()) {
t.line(String.format(" %s:%d in %s%s", u.file(), u.line(), u.inMethod(), t.line(String.format(" %s:%d in %s%s", u.file(), u.line(), u.inMethod(),
u.exact() ? "" : " [not confirmed by the solver]")); resolved && !u.exact() ? " [not confirmed by the solver]" : ""));
t.line(" " + u.code()); t.line(" " + u.code());
} }
if (r.unresolved() > 0) { if (resolved && r.unresolved() > 0) {
t.line(" not confirmed by the solver: " + r.unresolved()); t.line(" not confirmed by the solver: " + r.unresolved());
} }
} }
@@ -25,19 +25,19 @@ class UsageTest {
UsageFinder.Result byName = finder.find("OrderRepository#save", false); UsageFinder.Result byName = finder.find("OrderRepository#save", false);
t.section("name match only (resolve=false): " + byName.usages().size() + " usages"); t.section("name match only (resolve=false): " + byName.usages().size() + " usages");
print(t, byName); print(t, byName, false);
UsageFinder.Result resolved = finder.find("OrderRepository#save", true); UsageFinder.Result resolved = finder.find("OrderRepository#save", true);
t.section("resolved (resolve=true): " + resolved.usages().size() + " usage"); t.section("resolved (resolve=true): " + resolved.usages().size() + " usage");
print(t, resolved); print(t, resolved, true);
UsageFinder.Result other = finder.find("InventoryRepository#save", true); UsageFinder.Result other = finder.find("InventoryRepository#save", true);
t.section("the other save, InventoryRepository#save, resolved: " + other.usages().size() + " usages"); t.section("the other save, InventoryRepository#save, resolved: " + other.usages().size() + " usages");
print(t, other); print(t, other, true);
UsageFinder.Result iface = finder.find("CardGateway#authorize", true); UsageFinder.Result iface = finder.find("CardGateway#authorize", true);
t.section("a call through an interface, CardGateway#authorize, resolved: " + iface.usages().size() + " usage"); t.section("a call through an interface, CardGateway#authorize, resolved: " + iface.usages().size() + " usage");
print(t, iface); print(t, iface, true);
t.write(); t.write();
assertThat(byName.usages()).hasSize(3); assertThat(byName.usages()).hasSize(3);
@@ -56,16 +56,16 @@ class UsageTest {
UsageFinder.Result r = finder.find("PaymentService", true); UsageFinder.Result r = finder.find("PaymentService", true);
Transcript t = new Transcript("04-usages-type-and-gaps.txt", "find_usages for a type, and for a library that is not in the monorepo"); Transcript t = new Transcript("04-usages-type-and-gaps.txt", "find_usages for a type, and for a library that is not in the monorepo");
t.section("PaymentService (resolved): " + r.usages().size() + " usages"); t.section("PaymentService (resolved): " + r.usages().size() + " usages");
print(t, r); print(t, r, true);
UsageFinder.Result gap = finder.find("AuditClient#record", true); UsageFinder.Result gap = finder.find("AuditClient#record", true);
t.section("AuditClient#record (resolved): the class lives in a library outside the monorepo"); t.section("AuditClient#record (resolved): the class lives in a library outside the monorepo");
print(t, gap); print(t, gap, true);
// The second gap is not about missing libraries at all: calls whose ARGUMENTS use a record accessor. // The second gap is not about missing libraries at all: calls whose ARGUMENTS use a record accessor.
UsageFinder.Result refund = finder.find("PaymentService#refund", true); UsageFinder.Result refund = finder.find("PaymentService#refund", true);
t.section("PaymentService#refund (resolved): the call passes order.customerId(), an implicit record accessor"); t.section("PaymentService#refund (resolved): the call passes order.customerId(), an implicit record accessor");
print(t, refund); print(t, refund, true);
t.write(); t.write();
// The import line is not a usage: it is a Name node, not a type. Field and constructor parameter are. // The import line is not a usage: it is a Name node, not a type. Field and constructor parameter are.