fix(javascript): preserve mapped runtime digest disagreements

Fixes #3316

Co-authored-by: Kaoru0822 <208281322+kaoru0822-kitauji@users.noreply.github.com>
Co-authored-by: gensokyo-dev <342580529+gensokyo-dev@users.noreply.github.com>
This commit is contained in:
Ysopwnable
2026-10-15 17:04:49 +08:00
committed by GitHub
parent e18fccc548
commit d7651b6a0d
5 changed files with 316 additions and 84 deletions
@@ -47,6 +47,7 @@ const classifyLayer = (
const nodes = layer.graph.nodes.filter(isLoadStateNode);
const direct = new Map<string, string[]>();
const ambiguous = new Set<string>();
const incomplete = new Set<string>();
for (const match of matches)
if (
match.status === "matched" &&
@@ -54,10 +55,12 @@ const classifyLayer = (
match.static_node_id !== null
)
append(direct, match.static_node_id, match.runtime_node_id);
else if (match.status === "ambiguous")
else if (match.status === "ambiguous" || match.status === "unknown") {
const uncertain = match.status === "ambiguous" ? ambiguous : incomplete;
for (const candidate of match.candidate_static_nodes)
if (candidate.static_layer_id === layer.layerId)
ambiguous.add(candidate.static_node_id);
uncertain.add(candidate.static_node_id);
}
const resident = residentNodes(layer, new Set(direct.keys()));
const runtimeScope = createStaticRuntimeScope(layer, runtimeEntities);
const scopedEntities = runtimeEntities.filter(
@@ -82,11 +85,13 @@ const classifyLayer = (
runtimeNodeIds: [],
reason: "containing-asset-was-loaded",
});
if (ambiguous.has(node.node_id))
if (incomplete.has(node.node_id) || ambiguous.has(node.node_id))
return state(layer, node, {
status: "unknown",
runtimeNodeIds: [],
reason: "ambiguous-runtime-candidate",
reason: incomplete.has(node.node_id)
? "static-or-runtime-coverage-incomplete"
: "ambiguous-runtime-candidate",
});
const nodeWithinScope = staticNodeWithinRuntimeScope(node, runtimeScope);
if (layerComplete && nodeWithinScope)