mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
fix(json): consolidate dictionary admission across analysis and verification
This commit is contained in:
1 parent
c06dc2d356
commit
e7f986c994
18 files changed
+369
-99
No files matched your search
@@ -1,28 +0,0 @@
|
||||
import type { z } from "zod";
|
||||
|
||||
export interface StructuredScopeExpectation {
|
||||
readonly operation:
|
||||
| "parse-package-json"
|
||||
| "parse-json-module"
|
||||
| "parse-html-script-references"
|
||||
| "parse-local-source-map";
|
||||
readonly analysis_status: "interrupted" | "not-started";
|
||||
}
|
||||
|
||||
export interface StructuredProcessingScope {
|
||||
readonly properties: Readonly<Record<string, unknown>>;
|
||||
readonly evidence: {
|
||||
readonly authority: string;
|
||||
readonly state: string;
|
||||
readonly confidence: string;
|
||||
};
|
||||
}
|
||||
|
||||
export const structuredScopeExpectationsSchema: z.ZodType<
|
||||
Record<string, StructuredScopeExpectation>
|
||||
>;
|
||||
|
||||
export function matchesStructuredScopeExpectation(
|
||||
scopes: readonly StructuredProcessingScope[],
|
||||
expected: StructuredScopeExpectation | undefined,
|
||||
): boolean;
|
||||
+20
-3
@@ -1,8 +1,8 @@
|
||||
import { z } from "zod";
|
||||
import { jsonRecordSchema } from "../../src/domain/jsonRecord.js";
|
||||
|
||||
/** Independent expected outcomes supplied by the verification scenario. */
|
||||
export const structuredScopeExpectationsSchema = z.record(
|
||||
z.string().min(1),
|
||||
export const structuredScopeExpectationsSchema = jsonRecordSchema(
|
||||
z.strictObject({
|
||||
operation: z.enum([
|
||||
"parse-package-json",
|
||||
@@ -12,10 +12,27 @@ export const structuredScopeExpectationsSchema = z.record(
|
||||
]),
|
||||
analysis_status: z.enum(["interrupted", "not-started"]),
|
||||
}),
|
||||
z.string().min(1),
|
||||
);
|
||||
|
||||
export type StructuredScopeExpectation = z.output<
|
||||
typeof structuredScopeExpectationsSchema
|
||||
>[string];
|
||||
|
||||
export interface StructuredProcessingScope {
|
||||
readonly properties: Readonly<Record<string, unknown>>;
|
||||
readonly evidence: {
|
||||
readonly authority: string;
|
||||
readonly state: string;
|
||||
readonly confidence: string;
|
||||
};
|
||||
}
|
||||
|
||||
/** Every retained gap must match the named phase and its unavailable status. */
|
||||
export const matchesStructuredScopeExpectation = (scopes, expected) =>
|
||||
export const matchesStructuredScopeExpectation = (
|
||||
scopes: readonly StructuredProcessingScope[],
|
||||
expected: StructuredScopeExpectation | undefined,
|
||||
): boolean =>
|
||||
expected !== undefined &&
|
||||
scopes.length > 0 &&
|
||||
scopes.every(
|
||||
@@ -17,10 +17,12 @@ import {
|
||||
runOwnedCommand,
|
||||
} from "../../../dist/process/OwnedCommand.js";
|
||||
import { withVerifierCleanup } from "../../lib/verifier-cleanup.mjs";
|
||||
import {
|
||||
matchesStructuredScopeExpectation,
|
||||
structuredScopeExpectationsSchema,
|
||||
} from "../../lib/javascript-file-scope-oracle.mjs";
|
||||
import { importVerifierSource } from "../../lib/verifier-source-loader.mjs";
|
||||
|
||||
const { matchesStructuredScopeExpectation, structuredScopeExpectationsSchema } =
|
||||
await importVerifierSource(
|
||||
new URL("../../lib/javascript-file-scope-oracle.mts", import.meta.url).href,
|
||||
);
|
||||
|
||||
const { values } = parseArgs({
|
||||
options: {
|
||||
|
||||
Reference in new issue
Block a user