refactor(process): remove redundant schema version markers
This commit is contained in:
@@ -165,7 +165,7 @@ export class EvidenceLedger {
|
||||
return this.#appendUnknown(unknown, parsedMutation);
|
||||
}
|
||||
|
||||
/** Atomically record derived Evidence and an approved residual unknown. */
|
||||
/** Atomically record derived Evidence and a linked residual unknown. */
|
||||
recordWithUnknown(
|
||||
evidenceInput: Evidence,
|
||||
input: RecordUnknownInput,
|
||||
|
||||
@@ -43,7 +43,6 @@ const timerHost = () => {
|
||||
};
|
||||
const twoStateScenario = (): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
@@ -193,7 +192,6 @@ describe("process reactive coordinator ordering", () => {
|
||||
});
|
||||
it("executes input, resize, root signal, and checkpoint in journal order", async () => {
|
||||
const scenario = processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "ready",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -38,7 +38,6 @@ const timerHost = () => {
|
||||
};
|
||||
const twoStateScenario = (): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -36,7 +36,6 @@ const timerHost = () => {
|
||||
};
|
||||
const twoStateScenario = (): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -18,7 +18,6 @@ export const callPathInputSchema = z.object({
|
||||
functions: z.array(evidenceSchema).min(1),
|
||||
start: z.object({ address: inputAddressSchema }).strict(),
|
||||
goal: z.object({ address: inputAddressSchema }).strict(),
|
||||
unknown_registry_approved: z.literal(true).optional(),
|
||||
});
|
||||
|
||||
const citedNodeSchema = z.object({
|
||||
|
||||
@@ -15,7 +15,6 @@ const evidenceIdSchema = z.string().regex(/^ev_[a-f0-9]{64}$/u);
|
||||
/** Strict bounded input for aggregating existing comparison Evidence. */
|
||||
export const changedBehaviorInputSchema = z.object({
|
||||
comparisons: z.array(evidenceSchema).max(100).default([]),
|
||||
unknown_registry_approved: z.literal(true).optional(),
|
||||
});
|
||||
|
||||
const findingSchema = z.object({
|
||||
|
||||
@@ -14,7 +14,7 @@ const record = (
|
||||
evidenceIds: readonly string[] = [evidenceId("1")],
|
||||
) => ({ claim_id: claimId, status, evidence_ids: evidenceIds });
|
||||
|
||||
describe("Evidence v2 completion ledger", () => {
|
||||
describe("Evidence completion ledger", () => {
|
||||
it("marks only an all-pass ledger complete", () => {
|
||||
const ledger = createEvidenceCompletionLedger([
|
||||
record("scenario.launch", "pass"),
|
||||
|
||||
@@ -130,7 +130,7 @@ const ledgerIssues = (
|
||||
});
|
||||
};
|
||||
|
||||
/** Strict path-free Evidence v2 completion ledger. */
|
||||
/** Strict path-free Evidence completion ledger. */
|
||||
export const evidenceCompletionLedgerSchema =
|
||||
completionLedgerObjectSchema.superRefine(ledgerIssues);
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ const digestSchema = z.string().regex(/^[a-f0-9]{64}$/u);
|
||||
export const functionComparisonInputSchema = z.strictObject({
|
||||
left_evidence_id: evidenceIdSchema,
|
||||
right_evidence_id: evidenceIdSchema,
|
||||
unknown_registry_approved: z.literal(true).optional(),
|
||||
});
|
||||
|
||||
const textDeltaSchema = z.object({
|
||||
|
||||
@@ -28,7 +28,6 @@ const scenarioWith = (
|
||||
transitions: readonly unknown[],
|
||||
): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -28,7 +28,6 @@ const scenarioWith = (
|
||||
transitions: readonly unknown[],
|
||||
): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -32,7 +32,6 @@ const scenarioWith = (
|
||||
transitions: readonly unknown[],
|
||||
): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30_000,
|
||||
states: [
|
||||
|
||||
@@ -28,7 +28,6 @@ const scenarioWith = (
|
||||
transitions: readonly unknown[],
|
||||
): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
@@ -225,7 +224,6 @@ describe("process reactive runtime predicates", () => {
|
||||
consume: true,
|
||||
};
|
||||
const scenario = processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "one",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -28,7 +28,6 @@ const scenarioWith = (
|
||||
transitions: readonly unknown[],
|
||||
): ProcessReactiveScenario =>
|
||||
processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
@@ -147,7 +146,6 @@ const offer = (
|
||||
describe("process reactive runtime predicates", () => {
|
||||
it("rejects an exhausted state visit before proposing effects", () => {
|
||||
const scenario = processReactiveScenarioSchema.parse({
|
||||
version: 1,
|
||||
initial_state: "loop",
|
||||
deadline_ms: 30000,
|
||||
states: [
|
||||
|
||||
@@ -27,7 +27,6 @@ const finishTransition = () => ({
|
||||
});
|
||||
|
||||
const baseScenario = () => ({
|
||||
version: 1 as const,
|
||||
initial_state: "starting",
|
||||
deadline_ms: 30_000,
|
||||
states: [
|
||||
@@ -41,9 +40,8 @@ const baseScenario = () => ({
|
||||
});
|
||||
|
||||
describe("process reactive scenario schema", () => {
|
||||
it("parses the bounded v1 terminal scenario", () => {
|
||||
it("parses a bounded terminal scenario", () => {
|
||||
expect(processReactiveScenarioSchema.parse(baseScenario())).toMatchObject({
|
||||
version: 1,
|
||||
initial_state: "starting",
|
||||
});
|
||||
expect(PROCESS_REACTIVE_LIMITS.triggerDepth).toBe(6);
|
||||
@@ -176,7 +174,6 @@ describe("process reactive scenario graph validation", () => {
|
||||
|
||||
it("accepts only explicitly bounded cycles", () => {
|
||||
const cycle = {
|
||||
version: 1 as const,
|
||||
initial_state: "one",
|
||||
deadline_ms: 10_000,
|
||||
states: [
|
||||
@@ -261,7 +258,6 @@ describe("process reactive scenario checkpoint validation", () => {
|
||||
since: { kind: "checkpoint" as const, name },
|
||||
});
|
||||
const input = {
|
||||
version: 1 as const,
|
||||
initial_state: "one",
|
||||
deadline_ms: 10_000,
|
||||
states: [
|
||||
@@ -331,7 +327,7 @@ describe("process reactive scenario nesting validation", () => {
|
||||
expect(result.success).toBe(false);
|
||||
if (!result.success)
|
||||
expect(result.error.issues.map(({ message }) => message)).toContain(
|
||||
"trigger nesting exceeds the v1 limit",
|
||||
"trigger nesting exceeds the configured limit",
|
||||
);
|
||||
|
||||
let hostile: unknown = terminalTrigger();
|
||||
|
||||
@@ -5,7 +5,7 @@ import { processObservationSourceSchema } from "./processObservation.js";
|
||||
import { definitelyAvailableCheckpoints } from "./processReactiveCheckpointDataflow.js";
|
||||
import { preflightProcessReactiveScenario } from "./processReactiveScenarioPreflight.js";
|
||||
|
||||
/** Fixed public bounds for Process Reactive Scenario v1. */
|
||||
/** Fixed public bounds for process reactive scenarios. */
|
||||
export const PROCESS_REACTIVE_LIMITS = {
|
||||
states: 32,
|
||||
transitions: 128,
|
||||
@@ -232,13 +232,12 @@ const stateSchema = z.strictObject({
|
||||
});
|
||||
|
||||
const scenarioShapeSchema = z.strictObject({
|
||||
version: z.literal(1),
|
||||
initial_state: identifierSchema,
|
||||
deadline_ms: positiveRuntime,
|
||||
states: z.array(stateSchema).min(1).max(PROCESS_REACTIVE_LIMITS.states),
|
||||
});
|
||||
|
||||
/** Parsed Process Reactive Scenario v1 declaration. */
|
||||
/** Parsed process reactive scenario declaration. */
|
||||
export type ProcessReactiveScenario = z.infer<typeof scenarioShapeSchema>;
|
||||
|
||||
type TriggerMeasurements = {
|
||||
@@ -345,7 +344,7 @@ const validateTransition = (input: {
|
||||
if (measured.depth > PROCESS_REACTIVE_LIMITS.triggerDepth)
|
||||
context.addIssue({
|
||||
code: "custom",
|
||||
message: "trigger nesting exceeds the v1 limit",
|
||||
message: "trigger nesting exceeds the configured limit",
|
||||
path: [...path, "when"],
|
||||
});
|
||||
if (validation.transitionIds.has(transition.id))
|
||||
|
||||
@@ -39,16 +39,25 @@ const inspectJsonValue = (
|
||||
if (current === undefined) break;
|
||||
nodes += 1;
|
||||
if (nodes > limits.jsonNodes)
|
||||
return reject(context, "event exact JSON exceeds the v1 node limit");
|
||||
return reject(
|
||||
context,
|
||||
"event exact JSON exceeds the configured node limit",
|
||||
);
|
||||
if (current.depth > limits.jsonDepth)
|
||||
return reject(context, "event exact JSON exceeds the v1 depth limit");
|
||||
return reject(
|
||||
context,
|
||||
"event exact JSON exceeds the configured depth limit",
|
||||
);
|
||||
if (typeof current.value !== "object" || current.value === null) continue;
|
||||
if (seen.has(current.value))
|
||||
return reject(context, "event exact JSON must not contain cycles");
|
||||
seen.add(current.value);
|
||||
if (Array.isArray(current.value)) {
|
||||
if (current.value.length + nodes > limits.jsonNodes)
|
||||
return reject(context, "event exact JSON exceeds the v1 node limit");
|
||||
return reject(
|
||||
context,
|
||||
"event exact JSON exceeds the configured node limit",
|
||||
);
|
||||
for (const child of current.value)
|
||||
pending.push({ value: child, depth: current.depth + 1 });
|
||||
continue;
|
||||
@@ -57,7 +66,10 @@ const inspectJsonValue = (
|
||||
for (const key in current.value) {
|
||||
if (!Object.hasOwn(current.value, key)) continue;
|
||||
if (nodes + pending.length >= limits.jsonNodes)
|
||||
return reject(context, "event exact JSON exceeds the v1 node limit");
|
||||
return reject(
|
||||
context,
|
||||
"event exact JSON exceeds the configured node limit",
|
||||
);
|
||||
pending.push({
|
||||
value: current.value[key],
|
||||
depth: current.depth + 1,
|
||||
@@ -125,9 +137,9 @@ const inspectTriggerTree = (
|
||||
if (current === undefined) break;
|
||||
nodes += 1;
|
||||
if (nodes > maximumNodes)
|
||||
return reject(context, "trigger tree exceeds the v1 limit");
|
||||
return reject(context, "trigger tree exceeds the configured limit");
|
||||
if (current.depth > limits.triggerDepth)
|
||||
return reject(context, "trigger nesting exceeds the v1 limit");
|
||||
return reject(context, "trigger nesting exceeds the configured limit");
|
||||
if (
|
||||
isUnknownRecord(current.value) &&
|
||||
current.value["kind"] === "event" &&
|
||||
|
||||
@@ -87,7 +87,6 @@ export const processScenarioCommitment = (
|
||||
]),
|
||||
),
|
||||
reactive: reactiveScenarioCommitment(scenario.reactive),
|
||||
unknown_registry_approved: scenario.unknown_registry_approved === true,
|
||||
executable_sha256: executableSha256 ?? null,
|
||||
});
|
||||
|
||||
@@ -119,10 +118,6 @@ export const processComparisonContract = (
|
||||
*/
|
||||
export const processScenarioSchema = z
|
||||
.object({
|
||||
unknown_registry_approved: z
|
||||
.literal(true)
|
||||
.optional()
|
||||
.describe("Explicit approval to record capture residuals durably"),
|
||||
executable: z.string().startsWith("/"),
|
||||
arguments: z.array(z.string()).max(256).default([]),
|
||||
working_directory: z.string().startsWith("/"),
|
||||
|
||||
@@ -32,7 +32,6 @@ const capture = {
|
||||
} as const;
|
||||
|
||||
const traceSpecification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "before",
|
||||
@@ -121,7 +120,6 @@ describe("declared trace comparison adapters", () => {
|
||||
});
|
||||
};
|
||||
const specification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "status",
|
||||
@@ -210,7 +208,6 @@ describe("declared trace comparison coverage", () => {
|
||||
],
|
||||
});
|
||||
const specification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "status",
|
||||
@@ -285,7 +282,6 @@ describe("declared trace comparison nonconformance", () => {
|
||||
],
|
||||
});
|
||||
const specification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "expected",
|
||||
|
||||
@@ -108,7 +108,6 @@ const values = (
|
||||
})),
|
||||
});
|
||||
const partialSpecification = (): ProcessTraceSpecification => ({
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "ready",
|
||||
@@ -205,7 +204,6 @@ describe("process trace comparison", () => {
|
||||
});
|
||||
it("enforces explicit negative not-before constraints", () => {
|
||||
const specification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "ready",
|
||||
@@ -267,7 +265,6 @@ describe("process trace comparison", () => {
|
||||
],
|
||||
});
|
||||
const specification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "tick1",
|
||||
|
||||
@@ -107,7 +107,6 @@ const values = (
|
||||
})),
|
||||
});
|
||||
const partialSpecification = (): ProcessTraceSpecification => ({
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "ready",
|
||||
@@ -177,7 +176,6 @@ describe("process trace comparison", () => {
|
||||
ignore_fields: ["sequence", "at_ms"],
|
||||
};
|
||||
const rangeSpecification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [{ ...event, cardinality: { kind: "range", min: 2, max: 3 } }],
|
||||
language: {
|
||||
kind: "partial_order",
|
||||
@@ -204,7 +202,6 @@ describe("process trace comparison", () => {
|
||||
diagnostic: { kind: "cardinality", side: "right" },
|
||||
});
|
||||
const exactSpecification: ProcessTraceSpecification = {
|
||||
version: 1,
|
||||
events: [{ ...event, cardinality: { kind: "exact", count: 2 } }],
|
||||
language: {
|
||||
kind: "finite_traces",
|
||||
|
||||
@@ -33,7 +33,6 @@ const websocket = {
|
||||
outcome: "matched" as const,
|
||||
};
|
||||
const partialSpecification = (): ProcessTraceSpecification => ({
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "ready",
|
||||
@@ -92,7 +91,6 @@ describe("process trace specification", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: base.events.slice(0, 3),
|
||||
language: {
|
||||
kind: "partial_order",
|
||||
@@ -104,7 +102,6 @@ describe("process trace specification", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "invalid-ignore",
|
||||
@@ -121,7 +118,6 @@ describe("process trace specification", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
id: "invalid-ignore",
|
||||
@@ -138,14 +134,12 @@ describe("process trace specification", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: base.events.slice(0, 2),
|
||||
language: { kind: "partial_order" },
|
||||
}).success,
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: [base.events[0], { ...base.events[0], id: "duplicate" }],
|
||||
language: {
|
||||
kind: "partial_order",
|
||||
@@ -155,7 +149,6 @@ describe("process trace specification", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: [
|
||||
{
|
||||
...base.events[0],
|
||||
@@ -170,7 +163,6 @@ describe("process trace specification", () => {
|
||||
).toBe(false);
|
||||
expect(
|
||||
processTraceSpecificationSchema.safeParse({
|
||||
version: 1,
|
||||
events: [base.events[0]],
|
||||
language: {
|
||||
kind: "finite_traces",
|
||||
|
||||
@@ -104,7 +104,6 @@ const finiteTraceLanguageSchema = z.strictObject({
|
||||
});
|
||||
|
||||
const specificationShapeSchema = z.strictObject({
|
||||
version: z.literal(1),
|
||||
events: z.array(eventDeclarationSchema).min(1).max(256),
|
||||
language: z.discriminatedUnion("kind", [
|
||||
partialOrderLanguageSchema,
|
||||
|
||||
@@ -77,7 +77,6 @@ export const reconstructionSpecificationSchema = z
|
||||
/** Bounded reconstruction-verification input. */
|
||||
export const reconstructionVerificationInputSchema = z.strictObject({
|
||||
specification: reconstructionSpecificationSchema,
|
||||
unknown_registry_approved: z.literal(true).optional(),
|
||||
});
|
||||
|
||||
export const reconstructionClaimResultSchema = z.object({
|
||||
|
||||
@@ -88,7 +88,6 @@ export const staticRuntimeCorrelationInputSchema = z
|
||||
static_comparisons: z.array(evidenceSchema).min(1).max(100),
|
||||
runtime_comparisons: z.array(evidenceSchema).min(1).max(100),
|
||||
mappings: z.array(mappingSchema).min(1).max(500),
|
||||
unknown_registry_approved: z.literal(true).optional(),
|
||||
})
|
||||
.strict();
|
||||
|
||||
|
||||
@@ -72,12 +72,11 @@ const parseWorkerSide = (value: unknown): WorkerSide => {
|
||||
|
||||
const parseWorkerRequest = (value: unknown): WorkerRequest => {
|
||||
const request = record(value, "request");
|
||||
if (request.schemaVersion !== 1 || !Array.isArray(request.cases))
|
||||
throw new TypeError("Unsupported replay worker protocol");
|
||||
if (!Array.isArray(request.cases))
|
||||
throw new TypeError("Invalid replay worker cases");
|
||||
const determinism = record(request.determinism, "determinism");
|
||||
const limits = record(request.limits, "limits");
|
||||
return {
|
||||
schemaVersion: 1,
|
||||
left: parseWorkerSide(request.left),
|
||||
...(request.right === undefined
|
||||
? {}
|
||||
|
||||
@@ -15,7 +15,6 @@ export interface WorkerSide {
|
||||
|
||||
/** Parsed parent-to-worker runtime-hop request. */
|
||||
export interface WorkerRequest {
|
||||
readonly schemaVersion: 1;
|
||||
readonly left: WorkerSide;
|
||||
readonly right?: WorkerSide;
|
||||
readonly cases: readonly {
|
||||
|
||||
@@ -7,7 +7,6 @@ import { jsonValueSchema } from "../domain/jsonValue.js";
|
||||
import type { WorkerProtocolOutcome } from "./ReplayWorkerProtocol.js";
|
||||
|
||||
export const workerRequest = (prepared: PreparedReplayPlan) => ({
|
||||
schemaVersion: 1,
|
||||
left: workerSide(prepared.publicPlan.left, prepared.leftSources),
|
||||
...(prepared.publicPlan.right === undefined ||
|
||||
prepared.rightSources === undefined
|
||||
|
||||
Reference in New Issue
Block a user