[PR #4400] [MERGED] feat(electron): resolve stable local constant window options #6213

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/4400
Author: @N0zoM1z0
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @N0zoM1z0

Base: main ← Head: feat/electron-static-window-options


📝 Commits (8)

  • 6200fe5 feat(electron): resolve stable local constant window options
  • 7546212 chore: integrate current main for constant window options
  • 4d8e915 fix(verification): recognize source ranges in retained fact scenarios
  • 77d43d1 test(electron): retain real Joplin correctness and cost comparisons
  • 3fd71cb fix(electron): preserve construction order for deferred window facts
  • 7bc925c test(electron): record source-order regression verification
  • 9207ece perf(javascript): short circuit source reference mutation checks
  • 73ac512 test(javascript): preserve mutation query scaling and real-app checks

📊 Changes

20 files changed (+4544 additions, -64 deletions)

View changed files

📝 docs/javascript-artifact-reconstruction.md (+11 -0)
➕ docs/verification/javascript-window-options-2026-10-16.json (+3691 -0)
➕ docs/verification/javascript-window-options-2026-10-16.md (+72 -0)
➕ experiments/analysis-efficiency/compare-javascript-semantic-content.mjs (+52 -0)
➕ experiments/analysis-efficiency/joplin-window-options-check.py (+106 -0)
➕ experiments/analysis-efficiency/window-option-scaling.mjs (+68 -0)
📝 scripts/verify/javascript/retained-facts.mjs (+8 -1)
📝 src/application/javascript/ElectronBoundaryGraphWindows.ts (+17 -2)
📝 src/domain/javascript/electronStaticAnalysisBrowser.ts (+94 -15)
📝 src/domain/javascript/electronStaticAnalysisOptions.test.ts (+122 -0)
📝 src/domain/javascript/electronStaticAnalysisTypes.ts (+2 -0)
➕ src/domain/javascript/electronStaticOptionObjects.ts (+65 -0)
📝 src/domain/javascript/javascriptSemanticAnalysis.ts (+62 -19)
📝 src/domain/javascript/javascriptSemanticAnalysisSteps.test.ts (+46 -0)
📝 src/domain/javascript/javascriptSemanticState.ts (+10 -0)
📝 src/domain/javascript/javascriptStaticAnalysis.ts (+2 -0)
📝 src/domain/javascript/javascriptStaticAnalysisCalls.ts (+4 -27)
📝 src/domain/javascript/javascriptStaticAnalysisState.ts (+2 -0)
📝 src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.ts (+1 -0)
➕ tests/acceptance/applications/javascriptWindowOptionsCli.test.ts (+109 -0)

📄 Description

Summary

new BrowserWindow(options) previously lost explicit preferences when options was a local constant. This resolves stable const options/preferences through the shared lexical and mutation owners, while keeping relevant writes, escapes, shadowing and ambiguous initialization unknown. Unrelated options.icon writes do not discard webPreferences.

Fixes #4366; part of #3536 and #4027. #3536 remains open for popup overrides and optional spreads.

Contract and boundaries

  • Existing CLI/MCP analysis and retained fact views share the implementation; no new tool or target authority. Existing private analyzer workers read inert source; application code never executes.
  • Preserve constructor identity, construction order across mixed inline/constant/unresolved forms, inline observed Evidence and explicit unknowns. Constant associations are inferred and retain original object source ranges. The strict worker schema accepts the additive optional provenance field.
  • Build the yielding shared mutation index only for plausible constant candidates; no persistent cache or arbitrary new limits.

Evidence and validation

Real official Joplin 3.7.21 ASAR: one unchanged window identity now reports five explicit preferences (four literal booleans and dynamic session). Both trial orders pass independent source oracles and exact complete CLI/MCP view Evidence parity. Complete semantic content is equal after excluding only the changed parent-graph commitment and its derived graph ID; raw digests remain recorded.

  • Current shared-query implementation: npm run check and npm run docs:check (5 consistency cases) passed; 107 focused cases across ten files passed. Seventeen current source pins and the 1647-JavaScript runtime tree verified after commit.

  • Shared owner exposes lexical identity and early-exit mutation checks without allocating full reports; complete effects remain available to the require-source consumer. A deterministic regression bounds repeated effect reads. The synthetic capacity control at 1024 constructors measured 4.413→0.200 median CPU seconds; first-run/V8 warm-up and raw samples are retained. This is not a real-app speedup claim.

  • Focused 9-file invocation: 156/157 passed. An unchanged upstream generator case hit its 30s limit; isolated runs at that same limit passed on main and candidate (18.590/18.034s). The original failure remains recorded; no deadline changed.

  • The pinned checker passes two original real trial pairs, both subsequent real-app validations and eight mutated-result controls. The complete CLI semantic-content comparison and checker replay passed. The ordering regression failed before the producer fix; fresh real Joplin runs after the ordering and shared-query fixes preserve the exact complete answer and semantic fingerprint (44.028/44.607s, same BPE). Original trial receipts remain unchanged. The stored-alias review example already returned unknown on the reviewed code; executed CLI evidence and its retained regression document the disagreement, with no mutation-rule change.

Reproducible record and limitations, compact data.

Projected structured-task BPE 13337→13432 (+95); identical selected catalog. No speedup claim: the reversed pair was 42.958s on main versus44.793s here. One CPU, 8GiB hard limit; all observed runs reported no OOM and verified payload cleanup. No Electron GUI, live-model billing or system-cold claim.

Author readiness

Human owner: @N0zoM1z0

The session authorized implementation, validation, ready PRs and merging, including waiving manual declarations. The agent reviewed the diff/evidence. A human final-diff review is not asserted; declarations remain unchecked.

  • I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work.
  • I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps.
  • I declare this PR ready for initial maintainer review.

Before merge

  • Scope, shared ownership, caller choices, Evidence and local validation reviewed by the agent.
  • Current-main integration and reproducible real-application checks recorded without discarding negative results.
  • Current-head CI and automated reviews completed; attributable findings addressed.

Final head 73ac512f9ae633e3a65849ec7a862ad3c151fa7f: all 39 checks passed; core CI completed with all 36 jobs successful. Codex and Greptile reviewed this head with no outstanding findings; all three review threads are resolved.


🔄 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/4400 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `feat/electron-static-window-options` --- ### 📝 Commits (8) - [`6200fe5`](https://github.com/morluto/rea/commit/6200fe5a5c5e219da32ab0d94a33fdde8246bb75) feat(electron): resolve stable local constant window options - [`7546212`](https://github.com/morluto/rea/commit/7546212020d1ee3e546bba0c1c266374f53d7369) chore: integrate current main for constant window options - [`4d8e915`](https://github.com/morluto/rea/commit/4d8e915f6923a44abe74e85072928d9a940d1ba3) fix(verification): recognize source ranges in retained fact scenarios - [`77d43d1`](https://github.com/morluto/rea/commit/77d43d1f2fa686da45b226f49a0ebc93e0f42287) test(electron): retain real Joplin correctness and cost comparisons - [`3fd71cb`](https://github.com/morluto/rea/commit/3fd71cba256f0b5d0902e17a66f458bacd3fa985) fix(electron): preserve construction order for deferred window facts - [`7bc925c`](https://github.com/morluto/rea/commit/7bc925c7ada8ca00a8541f76a895c86922cc641a) test(electron): record source-order regression verification - [`9207ece`](https://github.com/morluto/rea/commit/9207ece2090208c272d2689c4002438ceda41145) perf(javascript): short circuit source reference mutation checks - [`73ac512`](https://github.com/morluto/rea/commit/73ac512f9ae633e3a65849ec7a862ad3c151fa7f) test(javascript): preserve mutation query scaling and real-app checks ### 📊 Changes **20 files changed** (+4544 additions, -64 deletions) <details> <summary>View changed files</summary> 📝 `docs/javascript-artifact-reconstruction.md` (+11 -0) ➕ `docs/verification/javascript-window-options-2026-10-16.json` (+3691 -0) ➕ `docs/verification/javascript-window-options-2026-10-16.md` (+72 -0) ➕ `experiments/analysis-efficiency/compare-javascript-semantic-content.mjs` (+52 -0) ➕ `experiments/analysis-efficiency/joplin-window-options-check.py` (+106 -0) ➕ `experiments/analysis-efficiency/window-option-scaling.mjs` (+68 -0) 📝 `scripts/verify/javascript/retained-facts.mjs` (+8 -1) 📝 `src/application/javascript/ElectronBoundaryGraphWindows.ts` (+17 -2) 📝 `src/domain/javascript/electronStaticAnalysisBrowser.ts` (+94 -15) 📝 `src/domain/javascript/electronStaticAnalysisOptions.test.ts` (+122 -0) 📝 `src/domain/javascript/electronStaticAnalysisTypes.ts` (+2 -0) ➕ `src/domain/javascript/electronStaticOptionObjects.ts` (+65 -0) 📝 `src/domain/javascript/javascriptSemanticAnalysis.ts` (+62 -19) 📝 `src/domain/javascript/javascriptSemanticAnalysisSteps.test.ts` (+46 -0) 📝 `src/domain/javascript/javascriptSemanticState.ts` (+10 -0) 📝 `src/domain/javascript/javascriptStaticAnalysis.ts` (+2 -0) 📝 `src/domain/javascript/javascriptStaticAnalysisCalls.ts` (+4 -27) 📝 `src/domain/javascript/javascriptStaticAnalysisState.ts` (+2 -0) 📝 `src/javascript/analysis/JavaScriptAnalysisWorkerSchemas.ts` (+1 -0) ➕ `tests/acceptance/applications/javascriptWindowOptionsCli.test.ts` (+109 -0) </details> ### 📄 Description ## Summary `new BrowserWindow(options)` previously lost explicit preferences when `options` was a local constant. This resolves stable const options/preferences through the shared lexical and mutation owners, while keeping relevant writes, escapes, shadowing and ambiguous initialization unknown. Unrelated `options.icon` writes do not discard `webPreferences`. Fixes #4366; part of #3536 and #4027. #3536 remains open for popup overrides and optional spreads. ## Contract and boundaries - Existing CLI/MCP analysis and retained fact views share the implementation; no new tool or target authority. Existing private analyzer workers read inert source; application code never executes. - Preserve constructor identity, construction order across mixed inline/constant/unresolved forms, inline observed Evidence and explicit unknowns. Constant associations are inferred and retain original object source ranges. The strict worker schema accepts the additive optional provenance field. - Build the yielding shared mutation index only for plausible constant candidates; no persistent cache or arbitrary new limits. ## Evidence and validation Real official Joplin 3.7.21 ASAR: one unchanged window identity now reports five explicit preferences (four literal booleans and dynamic `session`). Both trial orders pass independent source oracles and exact complete CLI/MCP view Evidence parity. Complete semantic content is equal after excluding only the changed parent-graph commitment and its derived graph ID; raw digests remain recorded. - Current shared-query implementation: `npm run check` and `npm run docs:check` (5 consistency cases) passed; 107 focused cases across ten files passed. Seventeen current source pins and the 1647-JavaScript runtime tree verified after commit. - Shared owner exposes lexical identity and early-exit mutation checks without allocating full reports; complete effects remain available to the require-source consumer. A deterministic regression bounds repeated effect reads. The synthetic capacity control at 1024 constructors measured 4.413→0.200 median CPU seconds; first-run/V8 warm-up and raw samples are retained. This is not a real-app speedup claim. - Focused 9-file invocation: 156/157 passed. An unchanged upstream generator case hit its 30s limit; isolated runs at that same limit passed on main and candidate (18.590/18.034s). The original failure remains recorded; no deadline changed. - The pinned checker passes two original real trial pairs, both subsequent real-app validations and eight mutated-result controls. The complete CLI semantic-content comparison and checker replay passed. The ordering regression failed before the producer fix; fresh real Joplin runs after the ordering and shared-query fixes preserve the exact complete answer and semantic fingerprint (44.028/44.607s, same BPE). Original trial receipts remain unchanged. The stored-alias review example already returned unknown on the reviewed code; executed CLI evidence and its retained regression document the disagreement, with no mutation-rule change. [Reproducible record and limitations](https://github.com/morluto/rea/blob/73ac512f9ae633e3a65849ec7a862ad3c151fa7f/docs/verification/javascript-window-options-2026-10-16.md), [compact data](https://github.com/morluto/rea/blob/73ac512f9ae633e3a65849ec7a862ad3c151fa7f/docs/verification/javascript-window-options-2026-10-16.json). Projected structured-task BPE 13337→13432 (+95); identical selected catalog. No speedup claim: the reversed pair was 42.958s on main versus44.793s here. One CPU, 8GiB hard limit; all observed runs reported no OOM and verified payload cleanup. No Electron GUI, live-model billing or system-cold claim. ## Author readiness Human owner: @N0zoM1z0 The session authorized implementation, validation, ready PRs and merging, including waiving manual declarations. The agent reviewed the diff/evidence. A human final-diff review is not asserted; declarations remain unchecked. - [ ] I reviewed the final diff and relevant existing code, understand the change and its edge cases, and take responsibility for the complete PR, including AI-assisted work. - [ ] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [ ] I declare this PR ready for initial maintainer review. ## Before merge - [x] Scope, shared ownership, caller choices, Evidence and local validation reviewed by the agent. - [x] Current-main integration and reproducible real-application checks recorded without discarding negative results. - [x] Current-head CI and automated reviews completed; attributable findings addressed. Final head `73ac512f9ae633e3a65849ec7a862ad3c151fa7f`: all 39 checks passed; [core CI](https://github.com/morluto/rea/actions/runs/38862314932) completed with all 36 jobs successful. Codex and Greptile reviewed this head with no outstanding findings; all three review threads are resolved. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:12:44 +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#6213
No description provided.