mirror of
https://github.com/morluto/rea
synced 2026-10-27 22:45:19 -04:00
perf(javascript): validate the version change graph once (#1370)
compareJavaScriptApplicationVersions built the change graph with createJavaScriptApplicationGraph, which validates it and re-derives every node, observation, edge and graph ID, then parsed the result with a schema that embeds the full graph schema, repeating all of that work. Seal the change graph with the owned immutable factory and accept that exact sealed graph in the result parse, as owned analysis results already do. Items, coverage and the public result schema are unchanged; output is byte-identical.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import {
|
||||
createJavaScriptApplicationEdge,
|
||||
createJavaScriptApplicationGraph,
|
||||
createImmutableJavaScriptApplicationGraphSteps,
|
||||
createJavaScriptApplicationNode,
|
||||
type JavaScriptApplicationGraph,
|
||||
} from "./javascriptApplicationGraph.js";
|
||||
@@ -59,7 +59,7 @@ export const buildJavaScriptApplicationChangeGraph = (
|
||||
const candidateEdges = uniqueEdges([...sourceEdges, ...comparisonEdges]);
|
||||
const rootNodeIds = preferredRoots.filter((nodeId) => retained.has(nodeId));
|
||||
const fallbackRoot = mergedNodes[0]?.node_id;
|
||||
const graph = createJavaScriptApplicationGraph({
|
||||
const steps = createImmutableJavaScriptApplicationGraphSteps({
|
||||
schema: "JavaScriptApplicationGraph",
|
||||
root_node_ids:
|
||||
rootNodeIds.length > 0
|
||||
@@ -77,7 +77,9 @@ export const buildJavaScriptApplicationChangeGraph = (
|
||||
"The change graph contains compared entities and their retained relationships; it is not an executable application.",
|
||||
]),
|
||||
});
|
||||
return { graph };
|
||||
let next = steps.next();
|
||||
while (!next.done) next = steps.next();
|
||||
return { graph: next.value };
|
||||
};
|
||||
|
||||
const nodeCandidates = (
|
||||
|
||||
Reference in New Issue
Block a user