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 commit688defca0f) * fix(ci): isolate Linux Hopper process fixture inventory (cherry picked from commit8cac51e121) * fix(android): make DEX descriptor pattern portable (cherry picked from commit1335bcddc5) * 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 commitdf3d96da80) --------- 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:
8 files changed
+567
-8
No files matched your search
@@ -1318,6 +1318,29 @@ describe("package import alias resolution", () => {
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps package import aliases available for runtime entrypoints", () => {
|
||||
const files = aliasFiles({
|
||||
"package.json": JSON.stringify({
|
||||
imports: { "#worker": "./worker.js" },
|
||||
}),
|
||||
"main.cjs": "",
|
||||
"worker.js": "",
|
||||
});
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "#worker",
|
||||
sourcePath: "main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "worker.js",
|
||||
declared_path: "#worker",
|
||||
});
|
||||
});
|
||||
|
||||
it("uses a nested package imports map rather than the application root", () => {
|
||||
const files = aliasFiles({
|
||||
"package.json": JSON.stringify({
|
||||
@@ -2093,6 +2116,26 @@ describe("url-reference directory and empty-segment semantics", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("suffix-only non-runtime URL references", () => {
|
||||
it.each(["", "?cache=1", "#worker"])(
|
||||
"rejects URL reference %s without a path or known base document",
|
||||
(declaredPath) => {
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath,
|
||||
sourcePath: "dist/app.mjs",
|
||||
context: "url-reference",
|
||||
files: fileMap([file("dist/app.mjs", "root")]),
|
||||
}),
|
||||
).toMatchObject({
|
||||
declared_path: declaredPath,
|
||||
resolution_status: "rejected",
|
||||
resolved_path: null,
|
||||
});
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
describe("url-reference JavaScript artifact path resolution", () => {
|
||||
it.each([
|
||||
["C|?cache=1#entry", "dist/C|"],
|
||||
@@ -2327,3 +2370,178 @@ describe("exact HTML resource resolution", () => {
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("exact Electron runtime entrypoint resolution", () => {
|
||||
it("requires a protocol for Electron URL resources", () => {
|
||||
const files = fileMap([
|
||||
file("app/main.cjs", "root"),
|
||||
file("app/renderer", "root"),
|
||||
file("app/renderer.js", "root"),
|
||||
]);
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "./renderer",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "url-resource",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "unavailable",
|
||||
resolved_path: null,
|
||||
limitations: [expect.stringContaining("requires a URL protocol")],
|
||||
});
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "file:///app/renderer",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "url-resource",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "app/renderer",
|
||||
});
|
||||
});
|
||||
|
||||
it("checks local paths exactly while preserving bare package lookup", () => {
|
||||
const files = fileMap([
|
||||
file("app/main.cjs", "root"),
|
||||
file("app/worker.js", "root"),
|
||||
file("app/worker", "root"),
|
||||
file("app/worker#v1.js", "root"),
|
||||
file(
|
||||
"node_modules/exported/package.json",
|
||||
"root",
|
||||
'{"exports":{"./parser":"./parser.cjs"}}',
|
||||
),
|
||||
file("node_modules/exported/parser.cjs", "root"),
|
||||
file("app/fallback/index.js", "root"),
|
||||
]);
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "./worker.js",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "app/worker.js",
|
||||
});
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "exported/parser",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "node_modules/exported/parser.cjs",
|
||||
});
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "./worker#v1.js",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "app/worker#v1.js",
|
||||
});
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "./fallback",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "not-found",
|
||||
resolved_path: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("accepts an exact extensionless file but not a directory index", () => {
|
||||
const files = fileMap([
|
||||
file("app/main.cjs", "root"),
|
||||
file("app/preload", "root"),
|
||||
file("app/preload.js", "root"),
|
||||
file("app/fallback/index.js", "root"),
|
||||
]);
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "./preload",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "resolved",
|
||||
resolved_path: "app/preload",
|
||||
});
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath: "./fallback",
|
||||
sourcePath: "app/main.cjs",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "exact-file",
|
||||
}),
|
||||
).toMatchObject({
|
||||
resolution_status: "not-found",
|
||||
resolved_path: null,
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it.each(["#home", "?theme=dark", ""])(
|
||||
"does not invent a document base for runtime URL %s",
|
||||
(declaredPath) => {
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath,
|
||||
sourcePath: "main.cjs",
|
||||
context: "url-reference",
|
||||
runtimePathKind: "url-resource",
|
||||
files: fileMap([file("main.cjs", "root")]),
|
||||
}),
|
||||
).toMatchObject({
|
||||
declared_path: declaredPath,
|
||||
resolution_status: "unavailable",
|
||||
resolved_path: null,
|
||||
});
|
||||
},
|
||||
);
|
||||
|
||||
it("resolves Node runtime entrypoints without substituting emitted TypeScript sources", () => {
|
||||
const files = fileMap([
|
||||
file("main.ts", "root"),
|
||||
file("worker.ts", "root"),
|
||||
file("worker.js", "other-container"),
|
||||
file("runtime.js", "root"),
|
||||
file("directory/index.js", "root"),
|
||||
]);
|
||||
for (const [declaredPath, status, path] of [
|
||||
["./worker.js", "not-found", null],
|
||||
["./runtime", "resolved", "runtime.js"],
|
||||
["./directory", "resolved", "directory/index.js"],
|
||||
] as const)
|
||||
expect(
|
||||
resolve({
|
||||
declaredPath,
|
||||
sourcePath: "main.ts",
|
||||
context: "module-specifier",
|
||||
files,
|
||||
runtimePathKind: "node-entrypoint",
|
||||
}),
|
||||
).toMatchObject({ resolution_status: status, resolved_path: path });
|
||||
});
|
||||
Reference in new issue
Block a user