Skip to content

Ghidrust provides a hyper fast, AI native reverse engineering platform built in Rust, inspired by Ghidra. Includes experimental GPU kernels to rapidly decompile large files, a decryption suite, and network monitor for packet to binary reverse engineering.

26.0 KB
Raw Blame
//! provider catalog for visible.
//!
//! Every provider bundled with 's default `.tool`, plus commonly-reached
//! providers from `Window` menu, is enumerated here with the exact title so muscle
//! memory transfers. Providers whose backing analysis is not yet implemented render a
//! clearly labelled empty state that names the analyzer/model required — never fake data.
//!
//! Source anchors: see internal UI notes § 1.1 and § 1.2.

use ghidrust_core::FibScale;
use eframe::egui::{Color32, RichText, Ui};

/// One provider (window / dockable pane).
///
/// Ordering matches the `Window` menu (roughly alphabetical). Titles are the
/// exact strings uses so the Window menu is a drop-in mental map.
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub enum PaneKind {
    /// Ghidrust addition: the Grok Build agent
    /// console. Rendered as the primary tab in the bottom dock (next to the
    /// plain `Console`) so RE users can chat with an agent that already
    /// speaks the full Ghidrust MCP tool surface.
    AgentConsole,
    Bookmarks,
    Bytes,
    ChecksumGenerator,
    CommentWindow,
    Console,
    DataTypeManager,
    DataTypePreview,
    DecompiledView, // Alias for main Decompiler; kept as tab in center
    CryptoCapabilities,
    CryptoConstants,
    Decrypt,
    DefinedData,
    DefinedStrings,
    DisassembledView,
    Entropy,
    EquatesTable,
    ExternalPrograms,
    FunctionCallGraph,
    FunctionCallTrees,
    FunctionGraph,
    FunctionTags,
    FunctionsWindow,
    Listing,
    MemoryMap,
    Overview,
    ProgramTree,
    Python,
    RegisterManager,
    RelocationTable,
    ScriptManager,
    SymbolReferences,
    SymbolTable,
    SymbolTree,
    TextEditor,
    // Project Window providers (Ghidrust fuses Project + today).
    ProjectTree,
    // ── Agent Friction Closure §13 — tool panes (real backends, no stubs) ──
    /// `global-metadata.dat` parser (ghidrust-il2cpp) — types / methods / images.
    Il2cppMetadata,
    /// CodeRegistration correlation (metadata method index → binary VA).
    Il2cppMethods,
    /// Unity native icall name‖fn table pairing.
    Il2cppIcalls,
    /// Metadata string-heap touch-map (`ghidrust_il2cpp::touch_map`).
    Il2cppTouchMap,
    /// IL2CPP resolve-stub scanner (`ghidrust_il2cpp::find_resolve_stubs`).
    Il2cppStubs,
    /// Unity player install inventory (`ghidrust_unity_inventory::inventory_path`).
    UnityInventory,
    /// Folder → PE inventory (VERSIONINFO catalog) via `ghidrust_core::inventory`.
    InstallInventory,
    /// Bounded directory tree browser via `ghidrust_core::tree_index`.
    FileSystemBrowser,
    /// Spilled analysis artifact catalog + preview via `ghidrust_core::artifacts`.
    AnalysisArtifacts,
    RecoveredStrings,
}

