## Summary
Adds a safe in-app updater for ThreadPilot. This PR does not bump the app version and does not prepare a release; version and release metadata will be handled separately for v1.4.0.
## Type of Change
- [x] Feature
- [x] Security hardening
- [x] Documentation
- [x] Added/updated tests
## Update flow
- Checks for updates on demand from Settings.
- Performs background startup checks only when enabled and the last check is older than the configured interval.
- Defaults to a 7-day interval.
- Excludes prereleases by default.
- Notifies users when an update is available.
- Requires explicit user action before download/install.
## Security and safety
- Uses release metadata from the official `PrimeBuild-pc/ThreadPilot` repository only.
- Selects safe ThreadPilot installer assets from GitHub HTTPS release assets.
- Downloads into a ThreadPilot-owned temp update directory.
- Verifies SHA256 checksums when `SHA256SUMS.txt` is available.
- Rejects checksum mismatches.
- Performs best-effort Authenticode verification and rejects explicitly invalid signatures.
- Starts the installer elevated without shell command construction.
- Prevents concurrent install attempts.
## User data preservation
- Update flow does not delete AppData, settings, profiles, CPU masks, rules, custom/imported power plans, or logs.
- Only updater temp files are cleaned.
- Full uninstall behavior remains separate.
## Validation
- `dotnet restore ThreadPilot_1.sln`: passed
- `dotnet build ThreadPilot_1.sln`: passed, 0 warnings, 0 errors
- `dotnet test ThreadPilot_1.sln`: passed, 537 tests
## Release note
This PR intentionally leaves `ThreadPilot.csproj` at `1.3.1`. The `1.4.0` version bump, changelog, packaging metadata, and tag should happen in a separate release-prep branch after this PR is merged.
## Summary
Fixes the release workflow smoke-test hang by handling `--smoke-test` early during app startup.
## Changes
- Detects `--smoke-test` before elevation, mutex, WPF UI startup, tray, or background services.
- Performs lightweight startup/package validation only.
- Exits explicitly with code 0 on success, 1 on validation failure, 2 on timeout.
- Adds regression tests for early smoke-test behavior.
## Validation
- `dotnet build ThreadPilot_1.sln`: passed
- `dotnet test ThreadPilot_1.sln`: passed, 527 tests
## Safety
- No normal startup behavior changes.
- No localization changes.
- No installer/uninstaller changes.
- No elevation/process/power plan behavior changes.
## Summary
Fixes the incomplete Simplified Chinese localization shipped in v1.3.0 and prepares v1.3.1.
## Changes
- Completed zh-CN localization coverage across the main UI.
- Added/updated localization keys for primary views, tray/status text, notifications, and settings.
- Kept en-US as the default language.
- Updated version metadata to 1.3.1.
- Changed installer display name to ThreadPilot while keeping version metadata separate.
- Added guarded cleanup for obsolete ThreadPilot 0.1.0-beta uninstall entry.
- Improved uninstall cleanup for ThreadPilot AppData, startup task, and HKCU Run entry.
- Added localization and packaging metadata tests.
## Validation
- dotnet build ThreadPilot_1.sln: passed, 0 warnings
- dotnet test ThreadPilot_1.sln: passed, 524 tests
## Safety
- No change to elevation behavior.
- No change to affinity/process control behavior.
- No change to power plan or system tweak behavior.
- Normal install/update preserves user settings.
- Full uninstall removes ThreadPilot-owned AppData for the uninstalling user.
Adds English/Chinese localization infrastructure with en-US as default, zh-CN as optional language, safe fallback behavior, settings integration, localized notifications, and expanded test coverage.
* Fix startup binding and prep v1.2.0
* Polish v1.2.0 validation UX
* Fix final v1.2.0 validation polish
* Make Activity Logs a ThreadPilot audit trail
* Fix high scheduling registry value
* Polish process list and automation settings UX
* Fix process context menu separator styling
* Theme process context menu visuals
* Stabilize process context menu styling
* Remove process menu icon gutter
* Polish startup and idle process refresh
* Finalize PR22 release polish
Apply persistent rules when processes start
Wire persistent process rules into runtime process discovery so existing enabled rules can apply automatically while ThreadPilot is running.
- Add PersistentRuleAutoApplyService for runtime rule auto-apply
- Hook auto-apply into ProcessMonitorManagerService snapshot and process-start paths
- Add ApplyPersistentRulesOnProcessStart app setting enabled by default
- Use existing PersistentRulesEngine for CpuSelection, legacy affinity, CPU priority and memory priority
- Add per-process/rule cooldown to avoid repeated apply spam
- Clear cooldown state when processes exit or disappear from snapshots
- Preserve safe protected-process and access-denied behavior without bypass claims
- Preserve cancellation semantics during shutdown/stop paths
- Add tests for matching rules, disabled/no-match cases, cooldown, retry, PID reuse, failures, feature flag and monitor integration
No Windows Service, registry/IFEO persistence, installer changes, rules editor, version bump or tag changes.
Add Apply now and save as rule flow
Add explicit opt-in persistent rule creation from Process tab actions.
- Add ProcessRuleCreationService for creating/updating persistent process rules
- Add Rules submenu with Save Current Settings as Rule and Apply Affinity and Save as Rule
- Match existing rules by executable path or process name fallback to avoid duplicates
- Preserve rule Id and CreatedAt when updating existing rules
- Prefer CpuSelection and only save legacy affinity when safely representable
- Avoid saving Normal CPU priority from automatic current-state capture
- Block Realtime priority and unsafe affinity persistence with controlled messages
- Save memory priority when known
- Keep existing normal context actions from creating persistent rules
- Add tests for create/update, path/name matching, CpuSelection, legacy safety, priority capture, memory priority, no-action failure and ViewModel commands
No full rules editor, modal confirmation flow, registry/IFEO, Windows Service, diagnostics changes, version bump or tag changes.
Add Process tab context menu actions
Add a lightweight right-click context menu to Process tab rows using existing safe process action paths.
- Add row context menu for Process tab DataGrid rows
- Add row-specific Apply Affinity command using ProcessAffinityApplyCoordinator
- Add Clear CPU Sets action using the safe CPU Sets clear path
- Add CPU priority actions while keeping Realtime blocked
- Add memory priority actions through ProcessMemoryPriorityService
- Add Open Executable Location, Copy Process Info and Refresh Process Info actions
- Refresh selected-process summary after context actions
- Keep context menu actions from creating persistent rules
- Add tests for row-specific affinity, CPU priority, memory priority, copy/open/refresh, CPU Sets clear and no rule creation
No save-as-rule flow, rules editing UI, persistent rule creation, affinity core changes, memory-priority backend changes, diagnostics changes, version bump or tag changes.
Add selected process summary to Process tab
Add a lightweight current-process status strip under the Process tab process list without reintroducing dashboard-style monitoring.
- Add SelectedProcessSummaryViewModel populated from selected ProcessModel data
- Show selected process name, PID, path, CPU priority, memory priority, affinity, rule status, CPU usage and memory usage
- Read memory priority once on selection when available
- Check saved persistent rule status through the existing rule store and matcher
- Avoid PerformanceMonitoringService, diagnostics/live monitoring and timers
- Guard async summary updates so stale memory/rule lookups cannot overwrite newer selections
- Update summary after refreshed process fields only when the selected process is still current
- Add tests for no-selection state, selection changes, memory priority, rule status, no performance dependency and stale async update protection
No context menu, save-as-rule flow, rules editing UI, diagnostics redesign, background monitoring, version or tag changes.
Reduce Performance tab to optional diagnostics
Hide the Performance/Diagnostics surface from the primary UX by default and remove hidden startup/tray runtime cost.
- Hide Diagnostics from primary navigation and tray by default
- Lazy-create PerformanceViewModel only when Diagnostics is opened
- Stop initializing diagnostics snapshots during app startup
- Gate tray CPU/RAM metrics behind the advanced diagnostics flag
- Avoid starting the tray lightweight metrics timer when diagnostics are hidden
- Lazily allocate PerformanceMonitoringService counters on first metrics use
- Stop live diagnostics when inactive, minimized or tray-hidden
- Preserve diagnostics internals for future selected-process summary work
- Add tests for lazy diagnostics creation, tray metrics gating and explicit diagnostics activation
No Process tab redesign, CPU affinity changes, memory priority changes, persistent rules changes, version bump or tag changes.
Migrate Process tab manual affinity apply to CpuSelection
Route manual Process tab affinity operations through a topology-aware coordinator so CpuSelection and CPU Sets are preferred over legacy long masks.
- Add ProcessAffinityApplyCoordinator for manual Process tab affinity apply
- Prefer CoreMask.CpuSelection when available
- Migrate legacy BoolMask selections to CpuSelection when topology is available
- Block unsafe legacy fallback for selections above CPU64
- Keep legacy long mask fallback only for safe single-group <=64 selections
- Wire SetAffinity, ApplyCoreMaskToProcessAsync and QuickApplyAffinityAndPowerPlan through the coordinator
- Document CoreMask.ToProcessorAffinity as legacy-only
- Ensure ProcessViewModel fallback coordinator receives topology provider
- Add regression tests for CPU64, multi-group, safe legacy fallback, migration and protected-process messages
No UI redesign, preset generator, memory priority, persistent rules engine, migration logic, version or tag changes.
Add process memory priority foundation
Introduce backend support for process memory priority using Windows GetProcessInformation and SetProcessInformation while keeping the feature testable and safe.
- Add ProcessMemoryPriority model with documented Windows memory priority levels
- Add fakeable native API wrapper for process memory priority
- Add ProcessMemoryPriorityService with safe error handling
- Add ProcessOperationResult for process operation outcomes
- Extend persistent process rules with memory priority support
- Apply memory priority through PersistentRulesEngine when configured
- Preserve anti-cheat/protected-process safety messaging
- Add tests for native get/set, invalid process, access denied, unsupported API, enum mapping, persistent rules and JSON roundtrip
No UI redesign, registry/IFEO persistence, Windows Service, preset generator, migration, version or tag changes.
Add persistent rules engine foundation
Introduce the foundation for Apply at process start without adding a background loop, Windows Service, installer changes, registry affinity or anti-cheat bypass behavior.
- Add PersistentProcessRule and PersistentRuleApplyResult models
- Add process-name and executable-path rule matching
- Add PersistentRulesEngine using existing safe affinity and priority services
- Add JSON-backed persistent rule store
- Add safe Apply at process start user-facing copy
- Validate incomplete rules so missing affinity/priority payloads fail safely
- Add tests for matching, CpuSelection, legacy affinity, priority, Realtime guardrails, access denied, protected processes, process exit, disabled rules and storage roundtrip
No process monitor hook, UI management, Windows Service, registry/IFEO expansion, version bump or tag changes.
Improve affinity errors and priority guardrails
Centralize safe user-facing messages for process affinity, CPU Sets, protected processes, access denied cases, topology errors and priority guardrails.
- Add CpuSetApplyResult detailed path while preserving existing bool CPU Sets APIs
- Use detailed CPU Sets results in the CpuSelection affinity flow
- Centralize affinity/priority messages in ProcessOperationUserMessages
- Improve AccessDenied, anti-cheat/protected, invalid topology, process exited and legacy fallback blocked messages
- Add High priority warning
- Block Realtime priority for direct apply, profile load and registry priority requests
- Audit and log blocked Realtime priority attempts
- Prevent critical status messages from being cleared immediately
- Add tests for affinity messages, CPU Sets detailed failures, priority guardrails and status clearing
No persistent rules engine, registry affinity, preset/profile migration, version or tag changes.
Migrate profiles and core masks to CpuSelection
Add a conservative compatibility layer for moving persisted profiles and core masks toward topology-aware CpuSelection while preserving legacy fields.
- Add profile schema version constants and CpuSelection migration metadata
- Add ProcessProfileSnapshot with legacy ProcessorAffinity plus optional CpuSelection
- Extend ProfileModel and CoreMask with CpuSelection fields without removing legacy data
- Add CpuSelectionMigrationService for legacy affinity mask and bool core mask conversion
- Preserve legacy mask build-back only when CpuSelection is safely representable
- Wire profile save/load to read and persist CpuSelection when topology is available
- Wire core mask load/save to attach CpuSelection metadata while keeping BoolMask
- Return failure when CpuSelection profile application fails
- Add tests for CPU64 alias protection, multi-group safety, topology signature review, legacy/v2 JSON compatibility and profile load behavior
No UI, preset generator, registry/IFEO, priority guardrail, X3D detection, version or tag changes.
Add topology-aware CPU preset generator foundation
Introduce a topology-derived preset generator for safe default CPU affinity suggestions without relying on CPU SKU hardcoding.
- Add CpuPreset, ICpuPresetGenerator and CpuPresetGenerationOptions
- Generate deterministic presets for all cores, physical/no-SMT, all except CPU0, P/E cores, L3 group physical cores, best gaming and safe compatibility
- Add SourcePresetId for best-gaming while keeping Reason user-facing
- Use CpuTopologySnapshot metadata such as CoreIndex, EfficiencyClass, L3/cache groups and SMT siblings
- Avoid X3D/3D V-Cache preset generation until reliable detection is available
- Register the generator for future UI/profile phases
- Add tests for SMT, hybrid P/E cores, dual CCD, >64 logical processors, deleted presets and missing CoreIndex
No UI, profile migration, runtime affinity apply, ProcessService, registry/IFEO, version or tag changes.
Add safe CpuSelection affinity apply path
Introduce a structured CpuSelection affinity apply path that tries CPU Sets first and falls back to legacy ProcessorAffinity only when the selection is safely representable as a non-zero single-group <64 mask.
- Add structured AffinityApplyResult fields and error codes
- Add CpuSelectionAffinityApplier with CPU Sets-first behavior
- Add ProcessService overload for CpuSelection affinity apply
- Block unsafe legacy fallback for multi-group and CPU >=64 selections
- Preserve existing legacy SetProcessorAffinity(long) behavior
- Add audit coverage for CpuSelection apply success/failure paths
- Add tests for safe fallback, blocked fallback, access denied, process exit and invalid selection
No UI, preset generator, profile migration, registry/IFEO, priority guardrail, versioning or tag changes.
Make CPU Sets mapping group-aware
Replace legacy LogicalProcessorIndex-based CPU Set mapping with ProcessorRef-based mapping that preserves processor group and group-relative logical processor identity.
- Add CpuSetMapping with ProcessorRef -> CpuSetId and reverse lookup
- Add fakeable ProcessCpuSet native API seam
- Add ApplyCpuSelection for topology-aware CPU Set assignment
- Keep legacy ApplyCpuSetMask path for single-group <=64 compatibility
- Prevent CPU64 / Group 1 CPU0 from aliasing CPU0
- Add tests for group-aware mapping, explicit CpuSetIds, selection clearing and legacy behavior
No ProcessService wiring, UI, preset generator or profile migration changes.
Add CPU topology provider abstraction
Introduce ICpuTopologyProvider and WindowsCpuTopologyProvider for topology-aware CPU detection using Windows CPU Sets and logical processor relationship APIs.
- Extend CpuTopologySnapshot with core, NUMA, L3/cache, package and SMT sibling metadata
- Add WindowsCpuTopologyNativeLayout for testable Win32 native layout parsing
- Add group-aware fallback processor generation for >64 logical processors
- Add simulated topology tests for multi-group, hybrid efficiency classes, SMT on/off, L3 groups and >64 LP systems
No runtime affinity, ProcessService, ProcessCpuSetHandler, UI, preset or profile migration behavior changes.
* Improve background refresh and process detection
* Harden affinity and power plan automation
* Fix passive process refresh failures
* Improve UX terminology and process layout
* Polish UX layout and empty states
* Expand core service test coverage
Introduce IElevatedTaskService and ElevatedTaskService to manage scheduled-task based elevated launch and autostart. Update App.xaml.cs to bootstrap elevation, attempt managed elevated launch, and handle task registration markers. Refactor AutostartService to delegate autostart operations to the elevated task service, remove legacy registry usage where appropriate, add logging, and update DI registration and unit tests. Remove MSIX packaging support and related tooling: delete build/build-msix.ps1, remove MSIX publish/validation/upload steps from GitHub Actions, drop MSIX-related csproj targets and EnableMsixTooling, and update docs/README/.gitignore to no longer reference MSIX artifacts.
Add comprehensive CI and release improvements (coverage collection, Codecov upload, SBOM generation), split release workflow into build/smoke-test/release stages with deterministic version resolution, artifact uploads, winget manifest updates and changelog generation. Add a pre-commit hook to block large or unwanted artifacts. Introduce runtime improvements: smoke-test startup mode, improved unhandled/dispatcher/task-exception reporting, ThreadPilotException error codes, single-instance behavior adjustments, and logging enhancements. UI and UX changes include a new Logs tab and LogViewer wiring, DWM title-bar theming helper, navigation serialization/unsaved-changes guard, system-tray update backoff logic, and related viewmodel/service integrations. Also add installer template, helper classes, tests, docs, packaging and build scripts, and minor .gitignore updates.
Replaces the project's license from GNU GPL v3 to the GNU Affero General Public License v3: updated LICENSE (full AGPL text) and updated license headers across source files. Adds InternalsVisibleTo("ThreadPilot.Core.Tests") (plus using System.Runtime.CompilerServices) in AssemblyInfo to allow test access to internal types. Also introduces Services/TaskSafety.cs and two new test files under Tests/ThreadPilot.Core.Tests to cover task safety. These changes apply the AGPLv3 terms and enable internal API access for unit tests.
Large changeset adding documentation, themes, converters and wiring between UI and services. Key changes:
- Rewrote .gitignore to standardize build, IDE, OS and project-specific ignores.
- Added comprehensive documentation: ADVANCED_CPU_FEATURES.md, API_REFERENCE.md, ARCHITECTURE_GUIDE.md, DEVELOPER_GUIDE.md, GAME_BOOST_VALIDATION.md, CLAUDE.md, PROJECT_STRUCTURE.md, UI_STYLE_GUIDE.md, TRADEMARK.md.
- Added theme resources (Themes/FluentLight.xaml, Themes/FluentDark.xaml) and merged FluentLight into App.xaml resource dictionary.
- Added NullToBoolConverter and registered it in App.xaml.
- Enabled a DEBUG-only console test mode in App.xaml.cs (--test flag) and guarded AllocConsole with #if DEBUG.
- Added new service/support files (AtomicFileWriter, StoragePaths, ThemeService) and numerous updates across Services (CpuTopologyService, CoreMaskService, PowerPlanService, ProcessMonitorManagerService, ProcessService, NotificationService, SystemTrayService, SystemTweaksService, EnhancedLoggingService, etc.).
- Updated many ViewModels and Views to support new functionality (CPU topology, power plan and game-boost features) and tests (Tests/TestRunner.cs).
- Added build-release.ps1 and various project metadata updates.
Overall this commit introduces documentation, theming, new converters and test/debug support, plus extensive service and UI wiring for CPU topology, process monitoring, power plans and game boost features.