mirror of
https://github.com/morluto/rea.git
synced 2026-12-02 13:11:18 -05:00
fix(call-graph)!: report each node's coverage limits once, in relationship_coverage (#15582)
get_call_graph copied each node's relationship coverage into the node's limitations: a partial coverage's limitations, an unknown coverage's reason (including the synthesized "Provider did not report relationship coverage."), and its diagnostics. Every ok node therefore repeated what its relationship_coverage already said, which costs tokens on every node of a large graph. A node now keeps limitations only for the provider's own caveats that no coverage classified, when the provider reported no relationship coverage. Graph-wide limitations are unchanged. BREAKING CHANGE: get_call_graph nodes no longer repeat relationship_coverage limitations, reason or diagnostics in their limitations field. Read relationship_coverage for a node's coverage limits; node limitations now hold only unclassified provider caveats.
This commit is contained in:
@@ -633,25 +633,13 @@ export class EnhancedTools {
|
||||
limited_directions: directionFallback,
|
||||
}
|
||||
: withRequiredLimitedDirections(reportedCoverage, directionFallback);
|
||||
const relationshipLimitations =
|
||||
// relationship_coverage already carries reported limitations, its
|
||||
// reason and its diagnostics. A node keeps only the provider's own
|
||||
// caveats that no coverage classified.
|
||||
const nodeLimitations =
|
||||
reportedCoverage === undefined
|
||||
? [
|
||||
...execution.limitations,
|
||||
"Provider did not report relationship coverage.",
|
||||
]
|
||||
: [
|
||||
...(reportedCoverage.status === "partial"
|
||||
? reportedCoverage.limitations
|
||||
: reportedCoverage.status === "unknown"
|
||||
? [reportedCoverage.reason]
|
||||
: []),
|
||||
...("diagnostics" in reportedCoverage
|
||||
? reportedCoverage.diagnostics
|
||||
: []),
|
||||
];
|
||||
const nodeLimitations = [...new Set(relationshipLimitations)].sort(
|
||||
compareUnicodeCodePoints,
|
||||
);
|
||||
? [...new Set(execution.limitations)].sort(compareUnicodeCodePoints)
|
||||
: [];
|
||||
nodes.push({
|
||||
address: current.address,
|
||||
status: "ok",
|
||||
|
||||
@@ -334,7 +334,6 @@ describe("enhanced MCP tools", () => {
|
||||
address: "0x1",
|
||||
status: "ok",
|
||||
calls: ["0x2", "0x3"],
|
||||
limitations: ["Provider did not report relationship coverage."],
|
||||
relationship_coverage: {
|
||||
status: "unknown",
|
||||
reason: "Provider did not report relationship coverage.",
|
||||
@@ -347,7 +346,6 @@ describe("enhanced MCP tools", () => {
|
||||
address: "0x2",
|
||||
status: "ok",
|
||||
calls: ["0x1"],
|
||||
limitations: ["Provider did not report relationship coverage."],
|
||||
relationship_coverage: {
|
||||
status: "unknown",
|
||||
reason: "Provider did not report relationship coverage.",
|
||||
@@ -358,7 +356,6 @@ describe("enhanced MCP tools", () => {
|
||||
address: "0x3",
|
||||
status: "ok",
|
||||
calls: [],
|
||||
limitations: ["Provider did not report relationship coverage."],
|
||||
relationship_coverage: {
|
||||
status: "unknown",
|
||||
reason: "Provider did not report relationship coverage.",
|
||||
|
||||
@@ -44,7 +44,7 @@ const relationshipExecution = (
|
||||
);
|
||||
|
||||
describe("enhanced MCP relationship limitations", () => {
|
||||
it("preserves per-node relationship limitations and keeps observed edges", async () => {
|
||||
it("reports a node's relationship limitations once, in its coverage, and keeps observed edges", async () => {
|
||||
const limitation = "ARM64 call targets are only partially resolved.";
|
||||
const client = await connect({
|
||||
execute: async (name, arguments_) => {
|
||||
@@ -78,7 +78,6 @@ describe("enhanced MCP relationship limitations", () => {
|
||||
address: "0x1",
|
||||
status: "ok",
|
||||
calls: ["0x2"],
|
||||
limitations: [limitation],
|
||||
relationship_coverage: {
|
||||
status: "partial",
|
||||
limitations: [limitation],
|
||||
@@ -89,6 +88,13 @@ describe("enhanced MCP relationship limitations", () => {
|
||||
limitations: [limitation],
|
||||
},
|
||||
});
|
||||
// The node does not repeat what its coverage already states.
|
||||
const root = (
|
||||
graph.structuredContent as {
|
||||
normalized_result: { graph: Record<string, object[]> };
|
||||
}
|
||||
).normalized_result.graph["0"]?.[0];
|
||||
expect(root).not.toHaveProperty("limitations");
|
||||
const trace = await client.callTool({
|
||||
name: "trace_call_path",
|
||||
arguments: { start: "0x1", goal: "0x2" },
|
||||
@@ -210,10 +216,7 @@ describe("enhanced MCP graph caveats", () => {
|
||||
{
|
||||
status: "ok",
|
||||
relationship_coverage: { status: "unknown" },
|
||||
limitations: [
|
||||
"Provider did not report relationship coverage.",
|
||||
caveat,
|
||||
],
|
||||
limitations: [caveat],
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
@@ -109,9 +109,11 @@ it("shows the callee edges of an ARM64 procedure in the call graph", async () =>
|
||||
address: "0x1000",
|
||||
status: "ok",
|
||||
calls: ["0x2000", "0x3000"],
|
||||
limitations: expect.arrayContaining([
|
||||
"This relationship read does not establish calls to targets IDA does not recognize as functions; imports and other non-function call targets remain unknown.",
|
||||
]),
|
||||
relationship_coverage: expect.objectContaining({
|
||||
diagnostics: [
|
||||
"This relationship read does not establish calls to targets IDA does not recognize as functions; imports and other non-function call targets remain unknown.",
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
"1": [
|
||||
@@ -119,17 +121,21 @@ it("shows the callee edges of an ARM64 procedure in the call graph", async () =>
|
||||
address: "0x2000",
|
||||
status: "ok",
|
||||
calls: [],
|
||||
limitations: expect.arrayContaining([
|
||||
"This relationship read does not establish calls to targets IDA does not recognize as functions; imports and other non-function call targets remain unknown.",
|
||||
]),
|
||||
relationship_coverage: expect.objectContaining({
|
||||
diagnostics: [
|
||||
"This relationship read does not establish calls to targets IDA does not recognize as functions; imports and other non-function call targets remain unknown.",
|
||||
],
|
||||
}),
|
||||
},
|
||||
{
|
||||
address: "0x3000",
|
||||
status: "ok",
|
||||
calls: [],
|
||||
limitations: expect.arrayContaining([
|
||||
"This relationship read does not establish calls to targets IDA does not recognize as functions; imports and other non-function call targets remain unknown.",
|
||||
]),
|
||||
relationship_coverage: expect.objectContaining({
|
||||
diagnostics: [
|
||||
"This relationship read does not establish calls to targets IDA does not recognize as functions; imports and other non-function call targets remain unknown.",
|
||||
],
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -286,9 +292,10 @@ it("preserves missing callgraph coverage through direct, graph, and trace workfl
|
||||
{
|
||||
status: "ok",
|
||||
calls: [],
|
||||
limitations: expect.arrayContaining([
|
||||
expect.stringContaining("callgraph was unavailable"),
|
||||
]),
|
||||
relationship_coverage: expect.objectContaining({
|
||||
status: "unknown",
|
||||
reason: expect.stringContaining("callgraph was unavailable"),
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -389,7 +396,10 @@ it("preserves an explicit root cap below the edge limit through every relationsh
|
||||
"0": [
|
||||
{
|
||||
calls: ["0x2000"],
|
||||
limitations: expect.arrayContaining([limitation]),
|
||||
relationship_coverage: expect.objectContaining({
|
||||
status: "partial",
|
||||
limitations: [limitation],
|
||||
}),
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user