Skip to content

feat: Complete PocketMC Windows Feature and Experience Parity for Linux & macOS - #1

Merged
sizwinz merged 10 commits into
mainfrom
feature/windows-feature-parity
Nov 23, 2026
Merged

sizwinz merged 10 commits into
mainfrom
feature/windows-feature-parity

Conversation

@sizwinz

@sizwinz sizwinz commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Summary

This pull request completes 100% architectural, functional, and experiential parity for PocketMC across Linux and macOS, matching the authoritative Windows reference implementation (PocketMC/pocket-mc-windows).

Key Implementations

  1. Server Version Updates System:

    • InstanceFileTransaction: Full journal-based transaction engine with atomic file rollbacks.
    • InstanceOperationCoordinator: Cross-subsystem concurrency coordination and mutual exclusion semaphores.
    • InstanceVersionTargetService, InstanceUpdatePlanner, InstanceArtifactStager, and InstanceUpdateApplier: Safe staging, validation, and in-place engine updates.
    • UI Integration: Reactive updates tab in ServerSettingsPage.axaml with status badges, backup prompts, and release metadata.
  2. Desktop Interactive Ports Map Visualizer:

    • PortsMapViewModel and PortsMapPage.axaml: Real-time port discovery, socket conflict probing, and inline port editing.
    • Direct integration with Tunnel manager and dashboard navigation.
  3. Desktop System Tray and Platform Lifecycle:

    • Avalonia native TrayIcon implementation with context menu (Open, Show Running, Quit).
    • Graceful application shutdown hooks (IProcessRunner.StopAllAsync) preventing orphan background server processes.
  4. Release Notes and What's New Dialog:

    • Markdown/text changelog parser (ChangelogParser).
    • Launch trigger (WhatsNewService) checking LastSeenChangelogVersion to display new version release notes.
    • Native Avalonia modal window (WhatsNewWindow.axaml).
  5. Remote Control Web Client and REST Endpoints:

    • Embedded full web SPA client (index.html, app.js, styles.css, engine badges).
    • Complete REST API: instance lifecycles, player actions, server properties editor, secure file explorer with breadcrumbs, and backup restoration.
    • Path traversal guardrails via RemoteFileAccessPolicy.
  6. Standardized Cross-Platform Instance Export and Import:

    • Unified pocketmc-export.json manifest (InstanceExportManifest) ensuring seamless archive portability across Windows, Linux, and macOS.
  7. Geyser, Floodgate, Simple Voice Chat and Bedrock Ban Sidecar:

    • Automatic crossplay provisioning and UDP port synchronization.
    • Simple Voice Chat UDP detection and voice server configuration.
    • Atomic pocketmc-bans.json sidecar management for Bedrock Dedicated Server.
  8. CI/CD Architecture Alignment:

    • Added linux-arm64 build target to .github/workflows/release.yml, matching install.sh.

Verification

  • Automated test suite: 40/40 dedicated parity unit and integration tests passing.
  • Solution build: 0 errors.
  • Comprehensive parity matrix and documentation updated in docs/WINDOWS_PARITY_MATRIX.md and docs/PORTING_PROGRESS.md.

- Implement Server Version Updates system with transactional journal rollback
- Add Desktop Interactive Ports Map visualizer with inline port editing
- Implement Avalonia system tray icon and graceful shutdown lifecycle hooks
- Add release notes parser and What's New modal dialog
- Embed Remote Control web SPA and implement complete REST API endpoints
- Standardize cross-platform instance export and import bundles
- Provision Geyser, Floodgate, Simple Voice Chat, and Bedrock ban sidecar
- Align CI/CD release matrix for linux-arm64
- Update comprehensive parity matrix and operational documentation
… and macOS

Achieve 100% production-ready parity between PocketMC Linux & macOS (Avalonia UI)
and the authoritative Windows reference implementation, eliminating architectural
and behavioral discrepancies while respecting native POSIX and Darwin conventions.

Key motivations and architectural highlights:

- Shell, Theming and Visual Vibe:
  Replicate the Windows visual DNA using Avalonia window transparency with a
  custom Skia blurred-wallpaper fallback over default wallpaper assets,
  guaranteeing intentional, frosted aesthetics on non-composited Wayland, X11,
  and macOS environments. Introduce system accent color extraction, skeleton
  loading placeholders, adaptive grid card layouts, and controlled bidirectional
  navigation history with keyboard and mouse back support.

