mirror of
https://github.com/morluto/rea.git
synced 2026-11-12 01:41:21 +00:00
fix(javascript): preserve uncertainty for incomplete runtime captures (#7854)
This commit is contained in:
1 parent
5bef2b48b6
commit
1e421242b9
4 files changed
+62
-5
No files matched your search
@@ -1,6 +1,7 @@
|
||||
import type { ApplicationNode } from "./javascriptApplicationGraphSchemas.js";
|
||||
import { uniqueSorted } from "../canonicalOrdering.js";
|
||||
import type { ParsedStaticLayer } from "./javascriptRuntimeReconciliationParsing.js";
|
||||
import type { ParsedRuntimeCapture } from "./javascriptRuntimeReconciliationCaptureParsing.js";
|
||||
import type {
|
||||
JavaScriptRuntimeReconciliationItem,
|
||||
JavaScriptStaticLoadState,
|
||||
@@ -20,6 +21,7 @@ export interface StaticLoadStateProjection {
|
||||
/** Classify static code presence without claiming bundled module execution. */
|
||||
export const classifyStaticLoadStates = (
|
||||
layers: readonly ParsedStaticLayer[],
|
||||
captures: readonly ParsedRuntimeCapture[],
|
||||
runtimeEntities: readonly RuntimeReconciliationEntity[],
|
||||
matches: readonly JavaScriptRuntimeReconciliationItem[],
|
||||
options: {
|
||||
@@ -28,9 +30,15 @@ export const classifyStaticLoadStates = (
|
||||
): StaticLoadStateProjection => {
|
||||
const states: JavaScriptStaticLoadState[] = [];
|
||||
for (const layer of layers) {
|
||||
const projection = classifyLayer(layer, runtimeEntities, matches, {
|
||||
reconciliationComplete: options.reconciliationComplete,
|
||||
});
|
||||
const projection = classifyLayer(
|
||||
layer,
|
||||
captures,
|
||||
runtimeEntities,
|
||||
matches,
|
||||
{
|
||||
reconciliationComplete: options.reconciliationComplete,
|
||||
},
|
||||
);
|
||||
states.push(...projection.states);
|
||||
}
|
||||
return { states, omittedStates: 0 };
|
||||
@@ -38,6 +46,7 @@ export const classifyStaticLoadStates = (
|
||||
|
||||
const classifyLayer = (
|
||||
layer: ParsedStaticLayer,
|
||||
captures: readonly ParsedRuntimeCapture[],
|
||||
runtimeEntities: readonly RuntimeReconciliationEntity[],
|
||||
matches: readonly JavaScriptRuntimeReconciliationItem[],
|
||||
options: {
|
||||
@@ -70,8 +79,11 @@ const classifyLayer = (
|
||||
options.reconciliationComplete &&
|
||||
layer.graph.coverage.status === "complete" &&
|
||||
scopedEntities.length > 0 &&
|
||||
scopedEntities.every(
|
||||
({ capture }) => capture.codeInventoryCompleteWithinScope,
|
||||
// An incomplete inventory may have omitted scripts that map into this
|
||||
// layer, even when none of its reported entities map here.
|
||||
captures.every(
|
||||
({ codeInventoryCompleteWithinScope }) =>
|
||||
codeInventoryCompleteWithinScope,
|
||||
);
|
||||
const states = nodes.map((node) => {
|
||||
const runtimeNodeIds = uniqueSorted(direct.get(node.node_id) ?? []);
|
||||
|
||||
Reference in new issue
Block a user