refactor(captures)!: require canonical producer metadata
Require process retention accounting, browser network transaction identity, and all web comparison dimensions. Remove obsolete omission repairs and derive completeness from the owning producer facts. BREAKING CHANGE: Historical captures without current producer accounting or transaction identity, and web diffs missing accessibility or storage dimensions, are rejected.
This commit is contained in:
@@ -4,7 +4,9 @@ import { jsonValueSchema } from "../jsonValue.js";
|
||||
import { normalizationSchema } from "./processScenario.js";
|
||||
import { collectProcessCaptureIssues } from "./processCaptureValidation.js";
|
||||
import {
|
||||
filesystemCoverageSchema,
|
||||
processCaptureTruncationDetailsSchema,
|
||||
type FilesystemCoverage,
|
||||
type ProcessCaptureTruncationDetails,
|
||||
} from "./processCaptureCoverage.js";
|
||||
|
||||
@@ -66,6 +68,15 @@ export type FileState = FileStateIdentity &
|
||||
}
|
||||
);
|
||||
|
||||
/** Complete metadata returned for one root-aliased filesystem checkpoint. */
|
||||
export interface ProcessFilesystemSnapshot {
|
||||
readonly files: readonly FileState[];
|
||||
readonly truncated: boolean;
|
||||
/** Root aliases whose path enumeration was exhausted, regardless of hash coverage. */
|
||||
readonly completeRoots: readonly string[];
|
||||
readonly coverage: FilesystemCoverage;
|
||||
}
|
||||
|
||||
interface FileEffectIdentity {
|
||||
readonly path: string;
|
||||
}
|
||||
@@ -208,8 +219,8 @@ export interface UnverifiedProcessCapture {
|
||||
readonly files_after: readonly FileState[];
|
||||
readonly filesystem_effects: readonly FileEffect[];
|
||||
readonly truncated: boolean;
|
||||
/** Optional on older captures; identifies each producer's actual coverage. */
|
||||
readonly truncation_details?: ProcessCaptureTruncationDetails | undefined;
|
||||
/** Per-source accounting for the producer's actual capture coverage. */
|
||||
readonly truncation_details: ProcessCaptureTruncationDetails;
|
||||
readonly limitations: readonly string[];
|
||||
readonly residual_unknowns: readonly {
|
||||
readonly scope:
|
||||
@@ -265,14 +276,6 @@ export type PartialProcessObservationField<T> =
|
||||
| { readonly state: "available"; readonly value: T }
|
||||
| { readonly state: "unavailable"; readonly reason: string };
|
||||
|
||||
/** Snapshot facts available before filesystem comparison can be completed. */
|
||||
/** Snapshot facts available before filesystem comparison can be completed. */
|
||||
export interface PartialFilesystemSnapshot {
|
||||
readonly files: readonly FileState[];
|
||||
readonly truncated: boolean;
|
||||
}
|
||||
|
||||
/** Available and unavailable fields when a run never becomes a full capture. */
|
||||
/** Available and unavailable fields when a run never becomes a full capture. */
|
||||
export interface IncompleteProcessCaptureObservations {
|
||||
readonly target_pid: PartialProcessObservationField<number>;
|
||||
@@ -296,8 +299,8 @@ export interface IncompleteProcessCaptureObservations {
|
||||
readonly ProcessSample[]
|
||||
>;
|
||||
readonly filesystem_snapshots: {
|
||||
readonly before: PartialProcessObservationField<PartialFilesystemSnapshot>;
|
||||
readonly after: PartialProcessObservationField<PartialFilesystemSnapshot>;
|
||||
readonly before: PartialProcessObservationField<ProcessFilesystemSnapshot>;
|
||||
readonly after: PartialProcessObservationField<ProcessFilesystemSnapshot>;
|
||||
};
|
||||
readonly event_journal: PartialProcessObservationField<
|
||||
readonly ProcessCaptureEventJournalEntry[]
|
||||
@@ -330,6 +333,13 @@ const fileStateSchema = z.discriminatedUnion("type", [
|
||||
symlink_target: z.null(),
|
||||
}),
|
||||
]);
|
||||
/** Canonical checkpoint facts retained even when capture completion fails. */
|
||||
export const processFilesystemSnapshotSchema = z.strictObject({
|
||||
files: z.array(fileStateSchema),
|
||||
truncated: z.boolean(),
|
||||
completeRoots: z.array(z.string()),
|
||||
coverage: filesystemCoverageSchema,
|
||||
});
|
||||
const fileEffectSchema = z.discriminatedUnion("status", [
|
||||
z.object({
|
||||
path: z.string(),
|
||||
@@ -481,7 +491,7 @@ const processCaptureShapeSchema = z.strictObject({
|
||||
files_after: z.array(fileStateSchema),
|
||||
filesystem_effects: z.array(fileEffectSchema),
|
||||
truncated: z.boolean(),
|
||||
truncation_details: processCaptureTruncationDetailsSchema.optional(),
|
||||
truncation_details: processCaptureTruncationDetailsSchema,
|
||||
limitations: z.array(z.string()),
|
||||
residual_unknowns: z.array(
|
||||
z.object({
|
||||
@@ -545,18 +555,8 @@ const incompleteProcessCaptureObservationsSchema = z.strictObject({
|
||||
processCaptureShapeSchema.shape.process_samples,
|
||||
),
|
||||
filesystem_snapshots: z.strictObject({
|
||||
before: partialObservationFieldSchema(
|
||||
z.strictObject({
|
||||
files: z.array(fileStateSchema),
|
||||
truncated: z.boolean(),
|
||||
}),
|
||||
),
|
||||
after: partialObservationFieldSchema(
|
||||
z.strictObject({
|
||||
files: z.array(fileStateSchema),
|
||||
truncated: z.boolean(),
|
||||
}),
|
||||
),
|
||||
before: partialObservationFieldSchema(processFilesystemSnapshotSchema),
|
||||
after: partialObservationFieldSchema(processFilesystemSnapshotSchema),
|
||||
}),
|
||||
event_journal: partialObservationFieldSchema(
|
||||
processCaptureShapeSchema.shape.event_journal,
|
||||
|
||||
Reference in New Issue
Block a user