Skip to content

test (desktop): added logs for release testing on white screening#763

Merged
AviPeltz merged 2 commits into
mainfrom
testttttt
Jan 15, 2026
Merged

test (desktop): added logs for release testing on white screening#763
AviPeltz merged 2 commits into
mainfrom
testttttt

Conversation

@AviPeltz
Copy link
Copy Markdown
Collaborator

@AviPeltz AviPeltz commented Jan 15, 2026

Description

Related Issues

Type of Change

  • Bug fix
  • New feature
  • Documentation
  • Refactor
  • Other (please describe):

Testing

Screenshots (if applicable)

Additional Notes

Summary by CodeRabbit

  • Bug Fixes
    • Enhanced error handling and surfaced load failures in both development and production launch paths.
    • Broadened filename handling for cross-platform URL resolution to reduce load errors.
    • Added detailed logging around protocol handling and renderer lifecycle (load success/failure, crashes, preload issues) and ensured windows are shown when renderer errors occur.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Jan 15, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Added diagnostic logging and explicit error handling for window loading, custom protocol requests, and renderer lifecycle events; made production filename extraction cross-platform.

Changes

Cohort / File(s) Summary
Window Loader
apps/desktop/src/lib/window-loader.ts
Wrapped loadURL() calls with catch handlers; added console logs for dev and prod paths; replaced brittle filename split with cross-platform extraction; logged produced URLs and attempted HTML file paths.
Protocol Registration & Request Handling
apps/desktop/src/main/index.ts
Added diagnostic logs around custom protocol registration and per-request handling in non-dev mode (protocol scheme, __dirname, renderer path, request URL, pathname, resolved file path). Core handler logic unchanged.
Renderer Lifecycle Monitoring
apps/desktop/src/main/windows/main.ts
Added listeners and logs for did-finish-load, did-fail-load, render-process-gone, and preload-error; ensure window visibility on load failure and surface error details (codes, descriptions, URLs, preload path).

Sequence Diagram(s)

sequenceDiagram
  autonumber
  Participant AppMain as Main Process
  Participant Protocol as Custom Protocol Handler
  Participant FS as File System
  Participant BrowserWin as BrowserWindow (Renderer)

  AppMain->>Protocol: register protocol (non-dev)
  Note right of Protocol: logs protocol scheme, paths
  BrowserWin->>AppMain: request URL (via protocol)
  Protocol->>FS: resolve pathname -> file path
  Protocol-->>AppMain: return file path (served)
  AppMain->>BrowserWin: loadURL(resolved URL)
  BrowserWin-->>AppMain: did-finish-load / did-fail-load / render-process-gone / preload-error
  Note left of AppMain: logs details and ensures window shown on failures
Loading

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐇 I hopped through code, found paths astray,
I logged each step to light the way,
When loads may fail or renderers sigh,
I cheerfully note the where and why,
Debug carrots left—no bug shall stay.

🚥 Pre-merge checks | ✅ 1 | ❌ 2
❌ Failed checks (2 warnings)
Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely empty with only the template structure and 'Bug fix' checkbox marked. Required sections like Description, Related Issues, and Testing lack substantive content. Add a detailed description of the changes, link any related issues, and describe testing performed to verify the white screen logging improvements.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (1 passed)
Check name Status Explanation
Title check ✅ Passed The title 'fix (desktop): added logs for release testing on white screening' directly describes the main change—adding logging for debugging white screen issues in the desktop app during release testing.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4e41bf4 and 2632556.

📒 Files selected for processing (1)
  • apps/desktop/src/lib/window-loader.ts

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In `@apps/desktop/src/lib/window-loader.ts`:
- Line 1: Remove the Node.js path import and replace the use of path.basename in
window-loader.ts: instead of importing "node:path" and calling
path.basename(props.htmlFile), compute the file name from props.htmlFile using a
split on both slashes (e.g., split on /[/\\]/ and take the last element) and
fallback to "index.html" if empty; update any references to the old variable
(e.g., fileName) accordingly and delete the import line.
🧹 Nitpick comments (1)
apps/desktop/src/main/index.ts (1)

229-231: Consider removing or reducing verbosity of per-request logging.

Logging every protocol request may generate excessive noise in production. These logs are helpful for debugging but could clutter logs during normal operation, especially if resources like images or fonts are loaded repeatedly.

