You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maka.apache.org by as...@apache.org on 2026/09/02 14:03:08 UTC

(maka) branch main updated: docs(desktop): correct safe-send documentation (#4015)

This is an automated email from the ASF dual-hosted git repository.

Astro-Han pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/maka.git


The following commit(s) were added to refs/heads/main by this push:
     new aaa4eb7b29 docs(desktop): correct safe-send documentation (#4015)
aaa4eb7b29 is described below

commit aaa4eb7b297d1fd529911eabe9d7a57834bfe926
Author: yzy <80...@users.noreply.github.com>
AuthorDate: Wed Sep 2 22:02:57 2026 +0800

    docs(desktop): correct safe-send documentation (#4015)
    
    The Desktop README claimed a fixed-list source scanner verifies main-to-renderer sends. No such scanner exists; the actual guard is the in-place `safeSendToRenderer` helper and the convention that new main-window pushes route through it. The README now describes that. Documentation only; the helper extraction and tests proposed in earlier revisions were dropped because nothing reproduces a need for a new production seam.
    
    Fixes #4003
    
    Generated-by: Codex
---
 apps/desktop/README.md | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps/desktop/README.md b/apps/desktop/README.md
index 6b51badbfc..d611cb4285 100644
--- a/apps/desktop/README.md
+++ b/apps/desktop/README.md
@@ -139,7 +139,7 @@ Sub-folders hold OS-facing implementations such as `browser/`, `computer-use/`,
 Three patterns, all rooted in preload's `maka` namespace. Channel names are `<domain>:<action>`.
 
 - **Request/response** — `ipcRenderer.invoke('<domain>:<action>', …args)` in preload ↔ `ipcMain.handle('<domain>:<action>', …)`. Runtime domains are projected by `runtime-host-*-ipc-main.ts`; OS-facing client domains use a focused `*-ipc-main.ts` module.
-- **Main→renderer push** — main sends through the safe-send guard (`safeSendToRenderer` via `mainWindowController.send`), not raw `webContents.send` (which throws when the window/`webContents` is destroyed); preload subscribes via `ipcRenderer.on` and returns an unsubscribe fn (e.g. `sessions:changed`, `scheduled-tasks:changed`, `artifacts:changed`). The safe-send contract test scans a fixed list of main-source files for direct `mainWindow.webContents.send(...)` forms — new `*-ipc-main.t [...]
+- **Main→renderer push** — main sends through the safe-send guard (`safeSendToRenderer` via `mainWindowController.send`), not raw `webContents.send` (which throws when the window/`webContents` is destroyed); preload subscribes via `ipcRenderer.on` and returns an unsubscribe fn (e.g. `sessions:changed`, `scheduled-tasks:changed`, `artifacts:changed`). The guard checks both the `BrowserWindow` and its `webContents` before delivery. Route every new main-window push through it.
 - **Renderer→main fire-and-forget** — `ipcRenderer.send('<domain>:<action>', …)` in preload ↔ `ipcMain.on('<domain>:<action>', …)`. Used when no response is needed (e.g. `browser:active-session`, `browser:setViewport`).
 
 Adding a new IPC surface: if extracting, write the `*-ipc-main.ts` exporting a `register*Ipc(...)`, import it in `main.ts`, and call it inside `registerIpc()`; add the matching method to the `maka` namespace in `preload.ts`; add the method to the `window.maka` type in `src/global.d.ts` (the renderer's typed bridge — without it, renderer calls get a TS error); keep the `<domain>:<action>` channel naming. A handler file that isn't registered in `registerIpc()` compiles but never mounts.


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@maka.apache.org
For additional commands, e-mail: commits-help@maka.apache.org