fix(analysis)!: scope call-graph caveats to their observed relationships
Return deduplicated execution caveats once and preserve provider-owned relationship diagnostics and completeness on graph nodes. Keep complete relationship reads exhaustive despite contextual caveats, including portable call-path reconstruction.
Preserve omitted diagnostic fields in historical Evidence and bind reported diagnostics into semantic identity. Revise graph workflow and Ghidra adapter profiles so old cached representations cannot replay under the new contracts.
Remove stale duplicate-lookup test claims and redundant fixture validation. Prune million-entry duplicate cases while retaining argument-stack and deep-chain regressions; bounded Flameox captures identified validation and canonical hashing costs.
Validation: static and architecture checks, generated docs, 364 focused tests before pruning, 21 call-path tests after pruning, public MCP schema validation and targeted profile tests. Real engine behavior was not locally exercised.
BREAKING CHANGE: get_call_graph normalized_result now contains { graph, limitations }; traversal-depth groups are under graph.
This commit is contained in:
@@ -33,6 +33,7 @@ import { inspectNativeDispatch } from "./native/NativeDispatchMetadataInspection
|
||||
import { traceNativeValues } from "./native/NativeValueTrace.js";
|
||||
import { traceNativeUiAction } from "./native/NativeUiActionTrace.js";
|
||||
import { jsonValueSchema, type JsonValue } from "../domain/jsonValue.js";
|
||||
import { compareUnicodeCodePoints } from "../domain/unicodeCodePointOrder.js";
|
||||
|
||||
import {
|
||||
invalidEnhancedInput,
|
||||
@@ -343,15 +344,26 @@ export class EnhancedTools {
|
||||
const relation = input.direction === "forward" ? "callees" : "callers";
|
||||
const tool =
|
||||
input.direction === "forward" ? "procedure_callees" : "procedure_callers";
|
||||
const resolved = await resolveProcedureAddress(
|
||||
this.#call.bind(this),
|
||||
input.address,
|
||||
const limitations = new Set<string>();
|
||||
const resolved = await this.#observe(
|
||||
"procedure_address",
|
||||
{ procedure: input.address },
|
||||
signal,
|
||||
);
|
||||
if (!resolved.ok) return resolved;
|
||||
const discovered = new Set([resolved.value]);
|
||||
for (const limitation of resolved.value.limitations)
|
||||
limitations.add(limitation);
|
||||
const startAddress = resolved.value.result;
|
||||
if (typeof startAddress !== "string" || startAddress.length === 0)
|
||||
return err(
|
||||
new AnalysisOutputError(
|
||||
"procedure_address",
|
||||
"provider returned no canonical procedure address",
|
||||
),
|
||||
);
|
||||
const discovered = new Set([startAddress]);
|
||||
const queue: Array<{ address: string; depth: number }> = [
|
||||
{ address: resolved.value, depth: 0 },
|
||||
{ address: startAddress, depth: 0 },
|
||||
];
|
||||
let queueIndex = 0;
|
||||
const graph: Record<string, JsonValue[]> = {};
|
||||
@@ -385,17 +397,40 @@ export class EnhancedTools {
|
||||
});
|
||||
continue;
|
||||
}
|
||||
for (const limitation of result.value.limitations)
|
||||
limitations.add(limitation);
|
||||
const reportedCoverage = result.value.relationshipCoverage;
|
||||
const coverage = reportedCoverage ?? {
|
||||
status: "unknown" as const,
|
||||
reason: "Provider did not report relationship coverage.",
|
||||
};
|
||||
const relationshipLimitations =
|
||||
reportedCoverage === undefined
|
||||
? [
|
||||
...result.value.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,
|
||||
);
|
||||
graph[level].push({
|
||||
address: current.address,
|
||||
status: "ok",
|
||||
calls: [...related.value],
|
||||
relationship_coverage: result.value.relationshipCoverage ?? {
|
||||
status: "unknown",
|
||||
reason: "Provider did not report relationship coverage.",
|
||||
},
|
||||
...(result.value.limitations.length === 0
|
||||
relationship_coverage: coverage,
|
||||
...(nodeLimitations.length === 0
|
||||
? {}
|
||||
: { limitations: [...result.value.limitations] }),
|
||||
: { limitations: nodeLimitations }),
|
||||
});
|
||||
for (const address of related.value) {
|
||||
if (!discovered.has(address)) {
|
||||
@@ -404,7 +439,10 @@ export class EnhancedTools {
|
||||
}
|
||||
}
|
||||
}
|
||||
return ok(graph);
|
||||
return ok({
|
||||
graph,
|
||||
limitations: [...limitations].sort(compareUnicodeCodePoints),
|
||||
});
|
||||
}
|
||||
|
||||
async #analyzeSwiftTypes(
|
||||
|
||||
Reference in New Issue
Block a user