Repository navigation
fix(javascript): recover inline FunctionExpression bundler IIFEs and Rspack getters - #9500
saariuslystoned wants to merge 21 commits into
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
[Medium impact] The PR changes results from static JavaScript and Electron application analysis. The PR should not merge until the three missed method-replacement paths are fixed. Findings
Fix with agent prompt### Issue 1
src/domain/javascript/javascriptSemanticAnalysis.ts:3514-3516
`enqueueFromEntriesSources` keeps only the last matching entry, even when the selected key is unknown. For `const a = Object.fromEntries([["ipc", e.ipcRenderer], ["other", {}]]); a[globalThis.key].send = () => {};`, both keys match the unknown selection. The second entry discards the Electron alias.
If `globalThis.key` is `"ipc"`, the analyzer misses the replacement and can report a later `e.ipcRenderer.send("FALSE")` as real IPC. Apply last-write-wins separately for each actual key. An unknown selection must retain all surviving keys.
### Issue 2
src/domain/javascript/javascriptSemanticAnalysis.ts:3631-3640
`enqueueArrayFromAsyncSources` follows mapper return expressions without binding the mapper's parameters to the input elements. For `const a = await Array.fromAsync([e], x => x); a[0].ipcRenderer.send = () => {};`, the search reaches `x` with no call frame and never reaches `e`.
The mapper is fully resolved, so the fallback does not run. A later Electron call can be reported even though its method was replaced. Carry the mapper's arguments and receiver through the shared call-frame path, as the `Array.from` branch does.
### Issue 3
src/domain/javascript/javascriptSemanticAnalysis.ts:3835-3839
The `Object.create` and `Object.defineProperties` paths follow descriptor `value` fields but ignore getter results. For `const a = Object.create(null, { ipc: { get: () => e.ipcRenderer } }); a.ipc.send = () => {};`, the search looks for `ipc.value`, finds nothing, and misses the Electron method replacement. The same happens with `Object.defineProperties({}, ...)`.
A later call can be reported as IPC even though it invokes the replacement. Reuse the descriptor path that follows both values and getter returns instead of treating these descriptors as value-only.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.SummaryThe PR recovers inline and variable-declared bundler loaders, block-body interop getters, and more Electron aliases.
Diagram%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Bundler bootstrap] --> B[Prove loader and module origins]
B --> C[Recover Electron aliases]
C --> D[Trace writes through calls and containers]
D --> E[Exclude replaced methods]
E --> F[Report Electron IPC]
Reviews (12) · Last reviewed commit: "fix(javascript): keep the last Object.fr..." · Reviewed by Greptile |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 087aa60afa
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…nd preserve deferred bundled aliases
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e2e9610a9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…signed Electron member writes
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 44b356e0b6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…od keys before loader init
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 80da36e603
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…le bootstrap loaders
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 89a7105ea0
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…, and indirect Electron writes
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 20cd9e9653
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e5eaba3a88
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ssigned params, and filter generator completion returns
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 5e1beb2ce9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f26d4483dc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ck-iife-bootstrap
…ctions, and nested defaults
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 25c8d8bba1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ck-iife-bootstrap
…ate defaults, and unresolved callable fallbacks
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7cc3fa8984
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: d47d0fc82e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 2b52810f0e
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…container boundaries
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c296587eb2
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
… member-write identities
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 03273bb93f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 45b1218200
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ctx.pending.push({ | ||
| ...current, | ||
| node: vNode, | ||
| suffix: remaining, |
There was a problem hiding this comment.
Respect duplicate-key overwrite order in Object.fromEntries
For CommonJS code with e = require("electron"), const a = Object.fromEntries([["ipc", e.ipcRenderer], ["ipc", {}]]); a.ipc.send = () => {}; e.ipcRenderer.send("REAL"); only modifies the fresh object from the last entry. This loop nevertheless queues both matching values, attributing the write to Electron's original send method and suppressing the genuine IPC finding. Represent the last surviving entry in the owning result projection instead of retaining every matching value.
AGENTS.md reference: AGENTS.md:L27-L27
Useful? React with 👍 / 👎.
| if (receiver !== undefined && t.isExpression(receiver)) | ||
| ctx.pending.push({ | ||
| ...current, | ||
| node: receiver, | ||
| suffix: [propKey, ...current.suffix], |
There was a problem hiding this comment.
Keep Reflect.get receivers out of data-property result identities
With e = require("electron"), const a = Reflect.get({ x: {} }, "x", { x: e }); a.ipcRenderer = {}; e.ipcRenderer.send("REAL"); only modifies the fresh target value: a data-property read ignores the receiver. This branch unconditionally forwards receiver[propKey] as another result identity, so it follows e, records an Electron namespace overwrite, and suppresses the genuine IPC finding. Resolve the target descriptor through the property/getter owner and use the receiver only as getter this, rather than as an alternate property source.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| const mapped = ctx.returnQueries.awaited(mapFn, undefined, current.callFrame); | ||
| for (const ref of mapped.references) | ||
| ctx.pending.push({ | ||
| ...current, | ||
| node: ref.node, |
There was a problem hiding this comment.
Apply mapper invocation facts to Array.fromAsync results
Inside an async CommonJS function with e = require("electron"), const a = await Array.fromAsync([{}], (x = e) => x); a[0].ipcRenderer = {}; e.ipcRenderer.send("REAL"); never uses the mapper default. Unlike the synchronous Array.from path, this new async branch queues the returned parameter without constructing the mapper frame or marking inactive defaults. Following x therefore leaves its default e eligible, records an unrelated Electron overwrite, and suppresses the real IPC observation. Consume the shared mapper invocation/default-activation facts here as well.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| for (const gen of gens) { | ||
| const list = collector.byGenerator.get(gen) ?? []; | ||
| list.push(firstArg); | ||
| collector.byGenerator.set(gen, list); |
There was a problem hiding this comment.
Exclude iterator-start arguments from generator resume sources
For function* g() { const a = yield {}; a.ipcRenderer = {}; }, the sequence const it = g(); it.next(e); it.next({}); e.ipcRenderer.send("REAL");, with e bound to Electron, cannot mutate Electron because the argument to the initial next() is ignored. The new collector nevertheless adds that argument to the generator's resume sources, attributing the yield-expression result to e and suppressing the genuine IPC finding. Represent iterator startup separately from suspended-yield resumes before transferring argument identities.
AGENTS.md reference: AGENTS.md:L27-L27
Useful? React with 👍 / 👎.
…ck-iife-bootstrap Keep main's alias-selection budget and the branch's candidate/frame projection for returned references. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…d key Main replaced the fixed alias-selection cap with caller semantic precision, so the merged rspack projection uses that budget. A later static key overwrites earlier fromEntries values and no longer suppresses a real IPC send. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 760406ede5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| t.isExpression(proto) && | ||
| !t.isNullLiteral(unwrapJavaScriptExpression(proto).node) | ||
| ) | ||
| ctx.pending.push({ ...current, node: proto, capturedSelections }); |
There was a problem hiding this comment.
Honor own properties before following prototype sources
For CommonJS input with e = require("electron"), const a = Object.create(e, { ipcRenderer: { value: {} } }); a.ipcRenderer.send = () => {}; e.ipcRenderer.send("REAL"); only modifies the fresh own child. This branch nevertheless queues e with the ipcRenderer suffix despite the shadowing descriptor, causing write coverage to mark Electron's send as replaced and suppress the genuine IPC observation. Object.setPrototypeOf({ ipcRenderer: {} }, e) reaches the same unconditional prototype forwarding in enqueueTargetArgumentIntrinsicSources. Resolve the selected own slot before consulting the prototype instead of retaining both identities.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| const remaining = suffix.slice(targetMembers.length); | ||
| for (const rhs of assignmentValueSources(cur)) | ||
| ctx.pending.push({ | ||
| ...current, | ||
| node: rhs, |
There was a problem hiding this comment.
Exclude superseded assignments from constructor result slots
When a constructor definitely replaces a field before returning, such as class Box { constructor(ipc) { this.ipc = ipc; this.ipc = {}; } }, the sequence const a = new Box(e.ipcRenderer); a.ipc.send = () => {}; e.ipcRenderer.send("REAL"); with e = require("electron") only modifies a fresh object. This walk enqueues every matching assignment's RHS, including the superseded ipc, so it falsely records an Electron send overwrite and suppresses the genuine IPC observation. Derive the selected instance slot at constructor completion, including ordered replacements, rather than unioning every store found in the constructor body.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
| node: target, | ||
| suffix: [propKey, ...remaining], | ||
| readAt: current.readAt ?? callNode, |
There was a problem hiding this comment.
Capture descriptor values at the intrinsic call boundary
For CommonJS input with e = require("electron"), const box = { x: {} }; const desc = Object.getOwnPropertyDescriptor(box, "x"); box.x = e; desc.value.ipcRenderer = {}; e.ipcRenderer.send("REAL"); leaves Electron unchanged because the descriptor retains the original fresh object. This new descriptor projection reuses the consumer's readAt without adding a call-time capture, so semanticProjectedSourceFactsAtRead follows the later box.x = e and incorrectly invalidates the genuine IPC observation. The plural property-descriptors branch has the same omission. Preserve the copied value's snapshot boundary using capturedSelections, as the Object.values path already does, rather than treating the descriptor as a live property lookup.
AGENTS.md reference: AGENTS.md:L19-L19
Useful? React with 👍 / 👎.
|
Closing this. It grew to about 10k lines over many review rounds and still has open automated findings, so it is not a reviewable fix in this form. If Rspack/IIFE bootstrap recovery is still wanted, I'll come back with a small, focused PR. Thanks for the reviews. ☁️ |
| if (kStatic !== null && keyMatches(kStatic)) { | ||
| definiteValue = vNode; | ||
| maybeValues.length = 0; |
There was a problem hiding this comment.
Computed writes lose earlier keys
enqueueFromEntriesSources keeps only the last matching entry, even when the selected key is unknown. For const a = Object.fromEntries([["ipc", e.ipcRenderer], ["other", {}]]); a[globalThis.key].send = () => {};, both keys match the unknown selection. The second entry discards the Electron alias.
If globalThis.key is "ipc", the analyzer misses the replacement and can report a later e.ipcRenderer.send("FALSE") as real IPC. Apply last-write-wins separately for each actual key. An unknown selection must retain all surviving keys.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptSemanticAnalysis.ts
Line: 3514-3516
Comment:
**Computed writes lose earlier keys**
`enqueueFromEntriesSources` keeps only the last matching entry, even when the selected key is unknown. For `const a = Object.fromEntries([["ipc", e.ipcRenderer], ["other", {}]]); a[globalThis.key].send = () => {};`, both keys match the unknown selection. The second entry discards the Electron alias.
If `globalThis.key` is `"ipc"`, the analyzer misses the replacement and can report a later `e.ipcRenderer.send("FALSE")` as real IPC. Apply last-write-wins separately for each actual key. An unknown selection must retain all surviving keys.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| const mapped = ctx.returnQueries.awaited(mapFn, undefined, current.callFrame); | ||
| for (const ref of mapped.references) | ||
| ctx.pending.push({ | ||
| ...current, | ||
| node: ref.node, | ||
| suffix: [...ref.projection, ...elementSuffix], | ||
| readAt: current.readAt ?? callNode, | ||
| ...(filteredAwaitDepths.length === 0 | ||
| ? { awaitDepths: undefined } | ||
| : { awaitDepths: filteredAwaitDepths }), |
There was a problem hiding this comment.
Async mapper aliases disappear
enqueueArrayFromAsyncSources follows mapper return expressions without binding the mapper's parameters to the input elements. For const a = await Array.fromAsync([e], x => x); a[0].ipcRenderer.send = () => {};, the search reaches x with no call frame and never reaches e.
The mapper is fully resolved, so the fallback does not run. A later Electron call can be reported even though its method was replaced. Carry the mapper's arguments and receiver through the shared call-frame path, as the Array.from branch does.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptSemanticAnalysis.ts
Line: 3631-3640
Comment:
**Async mapper aliases disappear**
`enqueueArrayFromAsyncSources` follows mapper return expressions without binding the mapper's parameters to the input elements. For `const a = await Array.fromAsync([e], x => x); a[0].ipcRenderer.send = () => {};`, the search reaches `x` with no call frame and never reaches `e`.
The mapper is fully resolved, so the fallback does not run. A later Electron call can be reported even though its method was replaced. Carry the mapper's arguments and receiver through the shared call-frame path, as the `Array.from` branch does.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| ctx.pending.push({ | ||
| ...current, | ||
| node: descriptors, | ||
| suffix: [current.suffix[0]!, "value", ...current.suffix.slice(1)], | ||
| readAt: current.readAt ?? callNode, |
There was a problem hiding this comment.
Descriptor getters hide replacements
The Object.create and Object.defineProperties paths follow descriptor value fields but ignore getter results. For const a = Object.create(null, { ipc: { get: () => e.ipcRenderer } }); a.ipc.send = () => {};, the search looks for ipc.value, finds nothing, and misses the Electron method replacement. The same happens with Object.defineProperties({}, ...).
A later call can be reported as IPC even though it invokes the replacement. Reuse the descriptor path that follows both values and getter returns instead of treating these descriptors as value-only.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptSemanticAnalysis.ts
Line: 3835-3839
Comment:
**Descriptor getters hide replacements**
The `Object.create` and `Object.defineProperties` paths follow descriptor `value` fields but ignore getter results. For `const a = Object.create(null, { ipc: { get: () => e.ipcRenderer } }); a.ipc.send = () => {};`, the search looks for `ipc.value`, finds nothing, and misses the Electron method replacement. The same happens with `Object.defineProperties({}, ...)`.
A later call can be reported as IPC even though it invokes the replacement. Reuse the descriptor path that follows both values and getter returns instead of treating these descriptors as value-only.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.
Summary
Recover standalone Rspack and Webpack 5 bundler bootstraps where SWC or Terser folds the module loader into an inline named
FunctionExpressionIIFE (or an unmutated variable-declared function) and support Rspack/Webpack block-body__webpack_require__.ndefault-interop getters and module-binding aliases during static JavaScript and Electron boundary analysis.No related GitHub issue is linked; this addresses a concrete static bundler analysis gap observed on minified standalone Rspack and Webpack 5 Electron bundles.
Problem and expected behavior
When a standalone Rspack or Webpack 5 bundle attaches no helper properties onto
__webpack_require__, SWC and Terser fold the loader declaration and entry invocation into an inline namedFunctionExpressioncall expression:Separately, Rspack and Webpack 5 emit block-body
__webpack_require__.ncompatibility getters (var getter = module && module.__esModule ? () => module.default : () => module; __webpack_require__.d(getter, { a: getter }); return getter;and SWC/Terser's comma-sequence formreturn __webpack_require__.d(getter, { a: getter }), getter;) alongside two-step module-binding imports (var e0 = __webpack_require__(91288); var d0 = __webpack_require__.n(e0); d0().ipcRenderer.send(...)orconst { ipcRenderer } = electron_1).Previously:
javascriptBootstrapAtandproveJavaScriptBootstrapIntegrityonly admittedFunctionDeclarationloaders invoked by a separate statement, producing0bundler_registrations,0recovered modules, and0Electron IPC/window findings on inlineFunctionExpressionIIFE and variable-declared bootstraps.isCanonicalGetterinjavascriptBundledRequireOrigin.tsonly admitted single-expression conditional arrows, andsemanticBundledRequireOrigindid not follow stable module-binding aliases into destructuring/member reads or two-step.n(moduleAlias)calls.Expected behavior:
FunctionExpressionloader IIFEs (in expression statements, variable declarators, assignments, and return statements) and unmutated variable-declared loaders recover bundler registrations, entry module edges, and externalrequire(...)origins whenever the loader, module table, and cache satisfy all existing bootstrap integrity invariants.__webpack_require__.ngetters (multi-statement and comma-sequence return forms) and stable local module-binding aliases preserve CommonJS external identity without admitting uncalled getters or mutated bindings.Change and scope
Follow the contribution scope.
src/domain/javascript/javascriptBootstrap.ts(javascriptBootstrapAt) to recognize unmutated inline namedFunctionExpressionloader IIFEs in the bootstrap body (outside nested functions) and unmutated variable-declared function/arrow loaders initialized before top-level use, recordingloaderSelfBindingIdsandinlineCallwhile verifying single non-assignment definitions and zero writes.src/domain/javascript/javascriptBootstrapIntegrity.ts(proveJavaScriptBootstrapIntegrity) fromt.FunctionDeclarationtoBootstrap["loader"], trackingloaderSelfBindingIdsintrackedloader references and enforcing read-only containment (identifierRole === "read"), unconditional single dispatch (m[id](...)orm[id].call(...), includingSequenceExpressionreturn tails), and cache/table confinement. Any reassignment, shadowing, unproven slot write, or mismatched third factory argument continues to reject recovery.src/domain/javascript/javascriptStaticAnalysisBundler.ts(inspectBundlerBootstrap) so inline bootstrap calls record their entry module key on the recoveredbundler_registrationsentry.src/domain/javascript/javascriptBundledRequireOrigin.tsto:FunctionExpressionblock-body.ngetters (return <cond>,var g = <cond>; return g;,var g = <cond>; r.d(g, { a: g }); return g;, andvar g = <cond>; return r.d(g, { a: g }), g;including shorthand{ a }), verifying single definitions, zero writes/member writes on the module parameter and localgetterbinding, exact<loader>.ddescriptor shape, and installation before entry dispatch (including top-levelSequenceExpressionstatements and inline bootstrap IIFEs);const electron_1 = r(91288); const { ipcRenderer } = electron_1;, member aliases, and two-stepvar e0 = r(91288); var d0 = r.n(e0); d0()...) withinSEMANTIC_ALIAS_SELECTION_LIMITand opaque-effect checks while proving definite initialization before same-activation and deferred hoisted-function reads (semanticStableBindingInitializedBeforeRead), indexing member writes across captured reassigned bindings inindexJavaScriptElectronIdentitySteps, and rejecting uncalled.ngetters.Contract and boundary impact
src/domain/javascript/javascriptBootstrap.ts), bootstrap integrity proof (src/domain/javascript/javascriptBootstrapIntegrity.ts), bundler entry inspection (src/domain/javascript/javascriptStaticAnalysisBundler.ts), and bundled externalrequireorigin recovery (src/domain/javascript/javascriptBundledRequireOrigin.ts), consumed by static Electron and JavaScript application graph reconstruction.webpack-bootstrapchunk/module node provenance,bundler-entry-moduleload edges, andrequireresolution provenance on recovered external calls.docs/public/product-catalog.json), package, or installation impact (CI generates and validates ignored catalogs andskills/; edit authored instructions in.agents/skills/reverse-engineer-anything/and never commit build outputs): None.Expected effects (check known effects; use documentation-only on its own).
Unchecked items do not establish absence; leave uncertainties visible.
Evidence and regression coverage
Evidence is executed via unit and filesystem boundary test suites (including
node:vmruntime parity checks on synthetic bundles).src/domain/javascript/javascriptRspackBootstrapIdentity.test.ts(33 tests): covers declarator, assignment (.call+SequenceExpressionreturn), expression-statement, and return-statement inline namedFunctionExpressionIIFEs withnode:vmparity;constarrow andvarFunctionExpressionloaders (including uncomputedrmodule-table keys andmeta.rmember properties before the loader declaration); multi-statement and comma-sequence block-body__webpack_require__.ngetters (including{ a }shorthand and top-levelSequenceExpressioninstallation); destructured, member-alias, and hoisted deferred-function Electron module reads; uncalled getter and overwritten member exclusions; and 17 tamper/shadowing/mutation/pre-init soundness rejections.tests/boundary/filesystem/javascript-applications/javascriptBundlerAdapters.test.ts(1 test added, 3 total): verifies end-to-endreconstructJavaScriptFixturerecovery ofwebpack-bootstrap@0, entry/external module nodes,bundler-entry-moduleload edge,electron_summary.ipc, andipc-channelgraph nodes from a standalone Rspack inlineFunctionExpressionpreload bundle.88cf49803,analyzeJavaScriptStaticSourceon the inlineFunctionExpressionIIFE fixture returnsbundler_registrations: [],electron.browser_windows: [], andelectron.ipc: [], andisCanonicalGetterreturnsfalseon block-body.ngetters.analyze_javascript_applicationandproject_electron_application_graphnow populatebundler_registrations,javascript-chunk/javascript-modulenodes, and Electron window/IPC findings for standalone Rspack/SWC inline-IIFE bundles instead of reporting zero registrations and zero IPC channels.Boundary regressions covered: JavaScript bundler adapter reconstruction (
tests/boundary/filesystem/javascript-applications/javascriptBundlerAdapters.test.ts) and Electron static boundary reconstruction (tests/boundary/filesystem/javascript-applications/electronApplicationAnalysis.test.ts). Lifecycle regressions are not applicable because no persistent sessions, child processes, or external bridges are modified.For evidence-bearing changes:
Validation performed
npx oxfmt . && npx oxfmt --check .— passed (All matched files use the correct formatacross 7,232 files)npm run test:prepare && npm run build:cached && npm run check:fast— passed (typecheck,lint,verify:module-boundaries, and catalog builds clean)npx vitest run src/domain/javascript/javascriptRspackBootstrapIdentity.test.ts src/domain/javascript/electronBundledRequireIdentity.test.ts src/domain/javascript/electronModuleInterop.test.ts src/domain/javascript/javascriptBundlerRegistrationIdentity.test.ts tests/boundary/filesystem/javascript-applications/javascriptBundlerAdapters.test.ts tests/boundary/filesystem/javascript-applications/electronApplicationAnalysis.test.ts):v22.23.4(darwin-arm64) — passed (6 passedtest files,353 passedtests)v24.22.2(darwin-arm64) — passed (6 passedtest files,353 passedtests)v26.13.0(darwin-arm64) — passed (6 passedtest files,353 passedtests)npm run verify:architecture-guards && npm run verify:test-discovery && npm run scan:todos— passed (2,548source files,3,197test files,0tech-debt markers)npm run jscpd && npm run knip && npm run knip:production && npm run metadata:check && npm run mcp-catalog:check && npm run docs:check— passed (0Knip issues;3.45%duplicated lines;readmeConsistency.test.ts9/9passed)npm run lint:typed— passed (6,676files,0errors)node scripts/rea.mjs analyze-javascript-application <dir> --format json) and stdio MCP (analyze_javascript_application) probe against a synthetic Electron application with a standalone Rspack inlineFunctionExpressionIIFE preload bundle — passed (browser_windows: 1,preload_entrypoints: 1,ipc.operations: 1,ipc.renderer_transmissions: 1,electron_semantics: "recovered")Compatibility, safety, and release
src/domain/javascript/.SEMANTIC_ALIAS_SELECTION_LIMITcycle/depth bounds, and retains strict fail-closed rejection whenever bootstrap table, cache, loader self-binding, or.ngetter bindings are mutated, shadowed, or escaped.Author readiness
Human owner: @saariuslystoned
Before merge
type(scope): outcome.