[PR #4389] [MERGED] fix(electron): preserve native IPC listener behavior #6212

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/4389
Author: @Adolanium
Created: 10/16/2026
Status: ✅ Merged
Merged: 10/16/2026
Merged by: @N0zoM1z0

Base: main ← Head: fix/electron-ipc-listener-removal


📝 Commits (10+)

  • 34ae0b2 fix(electron): remove observed ipcMain listeners by their original function
  • 6c60be9 fix(electron): resolve ipcMain removal from the emitter's listener list
  • 5a77acf fix(browser): preserve cleanup failure diagnostics
  • d72d856 feat(electron): resolve stable local constant window options
  • 3e32487 fix(electron): mirror EventEmitter wrapper identity for observed ipcMain listeners
  • e8a7d6d fix(electron): report originals from ipcMain removeAllListeners and resolve once hooks at call time
  • efd4529 fix(electron): mirror native ipcMain removeAllListeners and once under wrapping decorators
  • 781d575 fix(pwntools): preserve worker ownership across launcher exec
  • b25d351 fix(browser): report cancellation after cleanup and source-map abort (#2893)
  • c884864 fix(filesystem): observe cancellation after file finalization

📊 Changes

70 files changed (+24131 additions, -729 deletions)

View changed files

📝 docs/electron-observation.md (+47 -2)
📝 docs/javascript-artifact-reconstruction.md (+11 -0)
➕ docs/verification/electron-cancellation-2026-10-16.json (+2895 -0)
➕ docs/verification/electron-cancellation-2026-10-16.md (+158 -0)
➕ docs/verification/electron-ipc-listeners-2026-10-16.json (+10377 -0)
➕ docs/verification/electron-ipc-listeners-2026-10-16.md (+592 -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/drawio-electron-lifecycle-oracles.py (+115 -0)
➕ experiments/analysis-efficiency/drawio-electron-lifecycle.mjs (+191 -0)
➕ experiments/analysis-efficiency/electron-cancellation-oracles.py (+154 -0)
➕ experiments/analysis-efficiency/electron-cancellation.mjs (+273 -0)
➕ experiments/analysis-efficiency/joplin-cli-cancellation.py (+123 -0)
➕ experiments/analysis-efficiency/joplin-window-options-check.py (+106 -0)
➕ experiments/analysis-efficiency/window-option-scaling.mjs (+68 -0)
📝 scripts/ci/scopes.mjs (+1 -0)
📝 scripts/electron-active-hook.cjs (+297 -48)
📝 scripts/verify/javascript/retained-facts.mjs (+8 -1)
📝 src/adb/AdbProvider.ts (+31 -20)

...and 50 more files

📄 Description

Summary

Fixes #4390. Original-function IPC removal works and once is recorded once, preserving native traversal, callback dispatch and argument semantics within the documented metadata scope.

Change and scope

A weak registry owns wrapper identity; Node owns removeAllListeners traversal through a private forwarding receiver. App decorators receive the real emitter and appropriate original callback. Private property/collection operations and constructors are captured before startup; snapshots avoid target iterators and Array species. One initialization-only binder removes repeated binding construction without per-call helper argument arrays.

Metadata recognition has owned/unowned/unknown outcomes. Bound exhaustion, accessor links and Proxies retain native registration without an additional wrapper, with a bounded listener-chain gap after success. The gap does not prove IPC delivery. Shared descriptor parsing completes bounded prototype lookup before proving a link absent, preserving inherited data, getter/Proxy uncertainty and known undefined reads from setter-only properties during recognition/removal. Opaque custom apply likewise preserves the exact list and borrowed receiver while recording a custom-apply gap rather than invented callback facts. Shared projection and canonical CLI/MCP output retain channel, uncertainty and dropped-gap coverage. No new tool, cache or capture authority is added.

Validation

  • Hook/projection/actions/MCP: 102 passed (73 + 5 + 16 + 8). Five inherited-link native controls fail before correction (68 passed / 5 failed), covering data/getter/Proxy prototypes and prototype depths 16/17; earlier failed controls remain recorded. Both gap boundaries reach an actual SDK client and validate against the converted advertised output schema.
  • The canonical schema and verifier/five controlled exit-summary oracle sources reuse earlier passing checks by verified hashes. Projection/client are included in the fresh 102 cases. Earlier fixture-only lint failure and the 13-case rerun remain recorded without relaxed rules.
  • npm run check:fast: two uncached tasks pass; 90.797 s wall / 90.096799 family CPU s / 4,335,267,840 peak cgroup bytes, no OOM. npm run docs:check: six tasks and five README consistency cases pass.
  • Real unchanged draw.io Desktop 32.4.1 ASAR/resources on explicit generic Electron 44.7.0: actual dialog recovery/insertion completes, SVG 0→2, unsaved indicator true, seven IPC events. Final pipeline 11.264 s wall / 6.376574 family CPU s / 557,068,288 peak cgroup bytes, verified at payload exit while the observer lives. These are not final whole-scope counters or provider cleanup proof; earlier unverified observations retain their caveats. Historical source-pinned ABBA and no-insertion controls remain recorded.

Every real capture still fails overall provider cleanup. #4282/#2974/#4494 remain cleanup/startup gaps; #4513 raw-wrapper metadata mutation remains unfixed. Vendor Inspector fuses are inspected, not modified. No packaged-runtime compatibility, real MCP-wire provider success or real-app exercise of synthetic metadata cases is claimed.

Runs are serial, one CPU, 8 GiB hard / 6 GiB early stop. Counters are at payload exit while the observer lives, not final whole-scope; memory includes file cache. OS caches are uncontrolled. No completed-task speedup or token/context saving is claimed. Regenerable app packages/profiles are excluded from Git.

Previous-head CI run 38955237255 tests confirmed ae2c + main 8116dc06: all 36 jobs pass. Earlier independently reproduced firmware failures remain documented, without a cause/fix claim or firmware changes here. Fresh-head CI/review remain required.

Exact sources, scripts, failed controls, hashes, coverage and resource receipts.

Author readiness

Human owner: @Adolanium

  • 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

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, 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/4389 **Author:** [@Adolanium](https://github.com/Adolanium) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Base:** `main` ← **Head:** `fix/electron-ipc-listener-removal` --- ### 📝 Commits (10+) - [`34ae0b2`](https://github.com/morluto/rea/commit/34ae0b2c91866d9676a07f9d61d7dcbd1ec941ff) fix(electron): remove observed ipcMain listeners by their original function - [`6c60be9`](https://github.com/morluto/rea/commit/6c60be9085f9de6a8ca13d093240a0b9ea28a5e4) fix(electron): resolve ipcMain removal from the emitter's listener list - [`5a77acf`](https://github.com/morluto/rea/commit/5a77acfbcdb84f217f7433dd403fb206cee82aca) fix(browser): preserve cleanup failure diagnostics - [`d72d856`](https://github.com/morluto/rea/commit/d72d856f58d4747c5eb4307426e80d20934e017c) feat(electron): resolve stable local constant window options - [`3e32487`](https://github.com/morluto/rea/commit/3e324870147a06f0af8893165beca2b312ea3047) fix(electron): mirror EventEmitter wrapper identity for observed ipcMain listeners - [`e8a7d6d`](https://github.com/morluto/rea/commit/e8a7d6dac4a8b712540bba78848932dee91e6f79) fix(electron): report originals from ipcMain removeAllListeners and resolve once hooks at call time - [`efd4529`](https://github.com/morluto/rea/commit/efd452948c2940ff0234ce4d918bba966e3c6eb6) fix(electron): mirror native ipcMain removeAllListeners and once under wrapping decorators - [`781d575`](https://github.com/morluto/rea/commit/781d5751ad18b25a1fe1ffa8c6035388be8c3283) fix(pwntools): preserve worker ownership across launcher exec - [`b25d351`](https://github.com/morluto/rea/commit/b25d3517b68ad4352fa44e435f23c26de4bce54a) fix(browser): report cancellation after cleanup and source-map abort (#2893) - [`c884864`](https://github.com/morluto/rea/commit/c884864876c2568d8567235737b32e3f5893751d) fix(filesystem): observe cancellation after file finalization ### 📊 Changes **70 files changed** (+24131 additions, -729 deletions) <details> <summary>View changed files</summary> 📝 `docs/electron-observation.md` (+47 -2) 📝 `docs/javascript-artifact-reconstruction.md` (+11 -0) ➕ `docs/verification/electron-cancellation-2026-10-16.json` (+2895 -0) ➕ `docs/verification/electron-cancellation-2026-10-16.md` (+158 -0) ➕ `docs/verification/electron-ipc-listeners-2026-10-16.json` (+10377 -0) ➕ `docs/verification/electron-ipc-listeners-2026-10-16.md` (+592 -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/drawio-electron-lifecycle-oracles.py` (+115 -0) ➕ `experiments/analysis-efficiency/drawio-electron-lifecycle.mjs` (+191 -0) ➕ `experiments/analysis-efficiency/electron-cancellation-oracles.py` (+154 -0) ➕ `experiments/analysis-efficiency/electron-cancellation.mjs` (+273 -0) ➕ `experiments/analysis-efficiency/joplin-cli-cancellation.py` (+123 -0) ➕ `experiments/analysis-efficiency/joplin-window-options-check.py` (+106 -0) ➕ `experiments/analysis-efficiency/window-option-scaling.mjs` (+68 -0) 📝 `scripts/ci/scopes.mjs` (+1 -0) 📝 `scripts/electron-active-hook.cjs` (+297 -48) 📝 `scripts/verify/javascript/retained-facts.mjs` (+8 -1) 📝 `src/adb/AdbProvider.ts` (+31 -20) _...and 50 more files_ </details> ### 📄 Description ## Summary Fixes #4390. Original-function IPC removal works and `once` is recorded once, preserving native traversal, callback dispatch and argument semantics within the documented metadata scope. ## Change and scope A weak registry owns wrapper identity; Node owns `removeAllListeners` traversal through a private forwarding receiver. App decorators receive the real emitter and appropriate original callback. Private property/collection operations and constructors are captured before startup; snapshots avoid target iterators and Array species. One initialization-only binder removes repeated binding construction without per-call helper argument arrays. Metadata recognition has owned/unowned/unknown outcomes. Bound exhaustion, accessor links and Proxies retain native registration without an additional wrapper, with a bounded `listener-chain` gap after success. The gap does not prove IPC delivery. Shared descriptor parsing completes bounded prototype lookup before proving a link absent, preserving inherited data, getter/Proxy uncertainty and known undefined reads from setter-only properties during recognition/removal. Opaque custom apply likewise preserves the exact list and borrowed receiver while recording a `custom-apply` gap rather than invented callback facts. Shared projection and canonical CLI/MCP output retain channel, uncertainty and dropped-gap coverage. No new tool, cache or capture authority is added. ## Validation - Hook/projection/actions/MCP: **102 passed** (73 + 5 + 16 + 8). Five inherited-link native controls fail before correction (68 passed / 5 failed), covering data/getter/Proxy prototypes and prototype depths 16/17; earlier failed controls remain recorded. Both gap boundaries reach an actual SDK client and validate against the converted advertised output schema. - The canonical schema and verifier/five controlled exit-summary oracle sources reuse earlier passing checks by verified hashes. Projection/client are included in the fresh 102 cases. Earlier fixture-only lint failure and the 13-case rerun remain recorded without relaxed rules. - `npm run check:fast`: two uncached tasks pass; **90.797 s wall / 90.096799 family CPU s / 4,335,267,840 peak cgroup bytes**, no OOM. `npm run docs:check`: six tasks and five README consistency cases pass. - Real unchanged draw.io Desktop 32.4.1 ASAR/resources on explicit generic Electron 44.7.0: actual dialog recovery/insertion completes, SVG **0→2**, unsaved indicator true, **seven IPC events**. Final pipeline **11.264 s wall / 6.376574 family CPU s / 557,068,288 peak cgroup bytes**, verified at payload exit while the observer lives. These are not final whole-scope counters or provider cleanup proof; earlier unverified observations retain their caveats. Historical source-pinned ABBA and no-insertion controls remain recorded. **Every real capture still fails overall provider cleanup.** #4282/#2974/#4494 remain cleanup/startup gaps; #4513 raw-wrapper metadata mutation remains unfixed. Vendor Inspector fuses are inspected, not modified. No packaged-runtime compatibility, real MCP-wire provider success or real-app exercise of synthetic metadata cases is claimed. Runs are serial, one CPU, 8 GiB hard / 6 GiB early stop. Counters are at payload exit while the observer lives, not final whole-scope; memory includes file cache. OS caches are uncontrolled. No completed-task speedup or token/context saving is claimed. Regenerable app packages/profiles are excluded from Git. Previous-head CI run 38955237255 tests confirmed ae2c + main 8116dc06: **all 36 jobs pass**. Earlier independently reproduced firmware failures remain documented, without a cause/fix claim or firmware changes here. Fresh-head CI/review remain required. [Exact sources, scripts, failed controls, hashes, coverage and resource receipts](https://github.com/Adolanium/rea/blob/9a1bb507b97c57780d8cbb1f2cbcff94dfe463f4/docs/verification/electron-ipc-listeners-2026-10-16.md). ## Author readiness <!-- The human owner completes these declarations before requesting review. The PR author is the owner by default. A different owner must explicitly accept ownership on this PR. AI agents must leave these declarations to a human to dictate to them or there could be catastrophic consequences for many users of REA. Draft PRs may leave them unchecked. These declarations record initial readiness when opening the PR for review; later pushes do not require a new human sign-off. Keep the description and validation evidence current as the work changes. See CONTRIBUTING.md#pull-request-ownership-and-readiness. --> Human owner: @Adolanium - [x] 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. - [x] I checked the evidence above, confirmed it supports the current change, and recorded meaningful validation gaps. - [x] I declare this PR ready for initial maintainer review. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, 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-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#6212
No description provided.