fix(javascript): preserve Electron runtime entrypoint paths (#2742)

* fix(javascript): preserve Electron runtime entrypoint paths

* fix(javascript): resolve runtime entrypoints before modules

* fix(javascript): preserve Electron runtime path semantics

* fix(javascript): resolve Electron renderers exactly

* fix(javascript): retain runtime package aliases

* fix(javascript): retain missing renderer URL paths

* fix(javascript): resolve Electron URL and utility entries correctly

* fix(javascript): reject suffix-only worker URLs

* fix(javascript): respect Electron URL and utility path semantics

* fix(javascript): separate Node runtime entrypoints from source imports

* fix(comparison): recheck historical calls-only changes (#2223)

* fix(comparison): preserve incomplete function call evidence

Keep missing, unknown, partial and unresolved call relationships unknown in function comparisons and reconstruction claims. Aggregate IDA caller and callee coverage without overwriting uncertainty.

Validate with 144 focused tests, typecheck/lint, docs checks and test discovery. Real providers were not verified; the full headless IDA session suite requires unavailable Windows native controls.

* fix(comparison): recheck historical calls-only changes

---------

Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
(cherry picked from commit 688defca0f)

* fix(ci): isolate Linux Hopper process fixture inventory

(cherry picked from commit 8cac51e121)

* fix(android): make DEX descriptor pattern portable

(cherry picked from commit 1335bcddc5)

* fix: repair the static-check failures on the default branch (#2895)

* fix: repair the static-check failures on the default branch

The default branch fails its own required `Static checks` job three ways, so
every pull request reports that job as failed regardless of its own change.

- `npm run format:check` reports `src/domain/functionComparison.test.ts` and
  `src/ida/IdaOperationRunner.ts`.
- `npm run lint` reports a duplicate `import { join } from "node:path"` in
  `tests/boundary/mcp/ghidraInventoryMcp.test.ts` (lines 4 and 17).
- `npm run typecheck` reports `format: "devin"` missing from the client format
  union in `src/application/SupportedClients.ts`, and an unchecked index in
  `tests/boundary/cli/clientProfileLifecycle.test.ts`, whose pair array is
  inferred as `string[][]`.

Apply the pinned formatter, drop the duplicate import, list the `"devin"` format
that its own definition already uses, and mark the pair array `as const`.

Validation: `npm run check:fast` and `npm run format:check` pass.

* fix(setup): keep Devin on the JSON configuration dialect

---------

Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
(cherry picked from commit df3d96da80)

---------

Co-authored-by: morluto <morluto@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
Co-authored-by: Lucien <164857476+dakjdakd@users.noreply.github.com>
Co-authored-by: 吴佳浩Alben <35291372+XiaoBinGan@users.noreply.github.com>
Co-authored-by: 吴佳浩 <wujiahao@supremind.com>
This commit is contained in:
Avocado
2026-10-14 09:39:17 +11:00
committed by GitHub
parent 7072f87baf
commit 3a4d49406a
8 changed files with 567 additions and 8 deletions
@@ -78,6 +78,8 @@ export interface ResolveArtifactPathInput {
readonly htmlBaseHref?: string | null;
/** Import/require semantics; runtime resource paths omit this provenance. */
readonly moduleKind?: JavaScriptModuleResolutionMode;
/** Runtime paths retain their loader owner independently of source imports. */
readonly runtimePathKind?: "exact-file" | "node-entrypoint" | "url-resource";
}
/** Preserve an explicitly retained loader mode on graph relationships. */
@@ -189,6 +191,8 @@ const conditionalResolution = (
});
const resolvePath = (input: ResolveArtifactPathInput): CandidateResolution => {
if (input.runtimePathKind === "node-entrypoint")
return resolveNodeRuntimeEntrypoint(input);
if (input.moduleKind === "compiler-dependent") {
const imported = resolvePath({ ...input, moduleKind: "import" });
const required = resolvePath({ ...input, moduleKind: "require" });
@@ -222,6 +226,10 @@ const resolvePath = (input: ResolveArtifactPathInput): CandidateResolution => {
],
};
}
if (input.runtimePathKind === "url-resource")
return resolveExactUrlResource(input);
if (input.runtimePathKind === "exact-file" && isRuntimePathDeclaration(input))
return resolveRuntimeEntrypoint(input);
// Package import keys are literal lookup identities, not artifact paths.
// The selected target is admitted separately by resolveExportTarget.
if (
@@ -260,6 +268,82 @@ const resolvePath = (input: ResolveArtifactPathInput): CandidateResolution => {
return resolveCandidate(input, confined, new Set(), emittedSourceCandidates);
};
const resolveExactUrlResource = (
input: ResolveArtifactPathInput,
): CandidateResolution => {
// Electron loadURL requires a protocol. A scheme-less string is not relative
// to the calling script; filesystem paths belong to loadFile.
if (!hasScheme(input.declaredPath))
return unresolvedCandidate("unavailable", [
"Electron loadURL requires a URL protocol; relative filesystem paths belong to loadFile.",
]);
if (!/^file:/iu.test(input.declaredPath))
return unresolvedCandidate("external", [
"Only file URLs can be mapped to selected local application artifacts.",
]);
const urlContextCandidate = contextualCandidate(input);
if (typeof urlContextCandidate !== "string") return urlContextCandidate;
const confined = confineCandidate(urlContextCandidate);
if (typeof confined !== "string") return confined;
return (
resolveFileCandidates(input, [confined]) ?? {
resolvedPath: null,
status: "not-found",
candidatePath: confined,
limitations: [
`The exact URL resource ${confined} was not found among the selected application files.`,
],
}
);
};
const isRuntimePathDeclaration = (input: ResolveArtifactPathInput): boolean =>
input.context === "filesystem-expression" ||
(input.context === "module-specifier" &&
(isRelativeJavaScriptModuleSpecifier(input.declaredPath) ||
input.declaredPath.startsWith("/") ||
fileUrlPath(input.declaredPath) !== undefined));
const resolveNodeRuntimeEntrypoint = (
input: ResolveArtifactPathInput,
): CandidateResolution => {
const { runtimePathKind: _runtimePathKind, ...sourceInput } = input;
const runtimeInput = { ...sourceInput, moduleKind: "require" as const };
if (!isRuntimePathDeclaration(runtimeInput)) return resolvePath(runtimeInput);
const candidate = contextualCandidate(runtimeInput);
if (typeof candidate !== "string") return candidate;
const confined = confineCandidate(candidate);
if (typeof confined !== "string") return confined;
// Node entrypoints use runtime file/directory probes. They do not originate
// in emitted TypeScript import syntax and cannot select a source substitute.
return resolveCandidate(runtimeInput, confined, new Set());
};
const resolveRuntimeEntrypoint = (
input: ResolveArtifactPathInput,
): CandidateResolution => {
const rejected = rejectDeclaration(input.declaredPath);
if (rejected !== null) return rejected;
if (hasScheme(input.declaredPath) || looksExternal(input.declaredPath))
return unresolvedCandidate("external", [
"Electron runtime entrypoints must identify local paths, not external URLs.",
]);
const candidate = confineCandidate(
relativeCandidate(input.sourcePath, input.declaredPath),
);
if (typeof candidate !== "string") return candidate;
return (
resolveFileCandidates(input, [candidate]) ?? {
resolvedPath: null,
status: "not-found",
candidatePath: candidate,
limitations: [
`The declared Electron runtime entrypoint ${candidate} was not found as an exact file among the selected application files; extension and directory fallback were not attempted.`,
],
}
);
};
const resolveRuntimeSourceCandidates = (
input: ResolveArtifactPathInput,
exactPath: string,
@@ -316,6 +400,14 @@ const contextualCandidate = (
context === "url-reference"
? stripQueryAndFragment(input.declaredPath)
: input.declaredPath;
if (context === "url-reference" && declared.length === 0)
return input.runtimePathKind === "url-resource"
? unresolvedCandidate("unavailable", [
"A suffix-only runtime URL requires the window's current document URL; the calling script does not establish that base.",
])
: unresolvedCandidate("rejected", [
"The URL reference contains no pathname, and its base document is not established by this analysis.",
]);
if (context === "module-specifier" && /^file:/iu.test(declared)) {
const fileUrl = fileUrlPath(declared);
if (fileUrl === null)