feat: add managed characterization and coverage closure

This commit is contained in:
morluto
2026-07-16 22:53:50 +00:00
parent 00a3078148
commit 194349683a
163 changed files with 7832 additions and 245 deletions
+41
View File
@@ -62,6 +62,10 @@ import {
parseInvestigationWorkspace,
type InvestigationWorkspace,
} from "../domain/investigationWorkspace.js";
import {
parseReconstructionCoverageWorkspace,
type ReconstructionCoverageWorkspace,
} from "../domain/reconstructionCoverage.js";
import {
SessionProviderRouter,
type SessionProviderRoute,
@@ -97,6 +101,10 @@ export class BinarySession implements BinarySessionPort {
});
readonly #snapshot = new AnalysisSnapshotCache();
readonly #investigationWorkspaces = new Map<string, InvestigationWorkspace>();
readonly #reconstructionCoverageWorkspaces = new Map<
string,
ReconstructionCoverageWorkspace
>();
readonly #runtimeAvailability = new Map<
string,
{ readonly available: boolean; readonly reason: string | null }
@@ -288,6 +296,39 @@ export class BinarySession implements BinarySessionPort {
.map((workspace) => structuredClone(workspace));
}
/** Retain one validated immutable reconstruction coverage revision. */
retainReconstructionCoverageWorkspace(
workspace: ReconstructionCoverageWorkspace,
): "added" | "duplicate" {
const parsed = parseReconstructionCoverageWorkspace(workspace);
const key = `${parsed.workspace_id}:${String(parsed.revision)}`;
if (this.#reconstructionCoverageWorkspaces.has(key)) return "duplicate";
this.#reconstructionCoverageWorkspaces.set(key, parsed);
return "added";
}
/** Read one session-retained reconstruction coverage revision. */
reconstructionCoverageWorkspace(
workspaceId: string,
revision: number,
): ReconstructionCoverageWorkspace | undefined {
const workspace = this.#reconstructionCoverageWorkspaces.get(
`${workspaceId}:${String(revision)}`,
);
return workspace === undefined ? undefined : structuredClone(workspace);
}
/** List reconstruction coverage revisions in canonical identity order. */
reconstructionCoverageWorkspaces(): readonly ReconstructionCoverageWorkspace[] {
return [...this.#reconstructionCoverageWorkspaces.values()]
.sort(
(left, right) =>
left.workspace_id.localeCompare(right.workspace_id) ||
left.revision - right.revision,
)
.map((workspace) => structuredClone(workspace));
}
/** Create an approved residual unknown and immutable mutation evidence. */
recordUnknown(
input: RecordUnknownInput,