fix: preserve selections when config import is invalid (#4994)

* fix: validate imports before replacing selections

* test: cover atomic config imports

* docs: explain stale config imports

---------

Co-authored-by: Guilherme de Oliveira Rocha <contatoguilhermeoliveira@protonmail.com>
Co-authored-by: Chris Titus <contact@christitus.com>
This commit is contained in:
Guilherme Oliveira
2026-08-19 15:30:46 -05:00
committed by GitHub
co-authored by Guilherme de Oliveira Rocha Chris Titus
parent 2d0fd43bd3
commit 792122e998
4 changed files with 183 additions and 13 deletions
@@ -40,6 +40,12 @@ This is useful for:
- Reusing a known-good baseline after reinstalling Windows
- Standardizing deployments for labs, workstations, or personal setups
:::caution[Keep exported configurations current]
Exported configurations contain the WinUtil catalog keys that existed when the file was created. If a later WinUtil version removes or renames one of those keys, the import is rejected before any current selections are changed. PowerShell reports the stale entry as `Unknown selection key '<key>'`.
To recover, compare the reported key with the current files in the [WinUtil configuration catalog](https://github.com/ChrisTitusTech/winutil/tree/main/config). Remove or replace the stale key in your JSON file, or create and export a new configuration with the current WinUtil version, then run the import again. Re-export long-lived baselines after catalog changes so they remain compatible.
:::
:::note
Run the command in an elevated PowerShell session so WinUtil can apply system-level changes.
:::