Skip to content

Perf/professional hardening#4

Merged
PrimeBuild-pc merged 6 commits intomainfrom
perf/professional-hardening
May 9, 2026
Merged

Perf/professional hardening#4
PrimeBuild-pc merged 6 commits intomainfrom
perf/professional-hardening

Conversation

@PrimeBuild-pc
Copy link
Copy Markdown
Owner

@PrimeBuild-pc PrimeBuild-pc commented May 9, 2026

Summary

This PR hardens ThreadPilot’s background behavior, process refresh pipeline, affinity/power-plan automation, and UX clarity.

Main goals:

  • reduce unnecessary background work when the app is minimized, hidden to tray, or not on the Process tab;
  • make process refresh more robust against protected/terminated processes;
  • make CPU affinity changes explicit, verified, and safer;
  • prevent repeated/duplicate power plan transitions;
  • clarify UX terminology around Automation Monitoring, Live Metrics, pending affinity, rules, and power plans;
  • improve Process Management layout and empty states;
  • expand core service test coverage.

Type of Change

  • Bug fix
  • Feature
  • Refactor
  • Documentation
  • Security hardening
  • Performance improvement

What Changed

Performance / background behavior

  • Added AppRefreshPolicy to centralize refresh decisions.
  • Pauses process UI refresh, virtualized preload, power-plan UI refresh, tray status refresh, and performance UI monitoring when minimized/tray-hidden.
  • Keeps background automation active.
  • Added delta-based process list updates to avoid repeated O(n²) PID lookups.

Process refresh reliability

  • Added foreground-process detection and process classification metadata.
  • Hardened passive process enumeration against access-denied, module enumeration failures, and process churn.
  • Protected/inaccessible processes now create minimal rows where possible instead of aborting the whole refresh.
  • Throttled passive access-denied logging at Debug level.

Affinity and power-plan automation

  • Added shared affinity apply/verify path.
  • Removed remaining affinity preset auto-apply behavior.
  • CPU mask selection now stages pending changes; affinity changes require explicit apply or automation.
  • Added power-plan transition gate to suppress already-active and repeated same-plan requests.

UX improvements

  • Renamed ambiguous monitoring terminology:
    • process/rule monitoring → Automation Monitoring;
    • performance monitoring → Live Metrics.
  • Redesigned Process Management into a two-pane layout:
    • process table/search/filter on the left;
    • selected-process actions on the right.
  • Clarified current OS affinity vs pending core mask.
  • Improved labels and empty states in Process Management, Power Plans, CPU Masks, Rules & Automation, Tweaks, Performance, and Logs.

Tests

  • Expanded core service coverage around:
    • refresh policy;
    • process list delta updates;
    • passive process error throttling;
    • foreground/process classification;
    • affinity apply/verify failures;
    • power-plan transition gating;
    • process monitor manager automation paths;
    • passive process exception classification.

Validation

Local validation passed:

  • dotnet build ThreadPilot_1.sln
  • dotnet test ThreadPilot_1.sln
  • git diff --check
  • Manual smoke test of the updated UI
  • Verified process table loads after passive refresh fix
  • Verified selecting a core mask does not apply affinity automatically
  • Verified explicit affinity apply remains the path for OS changes
  • Verified Automation Monitoring / Live Metrics terminology is clearer
  • Verified GitHub Actions checks passed

Current test count: 104 passing.

Known local warnings are pre-existing analyzer/style warnings plus NU1900 when NuGet vulnerability metadata cannot be fetched.

Security and Risk Notes

This PR touches elevated/system-adjacent functionality, including process enumeration, processor affinity, power plans, process monitoring, tray behavior, and Windows tweak UI. Changes were intentionally scoped to make these paths safer:

  • affinity changes are now explicit and verified;
  • passive process enumeration handles protected processes more defensively;
  • power-plan switching suppresses repeated duplicate transitions;
  • background automation remains active while UI refresh work is reduced;
  • no packaging, installer, release, Chocolatey, WinGet, or version files were changed.

Manual QA Checklist

  • Launch app as administrator.
  • Open Process Management and verify process table loads.
  • Search/filter process list.
  • Select a process and verify right-side action pane updates.
  • Select a CPU mask and verify it is pending only.
  • Apply affinity explicitly and verify UI updates.
  • Verify power plan selection and quick apply behavior.
  • Open CPU Masks and verify mask editing still works.
  • Open Power Plans and verify Windows/custom power plan layout.
  • Open Rules & Automation and verify Automation Monitoring wording.
  • Open Performance and verify Live Metrics wording.
  • Open Logs and Tweaks tabs.
  • Minimize/hide to tray and restore app.
  • Verify foreground restore behavior improved.

Checklist

  • Updated docs where relevant
  • Added or updated tests where relevant
  • Kept changes scoped and backwards compatible where possible
  • No secrets/credentials introduced
  • No packaging/release files touched

@codecov-commenter
Copy link
Copy Markdown

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 87eb05e423

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +99 to +100
target.IsIdleServerDisabled = source.IsIdleServerDisabled;
target.IsRegistryPriorityEnabled = source.IsRegistryPriorityEnabled;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve process toggle flags when applying refresh snapshots

Do not overwrite IsIdleServerDisabled and IsRegistryPriorityEnabled from the incoming snapshot here. ProcessService does not hydrate those fields when building snapshot models, so every refresh writes the defaults back onto existing rows. In practice, if a user enables either toggle for a process, the next refresh clears that state in the in-memory model and later selections show the wrong value, causing confusing and incorrect UI behavior.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Owner Author

@PrimeBuild-pc PrimeBuild-pc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the changes and validation results. CI, CodeQL, and local validation passed. Approved for merge.

@PrimeBuild-pc PrimeBuild-pc merged commit 4fceda1 into main May 9, 2026
3 checks passed
@PrimeBuild-pc PrimeBuild-pc deleted the perf/professional-hardening branch May 9, 2026 21:15
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.

2 participants