impl PaneKind {
    /// Every provider Ghidrust ships.
    /// Order = `Window` menu order (alphabetical within group, then special).
    pub const ALL: &'static [PaneKind] = &[
        // Left dock defaults
        PaneKind::ProjectTree,
        PaneKind::ProgramTree,
        PaneKind::SymbolTree,
        PaneKind::DataTypeManager,
        // Center tabs
        PaneKind::Overview,
        PaneKind::Listing,
        PaneKind::DecompiledView,
        // Ghidrust-specific (bottom dock primary tab).
        PaneKind::AgentConsole,
        // Alphabetical from here
        PaneKind::Bookmarks,
        PaneKind::Bytes,
        PaneKind::ChecksumGenerator,
        PaneKind::CommentWindow,
        PaneKind::Console,
        PaneKind::CryptoCapabilities,
        PaneKind::CryptoConstants,
        PaneKind::DataTypePreview,
        PaneKind::Decrypt,
        PaneKind::DefinedData,
        PaneKind::DefinedStrings,
        PaneKind::DisassembledView,
        PaneKind::Entropy,
        PaneKind::EquatesTable,
        PaneKind::ExternalPrograms,
        PaneKind::FunctionCallGraph,
        PaneKind::FunctionCallTrees,
        PaneKind::FunctionGraph,
        PaneKind::FunctionTags,
        PaneKind::FunctionsWindow,
        PaneKind::MemoryMap,
        PaneKind::Python,
        PaneKind::RecoveredStrings,
        PaneKind::RegisterManager,
        PaneKind::RelocationTable,
        PaneKind::ScriptManager,
        PaneKind::SymbolReferences,
        PaneKind::SymbolTable,
        PaneKind::TextEditor,
        // Agent Friction Closure §13 — tool panes.
        PaneKind::Il2cppMetadata,
        PaneKind::Il2cppMethods,
        PaneKind::Il2cppIcalls,
        PaneKind::Il2cppTouchMap,
        PaneKind::Il2cppStubs,
        PaneKind::UnityInventory,
        PaneKind::InstallInventory,
        PaneKind::FileSystemBrowser,
        PaneKind::AnalysisArtifacts,
    ];

    /// Hover-submenu groups under Window → Providers (order = menu order).
    pub const WINDOW_MENU_GROUPS: &'static [&'static str] = &[
        "Program",
        "Crypto",
        "Graphs",
        "Scripts",
        "IL2CPP / Unity",
        "Tools",
    ];

    /// Window → Providers submenu for floating panes. `None` = docked/center (listed separately).
    pub const fn window_menu_group(self) -> Option<&'static str> {
        match self {
            PaneKind::ProjectTree
            | PaneKind::ProgramTree
            | PaneKind::SymbolTree
            | PaneKind::Console
            | PaneKind::Overview
            | PaneKind::Listing
            | PaneKind::DecompiledView
            | PaneKind::DataTypeManager => None,

            PaneKind::FunctionsWindow
            | PaneKind::SymbolTable
            | PaneKind::SymbolReferences
            | PaneKind::MemoryMap
            | PaneKind::DefinedStrings
            | PaneKind::DefinedData
            | PaneKind::Bytes
            | PaneKind::CommentWindow
            | PaneKind::Bookmarks
            | PaneKind::RelocationTable
            | PaneKind::EquatesTable
            | PaneKind::FunctionTags
            | PaneKind::DisassembledView
            | PaneKind::ExternalPrograms
            | PaneKind::DataTypePreview => Some("Program"),

            PaneKind::Decrypt
            | PaneKind::CryptoConstants
            | PaneKind::CryptoCapabilities
            | PaneKind::RecoveredStrings => Some("Crypto"),

            PaneKind::FunctionGraph
            | PaneKind::FunctionCallGraph
            | PaneKind::FunctionCallTrees
            | PaneKind::Entropy => Some("Graphs"),

            PaneKind::ScriptManager
            | PaneKind::TextEditor
            | PaneKind::Python
            | PaneKind::AgentConsole => Some("Scripts"),

            PaneKind::Il2cppMetadata
            | PaneKind::Il2cppMethods
            | PaneKind::Il2cppIcalls
            | PaneKind::Il2cppTouchMap
            | PaneKind::Il2cppStubs
            | PaneKind::UnityInventory
            | PaneKind::InstallInventory
            | PaneKind::FileSystemBrowser
            | PaneKind::AnalysisArtifacts => Some("IL2CPP / Unity"),

            PaneKind::ChecksumGenerator | PaneKind::RegisterManager => Some("Tools"),
        }
    }

    /// display title (Window menu label / provider `TITLE`).
    pub const fn title(self) -> &'static str {
        match self {
            PaneKind::AgentConsole => "Grok",
            PaneKind::Bookmarks => "Bookmarks",
            PaneKind::Bytes => "Bytes",
            PaneKind::ChecksumGenerator => "Checksum Generator",
            PaneKind::CommentWindow => "Comments",
            PaneKind::Console => "Console",
            PaneKind::DataTypeManager => "Data Type Manager",
            PaneKind::DataTypePreview => "Data Type Preview",
            PaneKind::DecompiledView => "Decompile",
            PaneKind::CryptoCapabilities => "Crypto Capabilities",
            PaneKind::CryptoConstants => "Crypto Constants",
            PaneKind::Decrypt => "Decrypt",
            PaneKind::DefinedData => "Defined Data",
            PaneKind::DefinedStrings => "Defined Strings",
            PaneKind::DisassembledView => "Disassembled View",
            PaneKind::Entropy => "Entropy",
            PaneKind::EquatesTable => "Equates Table",
            PaneKind::ExternalPrograms => "External Programs",
            PaneKind::FunctionCallGraph => "Function Call Graph",
            PaneKind::FunctionCallTrees => "Function Call Trees",
            PaneKind::FunctionGraph => "Function Graph",
            PaneKind::FunctionTags => "Function Tags",
            PaneKind::FunctionsWindow => "Functions",
            PaneKind::Listing => "Listing",
            PaneKind::MemoryMap => "Memory Map",
            PaneKind::Overview => "Overview",
            PaneKind::ProgramTree => "Program Trees",
            PaneKind::ProjectTree => "Project Tree",
            PaneKind::Python => "Python",
            PaneKind::RecoveredStrings => "Recovered Strings",
            PaneKind::RegisterManager => "Register Manager",
            PaneKind::RelocationTable => "Relocation Table",
            PaneKind::ScriptManager => "Script Manager",
            PaneKind::SymbolReferences => "Symbol References",
            PaneKind::SymbolTable => "Symbol Table",
            PaneKind::SymbolTree => "Symbol Tree",
            PaneKind::TextEditor => "Text Editor",
            PaneKind::Il2cppMetadata => "IL2CPP Metadata",
            PaneKind::Il2cppMethods => "IL2CPP Methods",
            PaneKind::Il2cppIcalls => "IL2CPP ICalls",
            PaneKind::Il2cppTouchMap => "IL2CPP Touch Map",
            PaneKind::Il2cppStubs => "IL2CPP Stubs",
            PaneKind::UnityInventory => "Unity Inventory",
            PaneKind::InstallInventory => "Install Inventory",
            PaneKind::FileSystemBrowser => "File System Browser",
            PaneKind::AnalysisArtifacts => "Analysis Artifacts",
        }
    }

    /// plugin owner (for empty-state hint text).
    pub const fn plugin(self) -> &'static str {
        match self {
            PaneKind::AgentConsole => "GhidrustAgentConsole",
            PaneKind::Bookmarks => "BookmarkPlugin",
            PaneKind::Bytes => "ByteViewerPlugin",
            PaneKind::ChecksumGenerator => "ComputeChecksumsPlugin",
            PaneKind::CommentWindow => "CommentWindowPlugin",
            PaneKind::Console => "ConsolePlugin",
            PaneKind::DataTypeManager => "DataTypeManagerPlugin",
            PaneKind::DataTypePreview => "DataTypePreviewPlugin",
            PaneKind::DecompiledView => "DecompilePlugin",
            PaneKind::CryptoCapabilities => "CryptoCapabilitiesPlugin",
            PaneKind::CryptoConstants => "CryptConstantsPlugin",
            PaneKind::Decrypt => "DecryptPanePlugin",
            PaneKind::DefinedData => "DataWindowPlugin",
            PaneKind::DefinedStrings => "ViewStringsPlugin",
            PaneKind::DisassembledView => "DisassembledViewPlugin",
            PaneKind::Entropy => "EntropyPlugin",
            PaneKind::EquatesTable => "EquateTablePlugin",
            PaneKind::ExternalPrograms => "ReferencesPlugin",
            PaneKind::FunctionCallGraph => "FunctionCallGraphPlugin",
            PaneKind::FunctionCallTrees => "CallTreePlugin",
            PaneKind::FunctionGraph => "FunctionGraphPlugin",
            PaneKind::FunctionTags => "FunctionTagPlugin",
            PaneKind::FunctionsWindow => "FunctionWindowPlugin",
            PaneKind::Listing => "CodeBrowserPlugin",
            PaneKind::MemoryMap => "MemoryMapPlugin",
            PaneKind::Overview => "OverviewPlugin",
            PaneKind::ProgramTree => "ProgramTreePlugin",
            PaneKind::ProjectTree => "FrontEndTool",
            PaneKind::Python => "InterpreterPanelPlugin",
            PaneKind::RecoveredStrings => "RecoveredStringsPlugin",
            PaneKind::RegisterManager => "RegisterPlugin",
            PaneKind::RelocationTable => "RelocationTablePlugin",
            PaneKind::ScriptManager => "ScriptMgrPlugin",
            PaneKind::SymbolReferences => "SymbolTablePlugin",
            PaneKind::SymbolTable => "SymbolTablePlugin",
            PaneKind::SymbolTree => "SymbolTreePlugin",
            PaneKind::TextEditor => "TextEditorManagerPlugin",
            PaneKind::Il2cppMetadata => "Il2cppMetadataPlugin",
            PaneKind::Il2cppMethods => "Il2cppMethodMapPlugin",
            PaneKind::Il2cppIcalls => "Il2cppICallsPlugin",
            PaneKind::Il2cppTouchMap => "Il2cppTouchMapPlugin",
            PaneKind::Il2cppStubs => "Il2cppStubsPlugin",
            PaneKind::UnityInventory => "UnityInventoryPlugin",
            PaneKind::InstallInventory => "InstallInventoryPlugin",
            PaneKind::FileSystemBrowser => "FileSystemBrowserPlugin",
            PaneKind::AnalysisArtifacts => "AnalysisArtifactsPlugin",
        }
    }

    /// True if backend implementation is Stage-0 or better (used to hide "backend pending" copy).
    #[cfg(test)]
    pub const fn has_backend(self) -> bool {
        matches!(
            self,
            PaneKind::Listing
                | PaneKind::DecompiledView
                | PaneKind::Overview
                | PaneKind::ProgramTree
                | PaneKind::ProjectTree
                | PaneKind::SymbolTree
                | PaneKind::Console
                | PaneKind::DefinedStrings
                | PaneKind::CryptoConstants
                | PaneKind::RecoveredStrings
                | PaneKind::CryptoCapabilities
                | PaneKind::Decrypt
                | PaneKind::FunctionsWindow
                | PaneKind::MemoryMap
                | PaneKind::SymbolTable
                | PaneKind::Bookmarks
                | PaneKind::CommentWindow
                | PaneKind::RelocationTable
                | PaneKind::DisassembledView
                | PaneKind::DefinedData
                // real backing added.
                | PaneKind::Bytes
                | PaneKind::SymbolReferences
                | PaneKind::EquatesTable
                | PaneKind::FunctionTags
                | PaneKind::ExternalPrograms
                | PaneKind::DataTypePreview
                | PaneKind::ChecksumGenerator
                // Grok agent console (ghidrust-agent crate).
                | PaneKind::AgentConsole
                // Agent Friction Closure §13 — real backends via ghidrust-core /
                // ghidrust-il2cpp (no empty stubs).
                | PaneKind::Il2cppMetadata
                | PaneKind::Il2cppMethods
                | PaneKind::Il2cppIcalls
                | PaneKind::Il2cppTouchMap
                | PaneKind::Il2cppStubs
                | PaneKind::UnityInventory
                | PaneKind::InstallInventory
                | PaneKind::FileSystemBrowser
                | PaneKind::AnalysisArtifacts
                | PaneKind::RegisterManager
                | PaneKind::DataTypeManager
        )
    }

    /// Optional stable id used for egui window ids (must be unique).
    pub const fn egui_id(self) -> &'static str {
        match self {
            PaneKind::AgentConsole => "pane_agent_console",
            PaneKind::Bookmarks => "pane_bookmarks",
            PaneKind::Bytes => "pane_bytes",
            PaneKind::ChecksumGenerator => "pane_checksum",
            PaneKind::CommentWindow => "pane_comments",
            PaneKind::Console => "pane_console_win",
            PaneKind::DataTypeManager => "pane_dtm_win",
            PaneKind::DataTypePreview => "pane_dtpreview",
            PaneKind::DecompiledView => "pane_decompile_win",
            PaneKind::CryptoCapabilities => "pane_crypto_capabilities",
            PaneKind::CryptoConstants => "pane_crypto_constants",
            PaneKind::Decrypt => "pane_decrypt",
            PaneKind::DefinedData => "pane_defined_data",
            PaneKind::DefinedStrings => "pane_defined_strings",
            PaneKind::DisassembledView => "pane_disasm_view",
            PaneKind::Entropy => "pane_entropy",
            PaneKind::EquatesTable => "pane_equates",
            PaneKind::ExternalPrograms => "pane_external_programs",
            PaneKind::FunctionCallGraph => "pane_fn_call_graph",
            PaneKind::FunctionCallTrees => "pane_fn_call_trees",
            PaneKind::FunctionGraph => "pane_fn_graph",
            PaneKind::FunctionTags => "pane_fn_tags",
            PaneKind::FunctionsWindow => "pane_functions",
            PaneKind::Listing => "pane_listing_win",
            PaneKind::MemoryMap => "pane_memory_map",
            PaneKind::Overview => "pane_overview_win",
            PaneKind::ProgramTree => "pane_program_tree_win",
            PaneKind::ProjectTree => "pane_project_tree_win",
            PaneKind::Python => "pane_python",
            PaneKind::RecoveredStrings => "pane_recovered_strings",
            PaneKind::RegisterManager => "pane_register_manager",
            PaneKind::RelocationTable => "pane_relocations",
            PaneKind::ScriptManager => "pane_script_manager",
            PaneKind::SymbolReferences => "pane_symbol_refs",
            PaneKind::SymbolTable => "pane_symbol_table",
            PaneKind::SymbolTree => "pane_symbol_tree_win",
            PaneKind::TextEditor => "pane_text_editor",
            PaneKind::Il2cppMetadata => "pane_il2cpp_metadata",
            PaneKind::Il2cppMethods => "pane_il2cpp_methods",
            PaneKind::Il2cppIcalls => "pane_il2cpp_icalls",
            PaneKind::Il2cppTouchMap => "pane_il2cpp_touch_map",
            PaneKind::Il2cppStubs => "pane_il2cpp_stubs",
            PaneKind::UnityInventory => "pane_unity_inventory",
            PaneKind::InstallInventory => "pane_install_inventory",
            PaneKind::FileSystemBrowser => "pane_fs_browser",
            PaneKind::AnalysisArtifacts => "pane_analysis_artifacts",
        }
    }
}

