Skip to content

Let haru open on Windows again, and say why when it cannot - #5

Merged
beingsuz merged 2 commits into
mainfrom
claude/project-thread-0i0dc9
Sep 26, 2026
Merged

beingsuz merged 2 commits into
mainfrom
claude/project-thread-0i0dc9

Conversation

@beingsuz

@beingsuz beingsuz commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Requested by beingsuz · project thread

Before: on Windows, haru from main (the v0.7.0 draft) does nothing when opened. No window and no error appear.

After: the window opens again. If haru ever cannot open it, or crashes, a message box says why and where the details were saved (%LOCALAPPDATA%\haru\haru.log). Re-running Release for the v0.7.0 draft now also moves the draft's tag target to the commit the new binaries were built from.

The cause was my change in #3. It restricted wgpu to DX12 on Windows, but eframe builds wgpu without its DX12 backend (cargo tree -e features -i wgpu-core --target x86_64-pc-windows-msvc lists only vulkan and gles). That left no backend at all, so creating the surface failed and run_native returned an error. main printed that error to stderr, which a windows_subsystem = "windows" build does not have.

How:

  • Backend. The backend is wgpu's own choice again: Vulkan, then OpenGL, with WGPU_BACKEND still overriding it. That is what v0.6.5 used. The opaque window and vsync from Fix the Windows port, offer the beta at install, and install WebView2 for web wallpapers #3 stay.
  • Startup errors. Every way main gives up now goes through a new failure module. It still prints to stderr, appends to haru.log in haru's data folder, and on Windows shows a message box through rfd, a Windows-only dependency. haru's unsafe_code = "forbid" stays, which rules out calling MessageBoxW directly.
  • Crashes. A panic hook logs every panic. A panic that ends the event loop is caught around run_native and shown once the window is gone. Showing it from inside the hook would mean running a modal loop while winit unwinds.
  • Release workflow. When the version's release already exists as a draft, the update path now passes --target "$GITHUB_SHA" to gh release edit. A draft has no tag until Publish, which makes the tag from the draft's target. Without this, publishing the rebuilt v0.7.0 would tag the pre-fix commit while shipping post-fix binaries. Published releases are untouched.

How it was tested

Run under Wine 9.0 on a virtual X display, with both builds cross-compiled with mingw (x86_64-pc-windows-gnu):

Build Result
main Exits with code 1 in about a second. The only output is WGPU error: Failed to create surface for any enabled backend: {} on stderr, which Windows discards. This reproduces the report.
This branch The window opens and draws, showing the install-kirie prompt with the WebView2 and beta checkboxes.
This branch with WGPU_BACKEND=dx12 (forcing the old failure) An error box says haru could not find a graphics driver it can draw with. The same text lands in haru.log.
This branch with a temporary panic! in app setup (not committed) The panic comes out of winit and run_native and shows in a box as "haru crashed in thread main: panicked at …". It is also logged.

Also: cargo fmt --all --check, cargo clippy --workspace --all-targets -- -D warnings (Linux and x86_64-pc-windows-gnu) and cargo test --workspace are clean, with 172 tests. The release workflow parses as YAML. Its changed branch runs only on a real release run.

Not tested: a real Windows machine and the MSVC release build. Wine drew through OpenGL on a software renderer, so the Vulkan path a real GPU will take was not exercised. It is the same path v0.6.5 used.

🤖 Generated with Claude Code

https://claude.ai/code/session_01QJnt7JtdtiqnVCP9GYqUhK

The last release asked wgpu for DX12 alone on Windows. eframe builds wgpu
without its DX12 backend, so that left no backend at all: creating the
surface failed, run_native returned an error, and main printed it to a
stderr that a windows-subsystem build does not have. Double-clicking haru
did nothing. Running both builds under Wine shows it: main exits with
"Failed to create surface for any enabled backend", this opens the window.

The backend is wgpu's own choice again (Vulkan, then OpenGL, with
WGPU_BACKEND still overriding it), as it was in v0.6.5. The opaque window
and vsync from the same change stay.

Every way main gives up now goes through failure::report, which still
prints, appends to haru.log in haru's data folder, and on Windows shows a
message box through rfd. Panics are logged by a hook, and one that ends
the event loop is caught around run_native and shown after the window is
gone, so a crash is no longer silent either.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJnt7JtdtiqnVCP9GYqUhK
@coderabbitai

coderabbitai Bot commented Sep 26, 2026

Copy link
Copy Markdown

Review in Change Stack →

Navigate logical layers of code changes, visualize relationships, and explore their blast radius.

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Advanced

Run ID: 8cccc491-f48a-450a-8b68-f79827d524e2

📥 Commits

Reviewing files that changed from the base of the PR and between f620642 and 57aa01a.

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (4)
  • Cargo.toml
  • crates/haru/Cargo.toml
  • crates/haru/src/failure.rs
  • crates/haru/src/main.rs
 ________________________________________________________
< A spoonful of AI helps the bitter code review go down. >
 --------------------------------------------------------
  \
   \   (\__/)
       (•ㅅ•)
       /   づ
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR

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.

Re-running Release for a version whose draft already exists replaced the
binaries but left the draft's target where the first run put it. A draft
has no tag until Publish, which makes it from that target, so publishing
a rebuilt draft would tag the commit before the change while shipping
binaries built after it, and the next changelog would list the change
again. The update path now sets --target to the commit being built
whenever the release is still a draft. Published releases are untouched.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QJnt7JtdtiqnVCP9GYqUhK
@beingsuz
beingsuz merged commit 28ce3a6 into main Sep 26, 2026
2 checks passed
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.

2 participants