refactor(evidence): move artifact construction into domain
This commit is contained in:
1 parent
4f8465d8db
commit
7f9a03d6ab
9 files changed
+42
-21
No files matched your search
@@ -7,7 +7,7 @@ import {
|
||||
AnalysisOutputError,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import type { Evidence } from "../../domain/evidence.js";
|
||||
import { evmInterfaceEvidence } from "./EvmInterfaceEvidence.js";
|
||||
import { evmInterfaceEvidence } from "../../domain/evm/evmInterfaceEvidence.js";
|
||||
import {
|
||||
inspectEvmInterfaceInputSchema,
|
||||
evmInterfaceSchema,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
AnalysisOutputError,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import type { Evidence } from "../../domain/evidence.js";
|
||||
import { createGpuCodeObjectsEvidence } from "./GpuCodeObjectsEvidence.js";
|
||||
import { createGpuCodeObjectsEvidence } from "../../domain/gpu/gpuCodeObjectsEvidence.js";
|
||||
import { err, ok, type Result } from "../../domain/result.js";
|
||||
import {
|
||||
requireAnalysisViewRetention,
|
||||
|
||||
@@ -9,7 +9,7 @@ import {
|
||||
AnalysisOutputError,
|
||||
} from "../../domain/analysisErrorCore.js";
|
||||
import type { Evidence } from "../../domain/evidence.js";
|
||||
import { createModelArtifactEvidence } from "./ModelArtifactEvidence.js";
|
||||
import { createModelArtifactEvidence } from "../../domain/model/modelArtifactEvidence.js";
|
||||
import { err, ok, type Result } from "../../domain/result.js";
|
||||
import {
|
||||
requireAnalysisViewRetention,
|
||||
|
||||
+18
-4
@@ -1,11 +1,25 @@
|
||||
import { createEvidence } from "../../domain/evidence.js";
|
||||
import type { InspectEvmInterfaceInput } from "../../domain/evm/evmInterface.js";
|
||||
import type { EvmInterfaceExecution } from "./EvmInterfacePort.js";
|
||||
import {
|
||||
createEvidence,
|
||||
type EvidenceLocation,
|
||||
type EvidenceProvider,
|
||||
type EvidenceSubjectTarget,
|
||||
} from "../evidence.js";
|
||||
import type { InspectEvmInterfaceInput } from "./evmInterface.js";
|
||||
import type { JsonValue } from "../jsonValue.js";
|
||||
|
||||
interface EvmInterfaceObservation {
|
||||
readonly subject: EvidenceSubjectTarget & { readonly format: "file" };
|
||||
readonly provider: EvidenceProvider;
|
||||
readonly result: JsonValue;
|
||||
readonly rawResult: JsonValue | null;
|
||||
readonly locations: readonly EvidenceLocation[];
|
||||
readonly limitations: readonly string[];
|
||||
}
|
||||
|
||||
/** Preserve the same validated inference and provenance on success and failed finalization. */
|
||||
export const evmInterfaceEvidence = (
|
||||
input: InspectEvmInterfaceInput,
|
||||
execution: EvmInterfaceExecution,
|
||||
execution: EvmInterfaceObservation,
|
||||
) =>
|
||||
createEvidence(execution.subject, execution.provider, {
|
||||
operation: "inspect_evm_interface",
|
||||
+9
-5
@@ -1,10 +1,13 @@
|
||||
import type { ProviderIdentity } from "../AnalysisProvider.js";
|
||||
import {
|
||||
createEvidence,
|
||||
type Evidence,
|
||||
type EvidenceProvider,
|
||||
} from "../evidence.js";
|
||||
import type {
|
||||
GpuCodeObjects,
|
||||
GpuCodeObjectsInput,
|
||||
GpuCodeObjectsPartial,
|
||||
} from "../../domain/gpu/gpuCodeObjects.js";
|
||||
import { createEvidence, type Evidence } from "../../domain/evidence.js";
|
||||
} from "./gpuCodeObjects.js";
|
||||
|
||||
const gpuParameters = (parameters: GpuCodeObjectsInput) => ({
|
||||
path: parameters.path,
|
||||
@@ -17,10 +20,11 @@ const gpuParameters = (parameters: GpuCodeObjectsInput) => ({
|
||||
? {}
|
||||
: { expected_sha256: parameters.expected_sha256 }),
|
||||
});
|
||||
|
||||
/** One Evidence interpretation for success and observations retained by file finalization failures. */
|
||||
export const createGpuCodeObjectsEvidence = (
|
||||
report: GpuCodeObjects,
|
||||
provider: ProviderIdentity,
|
||||
provider: EvidenceProvider,
|
||||
parameters: GpuCodeObjectsInput,
|
||||
): Evidence =>
|
||||
createEvidence(
|
||||
@@ -42,7 +46,7 @@ export const createGpuCodeObjectsEvidence = (
|
||||
|
||||
export const createGpuCodeObjectsPartialEvidence = (
|
||||
report: GpuCodeObjectsPartial,
|
||||
provider: ProviderIdentity,
|
||||
provider: EvidenceProvider,
|
||||
parameters: GpuCodeObjectsInput,
|
||||
): Evidence =>
|
||||
createEvidence(undefined, provider, {
|
||||
+9
-6
@@ -1,15 +1,18 @@
|
||||
import type { ProviderIdentity } from "../AnalysisProvider.js";
|
||||
import {
|
||||
createEvidence,
|
||||
type Evidence,
|
||||
type EvidenceProvider,
|
||||
} from "../evidence.js";
|
||||
import type {
|
||||
ModelArtifact,
|
||||
ModelArtifactPartial,
|
||||
ModelArtifactInput,
|
||||
} from "../../domain/model/modelArtifact.js";
|
||||
import { createEvidence, type Evidence } from "../../domain/evidence.js";
|
||||
ModelArtifactPartial,
|
||||
} from "./modelArtifact.js";
|
||||
|
||||
/** One Evidence interpretation for success and observations retained by file finalization failures. */
|
||||
export const createModelArtifactEvidence = (
|
||||
report: ModelArtifact,
|
||||
provider: ProviderIdentity,
|
||||
provider: EvidenceProvider,
|
||||
parameters: ModelArtifactInput,
|
||||
): Evidence => {
|
||||
const source = report.artifact;
|
||||
@@ -37,7 +40,7 @@ export const createModelArtifactEvidence = (
|
||||
/** Evidence for completed GGUF facts retained before final identity verification. */
|
||||
export const createModelArtifactPartialEvidence = (
|
||||
partial: ModelArtifactPartial,
|
||||
provider: ProviderIdentity,
|
||||
provider: EvidenceProvider,
|
||||
parameters: ModelArtifactInput,
|
||||
): Evidence =>
|
||||
createEvidence(undefined, provider, {
|
||||
@@ -37,7 +37,7 @@ import {
|
||||
AnalysisOutputError,
|
||||
} from "../domain/analysisErrorCore.js";
|
||||
import { projectAnalysisError } from "../domain/analysisErrorProjection.js";
|
||||
import { evmInterfaceEvidence } from "../application/evm/EvmInterfaceEvidence.js";
|
||||
import { evmInterfaceEvidence } from "../domain/evm/evmInterfaceEvidence.js";
|
||||
import {
|
||||
DEFAULT_EVM_TIMEOUT_MS,
|
||||
type InspectEvmInterfaceInput,
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { GpuCodeObjectsPort } from "../application/gpu/GpuCodeObjectsPort.j
|
||||
import {
|
||||
createGpuCodeObjectsEvidence,
|
||||
createGpuCodeObjectsPartialEvidence,
|
||||
} from "../application/gpu/GpuCodeObjectsEvidence.js";
|
||||
} from "../domain/gpu/gpuCodeObjectsEvidence.js";
|
||||
import type { ExecutionOptions } from "../application/AnalysisProvider.js";
|
||||
import type {
|
||||
GpuCodeObjects,
|
||||
|
||||
@@ -3,7 +3,7 @@ import type { ModelArtifactPort } from "../application/model/ModelArtifactPort.j
|
||||
import {
|
||||
createModelArtifactEvidence,
|
||||
createModelArtifactPartialEvidence,
|
||||
} from "../application/model/ModelArtifactEvidence.js";
|
||||
} from "../domain/model/modelArtifactEvidence.js";
|
||||
import type { ExecutionOptions } from "../application/AnalysisProvider.js";
|
||||
import type {
|
||||
ModelArtifact,
|
||||
|
||||
Reference in new issue
Block a user