Consider either:

  1. Removing these per-request logs before release (since they're for "release testing" per PR title)
  2. Gating them behind a debug flag or environment variable
💡 Optional: Gate verbose logging
+const DEBUG_PROTOCOL = process.env.DEBUG_PROTOCOL === "true";
+
 protocol.handle(PROTOCOL_SCHEME, (request) => {
   const parsedUrl = new URL(request.url);
   const pathname = parsedUrl.pathname;
   const filePath = path.normalize(
     path.join(__dirname, "../renderer", pathname),
   );
-  console.log(`[protocol] Request: ${request.url}`);
-  console.log(`[protocol] Pathname: ${pathname}`);
-  console.log(`[protocol] Resolved file path: ${filePath}`);
+  if (DEBUG_PROTOCOL) {
+    console.log(`[protocol] Request: ${request.url}`);
+    console.log(`[protocol] Pathname: ${pathname}`);
+    console.log(`[protocol] Resolved file path: ${filePath}`);
+  }
   return net.fetch(`file://${filePath}`);
 });
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cfd3b06 and 4e41bf4.

📒 Files selected for processing (3)
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
  • apps/desktop/src/main/windows/main.ts
🧰 Additional context used
📓 Path-based instructions (6)
apps/desktop/**/*.{ts,tsx}

📄 CodeRabbit inference engine (apps/desktop/AGENTS.md)

apps/desktop/**/*.{ts,tsx}: For Electron interprocess communication, ALWAYS use tRPC as defined in src/lib/trpc
Use alias as defined in tsconfig.json when possible
Prefer zustand for state management if it makes sense. Do not use effect unless absolutely necessary.
For tRPC subscriptions with trpc-electron, ALWAYS use the observable pattern from @trpc/server/observable instead of async generators, as the library explicitly checks isObservable(result) and throws an error otherwise

Files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

**/*.{ts,tsx}: Use object parameters for functions with 2+ parameters instead of positional arguments
Functions with 2+ parameters should accept a single params object with named properties for self-documentation and extensibility
Use prefixed console logging with context pattern: [domain/operation] message
Extract magic numbers and hardcoded values to named constants at module top
Use lookup objects/maps instead of repeated if (type === ...) conditionals
Avoid using any type - maintain type safety in TypeScript code
Never swallow errors silently - at minimum log them with context
Import from concrete files directly when possible - avoid barrel file abuse that creates circular dependencies
Avoid deep nesting (4+ levels) - use early returns, extract functions, and invert conditions
Use named properties in options objects instead of boolean parameters to avoid boolean blindness

Files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
apps/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Drizzle ORM for all database operations - never use raw SQL

Files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use Biome for formatting and linting - run at root level with bun run lint:fix or biome check --write

Files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
apps/desktop/src/lib/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Never import Node.js modules in shared code like electron-router-dom.ts - it runs in both main and renderer processes

Files:

  • apps/desktop/src/lib/window-loader.ts
apps/desktop/src/main/index.ts

📄 CodeRabbit inference engine (AGENTS.md)

Load environment variables from monorepo root .env in desktop app with override: true before any imports in src/main/index.ts and electron.vite.config.ts

Files:

  • apps/desktop/src/main/index.ts
🧠 Learnings (4)
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/desktop/src/renderer/**/*.{ts,tsx} : Never import Node.js modules (fs, path, os, net) in renderer process or shared code - they are externalized for browser compatibility

Applied to files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/desktop/src/lib/electron-router-dom.ts : Do not import Node.js modules like node:path or dotenv in electron-router-dom.ts and similar shared files - they run in both main and renderer processes

Applied to files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
📚 Learning: 2026-01-02T06:50:28.671Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-02T06:50:28.671Z
Learning: Applies to apps/desktop/src/lib/*.ts : Never import Node.js modules in shared code like electron-router-dom.ts - it runs in both main and renderer processes

Applied to files:

  • apps/desktop/src/main/windows/main.ts
  • apps/desktop/src/lib/window-loader.ts
  • apps/desktop/src/main/index.ts
📚 Learning: 2025-12-21T04:39:28.543Z
Learnt from: CR
Repo: superset-sh/superset PR: 0
File: apps/desktop/AGENTS.md:0-0
Timestamp: 2025-12-21T04:39:28.543Z
Learning: Applies to apps/desktop/**/*.{ts,tsx} : For Electron interprocess communication, ALWAYS use tRPC as defined in `src/lib/trpc`

Applied to files:

  • apps/desktop/src/lib/window-loader.ts
🧬 Code graph analysis (2)
apps/desktop/src/lib/window-loader.ts (1)
apps/desktop/src/shared/constants.ts (1)
  • PROTOCOL_SCHEME (30-31)
apps/desktop/src/main/index.ts (1)
apps/desktop/src/shared/constants.ts (1)
  • PROTOCOL_SCHEME (30-31)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
  • GitHub Check: Build
🔇 Additional comments (7)
apps/desktop/src/main/windows/main.ts (4)

173-180: LGTM!

The success log and window show logic are appropriate. The log follows the prefixed [main-window] pattern per coding guidelines.


182-192: LGTM!

Good error handling that logs all relevant details (error code, description, URL) and ensures the window is shown so the user isn't left with a blank screen. This aligns well with the PR's goal of diagnosing white screen issues.


194-196: LGTM!

Logging renderer process crashes will help diagnose unexpected terminations. The details object from Electron includes reason and exitCode which are useful for debugging.


198-202: LGTM!

Preload script errors are a common source of white screen issues, so this logging is valuable for the stated PR objective.

apps/desktop/src/main/index.ts (1)

214-220: LGTM!

These startup logs will help diagnose path resolution issues in packaged builds. The [main] prefix follows coding guidelines.

apps/desktop/src/lib/window-loader.ts (2)

25-31: LGTM!

Good addition of error handling on loadURL. The .catch() ensures load failures are logged rather than silently swallowed, which aligns with coding guidelines.


35-43: Good cross-platform fix with path.basename.

Using path.basename instead of string splitting handles Windows backslash paths correctly. The error logging on load failure is valuable for diagnosing white screen issues.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment thread apps/desktop/src/lib/window-loader.ts Outdated
@AviPeltz AviPeltz changed the title fix (desktop): added logs for release testing on white screening test (desktop): added logs for release testing on white screening Jan 15, 2026
@AviPeltz AviPeltz merged commit 719d72b into main Jan 15, 2026
4 of 5 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Preview Cleanup Complete

The following preview resources have been cleaned up:

  • ✅ Neon database branch
  • ⚠️ Electric Fly.io app

Thank you for your contribution! 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant