fix(desktop): gate notification content on Runtime Host privacy policy #5002
All Vouch review confidence checks passed
Residual risk 0.33 = Change Risk (0.59) × (1 − Review Confidence (0.45)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.59 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.02 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.344
Real PR Conversation Timeline
1 comments
"Review active on #5002"
general
weight: 0.35
Adarsh-Me
Summary
Fixes #4981. The run-ended notification gated content-bearing banners (session name + reply preview, shown outside the app in Notification Center / lock screen) on
settings.privacy.incognitoActive— but the local settings copy never receives privacy updates:clientOwnedSettingsPatchexcludes the section andprojectClientOwnedSettingskeeps the host's copy. After a user enabled incognito, the stale local copy kept readingfalseand the banner kept exposing content.registerNotificationsIpcnow takes a mandatoryprivacyAuthority; the optional local-settings fallback is gone, sosettings.privacy.incognitoActiveis no longer consulted for this decision at all (finding 2 of the automated review). The authority resolves the verdict for the notification's own host only, which is what closes both ⚠️ findings:sessionIdof the run that ended and main derives the owning host from the session key (resolveNotificationHostId, kept beside the rest of the gating logic so it stays unit-testable under plainnode --test). The derivation lives in main on purpose:app-shell.tsxandapp-shell-session-events.tsare frozen entries in the renderer architecture ledger, whose metrics may only shrink.createHostPrivacyAuthoritymatches that host in the desktop manager entries. Areconnectingsource keeps its unknown verdict instead of being filtered out of a ready-only snapshot, so it never answersruntime.policy.queryand the banner is suppressed rather than leaked ([P1]).SESSION_GUEST_OPERATION_GRANTSexcludesruntime.policy.query; one mounted guest can therefore no longer reject the resolution and silence unrelated local notifications ([P2]).Behavior change: a banner whose owning host's verdict cannot be established is now suppressed instead of raised. One consequence is not visible from the diff alone: a session id that is not a Desktop session key carries no host, so it resolves to no authority and also suppresses. If any shipped path still surfaces such an id to
notifyRunEnded, that banner is now dropped rather than shown. All other notification behavior (toggle, window focus, e2e, copy, sanitization) is unchanged.Verification
apps/desktop/src/main/__tests__/notifications-policy.test.ts— 6/6 pass (node --teston the bundled module;esbuild --platform=node --external:electron). Two cases exercise the real adapter shape rather than an injected resolver: reconnectingprivatealongside a ready non-incognitolocal→ suppressed with nothing queried, and readylocalplus a readysharedguest whosequeryRuntimePolicythrows → raised withqueriedexactly['local']. The new case drives the authority from realdesktopSessionKeyoutput and covers legacy / empty / malformed ids resolving to no host.tsc -p tsconfig.preload.json|tsconfig.main.json|tsconfig.renderer.json --noEmitall exit 0;biome checkreports no findings on the changed files.node scripts/check-renderer-architecture.mjs --base <this branch's own base> --strict-basepasses:app-shell-session-events.tsis back to its recorded values exactly, andapp-shell.tsxnow sits below them (nonTriviaTokens13279 → 13274,importSpecifiersback to 100). The ledger in this diff is a pure reduction; moving the best-effort.catchinto the bridge pays for the one field the payload gained.createHostPrivacyAuthoritychanged back to the old fail-open shape (a non-ready source contributes no verdict), the two real-adapter cases go red —scopes the host authority to the notification source hostandattributes a notification to the host that owns its session— 4 pass / 2 fail. The temporary edit was reverted before pushing and the tree verified clean.scripts/check-renderer-architecture.test.mjsfails 1 of 112 here ("attests the canonical main source in the final Vite entry graph"). It fails identically on a cleanorigin/main(0052f1cfd) worktree in the same environment, so it is not caused by this diff; the other 110 pass.AI use
Select exactly one:
Tool(s) and scope: Qoder (AI coding assistant) authored the implementation and the tests on this branch and pushed the commits; the contributor of record directs the work and owns its accuracy, provenance, licensing and the merge decision. The tip commit carries
Generated-by: Qoder (AI assistant), which is what a squash merge retains; the two earlier commits on this branch carry no trailer, so this PR-level statement is the authoritative disclosure for the whole change.Checklist
Does this PR entail a change in behavior?