/// Bookmark type — ships 5 standard categories + a plugin-registered Unknown.
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum BookmarkKind {
    Note,
    Info,
    Analysis,
    Error,
    Warning,
}

impl BookmarkKind {
    pub const ALL: &'static [BookmarkKind] = &[
        BookmarkKind::Note,
        BookmarkKind::Info,
        BookmarkKind::Analysis,
        BookmarkKind::Error,
        BookmarkKind::Warning,
    ];

    pub const fn label(self) -> &'static str {
        match self {
            BookmarkKind::Note => "Note",
            BookmarkKind::Info => "Info",
            BookmarkKind::Analysis => "Analysis",
            BookmarkKind::Error => "Error",
            BookmarkKind::Warning => "Warning",
        }
    }

    /// color for margin marker / row tint.
    pub fn color(self) -> Color32 {
        match self {
            BookmarkKind::Note => Color32::from_rgb(0x9C, 0x27, 0xB0), // purple
            BookmarkKind::Info => Color32::from_rgb(0x03, 0xA9, 0xF4), // cyan
            BookmarkKind::Analysis => Color32::from_rgb(0xFF, 0x98, 0x00), // orange
            BookmarkKind::Error => Color32::from_rgb(0xE5, 0x39, 0x35), // red
            BookmarkKind::Warning => Color32::from_rgb(0xFB, 0xC0, 0x2D), // amber
        }
    }
}

