Repository navigation
feat(desktop): route main process warnings into the session log - #2205
Conversation
- New warnMain() helper writes to stderr and sessionLog.append('main', …)
in one call, reusing the supervisor note() shape.
- All five stderr-only sites now use it: locale/theme/window-state pref
save failures, onSidecarCrash, and the startup failure.
- The startup failure also goes through the helper: one way to log, and
the log line is harmless (no window exists to read it when startup fails).
- issue-reports.md lists 'main' among the log sources; Known gaps line deleted.
Fixes MODSetter#1960
|
@Ehaan-Dadarkar is attempting to deploy a commit to the Rohan Verma's projects Team on Vercel. A member of the Team first needs to authorize it. |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (7)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughMain-process warnings now use a shared helper that writes to stderr and the session log. Locale, theme, and window-state save failures, sidecar crashes, and startup failures use this helper. The architecture documentation now lists main-process warnings as a session-log source. ChangesMain-process warning logging
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix · Severity of issue fixed: Low Merge Risk: ⚪ Minimal · up to The warning-routing change is ready to merge with no identified actionable risk. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to Warnings can now appear in issue reports. Logs are not uploaded automatically, and users can exclude or edit them before sharing. Home-directory redaction remains in place, but it does not guarantee removal of every sensitive detail from error messages. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 14.29% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 7 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
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 |
|
Merged into
|
What
warnMain()helper (electron/src/main/session-log/main-warn.ts) writes toprocess.stderrandsessionLog.append('main', …)in one call, reusing the supervisor'snote()shape.onSidecarCrash, and the startup failure inindex.ts.[main]prefixes are gone from the call sites; the log'ssourceargument carries it instead.docs/architecture/issue-reports.mdlistsmainamong the log's sources; the Known gaps line is deleted.Why
Fixes #1960. The session log is meant to be "what this run of the app has logged", but main's own warnings went to the terminal only — and a packaged app has no terminal, so they went nowhere. These are the one-line warnings that explain puzzling reports (window in the wrong place, theme reverting, language ignored).
Design note
The startup failure also goes through the helper rather than staying on stderr alone: one way to log (two ways is how the next one gets missed), the stderr output is unchanged, and the log line is harmless — no window exists to read it when startup fails.
How to test
New test in
session-log.test.ts: callswarnMainand asserts the line lands inlines()tagged[main]and on stderr with the[main]prefix. 167/167 tests pass, typecheck clean.High-level PR Summary
This PR routes main process warnings into the session log by introducing a
warnMain()helper that writes to bothstderrand the session log simultaneously. Previously, these warnings only went to the terminal (which doesn't exist in packaged apps), causing them to be lost. The changes update five call sites (locale/theme/window-state preference save failures, sidecar crashes, and startup failures) to use this new helper, removing hand-written[main]prefixes in favor of a structuredsourceargument.⏱️ Estimated Review Time: 5-15 minutes
💡 Review Order Suggestion
surfsense_local/electron/src/main/session-log/main-warn.tssurfsense_local/electron/src/main/session-log/session-log.test.tsdocs/architecture/issue-reports.mdsurfsense_local/electron/src/main/i18n/locale-prefs.tssurfsense_local/electron/src/main/theme-prefs.tssurfsense_local/electron/src/main/window-state.tssurfsense_local/electron/src/main/index.tsSummary by CodeRabbit