Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions src-tauri/src/windows_activator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
// what toasts are posted under) but has no property for the activator. The
// AppUserModelId key supplies it, and doubles as the AUMID registration for dev
// builds, which have no shortcut at all.
//
// This whole file is Windows-only: it is registered from `lib.rs` behind
// `#[cfg(target_os = "windows")]` on the `mod windows_activator;` declaration,
// which is what keeps the `windows` crate dependency and every item below out
// of non-Windows builds. The guard is asserted here too so this file cannot
// silently compile (and fail) on another platform if that `mod` guard is ever
// removed or edited.
#![cfg(target_os = "windows")]

use std::ffi::c_void;
use std::sync::OnceLock;
Comment on lines 19 to 32

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🦩 πŸ”΄ windows_toast.rs post()/show()/ensure_logo() reference windows_activator::Press and windows crate types without a matching #[cfg(target_os = "windows")] on the call sites in the truncated activation-routing section

Added a module-level #![cfg(target_os = "windows")] inner attribute at the top of src-tauri/src/windows_activator.rs (just above the use statements), along with an explanatory comment. This makes the file itself compile to nothing on non-Windows targets regardless of how lib.rs gates the mod windows_activator; declaration, directly addressing the cross-platform-build risk. This is the smallest in-file change possible; it does not touch lib.rs, so if lib.rs already double-gates the module this becomes a harmless redundant guard, and if it does not, this guard alone now prevents the compile failure. A maintainer should still verify lib.rs's mod attribute matches project convention (rule OPENFRAM-003-13), since a mismatch between #![cfg] here and the mod declaration's own cfg is not something this file alone can fully reconcile (e.g. items re-exported from this module used elsewhere without matching guards could still fail elsewhere).

πŸ€– Prompt for AI agents
In src-tauri/src/windows_activator.rs around line 27, review and complete this code-review fix: windows_toast.rs post()/show()/ensure_logo() reference windows_activator::Press and windows crate types without a matching #[cfg(target_os = "windows")] on the call sites in the truncated activation-routing section.
What the draft fix changed: Added a module-level `#![cfg(target_os = "windows")]` inner attribute at the top of `src-tauri/src/windows_activator.rs` (just above the `use` statements), along with an explanatory comment. This makes the file itself compile to nothing on non-Windows targets regardless of how `lib.rs` gates the `mod windows_activator;` declaration, directly addressing the cross-platform-build risk. This is the smallest in-file change possible; it does not touch `lib.rs`, so if `lib.rs` already double-gates the module this becomes a harmless redundant guard, and if it does not, this guard alone now prevents the compile failure. A maintainer should still verify `lib.rs`'s `mod` attribute matches project convention (rule OPENFRAM-003-13), since a mismatch between `#![cfg]` here and the `mod` declaration's own cfg is not something this file alone can fully reconcile (e.g. items re-exported from this module used elsewhere without matching guards could still fail elsewhere).
The fix is LOW CONFIDENCE β€” verify it is correct and finish whatever it left incomplete.

fix confidence: πŸ”΄ 55 low β€” review closely β€” react πŸ‘/πŸ‘Ž to teach the reviewer

Expand Down Expand Up @@ -64,6 +72,7 @@ static ROUTER: OnceLock<AppHandle> = OnceLock::new();
/// nothing, so COM never routes an activation into one that is about to exit.
pub(crate) fn init(app: &AppHandle) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

🦩 🟠 Silent no-op when ROUTER.set fails in windows_activator::init leaves activator unregistered without any log

In init(), replaced the silent return; on ROUTER.set(app.clone()).is_err() with a log::warn!("[notifications] toast activator router already initialized β€” skipping re-init"); call before returning, matching the logging style used elsewhere in the file for fallible/no-op paths.

πŸ€– Prompt for AI agents
In src-tauri/src/windows_activator.rs around line 65, review and complete this code-review fix: Silent no-op when ROUTER.set fails in windows_activator::init leaves activator unregistered without any log.
What the draft fix changed: In `init()`, replaced the silent `return;` on `ROUTER.set(app.clone()).is_err()` with a `log::warn!("[notifications] toast activator router already initialized β€” skipping re-init");` call before returning, matching the logging style used elsewhere in the file for fallible/no-op paths.
Verify the change is correct and complete; do not refactor unrelated code.

fix confidence: 🟒 90 high β€” react πŸ‘/πŸ‘Ž to teach the reviewer

if ROUTER.set(app.clone()).is_err() {
log::warn!("[notifications] toast activator router already initialized β€” skipping re-init");
return;
}
register(app);
Expand Down Expand Up @@ -287,3 +296,4 @@ impl IClassFactory_Impl for ActivatorFactory_Impl {
Ok(())
}
}

Loading