refactor!: enforce canonical evidence and provider boundaries

Deliver complete Evidence directly through MCP with required nullable analysis profiles and immutable per-server delivery settings. Bind selected environments at construction and require typed cleanup outcomes with retained retry ownership.

Remove test-only routing, duplicate session and snapshot metadata, producer-field repairs, and ambiguous provider arguments. Separate artifact byte identity from occurrence classification and retain typed source-map and partial native facts across CLI, MCP, and verifier consumers.

BREAKING CHANGE: obsolete Evidence envelopes, session aliases, incomplete snapshots, and missing normalized producer facts are no longer accepted.
This commit is contained in:
morluto
2026-10-09 20:18:52 +08:00
parent 2a7746998d
commit 63bf91405c
514 changed files with 9296 additions and 5825 deletions
+16 -49
View File
@@ -9,7 +9,6 @@ import {
type SourceToBundleSignal,
} from "./sourceToBundleComparisonSchemas.js";
import { isDigest } from "../digests.js";
import { resolveJavaScriptSourceMapPath } from "./javascriptSourceMapPaths.js";
type SourceFile = Extract<
HistoricalSourceGraph["entries"][number],
@@ -174,40 +173,24 @@ const projectCurrentNode = (node: ApplicationNode): CurrentProjection => {
if (node.identity.strategy === "source-map-original") {
if (node.identity.source_sha256 !== null)
digests.add(node.identity.source_sha256);
const mapLocations = node.observations.flatMap(({ evidence }) =>
evidence.extractor.operation === "parse-local-source-map" &&
evidence.location.available &&
evidence.location.value.kind === "artifact-path"
? [evidence.location.value.path]
: [],
);
if (mapLocations.length === 0)
addPath(paths, "source-map-original", node.identity.original_source);
for (const mapPath of mapLocations)
addPath(
paths,
"source-map-original",
node.identity.original_source,
mapPath,
);
}
if (node.identity.strategy === "canonical-path")
addPath(paths, "canonical-path", node.identity.path);
for (const observation of node.observations) {
const sourceDigest = observation.properties.source_sha256;
if (typeof sourceDigest === "string" && isDigest(sourceDigest))
digests.add(sourceDigest);
for (const key of PATH_PROPERTIES) {
const location = observation.evidence.location;
const mapPath =
node.identity.strategy === "source-map-original" &&
observation.evidence.extractor.operation === "parse-local-source-map" &&
(key === "source" || key === "original_source") &&
location.available &&
location.value.kind === "artifact-path"
? location.value.path
: undefined;
addJsonPath(paths, observation.properties[key], mapPath);
if (node.identity.strategy === "source-map-original") {
const resolution = observation.source_map_reference?.resolution;
if (resolution !== undefined && resolution.kind !== "unresolved")
paths.push({
kind: "source-map-original",
value: resolution.path,
allowSuffix: resolution.kind === "suffix",
});
} else {
const sourceDigest = observation.properties.source_sha256;
if (typeof sourceDigest === "string" && isDigest(sourceDigest))
digests.add(sourceDigest);
for (const key of PATH_PROPERTIES)
addJsonPath(paths, observation.properties[key]);
}
}
return {
@@ -298,31 +281,15 @@ const matchingPaths = (
)
.map(({ value }) => value);
const addJsonPath = (
paths: CurrentPath[],
value: unknown,
mapPath?: string,
): void => {
if (typeof value === "string")
addPath(paths, "observation-path", value, mapPath);
const addJsonPath = (paths: CurrentPath[], value: unknown): void => {
if (typeof value === "string") addPath(paths, "observation-path", value);
};
const addPath = (
paths: CurrentPath[],
kind: CurrentPathKind,
raw: string,
mapPath?: string,
): void => {
if (kind === "source-map-original" || mapPath !== undefined) {
const resolved = resolveJavaScriptSourceMapPath(raw, mapPath);
if (resolved !== null)
paths.push({
kind,
value: resolved.value,
allowSuffix: resolved.scope === "suffix",
});
return;
}
const value = normalizeCurrentPath(raw);
if (value !== null) paths.push({ kind, value, allowSuffix: true });
};