test: strengthen and prune audited test coverage (#8573)

* test: strengthen and prune audited test coverage

* test: require delivered DeepSeek skill instructions

* test: keep schema fixture types private

* test: verify Gemini receives skill instructions

* test: bind Qwen skill evidence to its tool result

* test: report NativeAOT verifier checks precisely

* fix: verify Ghidra cleanup paths reliably

* fix: verify Command Code skill activation

* test: tighten cleanup and fixture checks

* test: verify packet capture evidence is recorded

* fix: report HTTP3 capture provenance accurately

* test: preserve resource coverage through MCP

* test: prune repeated assertions and retain cancellation identity

* fix: validate client verifier fixture paths

* test: skip Copilot verifier cases on Windows

* test: keep verifier setup target relative
This commit is contained in:
morluto authored and GitHub committed 2026-11-02 02:13:32 +08:00
1 parent ce9095d727
commit 7bcefead69
167 files changed
+2396 -1012

No files matched your search

@@ -150,6 +150,7 @@ it("returns a typed output error for malformed Electron target output after abor
it("retains completed target facts when cancellation arrives before Evidence publication", async () => {
const controller = new AbortController();
const reason = { requested: "stop after listing targets" };
const targets = electronTargetListSchema.parse({
browser: inspection.browser,
targets: [],
@@ -159,7 +160,7 @@ it("retains completed target facts when cancellation arrives before Evidence pub
const provider: ElectronObservationPort = {
identity: () => identity,
listTargets: async () => {
controller.abort();
controller.abort(reason);
return ok(targets);
},
inspectPage: async () =>
@@ -173,8 +174,22 @@ it("retains completed target facts when cancellation arrives before Evidence pub
expect(result.ok).toBe(false);
if (!result.ok) {
expect(result.error).toBeInstanceOf(AnalysisCancelledError);
expect(result.error.cause).toBe(reason);
expect(parseEvidence(result.error.partialObservation)).toMatchObject({
operation: "list_electron_targets",
provider: identity,
parameters: { cdp_endpoint: input.cdp_endpoint },
confidence: "observed",
authority: "external-service",
environment: {
id: `${inspection.browser.product}@${inspection.browser.revision}`,
platform: "unknown",
architecture: "unknown",
isolation: "none",
},
limitations: expect.arrayContaining([
"Browser host platform and architecture were not observed.",
]),
normalized_result: targets,
});
}
@@ -1,5 +1,6 @@
import { setImmediate } from "node:timers/promises";
import { describe, expect, it } from "vitest";
import { ArtifactReaderFailure } from "../../artifacts/ArtifactReader.js";
import { completeJavaScriptAnalysisSteps } from "./JavaScriptAnalysisControl.js";
describe("JavaScript cooperative computation lifecycle", () => {
@@ -15,9 +16,19 @@ describe("JavaScript cooperative computation lifecycle", () => {
}
}
const cancellation = setImmediate().then(() => controller.abort(reason));
await expect(
completeJavaScriptAnalysisSteps(work(), controller.signal),
).rejects.toMatchObject({ reason: "cancelled", cause: reason });
const failure = await completeJavaScriptAnalysisSteps(
work(),
controller.signal,
).then(
() => {
throw new Error("Expected cancellation");
},
(cause: unknown) => cause,
);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
if (!(failure instanceof ArtifactReaderFailure)) throw failure;
expect(failure.reason).toBe("cancelled");
expect(failure.cause).toBe(reason);
await cancellation;
expect(released).toBe(true);
});
@@ -32,9 +43,19 @@ describe("JavaScript cooperative computation lifecycle", () => {
yield;
return 42;
}
await expect(
completeJavaScriptAnalysisSteps(work(), controller.signal),
).rejects.toMatchObject({ reason: "cancelled", cause: reason });
const failure = await completeJavaScriptAnalysisSteps(
work(),
controller.signal,
).then(
() => {
throw new Error("Expected cancellation");
},
(cause: unknown) => cause,
);
expect(failure).toBeInstanceOf(ArtifactReaderFailure);
if (!(failure instanceof ArtifactReaderFailure)) throw failure;
expect(failure.reason).toBe("cancelled");
expect(failure.cause).toBe(reason);
expect(started).toBe(false);
expect(await completeJavaScriptAnalysisSteps(work())).toBe(42);
});
@@ -1,6 +1,7 @@
import { describe, expect, it } from "vitest";
import { AnalysisCapabilityUnavailableError } from "../../domain/analysisErrorCore.js";
import { err, ok } from "../../domain/result.js";
import { parseEvidence } from "../../domain/evidence.js";
import type { JavaScriptRecoveryResult } from "../../domain/javascript/javascriptRecovery.js";
import { createAnalysisExecution } from "../AnalysisProvider.js";
import { JavaScriptRecoveryService } from "./JavaScriptRecoveryService.js";
@@ -179,7 +180,17 @@ it("returns cancellation with the validated Evidence when the caller aborts afte
if (result.ok) throw new Error("expected cancellation");
expect(result.error._tag).toBe("AnalysisCancelledError");
expect(result.error.cause).toBe(reason);
expect(result.error.partialObservation).toMatchObject({
expect(parseEvidence(result.error.partialObservation)).toMatchObject({
operation: "recover_javascript_sources",
provider: providerIdentity,
parameters: input,
subject: {
local_path: artifact.path,
digest: { sha256: artifact.sha256 },
format: "javascript",
},
confidence: "derived",
authority: "shipped-artifact",
normalized_result: recoveryResult(),
});
});