[PR #1286] [MERGED] fix(electron): resolve effective preload after option overrides #2767

Closed
opened 2026-10-17 21:10:00 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/1286
Author: @Y0UW1SH
Created: 10/9/2026
Status: ✅ Merged
Merged: 10/9/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: fix/electron-effective-preload


📝 Commits (1)

  • 9d7a230 fix(electron): resolve effective preload after option overrides

📊 Changes

2 files changed (+188 additions, -9 deletions)

View changed files

📝 src/domain/javascript/electronStaticAnalysisBrowser.ts (+14 -9)
➕ tests/acceptance/applications/electronPreloadOverridesCli.test.ts (+174 -0)

📄 Description

Summary

Fixes #1237.

BrowserWindow preload associations now follow JavaScript property order. A later unresolved duplicate, spread, or computed key leaves the effective preload unknown instead of linking the window to an overwritten file. A final explicit static preload still resolves.

Problem and expected behavior

For { preload: "./first.js", preload: runtimePath }, the previous analysis returned preload_path: "./first.js" and a resolved window-to-preload edge. The effective path must be unknown while both property observations remain available.

Change and scope

Resolve the effective preload through the existing objectProperty lookup, separately from collecting preference syntax. This also handles replacing accessors, methods, non-path values, and exact computed literal keys.

Contract and boundary impact

  • Semantic owner and earliest changed stage: static Electron webPreferences extraction in the JavaScript domain.
  • CLI and MCP/tool-catalog contract: existing schemas and tool names are unchanged; both surfaces receive the corrected result.
  • Provider, bridge, target-format, or platform compatibility: inert JavaScript source analysis; no provider or bridge changes.
  • Evidence, artifact, provenance, or reconstruction contract: an unresolved effective preload returns null path/context and emits no BrowserWindow-specific preload association. Observed properties, dynamic expressions, source ranges, and independent generic candidates remain available.
  • Process execution, authorization, cleanup, or containment impact: none.
  • Generated metadata, package, or installation impact: none.

Evidence and regression coverage

  • Added acceptance coverage through the compiled public CLI and a real stdio MCP session.
  • Twelve source cases cover later dynamic duplicates, spreads, computed keys, accessors, methods, non-path replacements, reversed ordering, final literal duplicates, exact computed literal preloads, and unrelated keys.
  • The regressions failed against upstream 0c6852b392b34319a6fd2c6dffcac10cee51ab94 with stale paths and resolved edges, then passed after the fix.
  • Original literal observations, exact later dynamic expressions, and construction source ranges are asserted.
  • Corrected output for the reported duplicate:
{"preload_path":null,"preload_resolution_context":null}

The window has no edge with extractor operation associate-browser-window-preload.

  • Remaining proof gaps: the complete deterministic suite, coverage thresholds, and platform/provider workflows were not run.

For evidence-bearing changes:

  • Observed, derived, and inferred claims remain distinguishable.
  • Artifact identity and source provenance remain preserved.
  • Uncertain outcomes remain visible.

Validation performed

  • npm run test:changed: 460 tests passed across 26 affected source test files.
  • npm run test:focused -- tests/acceptance/applications/electronPreloadOverridesCli.test.ts src/domain/javascript/electronStaticAnalysisOptions.test.ts tests/composition/javascript-applications/electronOptionKeys.test.ts: 16 tests passed.
  • npm run test:focused -- tests/acceptance/applications/electronPreloadOverridesCli.test.ts tests/composition/javascript-applications/electronApplicationAnalysis.test.ts tests/boundary/cli/electronCli.test.ts: 12 tests passed, including the final exact-expression assertions.
  • npm run check: passed type checking, lint/module boundaries, formatting, dead-code analysis, and package metadata checks. Lint reported warnings and zero errors.
  • npm run verify:test-discovery: all 678 test files were discovered exactly once.
  • git diff --check: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: public CLI and real stdio MCP exercised static source analysis. Real Hopper/Ghidra and Electron runtime verification were not run.
  • Package or release metadata impact: none.
  • Security, privacy, process, or containment review: the analyzed fixtures are not executed; no authority or process lifecycle changes.

Review checklist

  • This PR addresses a concrete problem.
  • The PR has one focused outcome and a Conventional Commit title.
  • The related issue is linked.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Existing docs and contracts remain consistent with the corrected behavior; generated metadata is unchanged.
  • User-visible CLI/MCP changes include representative output.
  • The final diff was checked for secrets, unrelated changes, and unsupported claims.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/1286 **Author:** [@Y0UW1SH](https://github.com/Y0UW1SH) **Created:** 10/9/2026 **Status:** ✅ Merged **Merged:** 10/9/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `fix/electron-effective-preload` --- ### 📝 Commits (1) - [`9d7a230`](https://github.com/morluto/rea/commit/9d7a230aa515aae46d84308a986d746bba595019) fix(electron): resolve effective preload after option overrides ### 📊 Changes **2 files changed** (+188 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/electronStaticAnalysisBrowser.ts` (+14 -9) ➕ `tests/acceptance/applications/electronPreloadOverridesCli.test.ts` (+174 -0) </details> ### 📄 Description ## Summary Fixes #1237. BrowserWindow preload associations now follow JavaScript property order. A later unresolved duplicate, spread, or computed key leaves the effective preload unknown instead of linking the window to an overwritten file. A final explicit static preload still resolves. ## Problem and expected behavior For `{ preload: "./first.js", preload: runtimePath }`, the previous analysis returned `preload_path: "./first.js"` and a resolved window-to-preload edge. The effective path must be unknown while both property observations remain available. ## Change and scope Resolve the effective preload through the existing `objectProperty` lookup, separately from collecting preference syntax. This also handles replacing accessors, methods, non-path values, and exact computed literal keys. ## Contract and boundary impact - Semantic owner and earliest changed stage: static Electron `webPreferences` extraction in the JavaScript domain. - CLI and MCP/tool-catalog contract: existing schemas and tool names are unchanged; both surfaces receive the corrected result. - Provider, bridge, target-format, or platform compatibility: inert JavaScript source analysis; no provider or bridge changes. - Evidence, artifact, provenance, or reconstruction contract: an unresolved effective preload returns null path/context and emits no BrowserWindow-specific preload association. Observed properties, dynamic expressions, source ranges, and independent generic candidates remain available. - Process execution, authorization, cleanup, or containment impact: none. - Generated metadata, package, or installation impact: none. ## Evidence and regression coverage - Added acceptance coverage through the compiled public CLI and a real stdio MCP session. - Twelve source cases cover later dynamic duplicates, spreads, computed keys, accessors, methods, non-path replacements, reversed ordering, final literal duplicates, exact computed literal preloads, and unrelated keys. - The regressions failed against upstream `0c6852b392b34319a6fd2c6dffcac10cee51ab94` with stale paths and resolved edges, then passed after the fix. - Original literal observations, exact later dynamic expressions, and construction source ranges are asserted. - Corrected output for the reported duplicate: ```json {"preload_path":null,"preload_resolution_context":null} ``` The window has no edge with extractor operation `associate-browser-window-preload`. - Remaining proof gaps: the complete deterministic suite, coverage thresholds, and platform/provider workflows were not run. For evidence-bearing changes: - [x] Observed, derived, and inferred claims remain distinguishable. - [x] Artifact identity and source provenance remain preserved. - [x] Uncertain outcomes remain visible. ## Validation performed - `npm run test:changed`: 460 tests passed across 26 affected source test files. - `npm run test:focused -- tests/acceptance/applications/electronPreloadOverridesCli.test.ts src/domain/javascript/electronStaticAnalysisOptions.test.ts tests/composition/javascript-applications/electronOptionKeys.test.ts`: 16 tests passed. - `npm run test:focused -- tests/acceptance/applications/electronPreloadOverridesCli.test.ts tests/composition/javascript-applications/electronApplicationAnalysis.test.ts tests/boundary/cli/electronCli.test.ts`: 12 tests passed, including the final exact-expression assertions. - `npm run check`: passed type checking, lint/module boundaries, formatting, dead-code analysis, and package metadata checks. Lint reported warnings and zero errors. - `npm run verify:test-discovery`: all 678 test files were discovered exactly once. - `git diff --check`: passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: public CLI and real stdio MCP exercised static source analysis. Real Hopper/Ghidra and Electron runtime verification were not run. - Package or release metadata impact: none. - Security, privacy, process, or containment review: the analyzed fixtures are not executed; no authority or process lifecycle changes. ## Review checklist - [x] This PR addresses a concrete problem. - [x] The PR has one focused outcome and a Conventional Commit title. - [x] The related issue is linked. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Existing docs and contracts remain consistent with the corrected behavior; generated metadata is unchanged. - [x] User-visible CLI/MCP changes include representative output. - [x] The final diff was checked for secrets, unrelated changes, and unsupported claims. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-17 21:10:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#2767
No description provided.