mirror of
https://github.com/morluto/rea.git
synced 2026-12-03 21:46:01 +00:00
fix(javascript): route directories by JavaScript input presence and name directory-capable operations (#14186)
* fix(javascript): refuse directories without JavaScript inputs and name directory-capable operations `analyze <dir>` routed every non-bundle directory to the static JavaScript lane, which reported an all-zero Electron summary as success for native build output. The JavaScript lane now owns that applicability decision from its complete inventory: when coverage is complete and no JavaScript, HTML, package.json, source map, or nested ASAR input exists, it returns a typed unsupported_target refusal naming inspect_desktop_application, audit_release_exposure, inspect_artifact, and open_binary. Incomplete coverage or unavailable files of unknown kind stay unknown and proceed. The directory_requires_file refusal no longer claims to come from open_binary when another operation (inspect, inspect-artifact) admitted the target, and it names the directory-capable operations instead of only the JavaScript lane. * fix(javascript): keep empty directories analyzable and report routing facts for non-JavaScript ones Owner decision on #14186: an empty directory is "nothing to analyze", not "unsupported". The JavaScript lane now classifies application-input presence once, in the domain owner of its file facts (javaScriptApplicationInputPresence): present, empty, absent, or unknown. - empty (complete traversal, no non-directory entries): analysis succeeds as before and the graph carries an explicit "No JavaScript inputs were found" limitation naming the next operations. - absent (complete traversal, entries but no JavaScript, HTML, package.json, source map, or nested ASAR): the typed unsupported_target refusal now carries bounded diagnostics from the inventory the lane already read: inventoried_entries, entries_by_format, json_files and native_addon_files. No paths are retained. - unknown (incomplete traversal or unavailable file of unknown kind) and present: unchanged analysis. Reverts the fixture edits that added package.json to empty directories.
This commit is contained in:
1 parent
a1d53d3956
commit
6dadd30fb6
8 files changed
+281
-7
No files matched your search
@@ -15,7 +15,10 @@ import {
|
||||
type JavaScriptApplicationGraph,
|
||||
} from "../../domain/javascript/javascriptApplicationGraph.js";
|
||||
import type { JavaScriptArtifactAnalysis } from "./JavaScriptArtifactAnalysisTypes.js";
|
||||
import type { JavaScriptArtifactFileSet } from "../../domain/javascript/javascriptArtifactFiles.js";
|
||||
import {
|
||||
javaScriptApplicationInputPresence,
|
||||
type JavaScriptArtifactFileSet,
|
||||
} from "../../domain/javascript/javascriptArtifactFiles.js";
|
||||
import { JavaScriptArtifactGraphAccumulator } from "./JavaScriptArtifactGraphAccumulator.js";
|
||||
import {
|
||||
HTML_INLINE_SCRIPT_LOCATION_COVERAGE_LIMIT,
|
||||
@@ -400,6 +403,18 @@ const semanticResourceLimits = (
|
||||
...new Set(semanticResourceBounds(context).map(({ limit }) => limit)),
|
||||
].sort();
|
||||
|
||||
/** Complete traversal found no entries, so there was nothing to analyze. */
|
||||
const EMPTY_INPUT_LIMITATION =
|
||||
"No JavaScript inputs were found: the complete inventory contains no files. Select the directory or .asar that holds the application sources; for a desktop installation directory, call inspect_desktop_application or audit_release_exposure.";
|
||||
|
||||
const emptyInputLimitations = (
|
||||
context: JavaScriptArtifactGraphContext,
|
||||
): readonly string[] =>
|
||||
javaScriptApplicationInputPresence(context.fileSet, context.snapshot) ===
|
||||
"empty"
|
||||
? [EMPTY_INPUT_LIMITATION]
|
||||
: [];
|
||||
|
||||
const graphLimitations = (
|
||||
context: JavaScriptArtifactGraphContext,
|
||||
coverage: "complete" | "partial" | "unknown" | "unavailable",
|
||||
@@ -419,6 +434,7 @@ const graphLimitations = (
|
||||
`Caller-selected source analysis leaves ${String(context.fileSet.source_selection?.unselected_files)} inventoried files outside analysis scope. Inventory identity covers the complete artifact; relationships through unselected sources remain unknown.`,
|
||||
]),
|
||||
...context.snapshot.limitations,
|
||||
...emptyInputLimitations(context),
|
||||
...context.snapshot.integrity_contradictions.map(
|
||||
({ logical_path: path }) =>
|
||||
`Artifact integrity metadata contradicts observed bytes at ${path}; the observed bytes are untrusted.`,
|
||||
|
||||
Reference in new issue
Block a user