refactor(application): move AnalysisViewRetention to a light module and defer view loading in services (#14102)

* refactor(application): move AnalysisViewRetention to a light module and defer view loading in services

AnalysisViewRetention and requireAnalysisViewRetention moved from AnalysisViewService (which pulls the 1.3 MB analysis-view result graph) into AnalysisViewRetention.ts, which depends only on error and Evidence port types. All type-only consumers now import the light module. ApkSignature, Il2cpp and Reverse services load AnalysisViewService dynamically only on the detail=summary branch, and executeArtifactInspection checks retention readiness through the light module and loads the view service only after a successful inspection. No behavior or wire change.

Refs #13275, #13940. Verified: check:fast (typecheck, lint, architecture guards), 93 source tests (AnalysisViewService, Il2cpp, ApkSignature, Reverse), cliStartupImports 10/10 on pinned Node 24.22.1, knip clean. Remaining static importers (ArtifactComparisonEvidence, environment build/state, Frida sync inspectStatus, server bindings) still block a full chunk split and stay in #13275.

* fix(application): recheck cancellation after lazy view imports and guard static view links

An abort arriving while the dynamic AnalysisViewService import was pending still recorded and returned a successful summary. ArtifactInspectionExecution, ApkSignature, Il2cpp and Reverse now recheck the signal after the import (retaining the complete Evidence as the cancelled partial observation) before projecting. Add a counted architecture guard so static AnalysisViewService imports in application services cannot return silently; the baseline records only the known synchronous helpers and Frida path tracked in #14112.
This commit is contained in:
morluto authored and GitHub committed 2026-11-23 12:00:29 -05:00
1 parent 90c374ea9c
commit 26d0bc7737
22 files changed
+133 -100

No files matched your search

@@ -9,9 +9,8 @@ import type {
import type { ExecutionOptions } from "../../ports/AnalysisProvider.js";
import {
requireAnalysisViewRetention,
summarizeRetainedAnalysis,
type AnalysisViewRetention,
} from "../analysisView/AnalysisViewService.js";
} from "../analysisView/AnalysisViewRetention.js";
import type { Il2cppMetadataPort } from "../../ports/il2cpp/Il2cppMetadataPort.js";
import { AnalysisError } from "../../domain/analysisErrorBase.js";
import {
@@ -169,9 +168,10 @@ export class Il2cppMetadataService {
seedReceipt = written.value;
}
if (isAborted(options?.signal)) return cancelled(options.signal);
return detail === "summary"
? summarizeRetainedAnalysis(evidence, retention)
: ok(evidence);
if (detail !== "summary") return ok(evidence);
const service = await import("../analysisView/AnalysisViewService.js");
if (options?.signal?.aborted) return cancelled(options.signal);
return service.summarizeRetainedAnalysis(evidence, retention);
}
#evidence(
value: Il2cppMetadata,