/// One bookmark row.
#[derive(Debug, Clone)]
pub struct Bookmark {
    pub va: u64,
    pub kind: BookmarkKind,
    pub category: String,
    pub description: String,
}

/// Render "backend pending" empty state for a pane; used by any provider without backing data.
pub fn empty_state(ui: &mut Ui, kind: PaneKind, muted: Color32) {
    ui.heading(kind.title());
    ui.small(RichText::new(format!("Provider · {}", kind.plugin())).color(muted));
    ui.separator();
    ui.add_space(FibScale::XS);
    ui.label(
        RichText::new(backend_pending_message(kind))
            .color(muted)
            .italics(),
    );
    ui.add_space(FibScale::XS);
    ui.small(
        RichText::new(
            "Pane is present in the shell catalog. Backing analysis \
                            and interactive actions land in later work — see \
                            internal UI notes.",
        )
        .color(muted),
    );
}

/// One-liner hint pointing at which analyzer/model would fill this pane.
pub const fn backend_pending_message(kind: PaneKind) -> &'static str {
    match kind {
        PaneKind::AgentConsole => "",
        PaneKind::Bookmarks => "Session bookmarks with margin markers.",
        PaneKind::Bytes => "",
        PaneKind::ChecksumGenerator => "",
        PaneKind::CommentWindow => "Program comments filter + jump to VA.",
        PaneKind::Console => "",
        PaneKind::DataTypeManager => "",
        PaneKind::DataTypePreview => "",
        PaneKind::DecompiledView => "Stage-1 SSA-C (expression fold + typed locals/params). Emit-time tokens when available; rename/commit wired.",
        PaneKind::CryptoCapabilities => "",
        PaneKind::CryptoConstants => "",
        PaneKind::Decrypt => "",
        PaneKind::DefinedData => "Defined-data proxy from strings + RTTI; Apply-at-address via DTM.",
        PaneKind::DefinedStrings => "Uses ghidrust-core::analyzers::strings::run — session-only until Program::strings lands.",
        PaneKind::DisassembledView => "Listing-backed disassembly view.",
        PaneKind::Entropy => "Shannon entropy strip over mapped blocks.",
        PaneKind::EquatesTable => "",
        PaneKind::ExternalPrograms => "",
        PaneKind::FunctionCallGraph => "Level-based directed call graph from Stage-0 refs.",
        PaneKind::FunctionCallTrees => "Incoming callers / outgoing callees trees.",
        PaneKind::FunctionGraph => "CFG vertex/edge layout from Stage-0 blocks.",
        PaneKind::FunctionTags => "",
        PaneKind::FunctionsWindow => "Uses Program::analysis.functions.",
        PaneKind::Listing => "",
        PaneKind::MemoryMap => "Uses Program::blocks / Program::sections (read-only). Editable table lands in .",
        PaneKind::Overview => "",
        PaneKind::ProgramTree => "",
        PaneKind::ProjectTree => "",
        PaneKind::Python => "MCP REPL — tool_name / tool_name {json} via ghidrust mcp (non-network).",
        PaneKind::RecoveredStrings => "",
        PaneKind::RegisterManager => "",
        PaneKind::RelocationTable => "",
        PaneKind::ScriptManager => "Catalog of ghidrust MCP tools; Run → CLI mapping or mcp tools/call.",
        PaneKind::SymbolReferences => "",
        PaneKind::SymbolTable => "Uses Program::analysis.symbols + functions (flat table).",
        PaneKind::SymbolTree => "",
        PaneKind::TextEditor => "Multi-tab in-memory editor (Open/Save via rfd).",
        PaneKind::Il2cppMetadata => "",
        PaneKind::Il2cppMethods => "",
        PaneKind::Il2cppIcalls => "",
        PaneKind::Il2cppTouchMap => "",
        PaneKind::Il2cppStubs => "",
        PaneKind::UnityInventory => "",
        PaneKind::InstallInventory => "",
        PaneKind::FileSystemBrowser => "",
        PaneKind::AnalysisArtifacts => "",
    }
}

