Repository navigation
feat(javascript): fold constant values and recover Electron boundaries through wrappers - #2094
coleleavitt wants to merge 50 commits into
Conversation
…nsion The parent charged 8x transfer bytes, 6x static checkpoints and an 8x application-projection forecast against half of its heap. On the Grok Bot app.asar at the default 4 GB heap this rejected application relationships for 492 of 579 sources and semantic analysis for 491, although the same run with a 28 GB heap peaked at 1.5 GB RSS. Measured retained heap is 1.23x-1.42x of the parsed JSON, and the summed application forecast was 9.7x the retained application graph. Use those measurements; the halved heap budget still covers sealing copies. The default-heap run now projects every source (3:07, 1.55 GB peak RSS).
Replace the default 100,000-node graph ceiling and 20,000-node file ceiling with a byte budget derived from resources. One application Evidence may occupy the parent heap divided by twelve (at most one V8 string): measured consumers peak at about six times the Evidence bytes, and compare_application_versions holds two records. Each source is offered the remaining budget in proportion to its share of unanalyzed source bytes, capped by the parent's free result heap. Caller-selected max_semantic_nodes and max_semantic_nodes_per_file still apply and close admission the same way; omitted, only the byte budget bounds the graph. Within a source, nodes are charged only when an admitted relation, fingerprint or unknown frontier references them, and frontiers are offered after every relation, so unknowns no longer flood the budget and a truncated source keeps a connected, source-ordered prefix. Refused facts are counted exactly. The ceiling truncated the Grok Bot app.asar to its first 58 of 579 sources without naming the omitted ones. Every source is now projected and reported in semantic_graph.coverage.files with its retained bytes, exact omitted node/relation/fingerprint counts and unknown totals by family and reason. The per-source byte budget derives from the analyzing process's V8 heap, so graph_byte_budget is recorded only for truncated sources; complete sources keep identical Evidence identities across hosts with different heaps. BREAKING CHANGE: semantic_graph.coverage.families[].unknown_ids is replaced by retained_unknowns and omitted_unknowns, coverage.files is added, the default semantic_graph_node_ceiling and semantic_graph_file_node_ceiling limits are removed (they appear only when the caller selects a node capacity), and truncation by the byte budget reports javascript_analysis_evidence_budget_bytes.
Grok Bot's main-app.cjs failed semantic analysis with "Maximum call stack size exceeded". Its undici classes read `this[symbol].name` in about twenty getters. The unknown key selected every getter again on each hop, so class lookups enumerated every ordering of getter names and spread the resulting arrays into push(). After one unknown-key hop, escape every field value and getter result of the receiver class instead of enumerating paths; an escape covers effects at any depth, so writes through those getters stay conservative. Duplicate references are dropped and results are appended without spreads. main-app.cjs now completes in 7 s under a 1 GiB heap.
…CP boundary The resource boundary test relied on the former 8x application-projection forecast. Twelve thousand findings still exceed a 512 MiB parent's result budget under the measured forecast.
…ontiers Add semantic_files and semantic_unknowns page collections for JavaScript application Evidence. semantic_files returns each source's semantic byte budget, retained bytes, exact omitted counts and unknown totals by family and reason; semantic_unknowns returns retained frontiers ordered by source, family and reason. The summary reports source counts by status instead of repeating every file, and its unknowns name both pages. Document the serialized-byte budget and its coverage, and verify the budget, exact counts and both pages through the public CLI.
The semantic value lattice now folds void, typeof, ~, arithmetic, comparison, shift and bitwise operators over exact primitive operands, plus Array.prototype.join over exact arrays and String.fromCharCode. Operands may be undefined, NaN, infinite or negative zero while folding; only JSON-representable results become literals, so void 0 and 1/0 alone stay unknown with an explicit reason.
…int findings Static findings now read values through the semantic value lattice instead of literal syntax alone. Electron webPreferences, contextBridge world IDs and sender checks gain a derived status that keeps the source expression; IPC channels and contextBridge keys built from constants carry both the exact value and the expression, and derived channels pair with handlers. Network endpoint arguments built by concatenation, templates, join or fromCharCode become exact values with their expression and a derived-value limitation. When member-mutation recovery exhausts a resource limit, the file keeps literal-only values and records why.
…efaults Request operations and configuration defaults read exact values through the semantic value lattice, so concatenated endpoints and folded defaults are complete. A literal null default is now an exact value rather than a partial one. The literal-only default reader is removed.
Static analysis now records URL-like strings that no recognized call site or route consumes as data endpoints: string literals and object keys, template text, and maximal folded expressions. Every endpoint carries a syntactic url_class (http, websocket, host, path, data, blob, file) and host; data endpoints also carry the property path from their nearest named container and are projected as exact module containment. Values already reported at a network call or route are not repeated. Host-only values must be lowercase DNS names under a two-letter IANA country code or a common generic top-level domain, which excludes dotted attribute keys such as k8s.pod.name or team.billing.read. Endpoint projection moves to its own module, and endpointArgument takes the call facts as one value.
Static analysis records whether constant folding was available. When member-write recovery exceeds a resource limit, the application analysis now lists the file and reason among its limitations instead of leaving the gap in per-file static limitations that the graph does not project.
Callee roots that are parameters (or destructured parameter keys) of a named function now resolve when its same-file direct call sites pass a proven Electron export, an object-literal member holding one, or a ??/||/&&/conditional branch of those. Every window, contextBridge, IPC and utility finding carries electron_identity with the basis, wrapper, parameter, call-site count, proven argument locations and unresolved argument count. Relationships that depend on an inferred identity are inferences with medium or low confidence.
contextBridge exposure arguments that are identifiers bound to one stable object-literal initializer now report their members (api_status object-binding), following member values that are such bindings. Keys from conditional object spreads with known branches are reported as conditional_members. Visible member writes to a bound object add an unknown member.
…bview hardening BrowserView and WebContentsView constructions are reported with the BrowserWindow surface (api field) and project to web-contents-view graph nodes. will-attach-webview listeners record writes and deletions through their webPreferences and params parameters and the last static preload path, which becomes an electron-preload role. The summary adds web_contents_views, webview_attach_handlers and wrapper_inferred_api_findings; Electron finding counts now share one helper.
A callee root bound once to a ??, ||, &&, conditional or object literal of Electron values, such as options.electron ?? { BrowserWindow: electron.BrowserWindow }, now resolves when its proving branches agree. electron_identity records basis local-alternatives with the proving value locations and the unresolved alternatives. The summary count is renamed to inferred_api_identity_findings and covers every inferred basis.
…bindings, node-gyp-build and process.dlopen Calls to a module.createRequire function, the bindings and node-gyp-build loaders, and process.dlopen are classified directly, through one stable alias, or through a parameter default. Loader bindings record loader, loader_basis and specifier_status. bindings and node-gyp-build add-ons are resolved to the single .node file in the build or prebuild trees of the nearest package root, with the candidates listed and low confidence. Summary and graph now share one native resolver.
… sources Policies are recovered from <meta http-equiv> elements in HTML files, from Content-Security-Policy header properties and assignments such as onHeadersReceived responseHeaders, from [...].join directive lists, and from string or template literals including meta markup. Each policy lists its directives and concerns (wildcard and network-scheme sources, data:/blob: script sources, unsafe-inline, unsafe-eval, missing script or plugin fallbacks). Runtime parts are kept as a placeholder and not judged. The summary adds content_security_policies and content_security_policy_concerns.
A loader parameter whose default is an identifier bound to a createRequire result, as in function load(requireAddon = createdRequire), now resolves through that binding, so its calls become require references or native bindings.
…d operator folder Move primitive operator, template, String.fromCharCode and Array.prototype.join folding into javascriptSemanticOperators as foldSemanticOperands, which reads every non-operator expression through caller-supplied leaves. The constant lattice supplies its once-bound binding leaves, so its values are unchanged. `void` now folds to undefined without reading its argument, so `"a" + void runtimeValue()` folds to "aundefined".
…or folder Symbolic call-path substitution now reads literals with readExactJavaScriptLiteral and folds operators, templates, String.fromCharCode and Array.prototype.join through the constant lattice's foldSemanticOperands, with operands read from its call-site environment. Branch conditions on operands carry over to the result; alternatives with different conditions mark it unresolved. Electron identity for imports and unbound parameters now comes from the shared identity index: an import keeps its module binding, and a parameter that no call site on the path binds uses the wrapper-parameter or local-alternatives fact, which substituted IPC and bridge findings record as their electron_identity. The two parameter mechanisms stay separate: the summary belongs to the identity index the substitution reads and records proving argument locations that substituted values do not carry. Call arguments are read only for callees that consume them, so unresolved reads inside calls of unrelated callees no longer mark a file partial.
…s and linked sources Wrapper substitution now starts from the outermost same-file callers of wrappers that forward a computed channel to an IPC-named call, following forwarded parameters and enclosing wrappers up to eight levels. The symbolic engine folds templates and concatenation, iterates exact arrays in for...of (Object.entries/keys/values, Array.prototype.map), keeps members written per iterated key or by ordered direct writes, evaluates literal getters, reads an absent key of a closed literal as undefined, binds destructured parameters and defaults, and recognizes esbuild __commonJS and __toESM structurally. Substituted values fold through the constant lattice's foldSemanticOperands. An operand whose alternatives carry predicates is folded once per alternative, so each result keeps its own predicates. An operand known only to be an object compares exactly under strict equality with a primitive and loose equality with null or undefined; every coercing operator on it stays unknown. A non-index member of array syntax is unknown without evaluating the elements. Call arguments stay lazy in the symbolic engine and the wrapped call walker. analyzeAndProjectJavaScriptArtifactFiles forwards each file's Electron call paths to the semantic projection, as the worker already does. A top-level globalThis[Symbol.for(key)] publication in another source of the artifact is linked when it is the only publication of a key a source reads; the worker receives candidate companion sources and parses them only when the key is read. Linked steps carry source_path, and IPC operations found there keep the local reaching call as location and the linked call as linked_operation. Guarded substituted IPC operations are reported with guard_alternatives; conjunctions differing only by one complementary predicate of the same activation merge, so operations reached on both branches are unconditional. Unique matches involving a guarded operation are counted as guarded_renderer_transmissions without a pairing edge. Handler bodies are traced after all registrations as event-loop dispatches with fair budget shares; promise fulfillment callbacks run under an explicit predicate. On Grok Bot this recovers all four dune-rpc edges: main 281/281, desktop-mount 10/10, sand-dev 10/10 and box-vnc 2/2 handlers plus probes, 278/281 renderer main-edge invokes (guarded by the main-edge-served gate) and 20 paired desktop-mount invokes; IPC paired 2 -> 24.
Codex Review SummaryThis 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. |
dandgabr
left a comment
There was a problem hiding this comment.
Review suggestion
- P2 — Bound global-symbol companion linking.
globalSymbolRegistryCompanions()compares every keyed source with every other source, thenJavaScriptAnalysisWorker.analyze()writes each matching companion’s full text again for every analyzed file. A crafted application with many files naming the sameSymbol.forkey causes quadratic comparisons and repeated disk I/O, potentially exhausting analysis time and temporary storage. Build a key-to-source index and cap total companion edges/bytes per artifact; report incomplete linking when that cap is reached.
|
@greptileai review |
|
`await` read a promise's fulfillment only when an async call recorded one. `Promise.resolve(x)` recorded no value, so `await Promise.resolve(false)` returned the promise object. A promise object is truthy, so an `if` that never runs was treated as taken and its IPC call was reported. `Promise.resolve` now records a literal argument as its fulfillment and returns a promise argument unchanged. `await` flattens nested promises to their final value. A promise whose fulfillment is unknown, and an object that has or may have a `then` member, now read as unknown instead of as a truthy object. The resolver owns this step, because the thenable check needs its member facts.
resolveElectronNativeAddon treated node-gyp-build like bindings: it searched the nearest package root of the calling file and ignored the loader's directory argument. For `node-gyp-build(path.join(__dirname, "plugin"))` it could resolve an unrelated add-on in the caller's build/Release tree and miss plugin/build/Release. The classifier now records the node-gyp-build directory when it is __dirname or a path built from it, relative to the source file's directory. Resolution searches that directory's build and prebuild trees (`resolution_basis: loader-directory`). A process-relative, dynamic or out-of-artifact directory stays unresolved (`loader-directory-unavailable`). bindings keeps its package-root search.
resolveElectronApiObjects flagged member writes only on the exposed
binding itself. With `const alias = api; alias.tools = {}` the exposed `api`
still listed `tools.copy` with no unknown member. The later bridge pass keeps
that object-binding finding, so the removed method was reported without any
warning.
The member-write flag now covers the binding's alias component from
javascriptBindingAliasComponents, the shared owner the symbolic resolver
already uses. A write through an alias now adds the same unknown member as a
direct write. Exact member lists are still not rebuilt from writes.
|
Changes pushed to this branch (fast-forward b4acf1e..e3570c2):
Checks run: |
| const key = JSON.stringify([ | ||
| finding.side, | ||
| finding.operation, | ||
| channel, | ||
| location, | ||
| descriptor.mode === "send" || descriptor.mode === "invoke" | ||
| ? null | ||
| : (invocationLocation ?? null), | ||
| finding.handler_kind, | ||
| finding.handler_location, | ||
| finding.linked_operation ?? null, |
There was a problem hiding this comment.
For function setup(names, ipc) { for (const name of names) ipc.on(`same`, () => electron.clipboard[name]()); } setup(["readText", "readHTML"], electron.ipcMain), both iterations have the same channel and source ranges, so this key merges them. The second iteration also skips handlerBodies.push, losing its captured name.
The report shows one handler and can call the channel match unique, although two listeners were registered. Preserve the loop activation in registration identity and trace each distinct handler closure.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/electronWrappedCallPaths.ts
Line: 448-458
Comment:
**Loop listeners collapse**
For ``function setup(names, ipc) { for (const name of names) ipc.on(`same`, () => electron.clipboard[name]()); } setup(["readText", "readHTML"], electron.ipcMain)``, both iterations have the same channel and source ranges, so this key merges them. The second iteration also skips `handlerBodies.push`, losing its captured `name`.
The report shows one handler and can call the channel match unique, although two listeners were registered. Preserve the loop activation in registration identity and trace each distinct handler closure.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| for (const statement of program.body) { | ||
| if (!t.isExpressionStatement(statement)) continue; | ||
| const expression = statement.expression; | ||
| if (!t.isAssignmentExpression(expression, { operator: "=" })) continue; | ||
| const key = globalSymbolRegistryKey(expression.left, state); | ||
| if (key === undefined) continue; | ||
| published.set(key, published.has(key) ? null : expression.right); |
There was a problem hiding this comment.
Replaced registry values stay linked
A companion containing globalThis[Symbol.for("api")] = first; 0, globalThis[Symbol.for("api")] = second; contributes only first. The second statement is a sequence, so this loop ignores it. Reads in another file then follow first as the unique publication and can report its Electron calls instead of second's.
Keep the narrow shape for selecting a publication, but reject the link when any other write or deletion can target the same slot.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptGlobalSymbolRegistry.ts
Line: 37-43
Comment:
**Replaced registry values stay linked**
A companion containing `globalThis[Symbol.for("api")] = first; 0, globalThis[Symbol.for("api")] = second;` contributes only `first`. The second statement is a sequence, so this loop ignores it. Reads in another file then follow `first` as the unique publication and can report its Electron calls instead of `second`'s.
Keep the narrow shape for selecting a publication, but reject the link when any other write or deletion can target the same slot.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| export const sourceDirectoryPath = (node: t.Node): string | undefined => | ||
| isDirectoryIdentity(node) | ||
| ? "." | ||
| : isFilesystemPathExpression(node) | ||
| ? staticPath(node) | ||
| : undefined; |
There was a problem hiding this comment.
Local directories resolve elsewhere
The new directory reader treats a local parameter named __dirname as the source directory. In function load(__dirname) { return require("node-gyp-build")(__dirname); } load("/opt/plugin"), it records "." and searches beside the calling source. If that directory has one add-on, the report marks that unrelated file as resolved.
Check which declared variable the argument refers to before treating it as the source directory. Otherwise leave the directory unresolved.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptStaticAnalysisHelpers.ts
Line: 190-195
Comment:
**Local directories resolve elsewhere**
The new directory reader treats a local parameter named `__dirname` as the source directory. In `function load(__dirname) { return require("node-gyp-build")(__dirname); } load("/opt/plugin")`, it records `"."` and searches beside the calling source. If that directory has one add-on, the report marks that unrelated file as resolved.
Check which declared variable the argument refers to before treating it as the source directory. Otherwise leave the directory unresolved.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if (callee.kind === "function") { | ||
| functionBody( | ||
| callee, | ||
| args, | ||
| callArguments(), |
There was a problem hiding this comment.
Unstarted generators invent IPC calls
This walk bypasses the generator check in #invoke and enters every function body directly. For function* gen(name) { electron.ipcRenderer.invoke("app:" + name); } gen("open"), it now reports an exact app:open operation even though the generator is never advanced. The new folding turns a previously unresolved channel into a pairing candidate.
Apply the generator check to body tracing too. Only trace a generator body when supported iteration actually reaches it.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/electronWrappedCallPaths.ts
Line: 654-657
Comment:
**Unstarted generators invent IPC calls**
This walk bypasses the generator check in `#invoke` and enters every function body directly. For `function* gen(name) { electron.ipcRenderer.invoke("app:" + name); } gen("open")`, it now reports an exact `app:open` operation even though the generator is never advanced. The new folding turns a previously unresolved channel into a pairing candidate.
Apply the generator check to body tracing too. Only trace a generator body when supported iteration actually reaches it.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| const dynamic = effective.some(({ sources }) => | ||
| sources.some((source) => source.includes(DYNAMIC_SOURCE)), | ||
| ); |
There was a problem hiding this comment.
Unknown policies raise definite warnings
For a declared header `${extra}; object-src 'none'`, the runtime placeholder becomes a directive name with no sources. This check only looks at sources, so it treats the policy as fully static and reports unrestricted scripts—even when extra supplies script-src 'none'.
Check names as well as sources, or use dynamic_parts, before judging missing directives. This avoids sending reviewers after a restriction that may already exist.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/contentSecurityPolicy.ts
Line: 118-120
Comment:
**Unknown policies raise definite warnings**
For a declared header `` `${extra}; object-src 'none'` ``, the runtime placeholder becomes a directive name with no sources. This check only looks at sources, so it treats the policy as fully static and reports unrestricted scripts—even when `extra` supplies `script-src 'none'`.
Check names as well as sources, or use `dynamic_parts`, before judging missing directives. This avoids sending reviewers after a restriction that may already exist.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| // keeps identical complete results identical across hosts. | ||
| graph_byte_budget: truncated ? budget.limit : null, | ||
| retained_graph_bytes: budget.used, | ||
| omitted_nodes: budget.omittedNodes, |
There was a problem hiding this comment.
Skipped sources understate missing nodes
When the module root cannot fit, projectFileSteps returns before counting the source's remaining nodes. This field then reports only the rejected root. A source offered zero remaining capacity can therefore show omitted_nodes: 1 regardless of its size.
Count the skipped nodes, or report the count as unknown instead of exact, so users inspecting coverage can judge how much work is missing.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/application/javascript/JavaScriptSemanticGraphConstruction.ts
Line: 307
Comment:
**Skipped sources understate missing nodes**
When the module root cannot fit, `projectFileSteps` returns before counting the source's remaining nodes. This field then reports only the rejected root. A source offered zero remaining capacity can therefore show `omitted_nodes: 1` regardless of its size.
Count the skipped nodes, or report the count as unknown instead of exact, so users inspecting coverage can judge how much work is missing.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| } | ||
| return { | ||
| status: "available", | ||
| evaluate: (node) => evaluateSemanticExpression(node, state), |
There was a problem hiding this comment.
Earlier calls get later values
The new constant reader uses later initializers for earlier reads. For ipcMain.handle("app:" + suffix, handler); var suffix = "open";, JavaScript registers app:undefined, but the report derives app:open. That can pair a renderer call with the wrong handler.
Check whether the initializer has run at the read point before using it as an exact value.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/javascriptSemanticAnalysis.ts
Line: 265
Comment:
**Earlier calls get later values**
The new constant reader uses later initializers for earlier reads. For `ipcMain.handle("app:" + suffix, handler); var suffix = "open";`, JavaScript registers `app:undefined`, but the report derives `app:open`. That can pair a renderer call with the wrong handler.
Check whether the initializer has run at the read point before using it as an exact value.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.| if (fulfilled !== null) | ||
| functionBody( | ||
| fn, | ||
| [symbolicUnknown("fulfillment value")], |
There was a problem hiding this comment.
Known promise channels disappear
The new .then walk discards known promise values. Inside an exposed method, Promise.resolve("open").then(name => ipcRenderer.invoke("app:" + name)) passes an unknown value to the callback even though the promise stores "open". The analyzer therefore misses app:open.
Pass the known final fulfillment to the callback, and keep it unknown only when that value cannot be established.
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/domain/javascript/electronWrappedCallPaths.ts
Line: 640
Comment:
**Known promise channels disappear**
The new `.then` walk discards known promise values. Inside an exposed method, `Promise.resolve("open").then(name => ipcRenderer.invoke("app:" + name))` passes an unknown value to the callback even though the promise stores `"open"`. The analyzer therefore misses `app:open`.
Pass the known final fulfillment to the callback, and keep it unknown only when that value cannot be established.
---
For each issue above, determine whether it is valid and should be fixed. If so, fix it directly.|
TL;DR: The new analysis works on Linux with Node 24 and 26. The PR's 36 test files pass, except one flaky failure in one Node 24 run, and a test app shows the new findings. One review bug from Greptile still reproduces on this head, and the head now conflicts with main. I tested head 84fe44e as pushed. GitHub says it conflicts with main 4692bb3 (#3801). Main has moved 327 commits since the PR's base aa6f74a (#2096), and 52 of the PR's 124 changed files were also changed on main. This head includes the commits of #2092. Results
One test failed in the first full run on head. It was javascriptSemanticBudgetCli, and a CLI call in it exited with code 1. The test passed alone and in a second full run. I did not find the cause. Test app, written from the PR body. It holds
On main, Open review bug, reproduced. Greptile's first finding on this head ("Earlier calls get later values") is real. With Not run
Thanks, Cole Leavitt, for the work and the quick fixes. Test setup
CommandsEach run sat under 🤖 Generated with Claude Code (Sonnet 5.5, verified by Opus 5.5) 🦊 |
|
@coleleavitt thanks for the PR — there are 8 open review threads here:
Could you address or reply to these? Once they're resolved and CI is green we can take another look. |
|
@coleleavitt also, this branch has merge conflicts with |
Depends on #2092 — this branch is based on it, so its first five commits are that PR's; review the commits listed below.
Branch:
pr/javascript-constant-folding-electron-ipcBase:
pr/javascript-semantic-budget(depends on it; see below). Merge that PR first.Commits (on top of
pr/javascript-semantic-budget):Problem
REA's static Electron model misses most of what a minified, wrapper-heavy Electron
app exposes. REA_REPORT.md §2 lists the gaps found by manual reading of Grok Bot 0.68.1
(REA 6.3.0), and they persist on current
origin/mainb3dec00:!0/!1options were reported asdynamic;channels and endpoints built with
+, templates,joinorString.fromCharCodestayed unresolved.
new t({…})wheretisBrowserWindowpassed to a wrapper(
main-app.cjs:369:807). The whole app RPC layer (dune-rpc:${edge}:m:${method})registers handlers through
ipcMainpassed as a parameter, with template channels.contextBridge.exposeInMainWorld("desktop", lp)withlpbound to an objectliteral reported
members: [].WebContentsView/BrowserView, nowill-attach-webviewhardening, no CSP.createRequire,bindingsornode-gyp-buildwerenot resolved.
reported; the endpoint model only saw call sites.
What changed
void,typeof,!,~, arithmetic, comparison, shift andbitwise operators over exact primitives, templates,
Array.prototype.joinandString.fromCharCodefold through one leaf-parameterized operator folder(
foldSemanticOperands) shared by static values and wrapper substitution. OnlyJSON-representable results become values. Folded values report
status: "derived"with the source expression; IPC pairing treats derived channels as exact
(
unique-exact-derived-channel). A file whose member-write recovery exceeds aresource limit keeps literal-only values and says so in
limitations.template text, folded expressions) are reported as
endpoint_kind: "data"withurl_class,hostandproperty_path. Host-only values must be lowercase DNS namesunder a two-letter IANA ccTLD or a common gTLD.
parameter key) resolves when every same-file call site passes the same proven
Electron export (
basis: "wrapper-parameter"); a local??/||/&&/conditional/object-literal binding resolves when its proving branches agree
(
basis: "local-alternatives"). Relationships that depend on an inferred identityare inferences with medium/low confidence.
(
api_status: "object-binding",conditional_membersfor known conditional spreads).BrowserView/WebContentsViewconstructions, andwill-attach-webviewwrites anddeletions on
webPreferences/paramsplus the last static preload path.module.createRequirefunctions,bindings,node-gyp-buildandprocess.dlopen, directly, through one alias, or through a parameter default.<meta http-equiv>, header properties/assignments,[...].joindirective lists and string/template literals, with per-directiveconcerns. Runtime parts stay
${…}and are not judged.callers through up to eight wrapper levels, iterates exact arrays in
for…of,links a unique
globalThis[Symbol.for(key)]publication in another source of theartifact, and reports operations reached only under unresolved predicates with
guard_alternatives(counted asguarded_renderer_transmissions, no pairing edge).compositeKey(no NUL-joined keys).Why it depends on
pr/javascript-semantic-budgetBoth change the worker protocol and schemas (
JavaScriptAnalysisWorker*.ts),JavaScriptArtifactAnalysis.tsand the semantic projection signature(
projectJavaScriptSemanticFileSteps(file, ir, graphByteBudget, nodeBudget, callPaths)).Splitting them would need a second, conflicting version of those files.
Breaking changes
None intended. Output additions only: new optional/added fields (
electron_identity,resolution_basis,guard_alternatives,linked_operation,url_class,host,property_path,web_contents_views,webview_attachments,content_security_policies, loader fields on native bindings) and summary counters.One behaviour change consumers may notice: values that were reported as
dynamic(for example
!0,"a" + "b") are nowderived, with the value and the sourceexpression.
Verification
On this branch (A + this PR), tree identical to the integration branch minus the
jsbeautify PR:
npm run check— pass.npm run test:changed -- --base origin/main— 109 files, 2005 passed, 3 skipped.npm run test:focusedon 60 javascript/electron boundary and acceptance files —453 tests passed.
npx tsc --noEmitpasses on every commit.app.asar, default heap (3:14 wall, 1.33 GB peak RSS,579/579 parsed).
summarycompared withorigin/mainb3dec00:main281/281,desktop-mount10/10,sand-dev10/10,box-vnc2/2, plus theprobes (REA 6.3.0 and origin/main: 0). 278/281 renderer main-edge invokes are
recovered as guarded (behind the
sand:main-edge-servedgate), 20 desktop-mountinvokes pair.
main-app.cjs:369:806,basis: wrapper-parameter),a dialog parent window found through local alternatives, and the avatar
WebContentsView(main-app.cjs:386:27105) are reported;will-attach-webviewis reported with its forced
nodeIntegration/contextIsolation/sandboxandpreload writes.
desktopbridge objectlpnow lists its members (381 members over 7bridge APIs, vs 95 on origin/main).
api.x.ai,api.x.com,mcp.money.x.com,connectors-gateway.grok.com,downloads.cursor.com,prod.authentication.cursor.sh,api2.cursor.sh,grok.com,cursor.com) are reported; origin/main and the budget PR alonereport 0 of them.
index.htmland panelpanel.htmlmetapolicies from §2.7 with their
img-src https:/connect-src ws:/style-src 'unsafe-inline'concerns.Limitations
reachability and guard outcomes are not proven; inferred identities are marked
as inferences.
for identity, eight for channel substitution.
String.fromCharCodeandArray.prototype.join.TLD can still match.
!0/!1fix is delivered by the constant lattice(
status: "derived", expression!0), not by a literal special case.