fix(javascript): keep encoded URL slashes inside one runtime path segment (#6259)

A url-prefix runtime mapping decoded the whole pathname suffix at once, so
`child%2Fpart.js` became the nested artifact path `child/part.js` and produced
a medium-confidence location match and an inferred observed_as edge.

Decode each URL path segment separately at the mapping boundary. A segment
that decodes to contain a slash, like a malformed or non-UTF-8 escape, has no
artifact path, so the runtime script stays unknown with
no-authorized-location-mapping. Encoded spaces, Unicode, %25 and the literal
%5C backslash name keep matching.

File-root and URL-prefix mappings now share one tri-state translation
(outside, untranslatable, translated) for matching and load-state scope.
Static nodes beneath a prefix whose runtime script or worker could not be
translated stay unknown instead of becoming not-observed-in-capture.

Fixes #5878

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822
2026-10-22 00:26:12 -07:00
committed by GitHub
parent c083fedaf4
commit 1639189f26
4 changed files with 408 additions and 55 deletions
@@ -9,7 +9,7 @@ import type { RuntimeReconciliationEntity } from "./javascriptRuntimeReconciliat
import {
createStaticRuntimeScope,
mappedRuntimePaths,
staticNodeWithinRuntimeScope,
staticNodeRuntimeScope,
} from "./javascriptRuntimeStaticCandidates.js";
export interface StaticLoadStateProjection {
@@ -93,8 +93,8 @@ const classifyLayer = (
? "static-or-runtime-coverage-incomplete"
: "ambiguous-runtime-candidate",
});
const nodeWithinScope = staticNodeWithinRuntimeScope(node, runtimeScope);
if (layerComplete && nodeWithinScope)
const membership = staticNodeRuntimeScope(node, runtimeScope);
if (layerComplete && membership === "within")
return state(layer, node, {
status: "not-observed-in-capture",
runtimeNodeIds: [],
@@ -103,9 +103,10 @@ const classifyLayer = (
return state(layer, node, {
status: "unknown",
runtimeNodeIds: [],
reason: !nodeWithinScope
? "layer-outside-runtime-scope"
: "static-or-runtime-coverage-incomplete",
reason:
membership === "outside"
? "layer-outside-runtime-scope"
: "static-or-runtime-coverage-incomplete",
});
});
return { states };