[PR #3105] [CLOSED] fix(electron): retain computed literal web preferences #5620

Closed
opened 2026-10-31 01:08:02 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3105
Author: @ShuaixinHuang
Created: 10/14/2026
Status: ❌ Closed

Base: main ← Head: codex/fix-computed-electron-preferences


📝 Commits (1)

  • 0c01643 fix(electron): retain computed literal web preferences

📊 Changes

4 files changed (+116 additions, -6 deletions)

View changed files

📝 src/domain/javascript/electronStaticAnalysisBrowser.ts (+3 -3)
📝 src/domain/javascript/electronStaticAnalysisOptions.test.ts (+79 -0)
📝 src/domain/javascript/electronStaticAnalysisValues.ts (+2 -3)
📝 tests/boundary/filesystem/javascript-applications/electronOptionKeys.test.ts (+32 -0)

📄 Description

Summary

Retain exact computed literal Electron webPreference keys and values instead of inventing dynamic names and downgrading static coverage. Fixes #2521.

Problem and expected behavior

For new BrowserWindow({ webPreferences: { ["sandbox"]: true, ["preload"]: "./preload.js" } }), the key parser already knows both names, but the preference collector rejects every computed property. It reports [dynamic@...] names, dynamic null values and partial parse status while separately recovering the exact preload path.

Computed string/numeric literal syntax should preserve the supplied name and literal value. The source should remain complete when all relevant observations are exact. An actually unresolved key or value must remain unknown.

Change and scope

Use the existing semanticStaticPropertyKey contract in both preference projection and effective option lookup. null denotes an unresolved key; the legal empty-string key remains exact. Remove the empty-string sentinel and its syntax-specific repair from option lookup. Keep override order, uncertainty from spreads/dynamic keys, source expressions and preload resolution.

This is a routine inert-source analysis fix within existing contribution scope. No Electron application is launched, no new provider or target authority is introduced, and an advance scope decision is not applicable. Baseline: b3c5672ce67564e9b7c7baa6ce21f1674e27b287.

Contract and boundary impact

  • Owner: Electron AST preference collection and its shared effective-property lookup.
  • CLI/MCP input/output shapes and generated schemas: unchanged. Named literal preference observations and coverage are corrected.
  • Evidence/provenance: retain source values and locations; an unresolved later key still prevents a definite effective preload.
  • Dependencies, packaging, installation and release metadata: unchanged.
  • Execution/authority: existing static-analysis workflows only; target source is read as data.

Evidence and regression coverage

Two new source restoration assertions failed on unchanged production code: exact computed preferences returned partial, and a known computed preload was projected as dynamic. With the correction they pass. Additional coverage retains wrapped empty keys without falsely overriding preload, numeric keys, and true dynamic-key uncertainty.

The existing reconstructed-application graph suite adds a computed-preference fixture and assertions for exact named values, source Evidence coverage and preload association. These downstream assertions are authored but have not been successfully executed on this host; see limits below.

Validation performed

Native Windows x64, pinned Node 24.18.0 / npm 11.16.0.

  • Seven selected source suites: 354 passed, 1 failed (355 total). electronStaticAnalysisOptions.test.ts passed all 12 cases. The remaining failure is electronWrappedCallPaths.test.ts / retains the original expression for a dynamic isolated world id, which expects resolution_basis: "wrapper-substitution" on an existing finding. Restoring both touched production files to pristine baseline reproduces that same failure; files were restored byte-for-byte afterward. This PR does not fix that unrelated assertion.
  • npm run check: all six tasks and architecture guards passed, including typecheck, lint/module boundaries, format, Knip and metadata. Existing lint warnings remain; zero errors.
  • git diff --check: passed.
  • Runtime/skill preparation for the selected boundary suites: passed.
  • electronOptionKeys.test.ts and electronApplicationAnalysis.test.ts: 22 failed, 2 passed before meaningful graph assertions, due to unavailable Windows native runtime authority. Initial checkout lacks native/windows/build/manifest.json. The verified native artifact from published rea-agents@6.4.0 (SHA-256 c4fd9f377e567bcf15ba3fec3e0b0ed965d82b765a2adcdac49e46f14524b6d5) also fails the current privateBridgeDescriptorAccess inspection contract. No authority check was weakened or mocked to turn these runs green; the downloaded build-path copies were removed. The initial sandboxed attempt failed earlier during temporary-module loading; the native-authority failures above were observed outside the sandbox.

Compatibility, safety, and remaining gaps

No breaking changes or migrations. No runtime Electron, Linux/macOS, complete CLI/MCP reconstruction, or full-suite pass is claimed. A compatible source-built Windows addon or an existing Linux/macOS CI lane is needed to execute the downstream graph assertions. No performance improvement is claimed.

Before merge

  • Concrete issue linked and source regression reproduced.
  • Owning key semantics reused without new wrappers or dependencies.
  • Exact/empty/numeric keys and genuine uncertainty covered.
  • Static checks pass and unavailable coverage is explicit.
  • Downstream application graph tests pass on a compatible host; current-head CI completes.

🔄 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/3105 **Author:** [@ShuaixinHuang](https://github.com/ShuaixinHuang) **Created:** 10/14/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `codex/fix-computed-electron-preferences` --- ### 📝 Commits (1) - [`0c01643`](https://github.com/morluto/rea/commit/0c016431f2926a45ea06b8eb0f400b33102d5568) fix(electron): retain computed literal web preferences ### 📊 Changes **4 files changed** (+116 additions, -6 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/electronStaticAnalysisBrowser.ts` (+3 -3) 📝 `src/domain/javascript/electronStaticAnalysisOptions.test.ts` (+79 -0) 📝 `src/domain/javascript/electronStaticAnalysisValues.ts` (+2 -3) 📝 `tests/boundary/filesystem/javascript-applications/electronOptionKeys.test.ts` (+32 -0) </details> ### 📄 Description ## Summary Retain exact computed literal Electron webPreference keys and values instead of inventing dynamic names and downgrading static coverage. Fixes #2521. ## Problem and expected behavior For `new BrowserWindow({ webPreferences: { ["sandbox"]: true, ["preload"]: "./preload.js" } })`, the key parser already knows both names, but the preference collector rejects every computed property. It reports `[dynamic@...]` names, dynamic null values and partial parse status while separately recovering the exact preload path. Computed string/numeric literal syntax should preserve the supplied name and literal value. The source should remain complete when all relevant observations are exact. An actually unresolved key or value must remain unknown. ## Change and scope Use the existing `semanticStaticPropertyKey` contract in both preference projection and effective option lookup. `null` denotes an unresolved key; the legal empty-string key remains exact. Remove the empty-string sentinel and its syntax-specific repair from option lookup. Keep override order, uncertainty from spreads/dynamic keys, source expressions and preload resolution. This is a routine inert-source analysis fix within existing contribution scope. No Electron application is launched, no new provider or target authority is introduced, and an advance scope decision is not applicable. Baseline: `b3c5672ce67564e9b7c7baa6ce21f1674e27b287`. ## Contract and boundary impact - Owner: Electron AST preference collection and its shared effective-property lookup. - CLI/MCP input/output shapes and generated schemas: unchanged. Named literal preference observations and coverage are corrected. - Evidence/provenance: retain source values and locations; an unresolved later key still prevents a definite effective preload. - Dependencies, packaging, installation and release metadata: unchanged. - Execution/authority: existing static-analysis workflows only; target source is read as data. ## Evidence and regression coverage Two new source restoration assertions failed on unchanged production code: exact computed preferences returned `partial`, and a known computed preload was projected as dynamic. With the correction they pass. Additional coverage retains wrapped empty keys without falsely overriding preload, numeric keys, and true dynamic-key uncertainty. The existing reconstructed-application graph suite adds a computed-preference fixture and assertions for exact named values, source Evidence coverage and preload association. These downstream assertions are authored but have not been successfully executed on this host; see limits below. ## Validation performed Native Windows x64, pinned Node 24.18.0 / npm 11.16.0. - Seven selected source suites: **354 passed, 1 failed** (355 total). `electronStaticAnalysisOptions.test.ts` passed all 12 cases. The remaining failure is `electronWrappedCallPaths.test.ts` / `retains the original expression for a dynamic isolated world id`, which expects `resolution_basis: "wrapper-substitution"` on an existing finding. Restoring both touched production files to pristine baseline reproduces that same failure; files were restored byte-for-byte afterward. This PR does not fix that unrelated assertion. - `npm run check`: **all six tasks and architecture guards passed**, including typecheck, lint/module boundaries, format, Knip and metadata. Existing lint warnings remain; zero errors. - `git diff --check`: passed. - Runtime/skill preparation for the selected boundary suites: passed. - `electronOptionKeys.test.ts` and `electronApplicationAnalysis.test.ts`: **22 failed, 2 passed** before meaningful graph assertions, due to unavailable Windows native runtime authority. Initial checkout lacks `native/windows/build/manifest.json`. The verified native artifact from published `rea-agents@6.4.0` (SHA-256 `c4fd9f377e567bcf15ba3fec3e0b0ed965d82b765a2adcdac49e46f14524b6d5`) also fails the current `privateBridgeDescriptorAccess` inspection contract. No authority check was weakened or mocked to turn these runs green; the downloaded build-path copies were removed. The initial sandboxed attempt failed earlier during temporary-module loading; the native-authority failures above were observed outside the sandbox. ## Compatibility, safety, and remaining gaps No breaking changes or migrations. No runtime Electron, Linux/macOS, complete CLI/MCP reconstruction, or full-suite pass is claimed. A compatible source-built Windows addon or an existing Linux/macOS CI lane is needed to execute the downstream graph assertions. No performance improvement is claimed. ## Before merge - [x] Concrete issue linked and source regression reproduced. - [x] Owning key semantics reused without new wrappers or dependencies. - [x] Exact/empty/numeric keys and genuine uncertainty covered. - [x] Static checks pass and unavailable coverage is explicit. - [ ] Downstream application graph tests pass on a compatible host; current-head CI completes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:08:02 +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#5620
No description provided.