[PR #3823] [CLOSED] fix(electron): retain parsed script frame attribution #5925

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3823
Author: @maxazure
Created: 10/15/2026
Status: ❌ Closed

Base: main ← Head: fix/electron-script-frame-attribution-3382


📝 Commits (1)

  • 65383db fix(electron): retain parsed script frame attribution

📊 Changes

5 files changed (+255 additions, -10 deletions)

View changed files

📝 src/browser/CdpElectronInspection.ts (+0 -1)
📝 src/browser/CdpElectronScriptEvents.ts (+6 -2)
📝 src/browser/CdpElectronScripts.ts (+2 -7)
➕ tests/boundary/browser/electronScriptAttribution.test.ts (+171 -0)
📝 tests/boundary/cli/electronCli.test.ts (+76 -0)

📄 Description

Summary

Fixes #3382. Electron scripts lost their observed frame and changed identity when the execution context was destroyed or reused before results were projected.

Problem and expected behavior

An already observed script-to-frame relationship should survive context teardown. A missing relationship must stay unknown.

Change and scope

Snapshot the known frame ID when Debugger.scriptParsed arrives, as the browser capture path already does. Projection uses that snapshot and retains the existing authorized-frame check. Live context mappings still clear on destruction/reset. Removed the obsolete draft context key and projection lookup parameter.

Contract and boundary impact

  • Owner: passive Electron script-event ingestion.
  • Scope decision: not applicable; correction within the existing observation boundary.
  • CLI/MCP schemas, target selection, file authorization, source opt-in and cleanup: unchanged.
  • Evidence: retained frame attribution and script keys no longer depend on later context lifetime.
  • Package, generated catalog and installation changes: none.
  • Existing workflow reads local files and communicates with the selected loopback CDP endpoint. No new target execution or instrumentation.

Evidence and regression coverage

Executed against base 4692bb3: six regression cases failed, including the public CLI returning a null frame and a changed script key after context destruction. Fixed runs retain the control frame/key. Tests also cover contextsCleared, numeric-ID reuse, scripts between contexts, malformed/missing/later relationships, out-of-scope frames and source opt-in.
All provider evidence here uses a simulated loopback CDP peer, not a real Electron application.

Validation performed

Linux cloud, pinned Node 24.18.0 / npm 11.16.0:

  • Focused provider/inspection/CLI suites: 4 files, 29 tests passed.
  • npm run check:fast, npm run check, npm run verify:test-discovery (1,302 files) and git diff --check: passed.
  • Normal local commit hooks passed. Published tree 492af1ce65 exactly matches the validated local commit tree.
  • verify:electron stopped at its missing REA_ELECTRON_EXECUTABLE prerequisite. Real Electron and a locally run full test suite are not claimed as passed.
  • Independent source review found no actionable issues; it did not independently rerun tests.

Compatibility, safety, and release

No schema or package change. Genuinely unknown frame relationships remain null; authorized-frame filtering remains in place. Real source retrieval after teardown is not established by the simulated fixture.

Current-head CI

CI run 38676147572 completed successfully on 2026-10-15 for 65383db: 15 successful checks, 16 skipped, no failures. Portable tests and CI required passed. Skipped jobs are not verification evidence. The real-browser lane also passed on Ubuntu 24.04 / Chrome 155.0.8059.39; that is not real Electron verification.

Author readiness

Human owner: @maxazure

  • 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/3823 **Author:** [@maxazure](https://github.com/maxazure) **Created:** 10/15/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/electron-script-frame-attribution-3382` --- ### 📝 Commits (1) - [`65383db`](https://github.com/morluto/rea/commit/65383db03c61d1a97d1e5c7c046eb3ff0e223d8b) fix(electron): retain parsed script frame attribution ### 📊 Changes **5 files changed** (+255 additions, -10 deletions) <details> <summary>View changed files</summary> 📝 `src/browser/CdpElectronInspection.ts` (+0 -1) 📝 `src/browser/CdpElectronScriptEvents.ts` (+6 -2) 📝 `src/browser/CdpElectronScripts.ts` (+2 -7) ➕ `tests/boundary/browser/electronScriptAttribution.test.ts` (+171 -0) 📝 `tests/boundary/cli/electronCli.test.ts` (+76 -0) </details> ### 📄 Description ## Summary Fixes #3382. Electron scripts lost their observed frame and changed identity when the execution context was destroyed or reused before results were projected. ## Problem and expected behavior An already observed script-to-frame relationship should survive context teardown. A missing relationship must stay unknown. ## Change and scope Snapshot the known frame ID when `Debugger.scriptParsed` arrives, as the browser capture path already does. Projection uses that snapshot and retains the existing authorized-frame check. Live context mappings still clear on destruction/reset. Removed the obsolete draft context key and projection lookup parameter. ## Contract and boundary impact - Owner: passive Electron script-event ingestion. - Scope decision: not applicable; correction within the existing observation boundary. - CLI/MCP schemas, target selection, file authorization, source opt-in and cleanup: unchanged. - Evidence: retained frame attribution and script keys no longer depend on later context lifetime. - Package, generated catalog and installation changes: none. - Existing workflow reads local files and communicates with the selected loopback CDP endpoint. No new target execution or instrumentation. ## Evidence and regression coverage Executed against base 4692bb3: six regression cases failed, including the public CLI returning a null frame and a changed script key after context destruction. Fixed runs retain the control frame/key. Tests also cover contextsCleared, numeric-ID reuse, scripts between contexts, malformed/missing/later relationships, out-of-scope frames and source opt-in. All provider evidence here uses a simulated loopback CDP peer, not a real Electron application. ## Validation performed Linux cloud, pinned Node 24.18.0 / npm 11.16.0: - Focused provider/inspection/CLI suites: 4 files, 29 tests passed. - `npm run check:fast`, `npm run check`, `npm run verify:test-discovery` (1,302 files) and `git diff --check`: passed. - Normal local commit hooks passed. Published tree 492af1ce6550d71ad0efb0afef3d8a67368ffc65 exactly matches the validated local commit tree. - `verify:electron` stopped at its missing REA_ELECTRON_EXECUTABLE prerequisite. Real Electron and a locally run full test suite are not claimed as passed. - Independent source review found no actionable issues; it did not independently rerun tests. ## Compatibility, safety, and release No schema or package change. Genuinely unknown frame relationships remain null; authorized-frame filtering remains in place. Real source retrieval after teardown is not established by the simulated fixture. ## Current-head CI [CI run 38676147572](https://github.com/morluto/rea/actions/runs/38676147572) completed successfully on 2026-10-15 for 65383db: 15 successful checks, 16 skipped, no failures. Portable tests and CI required passed. Skipped jobs are not verification evidence. The real-browser lane also passed on Ubuntu 24.04 / Chrome 155.0.8059.39; that is not real Electron verification. ## Author readiness Human owner: @maxazure - [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. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:10:29 +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#5925
No description provided.