mirror of
https://github.com/codewhale-hq/Codewhale.git
synced 2026-11-11 01:51:34 -10:00
fix(tui): make ShellKind's dead_code expectations platform-accurate
`Test (windows-latest)` has not compiled on this branch: five errors, all in shell_dispatcher.rs, and all the same mistake seen from two sides. Which `ShellKind` variants are live is exactly a platform split. `detect` builds `Pwsh`, `WindowsPowerShell`, `Cmd` and `Bash` inside `cfg(windows)` (:446-468) and `Sh` and `Custom` inside `cfg(not(windows))` (:471-504). The annotations from the #5587 sweep were written from the unix side only: the four Windows variants carried an unconditional `cfg_attr(not(test), expect(dead_code))`, and `Sh`/`Custom` carried none. On unix that is right and CI stayed green. On Windows both halves invert: the four expectations go unfulfilled because those variants *are* constructed, and `Sh`/`Custom` become genuinely unconstructed. `expect` is an error when unfulfilled, so the lib failed to compile before a single test ran. Each annotation now names the platform it is dead on. No variant is silenced on a platform where it is live, so the ratchet #5587 installed still bites on both. Verification, stated honestly: `cargo check -p codewhale-tui --lib --locked` is clean on unix, and the full CI clippy gate (`--workspace --all-targets --all-features -D warnings`) exits 0. The Windows half could NOT be checked locally — `cargo check --target x86_64-pc-windows-msvc` cannot build `ring`, whose build script needs an MSVC-targeting C compiler this host does not have. The Windows claim rests on the cfg structure above, and CI is its first real test. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
1 parent
26b6ecba5b
commit
aca2174447
1 file changed
+11
-4
@@ -40,21 +40,28 @@ pub(crate) mod test_env_lock;
|
||||
/// The concrete shell that the dispatcher will use.
|
||||
#[derive(Debug, Clone, PartialEq, Eq)]
|
||||
pub enum ShellKind {
|
||||
// Which variants are live is exactly a platform split: `detect` builds the
|
||||
// four Windows shells under `cfg(windows)` and `Sh`/`Custom` under
|
||||
// `cfg(not(windows))`. So each `expect(dead_code)` has to name the platform
|
||||
// it is dead on, or it fires as unfulfilled on the other one — which is how
|
||||
// the Windows build broke while unix stayed green.
|
||||
/// PowerShell 7+ (`pwsh.exe`).
|
||||
#[cfg_attr(not(test), expect(dead_code))]
|
||||
#[cfg_attr(all(not(test), not(windows)), expect(dead_code))]
|
||||
Pwsh,
|
||||
/// Windows PowerShell 5.1 (`powershell.exe`).
|
||||
#[cfg_attr(not(test), expect(dead_code))]
|
||||
#[cfg_attr(all(not(test), not(windows)), expect(dead_code))]
|
||||
WindowsPowerShell,
|
||||
/// Command Prompt (`cmd.exe`).
|
||||
#[cfg_attr(not(test), expect(dead_code))]
|
||||
#[cfg_attr(all(not(test), not(windows)), expect(dead_code))]
|
||||
Cmd,
|
||||
/// Unix `/bin/sh` fallback.
|
||||
#[cfg_attr(all(not(test), windows), expect(dead_code))]
|
||||
Sh,
|
||||
/// Bash — detected via `$SHELL` on WSL/Git Bash, or constructed explicitly.
|
||||
#[cfg_attr(not(test), expect(dead_code))]
|
||||
#[cfg_attr(all(not(test), not(windows)), expect(dead_code))]
|
||||
Bash,
|
||||
/// The exact shell executable selected by Unix `$SHELL`.
|
||||
#[cfg_attr(all(not(test), windows), expect(dead_code))]
|
||||
Custom { binary: String, flag: String },
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user