#[cfg(test)]
mod tests {
    use super::*;

    #[test]
    fn every_pane_has_title_and_plugin_and_id() {
        for k in PaneKind::ALL {
            assert!(!k.title().is_empty(), "empty title for {:?}", k);
            assert!(!k.plugin().is_empty(), "empty plugin for {:?}", k);
            assert!(!k.egui_id().is_empty(), "empty egui_id for {:?}", k);
        }
    }

    #[test]
    fn window_menu_groups_cover_all_floating_providers() {
        for k in PaneKind::ALL {
            match k.window_menu_group() {
                None => assert!(
                    matches!(
                        k,
                        PaneKind::ProjectTree
                            | PaneKind::ProgramTree
                            | PaneKind::SymbolTree
                            | PaneKind::Console
                            | PaneKind::Overview
                            | PaneKind::Listing
                            | PaneKind::DecompiledView
                            | PaneKind::DataTypeManager
                    ),
                    "{:?} missing Window menu group",
                    k
                ),
                Some(g) => assert!(
                    PaneKind::WINDOW_MENU_GROUPS.contains(&g),
                    "{:?} group {:?} not in WINDOW_MENU_GROUPS",
                    k,
                    g
                ),
            }
        }
        for g in PaneKind::WINDOW_MENU_GROUPS {
            assert!(
                PaneKind::ALL.iter().any(|k| k.window_menu_group() == Some(*g)),
                "empty Window menu group {g}"
            );
        }
    }

