refactor(scanners): remove the CDP webview-account surface (1/3 for #5478) - #5482
Conversation
1 of 3 for tinyhumansai#5478. Removes the six CDP-driven provider scanners and the webview-account surface they ran inside. Pure dead-code removal: the frontend entry points (SidebarAppRail, WebviewHost, webviewAccountService) were deleted in tinyhumansai#5457 and never restored, so none of this was reachable by a user. Deleted: - app/src-tauri/src/{whatsapp,discord,slack,telegram,gmessages,wechat}_scanner - app/src-tauri/src/webview_accounts (4,809 lines) - src/openhuman/channels/webview_accounts (WeChat ingest normalisation, whose only producer was wechat_scanner; already had zero other consumers) - app/src-tauri/src/cdp/{session,snapshot}.rs — the per-account session opener and DOM-snapshot parser. session.rs imports webview_accounts directly, so it cannot compile without it; both had no other consumer. - The CEF cold-start prewarm and the webview-close drain machinery, whose only producers were the prewarm webview and webview_accounts. Unregisters all 15 webview_account_* IPC commands, so the shell no longer exposes commands whose implementation is gone. imessage_scanner is untouched and still registered: it reads chat.db natively, has zero CDP references, and its only crate-internal dependency is core_rpc. cdp/ itself stays — after this its only consumers are the Meet stack (meet_scanner, meet_audio, meet_video), removed in PR 2 of 3. i18n keys and user-facing provider copy are deliberately left in place; they are split and removed in PR 3 pending the tinyhumansai#5423 decision on whether users with a connected web app get a removal notice.
|
@coderabbitai review |
|
|
Caution Review failedThe pull request is closed. ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (1)
📝 WalkthroughWalkthroughThe change removes CDP-based provider scanners, account webview infrastructure, and related Tauri wiring. It simplifies teardown, retains label-based CDP compatibility APIs, preserves iMessage scanner shutdown, and updates documentation and IPC tests. ChangesCDP and scanner removal
Estimated code review effort: 4 (Complex) | ~60 minutes Possibly related PRs
Suggested labels: Suggested reviewers: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src-tauri/src/lib.rs`:
- Around line 1643-1646: Update shutdown_imessage_scanner to emit privacy-safe
[imessage] logs on entry, registry-present and registry-absent branches, the
shutdown call, and completion. Add unit tests covering both
ScannerRegistry-present and ScannerRegistry-absent paths, including the
observable shutdown behavior and log-relevant branch execution.
🪄 Autofix
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 8f4ee4ff-6793-40ed-8625-39efdb2f00b0
📒 Files selected for processing (42)
AGENTS.mdapp/src-tauri/src/cdp/conn.rsapp/src-tauri/src/cdp/in_process.rsapp/src-tauri/src/cdp/mod.rsapp/src-tauri/src/cdp/session.rsapp/src-tauri/src/cdp/snapshot.rsapp/src-tauri/src/cdp/target.rsapp/src-tauri/src/discord_scanner/dom_snapshot.rsapp/src-tauri/src/discord_scanner/mod.rsapp/src-tauri/src/discord_scanner/mod_tests.rsapp/src-tauri/src/gmessages_scanner/cdp_walk.rsapp/src-tauri/src/gmessages_scanner/idb.rsapp/src-tauri/src/gmessages_scanner/mod.rsapp/src-tauri/src/lib.rsapp/src-tauri/src/lib_tests.rsapp/src-tauri/src/meet_audio/mod.rsapp/src-tauri/src/slack_scanner/dom_snapshot.rsapp/src-tauri/src/slack_scanner/extract.rsapp/src-tauri/src/slack_scanner/idb.rsapp/src-tauri/src/slack_scanner/mod.rsapp/src-tauri/src/telegram_scanner/dom_snapshot.rsapp/src-tauri/src/telegram_scanner/extract.rsapp/src-tauri/src/telegram_scanner/idb.rsapp/src-tauri/src/telegram_scanner/mod.rsapp/src-tauri/src/webview_accounts/mod.rsapp/src-tauri/src/webview_accounts/mod_tests.rsapp/src-tauri/src/webview_accounts/runtime.jsapp/src-tauri/src/wechat_scanner/dom_snapshot.rsapp/src-tauri/src/wechat_scanner/mod.rsapp/src-tauri/src/whatsapp_scanner/dom_snapshot.rsapp/src-tauri/src/whatsapp_scanner/dom_snapshot_tests.rsapp/src-tauri/src/whatsapp_scanner/idb.rsapp/src-tauri/src/whatsapp_scanner/idb_tests.rsapp/src-tauri/src/whatsapp_scanner/mod.rsapp/src-tauri/src/whatsapp_scanner/mod_tests.rsapp/src-tauri/src/whatsapp_scanner/test_fixtures/dom_snapshot_2026_05.jsonapp/src/utils/tauriCommands/common.test.tssrc/openhuman/channels/mod.rssrc/openhuman/channels/webview_accounts/README.mdsrc/openhuman/channels/webview_accounts/mod.rssrc/openhuman/channels/webview_accounts/wechat_ingest.rssrc/openhuman/channels/webview_accounts/wechat_ingest_tests.rs
💤 Files with no reviewable changes (33)
- app/src-tauri/src/slack_scanner/extract.rs
- app/src-tauri/src/webview_accounts/mod_tests.rs
- app/src-tauri/src/whatsapp_scanner/test_fixtures/dom_snapshot_2026_05.json
- src/openhuman/channels/mod.rs
- app/src-tauri/src/slack_scanner/dom_snapshot.rs
- app/src-tauri/src/gmessages_scanner/idb.rs
- app/src-tauri/src/telegram_scanner/mod.rs
- app/src-tauri/src/discord_scanner/mod.rs
- app/src-tauri/src/wechat_scanner/mod.rs
- app/src-tauri/src/whatsapp_scanner/dom_snapshot_tests.rs
- app/src-tauri/src/lib_tests.rs
- src/openhuman/channels/webview_accounts/wechat_ingest_tests.rs
- app/src-tauri/src/slack_scanner/mod.rs
- app/src-tauri/src/discord_scanner/dom_snapshot.rs
- app/src-tauri/src/telegram_scanner/idb.rs
- src/openhuman/channels/webview_accounts/mod.rs
- src/openhuman/channels/webview_accounts/wechat_ingest.rs
- src/openhuman/channels/webview_accounts/README.md
- app/src-tauri/src/telegram_scanner/extract.rs
- app/src-tauri/src/wechat_scanner/dom_snapshot.rs
- app/src-tauri/src/whatsapp_scanner/idb_tests.rs
- app/src-tauri/src/webview_accounts/runtime.js
- app/src-tauri/src/cdp/session.rs
- app/src-tauri/src/whatsapp_scanner/mod.rs
- app/src-tauri/src/slack_scanner/idb.rs
- app/src-tauri/src/gmessages_scanner/cdp_walk.rs
- app/src-tauri/src/whatsapp_scanner/dom_snapshot.rs
- app/src-tauri/src/telegram_scanner/dom_snapshot.rs
- app/src-tauri/src/whatsapp_scanner/mod_tests.rs
- app/src-tauri/src/whatsapp_scanner/idb.rs
- app/src-tauri/src/gmessages_scanner/mod.rs
- app/src-tauri/src/cdp/snapshot.rs
- app/src-tauri/src/discord_scanner/mod_tests.rs
| fn shutdown_imessage_scanner<R: tauri::Runtime>(app: &AppHandle<R>) { | ||
| if let Some(registry) = app.try_state::<std::sync::Arc<imessage_scanner::ScannerRegistry>>() { | ||
| registry.inner().shutdown(); | ||
| } |
There was a problem hiding this comment.
📐 Maintainability & Code Quality | 🟠 Major | ⚡ Quick win
Add logs and tests for iMessage scanner shutdown.
Add privacy-safe [imessage] logs for shutdown entry, the registry-present and registry-absent branches, and completion. The enclosing [app] logs cannot show whether this scanner shutdown ran.
Add unit coverage for both registry states. This teardown behavior must remain observable and tested.
As per coding guidelines, “New or changed flows must log entry/exit, branches, external calls, retries/timeouts, state transitions, and errors with stable grep-friendly prefixes” and “Untested code is incomplete; add unit tests for new or changed behavior.”
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@app/src-tauri/src/lib.rs` around lines 1643 - 1646, Update
shutdown_imessage_scanner to emit privacy-safe [imessage] logs on entry,
registry-present and registry-absent branches, the shutdown call, and
completion. Add unit tests covering both ScannerRegistry-present and
ScannerRegistry-absent paths, including the observable shutdown behavior and
log-relevant branch execution.
Source: Coding guidelines
…ners\n\nrefactor(scanners): remove the CDP webview-account surface (1/3 for tinyhumansai#5478)\n
Summary
webview_accountssurface they ran inside — 17,430 lines.webview_account_*IPC commands, so the shell stops exposing commands whose implementation is gone.imessage_scanneris byte-for-byte untouched and still registered — it readschat.dbnatively and has zero CDP references.Problem
CDP (Chrome DevTools Protocol) only exists where the webview engine is Chromium. #5456 replaced CEF with upstream Tauri's Wry, so the engine is now WKWebView on macOS and WebKitGTK on Linux — neither speaks CDP.
app/src-tauri/src/cdp/in_process.rsis a permanent error stub:install_for_labelalways returnsErr,set_cef_app_handleis a no-op, andCdpRegistry's map is never written. Every scanner bottoms out there.How it got here was a merge-ordering accident. #5457 deleted the embedded webview-account surface; #5456 branched before that commit and merged after it, and the conflict resolution
b3d861d06restored 6,659 lines — the Rust half only. The frontend half stayed deleted.So nothing here is user-reachable.
SidebarAppRail,WebviewHostandwebviewAccountServiceare gone fromapp/src;Accounts.tsxis down to 95 lines with no webview references; and the scanners were reached only fromwebview_accounts/mod.rs. The four remainingwebview_account_opencall sites inlib.rswere all dev-only env-var conveniences (OPENHUMAN_DEV_AUTO_WHATSAPP,_SLACK,_TELEGRAM,_GOOGLE_MEET). This PR removes an orphaned implementation.Solution
Deleted:
whatsapp/discord/slack/telegram/gmessages/wechat_scanner/app/src-tauri/src/webview_accounts/src/openhuman/channels/webview_accounts/app/src-tauri/src/cdp/{session,snapshot}.rsAlso removed: the CEF cold-start prewarm (
CEF_PREWARM_LABEL,spawn_cef_prewarm,teardown_cef_prewarm,cef_prewarm_enabled+ its 54 lines of tests) and theclose_early_cef_webviews/pending_cef_webview_labels/wait_for_cef_webviews_to_close_asyncdrain machinery. Its only two producers were the prewarm webview andwebview_accounts::shutdown_all; with both gone it drained an always-empty list.src/openhuman/channels/webview_accounts/was WeChat ingest normalisation whose only producer waswechat_scanner. It already had zero other consumers —grep -rn webview_accounts src/returned exactly one hit, its ownpub modline.Deviations from the three-PR split, and why each is forced
1.
meet_scanneris NOT in this PR (it moves to PR 2 with the rest of the Meet stack). It is inside the Meet dependency cycle, not the account-scanner group:meet_call/mod.rs:48isuse crate::meet_scanner;and callsmeet_scanner::spawn(...)at:251, whilemeet_scanneritself referencescrate::meet_call. Deleting it here would breakmeet_call's compile. It has 0 references towebview_accounts, so it does not belong to this PR's surface either.2.
cdp/session.rsandcdp/snapshot.rsARE in this PR, thoughcdp/is otherwise PR 3's.cdp/session.rs:29isuse crate::webview_accounts::{emit_load_finished, redact_url_for_log, RevealTrigger};— it cannot compile oncewebview_accountsis gone. Its own doc-comment describes it as "Per-account CDP session opener. One long-lived task per webview account", andsnapshot.rsis the DOM parser only the deleted scanners called. Both have zero other consumers. They are the webview-account half ofcdp/, not the transport.What survives in
cdp/, and why that matters for PR 3Each
cdp/mod.rsre-export was traced individually rather than trusting the module boundary. Consumers outsidecdp/after this PR:spawn_session,SpawnedSession,placeholder_marker,placeholder_url,target_url_fragment,Snapshot,detach_session,find_page_target_where,install_for_account,conn_for_account,connect_and_attach_matching_in_process→ 0 consumers, all removed.CdpConn→ 5 files, all Meet (meet_scanner,meet_video/inject,meet_audio/{caption_listener,speak_pump,inject}).install_for_label,set_cef_app_handle,CdpRegistry→ Meet pluslib.rs.After this PR,
cdp/'s only consumer is the Meet stack. PR 2 removes that; PR 3 can then deletecdp/outright.cdp/mod.rscarries a scoped#![allow(dead_code)]referencing PR 3: Meet uses a narrow slice of the transport, and pruning the rest would be churn that PR 3 deletes anyway. The module carried the same allow before #5456 removed it.Deliberately not done here
app/src/lib/webviewNotifications/is now orphaned — zero importers, and this PR deletes the Rust code that emitted its event — but removing it reaches intoaccountsSlicefunctions that still serve the live channel-accounts surface. Filed as Remove the orphaned webviewNotifications frontend module #5481 rather than bundled here.Submission Checklist
cef_prewarm_enabledtests inlib_tests.rswhose subject is gone, and retargeted twocommon.test.tsIPC fixtures (below). No new behaviour to cover.N/A: behaviour-only removal, no feature rows added/removed/renamed.N/A: no feature IDs.N/A: nothing removed here was reachable from the shipped UI, so no smoke step changes. (PR 2 does touch a reachable surface and will say so.)Closes #NNN— deliberately not closing Remove the CDP layer and every surface that depends on it #5478 here;Closesgoes on PR 3, the last of the stack.Impact
Desktop only. No runtime behaviour changes for any user: every surface removed was either unreachable from the UI or guaranteed to fail with
"CDP is unavailable with the upstream Tauri WebView runtime".The one externally-visible change is that 15
webview_account_*IPC commands are no longer registered. Any caller would previously have received a runtime error from the stub; it now gets an unknown-command error instead. There are no callers left inapp/src.No migration. No security or compatibility implications — this removes an automation path that drove logged-in web sessions, it does not add one.
Related
cdp/itself, the dead E2E scaffolding, the AGENTS.md rule and the i18n split, and carriesCloses #5478.webviewNotificationsfrontend module)b3d861d06(the merge resolution that restored the Rust half)AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
remove/cdp-1-scannersa11bde26a68f2b1730acdeca2552cc778168b63bValidation Run
pnpm --filter openhuman-app format:check— not run.node_modulesis not installed in this clone and the only frontend change is a 5-string fixture swap in a test file; CI covers it.pnpm typecheck— not run, same reason.app/src/utils/tauriCommands/common.test.tsfromwebview_account_hide/webview_account_revealtomascot_window_hide/mascot_window_show(really registered atlib.rs:1176,1191). Theinvokeis mocked, so the assertions are unchanged and pass either way; the fixtures simply no longer name deleted commands.cargo fmt --all -- --checkclean in both Cargo worlds.cargo check -p openhuman --tests→ 0 errors.cargo check --no-default-features→ 0 errors (channels-OFF, checked because the core-side deletion was#[cfg(feature = "channels")]).cargo check --manifest-path app/src-tauri/Cargo.toml --all-targets→ 0 errors.--all-targetsdeliberately, solib_tests.rscompiles — a lib-only check would not have caught the removed prewarm tests.Warnings: zero new ones. The core's warning set was diffed against a stashed baseline — empty delta. The Tauri shell emits one warning,
unused import: std::fsatprocess_recovery.rs:14, verified pre-existing onmainand left alone.Validation Blocked
command:pnpm test/pnpm typecheckerror:not attempted —node_modulesabsent in this cloneimpact:limited to the 5-string test-fixture swap described above; CI's frontend lane covers it.Behavior Changes
"CDP is unavailable with the upstream Tauri WebView runtime".Parity Contract
imessage_scanner— zero-line diff, still registered (module declaration, managed state,shutdown_imessage_scanner, both teardown call sites, tick registration).grep -c "webview_account_" app/src-tauri/src/lib.rs→ 0. Repo-wide code references to the deleted modules → 0.Duplicate / Superseded PR Handling
Summary by CodeRabbit
Removed Features
Maintenance