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:
@@ -1,10 +1,14 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import { projectAnalysisError } from "../../domain/analysisErrorProjection.js";
|
||||
import { ProviderAdapterError } from "../../domain/providerAdapterError.js";
|
||||
import { ProviderCleanupError } from "../../domain/providerCleanupError.js";
|
||||
import { err } from "../../domain/result.js";
|
||||
import type { AnalysisClient } from "../AnalysisProvider.js";
|
||||
import { closeAnalysisClient } from "./AnalysisClientCleanup.js";
|
||||
import {
|
||||
analysisErrorWithCleanupFailure,
|
||||
closeAnalysisClient,
|
||||
} from "./AnalysisClientCleanup.js";
|
||||
|
||||
const clientClosingWith = (cause: unknown): AnalysisClient => ({
|
||||
execute: () => Promise.resolve(err(new ProviderCleanupError("x", [], {}))),
|
||||
@@ -43,3 +47,31 @@ it("still reports an untyped close rejection as the provider client", async () =
|
||||
details: { resources: ["provider-client"] },
|
||||
});
|
||||
});
|
||||
|
||||
it("preserves the original explanation and collected output alongside cleanup uncertainty", () => {
|
||||
const primary = new ProviderAdapterError("fixture", "capture", {
|
||||
userMessage: "Select the running target process and retry the capture.",
|
||||
capturedOutput: {
|
||||
stdout: "partial observation",
|
||||
stderr: "native reason",
|
||||
truncated: false,
|
||||
},
|
||||
});
|
||||
const cleanup = new ProviderCleanupError("fixture", ["owned-process"], {
|
||||
reason: "Process termination was not confirmed",
|
||||
});
|
||||
const combined = analysisErrorWithCleanupFailure(primary, cleanup);
|
||||
expect(projectAnalysisError(combined)).toMatchObject({
|
||||
code: "cleanup_incomplete",
|
||||
message: primary.userMessage,
|
||||
details: {
|
||||
resources: ["owned-process"],
|
||||
captured_output: primary.capturedOutput,
|
||||
diagnostics: {
|
||||
primary_error: projectAnalysisError(primary),
|
||||
cleanup_error: projectAnalysisError(cleanup),
|
||||
},
|
||||
},
|
||||
});
|
||||
expect(combined.cause).toBe(primary);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user