fix(javascript): preserve loader authority for exact suffixes (#9477)

* fix(javascript): require exact loader suffix case

* fix(javascript): share exact loader mode across import resolution

* test(process): align symlink fixture with filesystem checkpoints

* test(javascript): normalize the module resolution oracle path separators

* test(frida): assert the CLI spawn Evidence contract

* test(mcp): use an unsupported analysis-view parent

* test(browser): separate source-location line bounds from parity

* fix(javascript): preserve uncertain loader provenance

* test(javascript): cover uncertain require resolution

* fix(javascript): retain conditional Electron evidence

* fix(javascript): preserve timed semantic provenance

* fix(javascript): retain conditional builtin effects

* test(javascript): distinguish bundled host authority

* fix(javascript): preserve nested loader invocation identity

* test(javascript): qualify Electron fixture authority

* fix(javascript): preserve loader invocation authority

* fix(javascript): respect source order for resolver escapes

* fix(javascript): check nested loader callable mutations

* fix(javascript): retain conditional constructor requests

* fix(reference): retain constructor loader relationships

* fix(reference): follow nested loader callable paths

* refactor(javascript): share callable mutation interpretation

* fix(javascript): require exact package loader suffixes

* refactor(javascript): unify conditional relation evidence

* refactor(javascript): unify conditional node evidence

* fix(javascript): retain unknown authority for mixed case sources

* fix(javascript): preserve loader uncertainty for dotfiles

* fix(reference): classify javascript suffix dotfiles

* test(reference): cover suffix dotfiles through cli

* fix(javascript): retain equivalent conditional built-in origins

* fix(javascript): preserve wrapped resolver operation

* fix(javascript): retain nested conditional built-in receivers

* test(javascript): declare CommonJS in native addon fixtures

* fix(javascript): retain wrapped resolver candidates

* style: format merged native command schema

* fix(javascript): preserve uncertain loader authority

* test(javascript): require candidate preload evidence

* test(javascript): cover reference loader member writes

---------

Co-authored-by: ShuaixinHuang <1836656514@qq.com>
This commit is contained in:
morlutoandShuaixinHuang authored and GitHub committed 2026-11-09 13:21:24 +08:00
1 parent 78a84d75c0
commit b46f4fcebd
112 files changed
+5156 -797

No files matched your search

@@ -82,6 +82,7 @@ it("substitutes numeric modules, named exports and captured wrapper arguments",
const env = resolver.bind(fn, []);
expect(resolver.evaluate(fn.node.body.callee, env)).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron", "ipcRenderer", "send"],
});
expect(resolver.arguments(fn.node.body, env)[0]).toEqual({
@@ -127,7 +128,11 @@ it("checks block lexical initializers against their containing function call", (
);
},
});
expect(resolved).toEqual({ kind: "external", path: ["electron"] });
expect(resolved).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron"],
});
});
it("keeps same-factory reads before initialization unresolved", () => {
@@ -236,8 +241,16 @@ it("keeps function declarations hoisted and checks closures at invocation", () =
inspect(localRead());
`);
expect(inspected[0]).toMatchObject({ kind: "function" });
expect(inspected[1]).toEqual({ kind: "external", path: ["electron"] });
expect(inspected[2]).toEqual({ kind: "external", path: ["electron"] });
expect(inspected[1]).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron"],
});
expect(inspected[2]).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron"],
});
});
it("keeps a synchronous cross-function callback before initialization unresolved", () => {
@@ -288,7 +301,11 @@ it("uses completed activation provenance for a returned closure", () => {
const value = require("electron");
return () => value;
}`);
expect(result).toEqual({ kind: "external", path: ["electron"] });
expect(result).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron"],
});
});
it("does not treat statements after a returned closure as initialized", () => {
@@ -898,7 +915,11 @@ it.each([
})();`);
expect(value.kind).toBe(kind);
if (kind === "external")
expect(value).toEqual({ kind: "external", path: ["electron"] });
expect(value).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron"],
});
},
);
@@ -910,7 +931,11 @@ it("reads a literal prototype only from its actual prototype setter", () => {
inspectOne(
'inspect(({__proto__:require("electron"),ordinary:1}).__proto__);',
),
).toEqual({ kind: "external", path: ["electron"] });
).toEqual({
kind: "external",
loaderAuthority: "candidate",
path: ["electron"],
});
});
it.each(["local", "outer"])(
@@ -1031,3 +1056,23 @@ it("keeps repeated cached queries within an independent depth budget", () => {
expect(values).toHaveLength(1);
expect(resolver.truncated).toBe(false);
});
it("retains each external selection guard once across deep member reads", () => {
const { parsed, resolver } = resolverFor("if (guard) {};");
const condition = { node: parsed.program.body[0]!, positive: true as const };
let value: SymbolicValue = {
kind: "external",
path: ["electron"],
loaderAuthority: "candidate",
conditions: [condition],
};
for (let index = 0; index < 32; index++) {
value = resolver.property(value, `member${index}`);
}
expect(value).toMatchObject({
kind: "external",
loaderAuthority: "candidate",
conditions: [condition],
});
expect(resolver.truncated).toBe(false);
});