From e7b21dba9e0acbf0e6491596c600c49575764b60 Mon Sep 17 00:00:00 2001 From: JeffreyChen Date: Tue, 17 Nov 2026 12:03:43 +0800 Subject: [PATCH 01/51] Record release 1.2.2 from the PR #552 merge --- docs/updates/2026-11-b.md | 14 ++++++++++++++ docs/updates/README.md | 1 + 2 files changed, 15 insertions(+) diff --git a/docs/updates/2026-11-b.md b/docs/updates/2026-11-b.md index 2ad4f1eec..f7045f6da 100644 --- a/docs/updates/2026-11-b.md +++ b/docs/updates/2026-11-b.md @@ -1144,3 +1144,17 @@ - **Change.** A new `settled(source)` helper retries an `inspect` that missed its deadline, or that found the source busy, for up to 5 s, as `check` does. It replaces the two drain calls (lines 175 and 223). The inspects that test the deadline, the capacity limit or the not-started path are unchanged. - **Tests:** `test_agent_presence_windows.py`, 26 passed in each of 3 runs. - **Files:** `test/unit_test/headless/test_agent_presence_windows.py`. + +## U-20261117-04 · 2026-11-17 · Release 1.2.2: PR #552 merged into main · #release + +- **What.** The maintainer approved the merge once the checks passed. They failed once, on `d97f09c7` (U-20261117-03). On `229bb33d` every check passed in the first round, and PR #552 (`dev` → `main`, 100 commits) was merged with a merge commit at 2026-11-17 03:55 UTC as `a798b4ed`, using `--match-head-commit`. +- **Release.** The `AutoControl Stable CI` run on `main` (44013574012) succeeded: tests on 3.11 to 3.14, then `publish`. It released `je_auto_control` **1.2.2** to PyPI and committed `Bump version to 1.2.2 [skip ci]` (`632f90c7`) on `main`. +- **Included:** + - the PySide6 split, 6.12.0 on Python 3.12+ and 6.11.2 on 3.11; + - the deferred-deletion abort workarounds (the test-side GC pause and GUI-thread collection); + - stoppable HTTP requests, template matching and OCR; + - the Slack handler `stop()` fix; + - read-only `ac_diagnose` audit verification; + - the M0 routing profile; + - the dnspython 2.9.2 lock floor. Dependabot alert 177 is now `fixed`. +- **Files:** `docs/updates/2026-11-b.md`, `docs/updates/README.md`. diff --git a/docs/updates/README.md b/docs/updates/README.md index ebdd37e5b..7112a9a11 100644 --- a/docs/updates/README.md +++ b/docs/updates/README.md @@ -58,6 +58,7 @@ In the same commit: delete the item from `Progress.md`, add a `#done` entry here | ID | Date | Title | Tags | Batch | |---|---|---|---|---| +| U-20261117-04 | 2026-11-17 | Release 1.2.2: PR #552 merged into main | #release | [2026-11-b](2026-11-b.md) | | U-20261117-03 | 2026-11-17 | Two presence-source drain inspects retry a missed deadline | #incident #ci #test #agent | [2026-11-b](2026-11-b.md) | | U-20261117-02 | 2026-11-17 | The deployment plan's rollback method is decided | #decision #deployment | [2026-11-b](2026-11-b.md) | | U-20261117-01 | 2026-11-17 | M0 closed: the first target is the owned fixture | #done #process-memory #decision | [2026-11-b](2026-11-b.md) | From 3e43623c05729a87b82b9beb6b0e78bead29024c Mon Sep 17 00:00:00 2001 From: JeffreyChen Date: Tue, 17 Nov 2026 13:20:49 +0800 Subject: [PATCH 02/51] Check the workspace-sync example's generation path before reading it SonarCloud's only vulnerability on main, the blocker failing its quality gate, was a path read from the directory materialize_sync_profile returns. The example now reads it only when it resolves inside the cache it made. --- docs/updates/2026-11-b.md | 8 ++++++++ docs/updates/README.md | 1 + examples/sync_workspace.py | 10 ++++++++-- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/docs/updates/2026-11-b.md b/docs/updates/2026-11-b.md index f7045f6da..1db1a708b 100644 --- a/docs/updates/2026-11-b.md +++ b/docs/updates/2026-11-b.md @@ -1158,3 +1158,11 @@ - the M0 routing profile; - the dnspython 2.9.2 lock floor. Dependabot alert 177 is now `fixed`. - **Files:** `docs/updates/2026-11-b.md`, `docs/updates/README.md`. + +## U-20261117-05 · 2026-11-17 · The workspace-sync example checks its generation path, clearing Sonar's blocker · #security #sonarcloud #examples + +- **Finding.** The SonarCloud quality gate on `main` was `ERROR` on a single condition: `new_security_rating` was 5, with 1 required. The one vulnerability behind it was `pythonsecurity:S2083`, a BLOCKER, "Path Traversal via file content in sync_workspace.main()", at `examples/sync_workspace.py:26` (opened 2026-10-19). The taint analysis treats the directory `materialize_sync_profile()` returns as shaped by synchronized content, and the example read `workspace.ini` from it with no check. The other 271 new-code issues are code smells, mostly composite test assertions (S9073: 162); none affects the gate. +- **Change.** The example resolves the cache root it passes in. It then resolves the generation's `workspace.ini` and reads it only when `is_relative_to(cache)` holds; otherwise it raises `ConfigSyncError`. The example's output is unchanged. +- **Tests:** the example runs as before. `test_sync_workspace.py`, `test_sync_preferences_review.py`, `test_config_sync_gui.py` and `test_doc_counts.py`: 71 passed. +- **Files:** `examples/sync_workspace.py`. +- **Open items:** the gate on `main` clears only once this reaches `main`. diff --git a/docs/updates/README.md b/docs/updates/README.md index 7112a9a11..a4eaa4c5e 100644 --- a/docs/updates/README.md +++ b/docs/updates/README.md @@ -58,6 +58,7 @@ In the same commit: delete the item from `Progress.md`, add a `#done` entry here | ID | Date | Title | Tags | Batch | |---|---|---|---|---| +| U-20261117-05 | 2026-11-17 | The workspace-sync example checks its generation path, clearing Sonar's blocker | #security #sonarcloud #examples | [2026-11-b](2026-11-b.md) | | U-20261117-04 | 2026-11-17 | Release 1.2.2: PR #552 merged into main | #release | [2026-11-b](2026-11-b.md) | | U-20261117-03 | 2026-11-17 | Two presence-source drain inspects retry a missed deadline | #incident #ci #test #agent | [2026-11-b](2026-11-b.md) | | U-20261117-02 | 2026-11-17 | The deployment plan's rollback method is decided | #decision #deployment | [2026-11-b](2026-11-b.md) | diff --git a/examples/sync_workspace.py b/examples/sync_workspace.py index 7f953083a..d0313a1a1 100644 --- a/examples/sync_workspace.py +++ b/examples/sync_workspace.py @@ -21,9 +21,15 @@ def main() -> None: receiver = WorkspaceSettingsSyncAdapter(receiver_source, SyncAdapterState(root / 'receiver.sqlite3', SyncLocalIdentity('https://controlled.invalid', 'example', 'laptop'))) report = receiver.apply(sender.snapshot()) - result = materialize_sync_profile([receiver], root / 'profile-cache') + cache = (root / 'profile-cache').resolve() + result = materialize_sync_profile([receiver], cache) + # The generation's directory comes back from the library; read from it only + # once it is proven to be inside the cache this example created. + generated = (Path(result.directory) / 'workspace.ini').resolve() + if not generated.is_relative_to(cache): + raise ConfigSyncError('the materialized profile is outside its cache directory') working_copy = root / 'explicit-workspace.ini' - working_copy.write_bytes((result.directory / 'workspace.ini').read_bytes()) + working_copy.write_bytes(generated.read_bytes()) # A caller may explicitly pass QSettings(working_copy, IniFormat) to AutoControlGUIUI. # The immutable generation itself must remain read-only when the GUI later saves preferences. if receiver_source.exists() or b'local-only' in working_copy.read_bytes(): From b7f40cd4fd76d030923655a70f0b2575863ab459 Mon Sep 17 00:00:00 2001 From: JeffreyChen Date: Tue, 17 Nov 2026 13:48:45 +0800 Subject: [PATCH 03/51] Clear SonarCloud's product-code findings on main Justified broad excepts and post-await identity re-checks are annotated where the reason already lives; duplicated labels became constants; the smaller findings (redundant except classes, loop lambdas, a nested conditional, an unused parameter, union syntax, one complex function) are fixed without changing behaviour. --- architecture_explore.md | 52 +++++----- docs/updates/2026-11-b.md | 21 ++++ docs/updates/README.md | 1 + je_auto_control/gui/_auto_click_tab.py | 4 +- je_auto_control/gui/_record_tab.py | 20 ++-- je_auto_control/gui/recording_editor_tab.py | 4 +- je_auto_control/utils/executor/run_control.py | 2 +- .../utils/http_client/http_client.py | 10 +- je_auto_control/utils/mcp_server/_authz.py | 4 +- .../utils/mcp_server/tools/_handlers.py | 12 +-- .../mcp_server/tools/_handlers_operations.py | 16 +-- .../utils/process_memory/reader.py | 3 +- .../utils/process_memory/windows_image.py | 3 +- je_auto_control/utils/rbac/command_review.py | 8 +- .../utils/remote_desktop/audio_retirement.py | 4 +- .../utils/remote_desktop/file_transfer.py | 2 +- je_auto_control/utils/remote_desktop/host.py | 2 +- .../utils/remote_desktop/lan_discovery.py | 12 +-- .../utils/remote_desktop/multi_viewer.py | 6 +- .../utils/remote_desktop/session_recorder.py | 4 +- .../utils/remote_desktop/webrtc_audio.py | 14 +-- .../utils/remote_desktop/webrtc_file_tasks.py | 2 +- .../utils/remote_desktop/webrtc_host.py | 26 ++--- .../utils/remote_desktop/webrtc_host_media.py | 19 ++-- .../remote_desktop/webrtc_media_owners.py | 2 +- .../remote_desktop/webrtc_peer_cleanup.py | 10 +- .../utils/remote_desktop/webrtc_retirement.py | 15 ++- .../utils/remote_desktop/webrtc_viewer.py | 98 ++++++++++--------- .../windows/window/windows_window_manage.py | 6 +- 29 files changed, 219 insertions(+), 163 deletions(-) diff --git a/architecture_explore.md b/architecture_explore.md index c9fcdaad6..d50b40d77 100644 --- a/architecture_explore.md +++ b/architecture_explore.md @@ -28,7 +28,7 @@ iOS(WebDriverAgent)。核心能力是滑鼠/鍵盤控制、影像辨識、 | 指標 | 數值 | | --- | ---: | | Python 模組總數(含周邊子專案) | 1,548 | -| 程式碼總行數 | 239,071 | +| 程式碼總行數 | 239,105 | | `je_auto_control/utils/` 子套件數 | 313 | | `AC_*` 動作指令數(`known_commands()` 實測) | 911 | | 套件門面 `__all__` 公開名稱數 | 1504 | @@ -202,7 +202,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 ### 5.3 平台後端 -#### Windows(`windows/`,24 檔/2,363 行) +#### Windows(`windows/`,24 檔/2,365 行) | 模組 | 行數 | 職責 | | --- | ---: | --- | @@ -214,7 +214,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | `record/win32_input_hook.py` | 258 | 單一一組低階鍵鼠 hook(`WH_KEYBOARD_LL`/`WH_MOUSE_LL`)+訊息迴圈,產生帶時間戳的事件時間軸;停止時以 `PostThreadMessageW(WM_QUIT)` 收掉執行緒,不會每錄一次就漏一條。 | | `record/win32_record.py` | 41 | 把 `win32_input_hook` 的時間軸轉成 action list(含按鍵放開、滾輪與間隔);整形本體與 macOS 共用 `utils/input_macro/recorder_base.py`。 | | `screen/win32_screen.py` | 171 | 螢幕尺寸與像素讀取。**每支 Win32 函式都明寫 argtypes/restype**(HDC 是指標寬度,走預設的 c_int 會截斷,錯誤會沉默地擴散到 GetPixel/ReleaseDC),並持有自己的 user32/gdi32 handle。import 時呼叫 `SetProcessDPIAware()`——**行程層級且不可還原**,實體↔邏輯座標換算請走 `utils/monitor_layout`。 | -| `window/windows_window_manage.py` | 566 | 視窗列舉/聚焦/關閉/最小化/幾何/所屬行程 PID/投遞式輸入(`auto_control_window` 的實作)。**每支 Win32 函式都明寫 argtypes/restype**,並持有自己的 user32 handle,避免把原型外溢到別的模組;hwnd 一律是 int。 | +| `window/windows_window_manage.py` | 568 | 視窗列舉/聚焦/關閉/最小化/幾何/所屬行程 PID/投遞式輸入(`auto_control_window` 的實作)。**每支 Win32 函式都明寫 argtypes/restype**,並持有自己的 user32 handle,避免把原型外溢到別的模組;hwnd 一律是 int。 | | `message/window_message.py` | 97 | 直接對視窗送 `WM_*` 訊息(背景輸入)。 | | `interception/_dll.py` | 232 | `interception.dll` 的延遲 ctypes 載入與結構定義。 | | `interception/keyboard.py` | 70 | 經 Interception 驅動的鍵盤輸入(繞過部分反自動化偵測)。 | @@ -324,7 +324,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 ### 5.4.2 框架基礎設施 -> 15 個套件、約 5,433 行。 +> 15 個套件、約 5,435 行。 | 模組 | 行數 | 職責 | | --- | ---: | --- | @@ -340,7 +340,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | `utils/package_manager/` | 198 | 動態載入套件並把 executor 注入其中;載入前先過套件閘門(允許清單加上只能從 Python 呼叫的開關,工作區 X-12) | | `utils/path_guard/` | 267 | 命令列及伺服器的路徑邊界、客戶端根目錄隔離與受管任務來源政策紀錄 | | `utils/platform_id/` | 62 | 作業系統家族的單一判定點。`sys.platform` 原本在一百多處跟字面清單比對,而那些清單都沒有 BSD;`is_x11_unix()` 問的是「這是不是 X11 unix」,這才是守衛一直想問的問題 | -| `utils/process_memory/` | 1,590 | 內部受審 probe 的有界語意觀察、typed Windows provider、獨立映像檔觀測、自有啟動加釘選雜湊的 attestor 與失敗 handle 回收;檔案證據不等於載入程式碼身分,原生驗收及 runtime 整合待完成 | +| `utils/process_memory/` | 1,592 | 內部受審 probe 的有界語意觀察、typed Windows provider、獨立映像檔觀測、自有啟動加釘選雜湊的 attestor 與失敗 handle 回收;檔案證據不等於載入程式碼身分,原生驗收及 runtime 整合待完成 | | `utils/shell_process/` | 312 | `ShellManager`:以 argv list 執行外部命令(禁用 `shell=True`) | | `utils/start_exe/` | 36 | 啟動另一個執行檔行程 | @@ -537,14 +537,14 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 ### 5.4.10 遠端桌面與 USB -> 6 個套件、約 32,298 行。 +> 6 個套件、約 32,318 行。 | 模組 | 行數 | 職責 | | --- | ---: | --- | | `utils/admin/` | 473 | 多主機管理主控台:平行輪詢 N 個 AutoControl REST 端點 | | `utils/config_sync/` | 8,577 | 持久化設定與條件交易:`contract.py` 管理有限 JSON 與協定例外;`store.py` 以 SQLite 原子比較版本/記錄重送收據;`routes.py` 提供第二版 HTTP 與明確盲寫相容;`commands.py` 共用 AC/MCP/Builder;`client.py` 條件提交,另有因果模型、peer ledger 與本機 SQLite outbox;第三版 /causal 交易已接上確認/退休/回收與刪除憑證;client/outbox 已接上原請求重送、有界 CAS 重合併及原子快照確認;持久化控制、原子本機 full-resync/舊待送退役與歷史收據已接上。本機資產工具另提供 manifest、整版雜湊驗證與不可變目錄發布;七種來源 adapters 保存可攜因果 profiles;workspace INI 與 GUI 共用偏好正規化。來源/outbox 與原子 full-resync 基準已由 SyncWorkspace 協調;引用資產以不可變分塊/完整 hash 收據、具驗證 HTTP 與完整 profile 串流發布接上;Sync UI 仍屬 C3。 | | `utils/device_matrix/` | 201 | 行動裝置矩陣:同一 action list 於多台裝置平行執行 | -| `utils/remote_desktop/` | 16,970 | **遠端桌面子系統**:TCP/WebSocket/WebRTC 三條傳輸路徑、主機與檢視端、訊令伺服器、TURN/中繼、多檢視者、錄影、信任清單、TOTP、稽核鏈;私有選用功能模組保留整組匯入結果。 | +| `utils/remote_desktop/` | 16,990 | **遠端桌面子系統**:TCP/WebSocket/WebRTC 三條傳輸路徑、主機與檢視端、訊令伺服器、TURN/中繼、多檢視者、錄影、信任清單、TOTP、稽核鏈;私有選用功能模組保留整組匯入結果。 | | `utils/usb/` | 5,069 | 跨平台 USB 列舉/熱插拔/裝置直通(WinUSB、IOKit、libusb 後端 + ACL + WebRTC DataChannel 通道) | | `utils/usbip/` | 1,008 | USB/IP 線路協定主機端(協定封包、TCP 伺服器、libusb URB 後端) | @@ -562,7 +562,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 ### 5.4.11 伺服器、網路協定與外部整合 -> 24 個套件、約 7,803 行。 +> 24 個套件、約 7,805 行。 | 模組 | 行數 | 職責 | | --- | ---: | --- | @@ -572,7 +572,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | `utils/email_send/` | 118 | SMTP 寄信(email 觸發器的發送端搭檔) | | `utils/events/` | 106 | 對外 CloudEvents 發送(執行生命週期事件) | | `utils/http_cassette/` | 200 | 錄製/重播 HTTP 互動,做離線決定性 API 測試 | -| `utils/http_client/` | 469 | 零依賴 HTTP(S) 用戶端,供 action 步驟呼叫 API | +| `utils/http_client/` | 471 | 零依賴 HTTP(S) 用戶端,供 action 步驟呼叫 API | | `utils/http_conditional/` | 148 | 條件式 HTTP 請求與快取驗證器 | | `utils/http_content/` | 158 | HTTP 內容協商與回應解壓縮 | | `utils/http_problem/` | 122 | RFC 9457 problem+json 解析 | @@ -665,7 +665,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 ### 5.4.14 安全、機密與合規 -> 13 個套件、約 4,763 行。 +> 13 個套件、約 4,765 行。 | 模組 | 行數 | 職責 | | --- | ---: | --- | @@ -674,7 +674,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | `utils/governance/` | 263 | 治理:maker-checker 核准閘門與即時憑證租約 | | `utils/license_policy/` | 240 | 以 SBOM 元件評估 SPDX 授權允許/拒絕政策 | | `utils/provenance/` | 126 | SLSA 建置來源證明(in-toto v1) | -| `utils/rbac/` | 1,991 | 角色型存取控制:使用者與權杖驗證、REST/MCP/executor 的能力政策,`deferred.py` 將背景工作綁定註冊者並在觸發時重新驗證來源 store;不保存 bearer token。;MCP 的 tool_classification.py 擁有明確畫面/呼叫者資料清單、標準別名與混合參數權限;未知唯讀提示要求 read_data;command_review.py 記錄 `COMMAND_CAPABILITIES` 以外每個 `AC_*` 指令的審查(只需提交入口的 drive_input),新指令未分類時 CI 失敗 | +| `utils/rbac/` | 1,993 | 角色型存取控制:使用者與權杖驗證、REST/MCP/executor 的能力政策,`deferred.py` 將背景工作綁定註冊者並在觸發時重新驗證來源 store;不保存 bearer token。;MCP 的 tool_classification.py 擁有明確畫面/呼叫者資料清單、標準別名與混合參數權限;未知唯讀提示要求 read_data;command_review.py 記錄 `COMMAND_CAPABILITIES` 以外每個 `AC_*` 指令的審查(只需提交入口的 drive_input),新指令未分類時 CI 失敗 | | `utils/redaction/` | 508 | 截圖遮蔽層:規則偵測 + 政策 + 協調器(上傳 VLM 前先遮) | | `utils/sbom/` | 170 | SBOM(CycloneDX)產生 | | `utils/secret_ref/` | 242 | URI scheme 形式的值參照解析 | @@ -731,17 +731,17 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 上表以子套件為單位;以下把行數最大的幾個子系統展開到檔案層。 -#### `utils/process_memory/`(1,590 行/10 檔) +#### `utils/process_memory/`(1,592 行/10 檔) | 檔案 | 行數 | 職責 | | --- | ---: | --- | | `__init__.py` | 1 | Internal reviewed process observations; no native provider or public command registration. | | `background_profile.py` | 119 | Reviewable M0 routing profile: which background channel serves an operation, never desktop input. | | `models.py` | 203 | Closed identities, reviewed probes and safe semantic observation results. | -| `reader.py` | 310 | Adapter-owned semantic observations with bounded reads and retained cleanup ownership. | +| `reader.py` | 311 | Adapter-owned semantic observations with bounded reads and retained cleanup ownership. | | `windows.py` | 194 | Owned Windows read handles with measured native facts and reviewed application attestation. | | `windows_facts.py` | 55 | Measure native birth, session and architecture through a retained process handle. | -| `windows_image.py` | 308 | Observe an image file while retaining its process and deny-write/delete file leases. | +| `windows_image.py` | 309 | Observe an image file while retaining its process and deny-write/delete file leases. | | `windows_image_native.py` | 62 | Typed process-image filename and read-only file acquisition calls. | | `windows_launch.py` | 225 | Attest a process this host launched itself, from an image file pinned by SHA-256. | | `windows_native.py` | 113 | Typed Win32 query/read bindings and caller-sized memory information layouts. | @@ -819,7 +819,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | `rate_limit.py` | 48 | 工具呼叫的 token bucket 限流。 | | `__main__.py` | 126 | `je_auto_control_mcp` console script 進入點。 | -#### `utils/remote_desktop/`(16,970 行/77 檔) +#### `utils/remote_desktop/`(16,990 行/77 檔) 三條傳輸路徑並存:**TCP**(JPEG 影格)、**WebSocket**(同協定換傳輸)、**WebRTC**(aiortc 視訊 + DataChannel)。 `_export_bindings.py` 保存產生的來源對照;`_optional/` 分別管理 WebRTC、錄影、多檢視者、 @@ -829,10 +829,10 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | 檔案 | 行數 | 職責 | | --- | ---: | --- | | `webrtc_host.py` | 750 | WebRTC 主機:串流螢幕視訊並接受檢視端輸入;session 生命週期、DataChannel 接線、檔案收發。 | -| `webrtc_viewer.py` | 740 | WebRTC 檢視端:接收視訊並送出輸入。 | -| `webrtc_retirement.py` | 186 | 序列化 peer 世代、保留未完成的停止 future,區分待完成與失敗清理。 | +| `webrtc_viewer.py` | 750 | WebRTC 檢視端:接收視訊並送出輸入。 | +| `webrtc_retirement.py` | 191 | 序列化 peer 世代、保留未完成的停止 future,區分待完成與失敗清理。 | | `webrtc_media_owners.py` | 249 | 保留 peer 媒體建構失敗及未完成子資源,提供快取的 slot 清理結果。 | -| `webrtc_peer_cleanup.py` | 166 | 逐項清理 host/viewer 的原始資源,保留失敗項目並等候影格任務結束。 | +| `webrtc_peer_cleanup.py` | 168 | 逐項清理 host/viewer 的原始資源,保留失敗項目並等候影格任務結束。 | | `host.py` | 702 | TCP 主機:接受迴圈、TLS 包裝、連線/認證握手、音訊與剪貼簿廣播、檔案推送、單次 token。 | | `viewer.py` | 748 | TCP 檢視端。 | | `host_service.py` | 561 | 無頭 WebRTC 主機執行器 + 多平台服務安裝器。 | @@ -863,7 +863,7 @@ socket server 有 8 MiB 讀取上限與 30 秒 handler timeout。 | `webrtc_host_auth.py` | 255 | 檢視端認證與核准:token 檢查、信任清單/IP 白名單自動放行、手動接受/拒絕、SAS、逾時關閉。 | | `lan_discovery.py` | 387 | mDNS/Zeroconf 區網探索。 | | `video_codec.py` | 197 | TCP/WS 路徑的可插拔視訊編解碼。 | -| `webrtc_host_media.py` | 258 | 重新協商與 recvonly 軌管理。aiortc 沒有 `removeTransceiver`,所以開/關不對稱——開是加軌重新 offer,關只能設 inactive 並停掉 receiver。 | +| `webrtc_host_media.py` | 261 | 重新協商與 recvonly 軌管理。aiortc 沒有 `removeTransceiver`,所以開/關不對稱——開是加軌重新 offer,關只能設 inactive 並停掉 receiver。 | | `hw_codec.py` | 207 | 硬體 H.264 編碼偵測與啟用。 | | `webrtc_stats.py` | 226 | 以單一 future 擁有 aiortc 統計輪詢;啟停不等待網路,停止後拒絕晚到樣本並釋放回呼。 | | `connect_coordinator.py` | 158 | 由使用者輸入的目標決定該用哪條傳輸。 | @@ -1327,7 +1327,7 @@ GUI 是**選用 extra**(`pip install je_auto_control[gui]`,只需要 PySide6 | `_screenshot_tab.py` | 180 | 獨立延遲建立的截圖/像素分頁;背景讀取、輸入快照與關閉後結果丟棄。 | | `_image_detect_tab.py` | 158 | 獨立影像偵測分頁,擁有輸入、背景工作與關閉生命週期。 | | `_script_tab.py` | 183 | 獨立腳本執行分頁;背景載入與執行,關閉取消並釋放控制項。 | -| `_record_tab.py` | 167 | 獨立錄製/回放檢視;背景工作與共享錄製器狀態,關閉檢視不停止錄製器。 | +| `_record_tab.py` | 173 | 獨立錄製/回放檢視;背景工作與共享錄製器狀態,關閉檢視不停止錄製器。 | | `_report_tab.py` | 106 | 報表分頁 mixin。 | | `_i18n_helpers.py` | 79 | 需要即時語言切換的分頁共用的翻譯註冊 mixin。 | | `_validators.py` | 29 | `int_validator()`/`double_validator()`:以 C locale 驗證的數字輸入框 validator,接受的正是 `int()`/`float()` 讀得懂的寫法(預設 locale 在法文、德文下只收小數逗號)。所有數字 `QLineEdit` 都用它。 | @@ -1358,7 +1358,7 @@ GUI 是**選用 extra**(`pip install je_auto_control[gui]`,只需要 PySide6 | auto_click | `_auto_click_tab.py` | 321 | 自動點擊:座標、間隔、熱鍵、`write`、捲動。 | | screenshot | `_screenshot_tab.py` | 180 | 截圖、選區、螢幕尺寸、取像素色。 | | image_detect | `_image_detect_tab.py` | 158 | 樣板裁切、定位、定位全部、定位並點擊。 | -| record | `_record_tab.py` | 167 | 錄製/停止/回放/存檔/載入。 | +| record | `_record_tab.py` | 173 | 錄製/停止/回放/存檔/載入。 | | script_builder | `script_builder/` | 6,957 | **視覺化腳本編輯器**:`command_schema.py`(5,551 行 `AC_*` 參數綱要)、`step_model.py`(步驟模型與 AC JSON 序列化)、`step_list_view.py`(含巢狀 body 的樹狀檢視)、`step_form_view.py`(綱要驅動表單)、`builder_tab.py`(含日誌候選預覽與明確匯入,保留來源)。 | | flow_editor | `flow_editor/` | 498 | 節點式流程圖檢視:`layout.py`(純 Python 佈局演算法,可單測)、`scene.py`(Qt 場景繪製)、`tab.py`。 | | script | `_script_tab.py` | 183 | 載入/執行單檔或整個目錄、內建編輯器執行。 | @@ -1552,15 +1552,15 @@ socket 預設綁 `127.0.0.1`;資源一律用 `with`。 | 層/子系統 | 檔案數 | 行數 | | --- | ---: | ---: | -| `gui/` | 167 | 44,024 | +| `gui/` | 167 | 44,030 | | `utils/mcp_server/` | 63 | 22,322 | -| `utils/remote_desktop/` | 77 | 16,970 | +| `utils/remote_desktop/` | 77 | 16,990 | | `utils/executor/` | 11 | 10,806 | | `utils/usb/` | 20 | 5,069 | | `je_auto_control/`(頂層 3 檔) | 5 | 5,168 | | `utils/accessibility/` | 16 | 3,384 | | `wrapper/` | 25 | 6,066 | -| `windows/` | 24 | 2,363 | +| `windows/` | 24 | 2,365 | | `utils/rest_api/` | 8 | 2,236 | | `utils/agent/` | 13 | 2,254 | | `linux_with_x11/` | 19 | 1,382 | @@ -1572,8 +1572,8 @@ socket 預設綁 `127.0.0.1`;資源一律用 `with`。 | `osx/` | 17 | 988 | | `autocontrol-lsp/` | 8 | 744 | | `utils/hotkey/` | 7 | 867 | -| 其餘模組(約 286 個 `utils/` 子套件 + `android/`/`ios/`/周邊小工具) | 1,010 | 104,530 | -| **總計** | **1,536** | **238,326** | +| 其餘模組(約 286 個 `utils/` 子套件 + `android/`/`ios/`/周邊小工具) | 1,010 | 104,536 | +| **總計** | **1,536** | **238,360** | `gui/agent_observation_view.py` provides the bounded read-only agent element table and DPR-1 image selection preview. `gui/agent_tasks_tab.py` owns only request editing and Actions-menu translation; business validation remains in the headless runtime. diff --git a/docs/updates/2026-11-b.md b/docs/updates/2026-11-b.md index 1db1a708b..44d3e19e6 100644 --- a/docs/updates/2026-11-b.md +++ b/docs/updates/2026-11-b.md @@ -1166,3 +1166,24 @@ - **Tests:** the example runs as before. `test_sync_workspace.py`, `test_sync_preferences_review.py`, `test_config_sync_gui.py` and `test_doc_counts.py`: 71 passed. - **Files:** `examples/sync_workspace.py`. - **Open items:** the gate on `main` clears only once this reaches `main`. + +## U-20261117-06 · 2026-11-17 · SonarCloud cleanup, product code: 69 new-code findings on main · #sonarcloud #cleanup + +- **Scope.** On `main`, SonarCloud listed 272 open new-code issues: 70 in product code and 202 in tests. This entry covers the product code; the vulnerability among them is U-20261117-05. +- **Broad excepts (S5754, 28 sites in 12 files)** were all deliberate. + - They are cleanup boundaries that collect the failure, run the other independent cleanups, and re-raise later through `raise_cleanup_failures` or while preserving control signals (asyncio's `CancelledError` is a `BaseException`). The rest hand an outcome to another thread or future (`stoppable_call`, the HTTP helper), or release the source before re-raising (`multi_viewer`). + - Narrowing them would drop control signals during cleanup, so each gets `# NOSONAR` on its `except` line next to the `# reason:` the broad-except gate reads. Reasons were shortened to keep every line within 120 characters. +- **Always-true conditions (S2589, 4)** are identity re-checks after an `await` or a `close()` that can replace the field. They are not logic errors and are kept, each annotated with why. +- **Duplicated literals (S1192, 11)** became module constants in 6 modules: `"request stopped"`, `"as AC_presence_register"`, and the WebRTC media-owner labels. Only identical string tokens were replaced, using `tokenize`. +- **Smaller fixes:** + - **Redundant exception classes (S5713):** `ConnectionError` is an `OSError`, and `AuthorizationError` is a `PermissionError`, so the redundant one is dropped from each tuple. + - **Loop lambdas (S1515):** the two in `process_memory` became `functools.partial`. + - **Nested conditional (S3358):** the record tab's chain became an `if` chain in `_status_key`. + - **Unused parameter (S1172):** `stop_resource` now uses its `label`, adding `while stopping