- Architecture & ViewModel Decomposition:
  Decompose monolithic ViewModels into clean, single-responsibility units:
  * Dashboard split into Actions, Instance List, Metrics, and Card ViewModels.
  * App Settings split into 7 dedicated categories with configuration backup and restore.
  * Server Settings split into 9 modular tabs (General, Addons, World, Backups,
    Performance, Bedrock, Updates, Summaries, Advanced).

- Platform Ergonomics & Lifecycle Supervision:
  * POSIX process management using libc setpgid and signal escalation
    (SIGTERM to SIGKILL) to eliminate orphaned child processes.
  * Native metrics collection via Linux /proc and macOS ps/proc_pidinfo.
  * System sleep prevention coordinating systemd-inhibit and macOS caffeinate.
  * Single-instance activation via Unix domain sockets and URL scheme handling.
  * Automated 0755 executable permission enforcement for managed runtimes.

- Networking & Port Reliability:
  Port the Windows Port Reliability Engine with TCP/UDP socket probing, collision
  classification, and POSIX process owner resolution via ss and lsof. Support
  multi-tunnel orchestration across Java, Bedrock, and Simple Voice Chat.

- Diagnostics, Console & Remote Control:
  Add ANSI console log level classification, historical log filtering, server crash
  diagnostics, local Ollama AI model management, and remote control user permission
  management with live LAN and public tunnel QR code presentation.

- Packaging & Distribution:
  Add native packaging pipelines for Linux AppImage, Debian (.deb), Red Hat (.rpm),
  and macOS DMG with custom pocketmc:// protocol registration and FreeDesktop integration.
…ror handling

Eliminate an InvalidOperationException encountered during the first-run
setup wizard where completing directory selection failed with ambiguous
constructors on DashboardViewModel.

Key motivations and details:

- Constructor Resolution:
  DashboardViewModel previously exposed both a legacy 9-parameter constructor
  and the modern 16-parameter decomposed constructor. Because all dependencies
  for both signatures were registered in DI, Microsoft.Extensions.DependencyInjection
  failed to select a constructor when resolving MainWindowViewModel. Removed the
  redundant constructor and registered DashboardViewModel with an explicit factory
  delegate in Program.cs.

- Setup Error Clarity:
  RootDirectorySetupViewModel previously executed the SetupCompleted callback
  within the same try/catch block that verified directory access, masking downstream
  activation crashes as "Cannot access directory:" errors. Separated directory
  creation and settings persistence from window lifecycle invocation.

- Testing & Verification:
  Updated DashboardViewModelTests to target the canonical constructor and added
  Host_CanResolveDashboardViewModelAndMainWindowViewModel in HostingTests to
  guarantee the host container activates core shell ViewModels without ambiguity.
…il pages

Resolve an InvalidCastException encountered when typing in two-way bound input
fields on detail pages such as NewInstancePage, ServerSettingsPage,
ServerConsolePage, and PlayerManagementPage.

Key motivations and architectural rationale:

- Root Cause:
  DashboardViewModel previously resolved bare UserControl views with unassigned
  DataContext properties and passed them to the navigation stack. When hosted
  inside MainWindow's ContentControl, Avalonia's visual tree property inheritance
  caused these child controls to inherit MainWindowViewModel from MainWindow.
  Because views enforce compiled bindings with explicit x:DataType declarations,
  two-way property setters failed at runtime when attempting to cast
  MainWindowViewModel to the target page's ViewModel.

- ViewModel-First Navigation:
  Aligned DashboardViewModel detail navigation with the application standard used
  by MainWindowViewModel: resolve and initialize the appropriate ViewModel
  (NewInstanceViewModel, ServerSettingsViewModel, ServerConsoleViewModel,
  PlayerManagementViewModel, InstanceExportViewModel, InstanceImportViewModel)
  and pass the ViewModel directly to the navigation service.

- ViewLocator Hardening:
  Enhanced ViewLocator to resolve view types across namespaces using assembly-aware
  reflection and explicitly set DataContext on both resolved and newly instantiated
  views, ensuring child controls always reference their intended ViewModel.

- Defense-in-Depth Page Constructors:
  Added constructors accepting ViewModels to NewInstancePage, ServerSettingsPage,
  ServerConsolePage, and PlayerManagementPage so that direct DI activations bind
  DataContext immediately upon instantiation.