    #[test]
    fn ghidra_default_toolbar_providers_present() {
        // 28 default `.tool` providers must all be enumerated.
        let names: Vec<&'static str> = PaneKind::ALL.iter().map(|k| k.title()).collect();
        for expected in [
            "Program Trees",
            "Symbol Tree",
            "Data Type Manager",
            "Listing",
            "Decompile",
            "Bytes",
            "Defined Data",
            "Defined Strings",
            "Equates Table",
            "External Programs",
            "Functions",
            "Relocation Table",
            "Data Type Preview",
            "Disassembled View",
            "Console",
            "Bookmarks",
            "Script Manager",
            "Memory Map",
            "Function Graph",
            "Register Manager",
            "Symbol Table",
            "Symbol References",
            "Checksum Generator",
            "Function Tags",
            "Comments",
            "Python",
            "Entropy",
            "Overview",
        ] {
            assert!(
                names.contains(&expected),
                "missing provider `{expected}` in PaneKind::ALL"
            );
        }
    }

    #[test]
    fn off_layout_providers_present() {
        let names: Vec<&'static str> = PaneKind::ALL.iter().map(|k| k.title()).collect();
        for expected in ["Function Call Trees", "Function Call Graph", "Text Editor"] {
            assert!(
                names.contains(&expected),
                "missing off-layout provider `{expected}` in PaneKind::ALL"
            );
        }
    }

    #[test]
    fn bookmark_kinds_ghidra_five_present() {
        let ks: Vec<&'static str> = BookmarkKind::ALL.iter().map(|k| k.label()).collect();
        for expected in ["Note", "Info", "Analysis", "Error", "Warning"] {
            assert!(ks.contains(&expected), "missing bookmark kind {expected}");
        }
    }

    #[test]
    fn every_pane_has_backend_message_or_backend() {
        for &k in PaneKind::ALL {
            let msg = backend_pending_message(k);
            if !k.has_backend() {
                assert!(
                    !msg.is_empty(),
                    "pane {:?} without backend must supply a pending message",
                    k
                );
            }
        }
    }
}