Skip to content

CPU topology v2 phase 6: migrate profiles and core masks to CpuSelection#12

Merged
PrimeBuild-pc merged 3 commits into
mainfrom
codex/cpu-topology-v2-phase-6-profile-cpuselection-migration
May 20, 2026
Merged

CPU topology v2 phase 6: migrate profiles and core masks to CpuSelection#12
PrimeBuild-pc merged 3 commits into
mainfrom
codex/cpu-topology-v2-phase-6-profile-cpuselection-migration

Conversation

@PrimeBuild-pc
Copy link
Copy Markdown
Owner

Summary

Adds a conservative CpuSelection migration and compatibility layer for persisted profiles and core masks.

  • Adds schema constants where legacy files without a schema version are treated as version 1 and CpuSelection-backed files are version 2.
  • Adds CpuSelectionMigrationMetadata for affinity/core-mask migration provenance, confidence, topology signature, review state, and source legacy mask.
  • Adds a public ProcessProfileSnapshot model with legacy ProcessorAffinity retained alongside optional CpuSelection and migration metadata.
  • Extends ProfileModel and CoreMask with optional CpuSelection fields without removing existing legacy fields.
  • Adds CpuSelectionMigrationService for testable migration from legacy affinity masks and bool core masks, plus safe legacy-mask build-back only when representable.
  • Wires profile save/load to persist/read CpuSelection when a topology snapshot is available, while keeping legacy ProcessorAffinity for compatibility.
  • Wires core mask load/save to attach CpuSelection metadata where possible while preserving BoolMask and leaving runtime core-mask apply unchanged.

Out of scope

  • No UI changes.
  • No profile UI migration or review UI.
  • No deletion of legacy fields.
  • No preset generator changes.
  • No Process Lasso-style registry/IFEO work.
  • No priority guardrails.
  • No X3D detection.
  • No version bump and no tag.
  • Core mask runtime auto-apply still uses the existing legacy path; switching it to CpuSelection is left for a later phase.

Tests

  • dotnet test "ThreadPilot_1.sln" --configuration Release --no-restore
  • Result: 230 passed, 0 failed, 0 skipped.

Existing warnings remain in unrelated test files: CS1998 in RetryPolicyServiceTests and CS0067 in ProcessMonitorManagerServiceTests.

@codecov-commenter
Copy link
Copy Markdown

codecov-commenter commented May 19, 2026

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 73.24561% with 61 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
Services/CoreMaskService.cs 0.00% 41 Missing ⚠️
Services/ProcessService.cs 89.39% 3 Missing and 4 partials ⚠️
Services/ServiceConfiguration.cs 0.00% 5 Missing ⚠️
Models/ProfileModel.cs 0.00% 4 Missing ⚠️
Models/CoreMask.cs 50.00% 3 Missing ⚠️
Services/CpuSelectionMigrationService.cs 98.88% 0 Missing and 1 partial ⚠️

πŸ“’ Thoughts on this report? Let us know!

@PrimeBuild-pc PrimeBuild-pc marked this pull request as ready for review May 20, 2026 13:28
@PrimeBuild-pc PrimeBuild-pc merged commit 731a537 into main May 20, 2026
3 checks passed
@PrimeBuild-pc PrimeBuild-pc deleted the codex/cpu-topology-v2-phase-6-profile-cpuselection-migration branch May 20, 2026 13:32
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: 0f06031f59

ℹ️ 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 +681 to +682
return false;
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Surface CpuSelection apply failures as exceptions

When CPU-selection application fails, this branch now returns false instead of throwing, which changes error signaling for profile loads. In the existing UI path (ProcessViewModel.LoadProfile), the return value is ignored and only exceptions trigger an error status, so protected/denied affinity applies can silently fail while the user sees a successful load. This regression is triggered whenever SetProcessorAffinity(process, profile.CpuSelection) returns a failed AffinityApplyResult.

Useful? React with πŸ‘Β / πŸ‘Ž.

Comment on lines +320 to +323
if (mask.CpuSelection != null)
{
mask.ProfileSchemaVersion = CpuAffinityProfileSchemaVersions.CpuSelection;
continue;
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 Recompute CpuSelection after BoolMask edits

This guard skips migration whenever CpuSelection is already set, so later edits to BoolMask (saved via UpdateMaskAsync -> SaveMasksAsync) do not refresh the persisted CpuSelection. After any mask edit, the file can contain a boolMask and cpuSelection that describe different CPU sets, which will produce incorrect behavior once CpuSelection-based mask application is used.

Useful? React with πŸ‘Β / πŸ‘Ž.

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