feat(javascript): compare source with shipped bundles
This commit is contained in:
@@ -5,6 +5,7 @@ import { compareApplicationVersionsInputSchema } from "../domain/javascriptAppli
|
||||
import { compareJavaScriptExportShapesInputSchema } from "../domain/javascriptExportShapeComparisonSchemas.js";
|
||||
import { traceApplicationFeatureInputSchema } from "../domain/javascriptFeatureTraceSchemas.js";
|
||||
import { javaScriptSemanticQueryInputSchema } from "../domain/javascriptSemanticQuerySchemas.js";
|
||||
import { compareSourceToBundleInputSchema } from "../domain/sourceToBundleComparisonSchemas.js";
|
||||
|
||||
const evidenceIdSchema = z
|
||||
.string()
|
||||
@@ -102,6 +103,25 @@ export const compareApplicationVersionsRequestSchema = z
|
||||
]);
|
||||
});
|
||||
|
||||
/** Historical-source comparison accepting full application Evidence or a ledger reference. */
|
||||
export const compareSourceToBundleRequestSchema = z
|
||||
.strictObject({
|
||||
reference: compareSourceToBundleInputSchema.shape.reference,
|
||||
application: evidenceSchema.optional(),
|
||||
application_evidence_id: evidenceIdSchema.optional(),
|
||||
limits: compareSourceToBundleInputSchema.shape.limits,
|
||||
unknown_registry_approved:
|
||||
compareSourceToBundleInputSchema.shape.unknown_registry_approved,
|
||||
})
|
||||
.superRefine((input, context) => {
|
||||
requireExactlyOne(context, [
|
||||
"application",
|
||||
input.application,
|
||||
"application_evidence_id",
|
||||
input.application_evidence_id,
|
||||
]);
|
||||
});
|
||||
|
||||
/** MCP/CLI export-shape request accepting full Evidence or ledger references. */
|
||||
export const compareJavaScriptExportShapesRequestSchema = z
|
||||
.strictObject({
|
||||
@@ -145,6 +165,9 @@ export type TraceJavaScriptSemanticsRequest = z.output<
|
||||
export type CompareApplicationVersionsRequest = z.output<
|
||||
typeof compareApplicationVersionsRequestSchema
|
||||
>;
|
||||
export type CompareSourceToBundleRequest = z.output<
|
||||
typeof compareSourceToBundleRequestSchema
|
||||
>;
|
||||
export type CompareJavaScriptExportShapesRequest = z.output<
|
||||
typeof compareJavaScriptExportShapesRequestSchema
|
||||
>;
|
||||
|
||||
@@ -4,6 +4,7 @@ import {
|
||||
JAVASCRIPT_APPLICATION_EVIDENCE_EXAMPLE,
|
||||
JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE,
|
||||
} from "./javascriptRuntimeReconciliationExample.js";
|
||||
import { createHistoricalSourceGraph } from "../domain/referenceSourceGraph.js";
|
||||
|
||||
const reconciliation = reconcileJavaScriptRuntime(
|
||||
JAVASCRIPT_RUNTIME_RECONCILIATION_EXAMPLE,
|
||||
@@ -66,6 +67,48 @@ export const JAVASCRIPT_APPLICATION_VERSION_COMPARISON_EXAMPLE = {
|
||||
right_evidence_id: SECOND_EXAMPLE_EVIDENCE_ID,
|
||||
};
|
||||
|
||||
/** Historical source inventory compared with one producer-returned graph ID. */
|
||||
export const SOURCE_TO_BUNDLE_COMPARISON_EXAMPLE = {
|
||||
reference: createHistoricalSourceGraph({
|
||||
schema: "HistoricalSourceGraph/v1",
|
||||
authority: "historical-reference",
|
||||
root_alias: "$REFERENCE_ROOT",
|
||||
inventory_state: "complete",
|
||||
entries: [
|
||||
{
|
||||
path: "src",
|
||||
kind: "directory",
|
||||
classifications: ["source"],
|
||||
tree_state: "enumerated",
|
||||
limitations: [],
|
||||
},
|
||||
{
|
||||
path: "src/main.ts",
|
||||
kind: "file",
|
||||
sha256: "2".repeat(64),
|
||||
size: 128,
|
||||
language: "TypeScript",
|
||||
classifications: ["source"],
|
||||
content_state: "hashed",
|
||||
limitations: [],
|
||||
},
|
||||
],
|
||||
relationships: [],
|
||||
parse_failures: [],
|
||||
exclusions: [],
|
||||
languages: ["TypeScript"],
|
||||
manifests: [],
|
||||
vcs: { kind: "none", head: null, dirty: null },
|
||||
provenance: {
|
||||
importer: "rea",
|
||||
importer_version: "1",
|
||||
caller: "contract-example",
|
||||
},
|
||||
limitations: [],
|
||||
}),
|
||||
application_evidence_id: EXAMPLE_EVIDENCE_ID,
|
||||
};
|
||||
|
||||
/** Exact static return-shape comparison using producer-returned Evidence IDs. */
|
||||
export const JAVASCRIPT_EXPORT_SHAPE_COMPARISON_EXAMPLE = {
|
||||
left_evidence_id: EXAMPLE_EVIDENCE_ID,
|
||||
|
||||
Reference in New Issue
Block a user