fix(analysis): bind overview document identity to the active target (#1094)

* fix(analysis): bind overview document identity to the active target

* fix(analysis): refresh legacy overview snapshot results
This commit is contained in:
Ysopwnable
2026-10-09 00:57:28 +08:00
committed by GitHub
parent 4a1837d9d5
commit 81b5104276
10 changed files with 292 additions and 129 deletions
+12 -9
View File
@@ -15,7 +15,6 @@ import { type AnalysisError } from "../domain/analysisErrorBase.js";
import {
addressDistance,
functionDossierSchema,
parseDocuments,
parseFunctionDossier,
parseListCount,
parseRelatedAddresses,
@@ -37,6 +36,7 @@ import {
type EnhancedResult,
type ValidatedEnhancedCall,
} from "./EnhancedToolTypes.js";
import { resolveAnalysisDocument } from "./AnalysisDocument.js";
import { traceCallPath } from "./CallPathTracing.js";
import { traceLiteralFeature } from "./EnhancedLiteralTracing.js";
import { projectNativeApiInspection } from "./native/NativeApiInspection.js";
@@ -388,29 +388,32 @@ export class EnhancedTools {
}
async #binaryOverview(signal?: AbortSignal): EnhancedResult {
const [segmentsResult, documentsResult, proceduresResult, stringsResult] =
await Promise.all([
const document = await resolveAnalysisDocument(
this.analysis,
undefined,
signal,
);
if (!document.ok) return document;
const [segmentsResult, proceduresResult, stringsResult] = await Promise.all(
[
this.#call("list_segments", {}, signal),
this.#call("list_documents", {}, signal),
this.#call("list_procedures", {}, signal),
this.#call("list_strings", {}, signal),
]);
],
);
if (!segmentsResult.ok) return segmentsResult;
if (!documentsResult.ok) return documentsResult;
if (!proceduresResult.ok) return proceduresResult;
if (!stringsResult.ok) return stringsResult;
const segments = parseSegments(segmentsResult.value);
if (!segments.ok) return segments;
const documents = parseDocuments(documentsResult.value);
if (!documents.ok) return documents;
const procedureCount = parseListCount(proceduresResult.value, "procedures");
if (!procedureCount.ok) return procedureCount;
const stringCount = parseListCount(stringsResult.value, "strings");
if (!stringCount.ok) return stringCount;
return ok({
document: documents.value[0] ?? "unknown",
document: document.value,
segments: segments.value.map(({ name, start, end }) => ({
name,
start,