fix(javascript): preserve semantic gaps for unparseable sources

Successful worker transport can carry an explicit failed parser status
with no semantic projection. Preserve that producer fact through the
shared source-availability interpretation used by full and incremental
graph construction, rather than dropping the source's semantic scope.

Retain the module when capacity permits, per-family incomplete-module
unknowns, and unknown omitted extents. Preserve existing operational
failure reasons and limits without classifying syntax as resource loss.
Document this coverage behavior.

Validation: regression-first run had 3 expected failures; all 22 selected
projection and public CLI source-selection/HTML cases passed after repair.
No JavaScript target execution or live external provider was involved.
This commit is contained in:
morluto committed 2026-10-24 08:58:22 +08:00
1 parent 54646e8dc4
commit d81d6b6707
6 files changed
+105 -6

No files matched your search

@@ -1,6 +1,7 @@
import { z } from "zod";
import { digestSchema } from "../digests.js";
import type { JavaScriptSourceSelection } from "./javascriptSourceSelection.js";
import type { JavaScriptStaticAnalysis } from "./javascriptStaticAnalysisTypes.js";
import type {
ArtifactInventoryCoverage,
ArtifactOccurrence,
@@ -61,6 +62,20 @@ export const javaScriptArtifactTextExclusion = (
: "Source bytes are not valid UTF-8; JavaScript semantics were not analyzed.";
};
/** Source availability shared by semantic consumers of parsed artifact facts. */
export const javaScriptSemanticSourceExclusion = (
file: JavaScriptArtifactFile,
parseStatus: JavaScriptStaticAnalysis["parse_status"] | null,
): string | null => {
if (file.kind !== "javascript") return null;
return (
javaScriptArtifactTextExclusion(file) ??
(parseStatus === "failed"
? "JavaScript syntax could not be parsed; JavaScript semantics were not analyzed."
: null)
);
};
/**
* One inventoried regular file not backed by analyzed source bytes. Its inventory
* occurrence remains available even when content is opaque or unavailable.