mirror of
https://github.com/morluto/rea.git
synced 2026-12-04 10:04:50 +00:00
refactor(evidence): share observed file report construction (#14320)
This commit is contained in:
1 parent
74996b5ba6
commit
52b73c0cc6
9 files changed
+101
-172
No files matched your search
@@ -1,13 +1,14 @@
|
||||
import type { ExecutionOptions } from "../../ports/AnalysisProvider.js";
|
||||
import type { PythonPycPort } from "../../ports/python/PythonPycPort.js";
|
||||
import type { AnalysisError } from "../../domain/analysisErrorBase.js";
|
||||
import { createEvidence, type Evidence } from "../../domain/evidence.js";
|
||||
import type { Evidence } from "../../domain/evidence.js";
|
||||
import {
|
||||
inspectPythonPycInputSchema,
|
||||
PYTHON_PYC_HEADER_BYTES,
|
||||
pythonPycSchema,
|
||||
} from "../../domain/python/pythonPyc.js";
|
||||
import type { Result } from "../../domain/result.js";
|
||||
import { observedFileEvidence } from "../observedFileEvidence.js";
|
||||
import { executeArtifactInspection } from "../ArtifactInspectionExecution.js";
|
||||
|
||||
const OPERATION = "inspect_python_pyc";
|
||||
@@ -39,34 +40,18 @@ export class PythonPycService {
|
||||
report.coverage.objects <= parameters.max_objects &&
|
||||
report.coverage.marshal_depth <= parameters.max_depth,
|
||||
buildEvidence: (value, identity, parameters) =>
|
||||
createEvidence(
|
||||
observedFileEvidence(value, identity, OPERATION, parameters, [
|
||||
{
|
||||
path: value.artifact.path,
|
||||
format: "file",
|
||||
sha256: value.artifact.sha256,
|
||||
kind: "file-offset-range",
|
||||
start: 0,
|
||||
end: PYTHON_PYC_HEADER_BYTES,
|
||||
},
|
||||
identity,
|
||||
{
|
||||
operation: OPERATION,
|
||||
parameters,
|
||||
result: value,
|
||||
confidence: "observed",
|
||||
limitations: value.limitations,
|
||||
locations: [
|
||||
{ kind: "artifact-path", path: value.artifact.path },
|
||||
{
|
||||
kind: "file-offset-range",
|
||||
start: 0,
|
||||
end: PYTHON_PYC_HEADER_BYTES,
|
||||
},
|
||||
{
|
||||
kind: "file-offset-range",
|
||||
start: PYTHON_PYC_HEADER_BYTES,
|
||||
end: value.artifact.bytes,
|
||||
},
|
||||
],
|
||||
kind: "file-offset-range",
|
||||
start: PYTHON_PYC_HEADER_BYTES,
|
||||
end: value.artifact.bytes,
|
||||
},
|
||||
),
|
||||
]),
|
||||
},
|
||||
rawInput,
|
||||
options,
|
||||
|
||||
Reference in new issue
Block a user