[PR #4605] [MERGED] fix(electron): delegate once dispatch to the active runtime #6331

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

📋 Pull Request Information

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

Base: main ← Head: fix/electron-native-once-4593-20261016


📝 Commits (6)

  • c0b52b5 fix(electron): delegate once dispatch to the native runtime
  • e60c4a1 refactor(electron): remove superseded once dispatch branches
  • 7f05f47 fix(electron): retain once gaps when registration bypasses on
  • 4547316 docs(electron): preserve native once verification cohorts
  • 4ebd0f6 fix(electron): retain once observation gaps on failed operations
  • c465723 docs(electron): record failed once operation regressions

📊 Changes

10 files changed (+2987 additions, -52 deletions)

View changed files

📝 docs/electron-observation.md (+18 -1)
➕ docs/verification/electron-native-once-2026-10-16.json (+1930 -0)
➕ docs/verification/electron-native-once-2026-10-16.md (+142 -0)
➕ docs/verification/electron-native-once-2026-10-16.review.rows.jsonl (+117 -0)
➕ docs/verification/electron-native-once-2026-10-16.rows.jsonl (+96 -0)
➕ experiments/analysis-efficiency/electron-once-runtime.mjs (+335 -0)
➕ experiments/analysis-efficiency/electron-once-runtimes.py (+89 -0)
📝 experiments/analysis-efficiency/joplin-shell-boundary.mjs (+37 -2)
📝 scripts/electron-active-hook.cjs (+151 -38)
📝 tests/boundary/browser/electronActiveHook.test.ts (+72 -11)

📄 Description

Summary

Fixes #4593. The copied Electron once dispatcher diverges from newer Node dispatch and can suppress an actual callback or record an invocation when its body never ran. Delegate wrapper creation, removal and dispatch to the current runtime; record only established callback entry, and retain explicit observation gaps when application methods or metadata prevent observation.

Change and scope

The existing hook owns registration adaptation and descriptor interpretation. Native wrappers retain callback identity and descriptor attributes. Private forwarding preserves method receivers, readonly descriptors and actual Arguments frames; opaque paths remain native and restore their observation scope on failure. Removed the superseded copied call/apply dispatch. This is a correctness fix within existing instrumentation authority; additional maintainer capability approval is not applicable.

CLI/MCP, schemas, event budgets and retained Evidence contracts are unchanged. Expected effects remain process launch and existing injection/in-memory instrumentation. No added network behavior, installation or generated metadata changes. Raw-wrapper mutation #4513, standard startup #2974 and provider cleanup #4282 remain unresolved.

Executed validation

  • Paired native/hooked controls: 39 cases each on pinned Node 24.18.0, official Node 24.21.0 and generic Electron 44.7.0's embedded Node. Baseline differences 4/16/16 → 0/0/0. These are controlled producer cases, not a natural real-app callback-loss reproduction.
  • npm run test:focused -- tests/boundary/browser/electronActiveHook.test.ts (pinned), explicit Node 24.21 vitest run --project boundary: 75 pass on each Node version. The new false-invocation regression fails on the baseline.
  • Shared projection/MCP boundaries: 13 pass on the initial fix; their consumer sources are unchanged by the later CJS cleanup/gap follow-up.
  • npm run check:fast: pass, two uncached tasks; 118.946 s wall / 117.752622 s CPU / 4,282,826,752 B cgroup peak. npm run docs:check: pass.
  • Unchanged Joplin Desktop 3.7.21: shipped PNG → actual menu/bridge → blocked reveal; events 0→1, image remains visible, no page errors, exact retained capture. Both staged hooks match the selected source. Explicit argv test shim required. Overall provider cleanup still fails, so this is not a completed public CLI/MCP workflow.

The final Joplin pipeline took 18.353 s; observed CPU 17.098599 s / peak 1,387,556,864 B, with complete-family measurement unverified. Heavy runs were serial, 1 CPU, 8 GiB hard/6 GiB early, no swap, 192 tasks. No token/speed improvement is claimed; added registration overhead, cold/warm repeats, real Windows/macOS and full check:pr are unmeasured.

Verification and reproduction, adjacent JSON and 117 final paired JSONL rows (plus the unchanged earlier 96-row cohort) preserve source cohorts, input hashes, failures and resource limitations. Regenerable apps/binaries/profiles are excluded.

The first-head CI failed one unchanged binary admission cancellation test; source attribution and log hash are preserved, without claiming local reproduction or a fix. Codex review is unavailable due to repository quota. Greptile found two own gaps; both now have failing-before/passing-after regressions and centralized failure reporting. The final Joplin trial uses local Xvfb -nolisten tcp -ac; its earlier XAUTHORITY display failure is preserved separately.

Author readiness

Human owner: @N0zoM1z0 (PR author). The requesting human explicitly authorized opening ready PRs and proceeding without repeated human confirmation. This AI-assisted report does not attest that a human reviewed this final diff.

  • 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.

🔄 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/4605 **Author:** [@N0zoM1z0](https://github.com/N0zoM1z0) **Created:** 10/16/2026 **Status:** ✅ Merged **Merged:** 10/16/2026 **Merged by:** [@morluto](https://github.com/morluto) **Base:** `main` ← **Head:** `fix/electron-native-once-4593-20261016` --- ### 📝 Commits (6) - [`c0b52b5`](https://github.com/morluto/rea/commit/c0b52b5408fa97013798e6ecee885ccac08e7356) fix(electron): delegate once dispatch to the native runtime - [`e60c4a1`](https://github.com/morluto/rea/commit/e60c4a1098321ed2a7f564ae35909a31d707694f) refactor(electron): remove superseded once dispatch branches - [`7f05f47`](https://github.com/morluto/rea/commit/7f05f476c52498adba41d943ead1a86e7216ca76) fix(electron): retain once gaps when registration bypasses on - [`4547316`](https://github.com/morluto/rea/commit/45473166e83f61e48c90732fb3f46ee8b4ad5cb7) docs(electron): preserve native once verification cohorts - [`4ebd0f6`](https://github.com/morluto/rea/commit/4ebd0f60e860daa57a7033c6e77ea7f5f4b8ac97) fix(electron): retain once observation gaps on failed operations - [`c465723`](https://github.com/morluto/rea/commit/c4657235fedaa6230141e17b7ae8de72bb96155d) docs(electron): record failed once operation regressions ### 📊 Changes **10 files changed** (+2987 additions, -52 deletions) <details> <summary>View changed files</summary> 📝 `docs/electron-observation.md` (+18 -1) ➕ `docs/verification/electron-native-once-2026-10-16.json` (+1930 -0) ➕ `docs/verification/electron-native-once-2026-10-16.md` (+142 -0) ➕ `docs/verification/electron-native-once-2026-10-16.review.rows.jsonl` (+117 -0) ➕ `docs/verification/electron-native-once-2026-10-16.rows.jsonl` (+96 -0) ➕ `experiments/analysis-efficiency/electron-once-runtime.mjs` (+335 -0) ➕ `experiments/analysis-efficiency/electron-once-runtimes.py` (+89 -0) 📝 `experiments/analysis-efficiency/joplin-shell-boundary.mjs` (+37 -2) 📝 `scripts/electron-active-hook.cjs` (+151 -38) 📝 `tests/boundary/browser/electronActiveHook.test.ts` (+72 -11) </details> ### 📄 Description ## Summary Fixes #4593. The copied Electron `once` dispatcher diverges from newer Node dispatch and can suppress an actual callback or record an invocation when its body never ran. Delegate wrapper creation, removal and dispatch to the current runtime; record only established callback entry, and retain explicit observation gaps when application methods or metadata prevent observation. ## Change and scope The existing hook owns registration adaptation and descriptor interpretation. Native wrappers retain callback identity and descriptor attributes. Private forwarding preserves method receivers, readonly descriptors and actual Arguments frames; opaque paths remain native and restore their observation scope on failure. Removed the superseded copied call/apply dispatch. This is a correctness fix within existing instrumentation authority; additional maintainer capability approval is not applicable. CLI/MCP, schemas, event budgets and retained Evidence contracts are unchanged. Expected effects remain process launch and existing injection/in-memory instrumentation. No added network behavior, installation or generated metadata changes. Raw-wrapper mutation #4513, standard startup #2974 and provider cleanup #4282 remain unresolved. ## Executed validation - Paired native/hooked controls: 39 cases each on pinned Node 24.18.0, official Node 24.21.0 and generic Electron 44.7.0's embedded Node. Baseline differences **4/16/16 → 0/0/0**. These are controlled producer cases, not a natural real-app callback-loss reproduction. - `npm run test:focused -- tests/boundary/browser/electronActiveHook.test.ts` (pinned), explicit Node 24.21 `vitest run --project boundary`: **75 pass on each Node version**. The new false-invocation regression fails on the baseline. - Shared projection/MCP boundaries: **13 pass** on the initial fix; their consumer sources are unchanged by the later CJS cleanup/gap follow-up. - `npm run check:fast`: **pass**, two uncached tasks; 118.946 s wall / 117.752622 s CPU / 4,282,826,752 B cgroup peak. `npm run docs:check`: **pass**. - Unchanged Joplin Desktop 3.7.21: shipped PNG → actual menu/bridge → blocked reveal; events **0→1**, image remains visible, no page errors, exact retained capture. Both staged hooks match the selected source. Explicit argv test shim required. **Overall provider cleanup still fails**, so this is not a completed public CLI/MCP workflow. The final Joplin pipeline took 18.353 s; observed CPU 17.098599 s / peak 1,387,556,864 B, with **complete-family measurement unverified**. Heavy runs were serial, 1 CPU, 8 GiB hard/6 GiB early, no swap, 192 tasks. No token/speed improvement is claimed; added registration overhead, cold/warm repeats, real Windows/macOS and full `check:pr` are unmeasured. [Verification and reproduction](docs/verification/electron-native-once-2026-10-16.md), adjacent JSON and 117 final paired JSONL rows (plus the unchanged earlier 96-row cohort) preserve source cohorts, input hashes, failures and resource limitations. Regenerable apps/binaries/profiles are excluded. The first-head CI failed one unchanged binary admission cancellation test; source attribution and log hash are preserved, without claiming local reproduction or a fix. Codex review is unavailable due to repository quota. Greptile found two own gaps; both now have failing-before/passing-after regressions and centralized failure reporting. The final Joplin trial uses local Xvfb `-nolisten tcp -ac`; its earlier XAUTHORITY display failure is preserved separately. ## Author readiness Human owner: @N0zoM1z0 (PR author). The requesting human explicitly authorized opening ready PRs and proceeding without repeated human confirmation. This AI-assisted report does not attest that a human reviewed this final diff. - [ ] 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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:13:39 +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#6331
No description provided.