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:
@@ -1,11 +1,11 @@
|
||||
# find_usages for OrderRepository#save: name match vs resolved
|
||||
|
||||
## 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));
|
||||
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));
|
||||
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));
|
||||
|
||||
## 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. */
|
||||
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()) {
|
||||
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());
|
||||
}
|
||||
if (r.unresolved() > 0) {
|
||||
if (resolved && r.unresolved() > 0) {
|
||||
t.line(" not confirmed by the solver: " + r.unresolved());
|
||||
}
|
||||
}
|
||||
@@ -25,19 +25,19 @@ class UsageTest {
|
||||
|
||||
UsageFinder.Result byName = finder.find("OrderRepository#save", false);
|
||||
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);
|
||||
t.section("resolved (resolve=true): " + resolved.usages().size() + " usage");
|
||||
print(t, resolved);
|
||||
print(t, resolved, true);
|
||||
|
||||
UsageFinder.Result other = finder.find("InventoryRepository#save", true);
|
||||
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);
|
||||
t.section("a call through an interface, CardGateway#authorize, resolved: " + iface.usages().size() + " usage");
|
||||
print(t, iface);
|
||||
print(t, iface, true);
|
||||
t.write();
|
||||
|
||||
assertThat(byName.usages()).hasSize(3);
|
||||
@@ -56,16 +56,16 @@ class UsageTest {
|
||||
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");
|
||||
t.section("PaymentService (resolved): " + r.usages().size() + " usages");
|
||||
print(t, r);
|
||||
print(t, r, true);
|
||||
|
||||
UsageFinder.Result gap = finder.find("AuditClient#record", true);
|
||||
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.
|
||||
UsageFinder.Result refund = finder.find("PaymentService#refund", true);
|
||||
t.section("PaymentService#refund (resolved): the call passes order.customerId(), an implicit record accessor");
|
||||
print(t, refund);
|
||||
print(t, refund, true);
|
||||
t.write();
|
||||
|
||||
// The import line is not a usage: it is a Name node, not a type. Field and constructor parameter are.
|
||||
|
||||
Reference in New Issue
Block a user