fix(javascript): preserve execution and invocation provenance

Keep direct empty bridge objects observed, reject unexecuted initializers,
invalidate modified bootstrap tables and Electron identities, and retain
selection predicates through symbolic values and wrapper paths. Track lexical
binding identity and completed activation boundaries without leaking analysis
order into earlier reads.

Separate wrapper invocation provenance from the underlying IPC source range
so repeated registrations remain ambiguous through transfer and graph joins.
Use the same offered transfer budget for module preflight and final writing.

Index static literal properties once instead of rescanning every member. Keep
the original 10,001-member capacity fixture; Flameox confirmed the repeated
lookup cost and the optimized fixture completes in under one second locally.
Prune the stale compact-schema tool inventory assertion and update the public
call-graph registration expectation to its declared result envelope.

Validation: build, check, docs:check, 83 focused tests, 10 Electron identity
acceptance cases, 2 full-scale finding-capacity cases, and 7 compact-schema
transport tests. No real Electron runtime execution is claimed.
This commit is contained in:
morluto committed 2026-10-12 10:03:17 +08:00
1 parent edf46248f2
commit b8fab74297
20 files changed
+1718 -342

No files matched your search

@@ -50,6 +50,51 @@ it("does not infer a bootstrap from a function table without a matching loader",
expect(analysis.bundler_registrations).toEqual([]);
});
it("does not confuse a shadowed dispatch table with the outer module table", () => {
const analysis = analyzeJavaScriptStaticSource(`(() => {
const modules = { 17(module) { module.exports = require("electron"); } };
function load(id) {
const modules = userInput;
const module = { exports: {} };
modules[id](module, module.exports, load);
return module.exports;
}
load(17);
})();`);
expect(analysis.bundler_registrations).toEqual([]);
});
it("retains a stable var module table without treating declaration mutability as a write", () => {
const analysis = analyzeJavaScriptStaticSource(`(() => {
var modules = { 17(module) { module.exports = require("electron"); } };
function load(id) {
const module = { exports: {} };
modules[id](module, module.exports, load);
return module.exports;
}
load(17);
})();`);
expect(analysis.bundler_registrations).toMatchObject([
{ entry_module_keys: ["17"], modules: [{ module_key: "17" }] },
]);
});
it("only attributes bootstrap entries to the recovered loader binding", () => {
const analysis = analyzeJavaScriptStaticSource(`(() => {
const modules = { 17(module) { module.exports = require("electron"); } };
function load(id) {
const module = { exports: {} };
modules[id](module, module.exports, load);
return module.exports;
}
{ const load = userInput; load(99); }
load(17);
})();`);
expect(analysis.bundler_registrations).toMatchObject([
{ entry_module_keys: ["17"] },
]);
});
it("preserves first insertion precedence and inclusive interval bounds", () => {
const nested = new JavaScriptModuleRangeIndex(100);
expect(nested.find(0)).toBeUndefined();