mirror of
https://github.com/morluto/rea.git
synced 2026-10-26 17:35:11 +00:00
fix(reference): require exact optional JSON diagnostics at the source schema
This commit is contained in:
1 parent
88bbf9c006
commit
779242aef0
3 files changed
+23
-4
No files matched your search
@@ -1,4 +1,4 @@
|
||||
import { jsonObjectSchema } from "../../domain/jsonValue.js";
|
||||
import type { JsonValue } from "../../domain/jsonValue.js";
|
||||
import { createEvidence } from "../../domain/evidence.js";
|
||||
import {
|
||||
readRuntimeReconciliationInput,
|
||||
@@ -73,7 +73,7 @@ export const JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE = {
|
||||
};
|
||||
|
||||
/** Historical source inventory compared with inline application Evidence. */
|
||||
export const SOURCE_TO_BUNDLE_COMPARISON_EXAMPLE = jsonObjectSchema.parse({
|
||||
export const SOURCE_TO_BUNDLE_COMPARISON_EXAMPLE = {
|
||||
reference: createHistoricalSourceGraph({
|
||||
schema: "HistoricalSourceGraph",
|
||||
authority: "historical-reference",
|
||||
@@ -112,4 +112,4 @@ export const SOURCE_TO_BUNDLE_COMPARISON_EXAMPLE = jsonObjectSchema.parse({
|
||||
limitations: [],
|
||||
}),
|
||||
application: JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE,
|
||||
});
|
||||
} satisfies Readonly<Record<string, JsonValue>>;
|
||||
@@ -131,6 +131,25 @@ describe("historical source graph", () => {
|
||||
).toThrow(/Unicode code point/u);
|
||||
});
|
||||
|
||||
it("omits absent local diagnostics and rejects explicitly undefined non-JSON metadata", () => {
|
||||
const input = graphInput();
|
||||
const graph = createHistoricalSourceGraph(input);
|
||||
expect(
|
||||
graph.entries.every(
|
||||
(entry) => !Object.hasOwn(entry, "local_diagnostics"),
|
||||
),
|
||||
).toBe(true);
|
||||
expect(() =>
|
||||
createHistoricalSourceGraph({
|
||||
...input,
|
||||
entries: input.entries.map((entry) => ({
|
||||
...entry,
|
||||
local_diagnostics: undefined,
|
||||
})),
|
||||
}),
|
||||
).toThrow();
|
||||
});
|
||||
|
||||
it("builds and verifies internal root and manifest commitments", () => {
|
||||
const graph = createHistoricalSourceGraph(graphInput());
|
||||
const first = createHistoricalSourceManifest(graph);
|
||||
|
||||
@@ -41,7 +41,7 @@ const entryBaseShape = {
|
||||
classifications: z.array(classificationSchema).min(1),
|
||||
limitations: z.array(boundedTextSchema),
|
||||
// Host presentation is retained evidence, separate from relocatable semantics.
|
||||
local_diagnostics: z.array(boundedTextSchema).optional(),
|
||||
local_diagnostics: z.array(boundedTextSchema).exactOptional(),
|
||||
};
|
||||
|
||||
const sourceFileBaseShape = {
|
||||
|
||||
Reference in new issue
Block a user