mirror of
https://github.com/morluto/rea
synced 2026-10-28 15:07:26 -04:00
refactor(artifacts): centralize completed snapshot observations
Normalize completed stable-file path, digest and length in one shared observation owner. Migrate thirteen identical provider projections while preserving their selected paths, schema checks and cleanup composition. Keep specialized metadata and worker reply observations at their existing owners. Validation: shared real-descriptor coverage and provider lifecycle tests passed; build, typecheck, lint and formatting passed.
This commit is contained in:
@@ -6,13 +6,10 @@ import {
|
||||
bindArtifactFileCleanup,
|
||||
} from "../artifacts/ArtifactFileOperation.js";
|
||||
import { ArtifactReaderFailure } from "../artifacts/ArtifactReader.js";
|
||||
import {
|
||||
completedStableArtifact,
|
||||
readStableArtifact,
|
||||
} from "../artifacts/readStableArtifact.js";
|
||||
import { readStableArtifact } from "../artifacts/readStableArtifact.js";
|
||||
import { ArtifactResourceScope } from "../artifacts/ArtifactResourceScope.js";
|
||||
import { analysisErrorWithCleanupFailure } from "../domain/analysisErrorCleanup.js";
|
||||
import { fileSnapshotPartialObservationSchema } from "../domain/fileSnapshotObservation.js";
|
||||
import { completedStableArtifactObservation } from "../artifacts/StableArtifactObservation.js";
|
||||
import type { PythonPycPort } from "../application/python/PythonPycPort.js";
|
||||
import type { ExecutionOptions } from "../application/AnalysisProvider.js";
|
||||
import { AnalysisError } from "../domain/analysisErrorBase.js";
|
||||
@@ -168,16 +165,8 @@ const failureForPrimary = (
|
||||
|
||||
const failureFor = (cause: unknown, input: InspectPythonPycInput) => {
|
||||
const primary = failureForPrimary(artifactFilePrimaryFacts(cause), input);
|
||||
const snapshot = completedStableArtifact(cause);
|
||||
if (snapshot !== undefined)
|
||||
primary.retainPartialObservation(
|
||||
fileSnapshotPartialObservationSchema.parse({
|
||||
kind: "file-snapshot-hash",
|
||||
path: input.path,
|
||||
sha256: snapshot.sha256,
|
||||
bytes: snapshot.bytes.length,
|
||||
}),
|
||||
);
|
||||
const observation = completedStableArtifactObservation(cause, input.path);
|
||||
if (observation !== undefined) primary.retainPartialObservation(observation);
|
||||
if (!(cause instanceof ArtifactReaderFailure) || cause.cleanup === undefined)
|
||||
return primary;
|
||||
const cleanup = new ProviderCleanupError(
|
||||
|
||||
Reference in New Issue
Block a user