fix(analysis): report call-edge truncation
This commit is contained in:
@@ -181,7 +181,11 @@ const recordEdge = (
|
|||||||
const targetAddress =
|
const targetAddress =
|
||||||
input.direction === "forward" ? edge.relatedAddress : edge.address;
|
input.direction === "forward" ? edge.relatedAddress : edge.address;
|
||||||
const edgeKey = `${sourceAddress}\u0000${targetAddress}`;
|
const edgeKey = `${sourceAddress}\u0000${targetAddress}`;
|
||||||
if (state.edges.has(edgeKey) || state.edges.size >= input.max_nodes) return;
|
if (state.edges.has(edgeKey)) return;
|
||||||
|
if (state.edges.size >= input.max_nodes) {
|
||||||
|
state.residual.add("Call-path traversal reached the edge limit.");
|
||||||
|
return;
|
||||||
|
}
|
||||||
state.edges.set(edgeKey, {
|
state.edges.set(edgeKey, {
|
||||||
source_address: sourceAddress,
|
source_address: sourceAddress,
|
||||||
target_address: targetAddress,
|
target_address: targetAddress,
|
||||||
|
|||||||
@@ -318,7 +318,10 @@ describe("enhanced MCP tools", () => {
|
|||||||
nodes: [{ address: "0x1", depth: 0 }],
|
nodes: [{ address: "0x1", depth: 0 }],
|
||||||
frontier: ["0x2"],
|
frontier: ["0x2"],
|
||||||
truncated: true,
|
truncated: true,
|
||||||
residual_unknowns: [expect.stringContaining("reached the node limit")],
|
residual_unknowns: expect.arrayContaining([
|
||||||
|
expect.stringContaining("reached the node limit"),
|
||||||
|
expect.stringContaining("reached the edge limit"),
|
||||||
|
]),
|
||||||
limits: {
|
limits: {
|
||||||
max_nodes: 1,
|
max_nodes: 1,
|
||||||
nodes_visited: 1,
|
nodes_visited: 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user