{"record":{"id":"db41751e37b9265b","repo":"Hmbown/CodeWhale","slug":"window-pinning-is-only-supported-on-windows","errorCode":null,"errorMessage":"window pinning is only supported on Windows","messagePattern":"window pinning is only supported on Windows","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/tui/window_control.rs","lineNumber":597,"sourceCode":"            drop(state);\n            reader.join().unwrap();\n            assert!(observed.is_ok(), \"rendering waited for the window worker\");\n        }\n\n        #[test]\n        fn headless_dispatch_rejects_before_resolving_or_changing_a_window() {\n            let error = start_toggle(None).unwrap_err();\n            assert!(error.to_string().contains(\"mailbox is unavailable\"));\n        }\n    }\n}\n\n#[cfg(not(windows))]\nmod imp {\n    pub(super) fn start_toggle(\n        _completion_tx: Option<tokio::sync::mpsc::Sender<crate::tui::app::DispatchApplyFn>>,\n    ) -> anyhow::Result<()> {\n        anyhow::bail!(\"window pinning is only supported on Windows\")\n    }\n\n    pub(super) fn pinned() -> bool {\n        false\n    }\n}\n\n/// Whether host-window control is available on this platform.\n/// Only Windows consoles can be driven from inside the TUI.\npub(crate) fn available() -> bool {\n    cfg!(windows)\n}\n\n/// Request a window change without blocking input or claiming it has applied.\n/// Both entry points share the worker and its observed completion receipt.\npub(crate) fn toggle_pin(app: &mut crate::tui::app::App) {\n    if let Err(error) = imp::start_toggle(app.dispatch_completion_tx.clone()) {\n        show_result(app, Err(error));","sourceCodeStart":579,"sourceCodeEnd":615,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/tui/window_control.rs#L579-L615","documentation":"This error is thrown by the non-Windows stub implementation of the window control module. Window pinning (always-on-top / taskbar pin toggle) is implemented only against the Win32 API; on all other platforms `start_toggle` immediately bails with this message instead of performing any operation. It surfaces whenever the pin toggle is invoked on a platform without native support.","triggerScenarios":"Calling `imp::start_toggle` (the pin-toggle dispatch) on any non-Windows platform (Linux, macOS), since the `#[cfg(not(windows))]` stub unconditionally returns this error.","commonSituations":"Running the TUI on Linux or macOS and triggering the window-pin toggle keybinding or command; CI or dev environments on non-Windows hosts exercising the pin feature; a build without the Windows cfg path compiled in.","solutions":["Do not invoke the pin toggle on non-Windows platforms; gate the keybinding/command behind `cfg(windows)` or a runtime `windows` check.","Check availability first with `imp::pinned()`-style feature detection (or expose an `is_supported()` returning `cfg!(windows)`) and hide the feature in the UI on unsupported platforms.","If pinning is needed on Linux/macOS, implement a platform-specific backend (e.g. via WM hints) instead of relying on this Windows-only module."],"exampleFix":"// before\nstart_toggle(None)?; // panics/bails on non-Windows\n// after\nif cfg!(windows) {\n    start_toggle(None)?;\n}","handlingStrategy":"fallback","validationCode":"if !cfg!(windows) { return; // skip pin toggle }","typeGuard":"fn pinning_supported() -> bool { cfg!(windows) }","tryCatchPattern":null,"preventionTips":["Gate window-pinning UI affordances behind a Windows check","Expose and consult an is_supported() predicate before invoking platform APIs","Test the toggle path on every target platform in CI"],"tags":["platform","windows-only","unsupported-feature"],"backgroundTag":"unsupported-platform","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}