[PR #3783] [MERGED] perf(javascript): check wrapper IPC duplicates by invocation set #5897

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

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/3783
Author: @kaoru0822-kitauji
Created: 10/15/2026
Status: ✅ Merged
Merged: 10/15/2026
Merged by: @kaoru0822-kitauji

Base: main ← Head: perf/ipc-invocation-index


📝 Commits (1)

  • 6c5f727 perf(javascript): check wrapper IPC duplicates by invocation set

📊 Changes

1 file changed (+27 additions, -13 deletions)

View changed files

📝 src/domain/javascript/electronWrappedCallPaths.ts (+27 -13)

📄 Description

Refs #3670. Follow-up to #3779, addressing the Greptile review finding on that PR.

Root cause

#3779 indexed wrapper-substituted IPC findings by [side, operation, channel, location], but within an endpoint it still scanned the bucket and ran JSON.stringify on each earlier invocation_location. When one wrapper is called many times for one channel (register("same:channel", copy) × N), every call shares the endpoint key and lands in the same bucket, so the duplicate check stayed O(N²).

Change

Each endpoint now records the two facts the duplicate rule actually reads:

  • observedTransmission: a directly observed send/invoke finding exists (no resolution_basis).
  • invocations: the set of serialized invocation locations. An absent location serializes as "undefined", so the original undefined === undefined match is preserved.

The duplicate rule is unchanged, and each check is now constant time.

Validation

Repro: one ipcMain.on wrapper invoked N times on one channel, analyzeJavaScriptStaticSource, Node 26.5, macOS arm64:

N source main (after #3779) this PR wrapper findings facts JSON
2,000 62 KB 203 ms 66 ms 2,000 = 2,000 2,759,063 B =
5,000 155 KB 1,005 ms 136 ms 5,000 = 5,000 6,902,063 B =
20,000 620 KB 15,275 ms 479 ms 20,000 = 20,000 27,657,072 B =

Real application code: static facts are byte-identical per file against the pre-#3779 main build on 3,309/3,309 files (Discord 2, Notion 97, Signal 573, Claude 424, Tabby 2,185, VS Code out/ 28). These apps rarely hit the repeated-wrapper pattern, so their timings match #3779's.

Tests: the existing duplicate-rule tests cover both halves. keeps a directly observed renderer operation singular… fails when observedTransmission is forced to false, and keeps one wrapper registration when one invocation reaches it twice covers the invocation set. All 157 JavaScript/domain test files pass (2,963 tests), as does npm run check:fast. Output size is unchanged.

🤖 Generated with Claude Code


🔄 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/3783 **Author:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Created:** 10/15/2026 **Status:** ✅ Merged **Merged:** 10/15/2026 **Merged by:** [@kaoru0822-kitauji](https://github.com/kaoru0822-kitauji) **Base:** `main` ← **Head:** `perf/ipc-invocation-index` --- ### 📝 Commits (1) - [`6c5f727`](https://github.com/morluto/rea/commit/6c5f727f30625648cee17a46ca7ba03bae6bf228) perf(javascript): check wrapper IPC duplicates by invocation set ### 📊 Changes **1 file changed** (+27 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `src/domain/javascript/electronWrappedCallPaths.ts` (+27 -13) </details> ### 📄 Description Refs #3670. Follow-up to #3779, addressing the Greptile review finding on that PR. ## Root cause #3779 indexed wrapper-substituted IPC findings by `[side, operation, channel, location]`, but within an endpoint it still scanned the bucket and ran `JSON.stringify` on each earlier `invocation_location`. When one wrapper is called many times for one channel (`register("same:channel", copy)` × N), every call shares the endpoint key and lands in the same bucket, so the duplicate check stayed O(N²). ## Change Each endpoint now records the two facts the duplicate rule actually reads: - `observedTransmission`: a directly observed `send`/`invoke` finding exists (no `resolution_basis`). - `invocations`: the set of serialized invocation locations. An absent location serializes as `"undefined"`, so the original `undefined === undefined` match is preserved. The duplicate rule is unchanged, and each check is now constant time. ## Validation **Repro:** one `ipcMain.on` wrapper invoked N times on one channel, `analyzeJavaScriptStaticSource`, Node 26.5, macOS arm64: | N | source | main (after #3779) | this PR | wrapper findings | facts JSON | |---:|---:|---:|---:|---:|---:| | 2,000 | 62 KB | 203 ms | 66 ms | 2,000 = 2,000 | 2,759,063 B = | | 5,000 | 155 KB | 1,005 ms | 136 ms | 5,000 = 5,000 | 6,902,063 B = | | 20,000 | 620 KB | **15,275 ms** | **479 ms** | 20,000 = 20,000 | 27,657,072 B = | **Real application code:** static facts are byte-identical per file against the pre-#3779 `main` build on 3,309/3,309 files (Discord 2, Notion 97, Signal 573, Claude 424, Tabby 2,185, VS Code `out/` 28). These apps rarely hit the repeated-wrapper pattern, so their timings match #3779's. **Tests:** the existing duplicate-rule tests cover both halves. `keeps a directly observed renderer operation singular…` fails when `observedTransmission` is forced to `false`, and `keeps one wrapper registration when one invocation reaches it twice` covers the invocation set. All 157 JavaScript/domain test files pass (2,963 tests), as does `npm run check:fast`. Output size is unchanged. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <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:16 +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#5897
No description provided.