refactor: remove forwarding exports and redundant aliases
This commit is contained in:
@@ -1,13 +1,11 @@
|
||||
import { compareProcessCaptures } from "./processComparison.js";
|
||||
import { parseProcessCapture } from "./processCaptureParsing.js";
|
||||
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
||||
|
||||
import {
|
||||
compareProcessCaptures,
|
||||
parseProcessCapture,
|
||||
processCaptureSchema,
|
||||
type UnverifiedProcessCapture,
|
||||
} from "./processCapture.js";
|
||||
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
||||
|
||||
export { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
||||
|
||||
/** Parse a detached valid empty capture for tests that need trusted evidence. */
|
||||
export const emptyProcessCapture = () =>
|
||||
parseProcessCapture(EMPTY_PROCESS_CAPTURE_EXAMPLE);
|
||||
|
||||
@@ -8,8 +8,6 @@ import {
|
||||
type ProcessCaptureTruncationDetails,
|
||||
} from "./processCaptureCoverage.js";
|
||||
|
||||
export * from "./processScenario.js";
|
||||
|
||||
/** Normalized raw PTY chunk, preserving transport-level output differences. */
|
||||
export interface TerminalFrame {
|
||||
readonly sequence: number;
|
||||
@@ -675,14 +673,3 @@ export const processCaptureSchema = processCaptureShapeSchema
|
||||
.describe(
|
||||
"The capture must preserve its canonical scenario, comparison, and normalization SHA-256 commitments; ordered capture timestamps and contiguous sequence numbers; before and final filesystem snapshots with truncation propagated; and exit-code consistency with deadline termination. The event journal is required; empty journals are valid. A non-empty journal must reference every captured observation exactly once with unique in-range references. These cross-field invariants are checked by REA after capture.",
|
||||
);
|
||||
|
||||
export { parseProcessCapture } from "./processCaptureParsing.js";
|
||||
export type { ProcessCapture } from "./processCaptureParsing.js";
|
||||
|
||||
export {
|
||||
compareProcessCaptures,
|
||||
comparisonStatusSchema,
|
||||
deriveProcessComparisonStatus,
|
||||
PROCESS_COMPARISON_DIMENSIONS,
|
||||
processCaptureComparisonSchema,
|
||||
} from "./processComparison.js";
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
import { expect, it } from "vitest";
|
||||
|
||||
import {
|
||||
digestProcessCommitment,
|
||||
parseProcessCapture,
|
||||
} from "./processCapture.js";
|
||||
import { digestProcessCommitment } from "./processScenario.js";
|
||||
import { parseProcessCapture } from "./processCaptureParsing.js";
|
||||
import {
|
||||
compareUnverifiedProcessCaptures as compareProcessCaptures,
|
||||
emptyUnverifiedProcessCapture as emptyCapture,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { JsonValue } from "../jsonValue.js";
|
||||
import { digestProcessCommitment } from "./processCapture.js";
|
||||
import { digestProcessCommitment } from "./processScenario.js";
|
||||
|
||||
const normalization = {
|
||||
paths: true,
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import type { UnverifiedProcessCapture } from "./processCapture.js";
|
||||
import { digestProcessCommitment } from "./processScenario.js";
|
||||
import { hasCaptureTruncation } from "./processCaptureCoverage.js";
|
||||
|
||||
import type { UnverifiedProcessCapture } from "./processCapture.js";
|
||||
/** One pure semantic validation failure in a shaped process capture. */
|
||||
export interface ProcessCaptureValidationIssue {
|
||||
readonly path: string;
|
||||
|
||||
@@ -3,21 +3,21 @@ import { z } from "zod";
|
||||
import { processSourceTruncated } from "./processCaptureCoverage.js";
|
||||
import type { ProcessObservationSource } from "./processObservation.js";
|
||||
|
||||
import type { ProcessCapture } from "./processCapture.js";
|
||||
import type { ProcessCapture } from "./processCaptureParsing.js";
|
||||
import { comparableTerminalFrame } from "./processObservation.js";
|
||||
import { AnalysisInputError } from "../analysisErrorCore.js";
|
||||
import { jsonValueSchema } from "../jsonValue.js";
|
||||
import {
|
||||
compareProcessTraces,
|
||||
processTraceOutcomesDiffer,
|
||||
processTraceComparisonResultSchema,
|
||||
type ProcessTraceSpecification,
|
||||
} from "./processTraceComparison.js";
|
||||
import { type ProcessTraceSpecification } from "./processTraceSpecification.js";
|
||||
import { processTraceComparisonResultSchema } from "./processTraceEvaluation.js";
|
||||
import {
|
||||
dimensionsForTraceSources,
|
||||
traceCoversObservedDimension,
|
||||
} from "./processTraceDimensionProjection.js";
|
||||
|
||||
import {
|
||||
compareProcessTraces,
|
||||
processTraceOutcomesDiffer,
|
||||
} from "./processTraceComparison.js";
|
||||
const OPERATION = "compare_process_captures";
|
||||
|
||||
/** Comparison classification that never equates incomplete evidence. */
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
|
||||
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCapture.fixture.js";
|
||||
import {
|
||||
compareProcessCaptures,
|
||||
parseProcessCapture,
|
||||
} from "./processCapture.js";
|
||||
import type { ProcessTraceSpecification } from "./processTraceComparison.js";
|
||||
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
||||
import { compareProcessCaptures } from "./processComparison.js";
|
||||
import { parseProcessCapture } from "./processCaptureParsing.js";
|
||||
import type { ProcessTraceSpecification } from "./processTraceSpecification.js";
|
||||
const beforeCheckpoint = {
|
||||
name: "before",
|
||||
at_ms: 0,
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCapture.fixture.js";
|
||||
import { parseProcessCapture, type ProcessCapture } from "./processCapture.js";
|
||||
import { type ProcessTraceSpecification } from "./processTraceComparison.js";
|
||||
import { EMPTY_PROCESS_CAPTURE_EXAMPLE } from "./processCaptureExample.js";
|
||||
import {
|
||||
parseProcessCapture,
|
||||
type ProcessCapture,
|
||||
} from "./processCaptureParsing.js";
|
||||
import { type ProcessTraceSpecification } from "./processTraceSpecification.js";
|
||||
|
||||
export const emptyCapture = parseProcessCapture(EMPTY_PROCESS_CAPTURE_EXAMPLE);
|
||||
export const terminal = { sequence: 0, at_ms: 900, data: "Ready" };
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { parseProcessCapture } from "./processCapture.js";
|
||||
import {
|
||||
compareProcessTraces,
|
||||
processTraceComparisonResultSchema,
|
||||
type ProcessTraceSpecification,
|
||||
} from "./processTraceComparison.js";
|
||||
import { parseProcessCapture } from "./processCaptureParsing.js";
|
||||
import { type ProcessTraceSpecification } from "./processTraceSpecification.js";
|
||||
import { processTraceComparisonResultSchema } from "./processTraceEvaluation.js";
|
||||
import {
|
||||
capture,
|
||||
partialSpecification,
|
||||
@@ -13,6 +10,7 @@ import {
|
||||
values,
|
||||
} from "./processTraceComparison.fixture.js";
|
||||
|
||||
import { compareProcessTraces } from "./processTraceComparison.js";
|
||||
describe("generic capture trace comparison", () => {
|
||||
it("requires explicit partial ordering and never infers causality from timestamps", () => {
|
||||
const specification = partialSpecification();
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ProcessCapture } from "./processCapture.js";
|
||||
import type { ProcessCapture } from "./processCaptureParsing.js";
|
||||
import {
|
||||
evaluateProcessTraceSide,
|
||||
processTraceComparisonResultSchema,
|
||||
@@ -9,15 +9,6 @@ import {
|
||||
type ProcessTraceSpecification,
|
||||
} from "./processTraceSpecification.js";
|
||||
|
||||
export {
|
||||
processTraceComparisonResultSchema,
|
||||
type ProcessTraceComparisonResult,
|
||||
} from "./processTraceEvaluation.js";
|
||||
export {
|
||||
processTraceSpecificationSchema,
|
||||
type ProcessTraceSpecification,
|
||||
} from "./processTraceSpecification.js";
|
||||
|
||||
/** Compare two captures against an explicit finite trace language. */
|
||||
export const compareProcessTraces = (
|
||||
left: ProcessCapture,
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import type { ProcessCapture } from "./processCapture.js";
|
||||
import type { ProcessTraceSource } from "./processTraceSpecification.js";
|
||||
import type { ProcessCapture } from "./processCaptureParsing.js";
|
||||
import type { ProcessObservationSource } from "./processObservation.js";
|
||||
|
||||
export type ProcessComparisonDimension =
|
||||
| "terminal"
|
||||
@@ -8,9 +8,9 @@ export type ProcessComparisonDimension =
|
||||
| "filesystem"
|
||||
| "process";
|
||||
|
||||
/** Map declared trace sources to legacy process-comparison dimensions. */
|
||||
/** Map declared trace sources to process-comparison dimensions. */
|
||||
export const dimensionsForTraceSources = (
|
||||
sources: ReadonlySet<ProcessTraceSource>,
|
||||
sources: ReadonlySet<ProcessObservationSource>,
|
||||
): ReadonlySet<ProcessComparisonDimension> => {
|
||||
const dimensions = new Set<ProcessComparisonDimension>();
|
||||
for (const source of sources) {
|
||||
@@ -26,7 +26,7 @@ export const dimensionsForTraceSources = (
|
||||
/** Whether a trace specification covers every observed source in a dimension. */
|
||||
export const traceCoversObservedDimension = (
|
||||
dimension: ProcessComparisonDimension,
|
||||
sources: ReadonlySet<ProcessTraceSource>,
|
||||
sources: ReadonlySet<ProcessObservationSource>,
|
||||
left: ProcessCapture,
|
||||
right: ProcessCapture,
|
||||
): boolean => {
|
||||
|
||||
@@ -1,30 +1,26 @@
|
||||
import { z } from "zod";
|
||||
|
||||
import type { JsonValue } from "../jsonValue.js";
|
||||
import type { ProcessCapture } from "./processCapture.js";
|
||||
import type { ProcessCapture } from "./processCaptureParsing.js";
|
||||
import { processSourceTruncated } from "./processCaptureCoverage.js";
|
||||
import {
|
||||
processObservationLocationSchema,
|
||||
projectProcessObservation,
|
||||
type ProcessObservationLocation,
|
||||
type ProcessObservationSource,
|
||||
} from "./processObservation.js";
|
||||
import {
|
||||
canonicalTraceJson,
|
||||
comparableTracePayload,
|
||||
processTraceCardinalityBounds,
|
||||
type ProcessTraceSource,
|
||||
type ProcessTraceSpecification,
|
||||
} from "./processTraceSpecification.js";
|
||||
|
||||
const identifierSchema = z.string().regex(/^[A-Za-z][A-Za-z0-9._\x2d]{0,63}$/u);
|
||||
|
||||
export type ProcessTraceLocation = ProcessObservationLocation;
|
||||
|
||||
const locationSchema = processObservationLocationSchema;
|
||||
|
||||
const matchedEventSchema = z.strictObject({
|
||||
event_id: identifierSchema,
|
||||
location: locationSchema,
|
||||
location: processObservationLocationSchema,
|
||||
});
|
||||
|
||||
const sideResultShape = {
|
||||
@@ -58,7 +54,7 @@ const diagnosticSchema = z.strictObject({
|
||||
side: z.enum(["left", "right"]),
|
||||
message: z.string(),
|
||||
event_ids: z.array(identifierSchema),
|
||||
locations: z.array(locationSchema),
|
||||
locations: z.array(processObservationLocationSchema),
|
||||
});
|
||||
|
||||
/** Structured verdict for one declared process trace language. */
|
||||
@@ -73,13 +69,13 @@ export type ProcessTraceComparisonResult = z.infer<
|
||||
>;
|
||||
|
||||
type TraceRecord = {
|
||||
readonly source: ProcessTraceSource;
|
||||
readonly source: ProcessObservationSource;
|
||||
readonly payload: JsonValue;
|
||||
readonly location: ProcessTraceLocation;
|
||||
readonly location: ProcessObservationLocation;
|
||||
};
|
||||
|
||||
const scopesFor = (
|
||||
sources: ReadonlySet<ProcessTraceSource>,
|
||||
sources: ReadonlySet<ProcessObservationSource>,
|
||||
): ReadonlySet<string> =>
|
||||
new Set(
|
||||
[...sources].map((source) => {
|
||||
@@ -109,7 +105,7 @@ type FailureInput = {
|
||||
readonly kind: z.infer<typeof diagnosticSchema>["kind"];
|
||||
readonly message: string;
|
||||
readonly eventIds: readonly string[];
|
||||
readonly locations: readonly ProcessTraceLocation[];
|
||||
readonly locations: readonly ProcessObservationLocation[];
|
||||
readonly rawTrace: z.infer<typeof matchedEventSchema>[];
|
||||
};
|
||||
|
||||
@@ -155,12 +151,12 @@ const evaluateFiniteTrace = (
|
||||
|
||||
type MatchedTrace = {
|
||||
readonly rawTrace: z.infer<typeof matchedEventSchema>[];
|
||||
readonly locationsById: ReadonlyMap<string, ProcessTraceLocation[]>;
|
||||
readonly locationsById: ReadonlyMap<string, ProcessObservationLocation[]>;
|
||||
};
|
||||
|
||||
const collectRecords = (
|
||||
capture: ProcessCapture,
|
||||
sources: ReadonlySet<ProcessTraceSource>,
|
||||
sources: ReadonlySet<ProcessObservationSource>,
|
||||
): readonly TraceRecord[] => {
|
||||
const records: TraceRecord[] = [];
|
||||
for (const location of capture.event_journal) {
|
||||
@@ -180,9 +176,9 @@ const matchRecords = (
|
||||
specification: ProcessTraceSpecification,
|
||||
): MatchedTrace | EvaluatedSide => {
|
||||
const rawTrace: z.infer<typeof matchedEventSchema>[] = [];
|
||||
const locationsById = new Map<string, ProcessTraceLocation[]>();
|
||||
const locationsById = new Map<string, ProcessObservationLocation[]>();
|
||||
const ignoredFieldsBySource = new Map<
|
||||
ProcessTraceSource,
|
||||
ProcessObservationSource,
|
||||
readonly string[]
|
||||
>();
|
||||
const eventsByKey = new Map<
|
||||
|
||||
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
|
||||
import {
|
||||
processTraceSpecificationSchema,
|
||||
type ProcessTraceSpecification,
|
||||
} from "./processTraceComparison.js";
|
||||
} from "./processTraceSpecification.js";
|
||||
|
||||
const ready = { sequence: 0, at_ms: 10, data: "ready" };
|
||||
const worker = {
|
||||
|
||||
@@ -12,10 +12,6 @@ import {
|
||||
|
||||
const identifierSchema = z.string().regex(IDENTIFIER_PATTERN);
|
||||
|
||||
/** Process observation families admitted by a declared trace specification. */
|
||||
export const processTraceSourceSchema = processObservationSourceSchema;
|
||||
export type ProcessTraceSource = ProcessObservationSource;
|
||||
|
||||
const cardinalitySchema = z.discriminatedUnion("kind", [
|
||||
z.strictObject({ kind: z.literal("required") }),
|
||||
z.strictObject({ kind: z.literal("optional") }),
|
||||
@@ -37,7 +33,7 @@ const cardinalitySchema = z.discriminatedUnion("kind", [
|
||||
|
||||
const eventDeclarationSchema = z.strictObject({
|
||||
id: identifierSchema,
|
||||
source: processTraceSourceSchema,
|
||||
source: processObservationSourceSchema,
|
||||
exact: jsonValueSchema,
|
||||
ignore_fields: z
|
||||
.array(
|
||||
|
||||
Reference in New Issue
Block a user