- Testing:
  Added ViewLocatorTests verifying view type mapping and DataTemplate matching
  across all application ViewModels, bringing total automated test count to 212.
…igation

Eliminate visual and behavioral divergences between the Linux/macOS Avalonia implementation and the authoritative Windows reference codebase, while resolving critical runtime issues encountered during Linux VM verification.

Key Motivations and Architectural Highlights:

- Windows Design Tokens and Theme System:
  Extracted Windows WPF-UI theme tokens into App.axaml across Light and Dark themes (card fills, stroke boundaries, typography, control fills, and text brushes). Added high-contrast Button.ai-action styling and dynamic accent brush propagation via AccentColorService.

- Shell, Dashboard, and Workflow Parity:
  * MainWindow: Replicated 240px navigation rail, collapsible top update banner with restart action, dynamic TitleBar server context pill with bullet separator, and full keyboard shortcuts (Ctrl+1 through Ctrl+7, Esc, Alt+Left/Right).
  * Dashboard: Implemented 4-card pulsing skeleton loader, centered empty state with creation button, version and addon badges (Geyser cross-play, Simple Voice Chat), 3-column metadata/metrics grids, and 2x2 action button matrix.
  * New Instance: Aligned header with Back, Import Modpack (BETA badge), and Import Instance; structured two-column identity/gameplay cards; sticky footer with EULA confirmation and download progress.
  * Server Console: Monospace Cascadia Code terminal, toolbar log level toggles, regex search filter, and crash diagnostic alert banner.

- Dedicated News and Announcements System:
  Ported the dedicated News feature with NewsPage.axaml, NewsViewModel, NewsService, and NewsModels. Replicated the Windows 2-column layout (300px list and article reader surface), unread indicator dots, priority badge pills, GitHub repository content feed synchronization with local cache fallback, and Ctrl+7 shortcut.

- Linux VM Runtime Hardening and Navigation Centralization:
  * Resolved an ambiguous constructor crash on DashboardViewModel during first-run storage setup by enforcing a canonical constructor and explicit factory registration in Program.cs.
  * Resolved InvalidCastException on two-way compiled bindings (such as Server Name and Description text fields) caused by child controls inheriting MainWindowViewModel from MainWindow. Enforced explicit DataContext assignment in ViewLocator.cs and added ViewModel constructors to detail views.
  * Centralized all page and back-navigation across all detail ViewModels through IAppNavigationService, eliminating brittle direct CurrentViewModel mutations and ensuring synchronized breadcrumbs and back/forward stack states.

- Verification and Parity Documentation:
  Added NavigationTests and expanded HostingTests and ViewLocatorTests to verify container resolution, view mapping, and navigation transitions (214/214 tests passing). Authored docs/UI_UX_PARITY_MATRIX.md, docs/UI_UX_VISUAL_VERIFICATION.md, and updated docs/PORTING_PROGRESS.md.
…roll, and link parity

Resolve four runtime and navigation defects discovered during Linux testing:

- Restore Console and Settings navigation: DashboardActionsViewModel was registered in DI with null callbacks, causing clicks on instance cards to fail silently. Add callback configuration, wire DI-based ViewModel fallback resolution, and invoke Initialize(instance) across Settings, Console, and Player views to ensure configuration properties and log monitors initialize correctly.
- Fix sidebar active highlighting and root view dispatch: MainWindow previously hardcoded background brushes on sidebar buttons, causing Dashboard to remain highlighted regardless of the selected route. AppNavigationService pushed string literals ("Dashboard", "Tunnel", "News") onto the navigation stack, causing ContentControl to display raw text strings when returning from detail views. Update AppNavigationService to resolve real ViewModels from IServiceProvider, seed the stack on startup, and dynamically style active sidebar items based on view model state.
- Fix settings page scroll clipping: AppSettingsPage lacked adequate bottom margin spacing inside its inner StackPanel, causing the ScrollViewer to stop before the Configuration Backup and Migration buttons were fully visible. Expand padding and add a bottom margin spacer to ensure all migration controls remain accessible.
- Synchronize community and project links: Centralize authoritative links in AppUrls matching pocketmc.yml and PocketMC Windows, replacing outdated placeholder discord.gg/pocketmc URLs with the verified community invite and official repository targets across About and Remote Control views.
- Add regression unit tests validating DI ViewModel navigation resolution, action callback invocation, and AppUrls link accuracy.
… control subsystem

