windows-reactor make callback panics fatal - #4829
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
This PR updates Reactor’s panic contract to treat panics as fatal at WinUI callback boundaries, removing the previous “catch/log/continue” recovery path and the public on_fault API.
Changes:
- Replace panic-catching-and-continuing with
abort_on_panicacross WinUI callback entry points (render loop, event handlers, timers, activation, exit callback). - Remove the
Faulttype,App::on_faultAPI, and theon_faultsample. - Update docs and remove tests that asserted “post-commit effect panics keep the host usable”.
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| docs/crates/windows-reactor.md | Updates documentation to reflect “panic is fatal / abort” contract and adjusts architecture checklist wording. |
| crates/tests/libs/reactor/tests/host_effects.rs | Removes test that expected committed tree to remain usable after an effect panic. |
| crates/tests/libs/reactor/tests/backend_faults.rs | Removes test that expected reconcile to remain usable after a post-commit effect panic. |
| crates/samples/reactor/samples/examples/on_fault.rs | Removes the on_fault sample demonstrating recoverable vs fatal panics. |
| crates/libs/reactor/src/lib.rs | Stops re-exporting Fault from the public API. |
| crates/libs/reactor/src/interaction.rs | Switches event handler invocation to abort-on-panic behavior. |
| crates/libs/reactor/src/host.rs | Switches activation callback handling to abort-on-panic behavior. |
| crates/libs/reactor/src/hooks.rs | Switches timer/rendering callbacks to abort-on-panic behavior. |
| crates/libs/reactor/src/fault.rs | Replaces the handler-based fault boundary with a simpler abort-on-panic boundary plus logging. |
| crates/libs/reactor/src/engine.rs | Wraps render pass in abort-on-panic boundary instead of render-scoped catching. |
| crates/libs/reactor/src/app.rs | Removes App::on_fault and changes callback execution to abort on panics. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
144
to
147
| presenter: PresenterKind, | ||
| backdrop: Option<Backdrop>, | ||
| icon: Option<String>, | ||
| on_fault: Option<Box<dyn Fn(&Fault) + Send>>, | ||
| on_exit: Option<Box<dyn FnOnce() + Send>>, |
Comment on lines
+7
to
13
| /// Run `f` and abort after reporting any panic under `context`. | ||
| pub(crate) fn abort_on_panic<T>(context: &'static str, f: impl FnOnce() -> T) -> T { | ||
| match std::panic::catch_unwind(AssertUnwindSafe(f)) { | ||
| Ok(value) => value, | ||
| Err(payload) => abort(context, &*payload), | ||
| } | ||
| } |
Comment on lines
+21
to
28
| #[cold] | ||
| fn abort(context: &'static str, payload: &(dyn std::any::Any + Send)) -> ! { | ||
| let message = diagnostics::format_panic_payload(payload); | ||
| diagnostics::emit(&format!( | ||
| "windows_reactor: {context} panicked: {message}; aborting" | ||
| )); | ||
| std::process::abort() | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.