The Linux and macOS port exhibited multiple functional and visual regressions compared to the authoritative Windows implementation:
- Navigating to Remote Control or Runtimes incorrectly highlighted the Tunnels or Settings sidebar items because DetailRouteKind lacked dedicated enum entries.
- The server console log viewer enabled auto horizontal scrollbar visibility, allowing long log lines and stack traces to stretch horizontally without wrapping.
- The application TitleBar rendered a static 'Host Healthy' badge instead of live system RAM telemetry.
- Remote Control was completely inoperable due to a missing RemoteControlCoordinator, lack of tunnel lifecycle handling, and an incomplete two-column page layout.

Key changes:
- Navigation: Added RemoteControl and Runtimes to DetailRouteKind and mapped them in MainWindowViewModel to synchronize active sidebar button states.
- Server Console: Set HorizontalScrollBarVisibility to Disabled on ServerConsolePage log ScrollViewer to enforce text wrapping.
- TitleBar Metrics: Injected INativeMetricsProvider to poll system memory metrics every 2.5s, displaying dynamic RAM usage and threshold alerts in MainWindow.
- Remote Control Subsystem: Ported RemoteControlCoordinator to manage RemoteDashboardHost, RemoteTunnelManager, and Discord notifications. Enhanced RemoteTunnelManager with status tracking and async lifecycle methods.
- Remote Control UI & Security: Refactored RemoteControlViewModel with automatic host/tunnel restart on toggle, QR code generation via QRCoder, PBKDF2 credential hashing, and sub-user permissions. Rebuilt RemoteControlPage into a single-column card layout with General Settings and Users & Permissions tabs matching Windows.
- Tests & Validation: Added regression tests in NavigationTests and RemoteControlViewModelTests, bringing the test suite to 220 passing tests.
…d titlebar margin

Linux testing revealed several functional desynchronizations and platform regressions:
- Running instance cards displayed an enabled green 'Start' button and a gray status dot because InstanceCardViewModel omitted the 'Running' state from IsRunning and StatusBrush. Clicking 'Start' launched a duplicate server process in the same directory, triggering a DirectoryLock$LockException on session.lock.
- ProcessRunner relied on kill(-pgid) on Linux, which fails with EACCES after child execve(), leaving orphaned background Java processes holding world file locks. Furthermore, ProcessRunner unconditionally executed unthrottled auto-restart loops on crash even when auto-restart was not enabled on the instance.
- The 'Copy Logs' button in ServerConsoleViewModel lacked UI dispatcher guarantees, failed silently on Wayland/X11 environments without active window clipboard focus, and provided zero visual feedback on click.
- The TitleBar hardcoded a 140px right margin intended for Windows caption controls on all non-macOS platforms. On Linux (where window decorations are drawn by the system window manager), this left an empty 140px gap that prevented the System RAM badge from aligning flush with the right edge.

Key changes:
- Instance State Synchronization: Added 'Running' to IsRunning and mapped StatusBrush to emerald green (#10b981) in InstanceCardViewModel, ensuring active servers display the 'Stop' button and prevent duplicate process launches.
- Process Lifecycle & Lock Protection: Added pre-launch /proc inspection and fuser -k cleanup in ProcessRunner to terminate orphaned processes using the instance directory before launch without deleting session.lock. Guaranteed Process.Kill(entireProcessTree: true) during shutdown, and gated crash auto-restart behind instance.EnableAutoRestart with configurable delays.
- Native Clipboard Service: Introduced AppClipboard with Avalonia UI thread dispatcher handling and native CLI fallbacks (wl-copy on Wayland, xclip/xsel on X11, pbcopy on macOS). Updated ServerConsoleViewModel and ServerConsolePage to toggle 'Copied!' and a checkmark icon with a 2-second auto-reset.
- Platform TitleBar Margins: Implemented GetDefaultTitleBarMargin in MainWindow.axaml.cs returning 0px right margin on Linux, 80px left margin on macOS, and 140px right margin on Windows, aligning the System RAM badge flush with the right edge.
- Automated Testing: Added regression tests covering InstanceCardViewModel status mappings, auto-restart opt-in behavior, AppClipboard feedback, and platform title bar margins, bringing the test suite to 231 passing tests.
@sizwinz
sizwinz merged commit c19a247 into main Nov 23, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant