Skip to content

Cover the custom-feature apply and undo bodies - #84

Merged
BiosSystem merged 1 commit into
masterfrom
feature/custom-feature-apply-tests
Sep 29, 2026
Merged

BiosSystem merged 1 commit into
masterfrom
feature/custom-feature-apply-tests

Conversation

@BiosSystem

Copy link
Copy Markdown
Owner

The Enable/Disable functions for gaming mode, performance tweaks, security hardening and the extended AI purge do real registry, service, power, firewall and optional-feature changes. Until now nothing ran a body outside the Sandbox mutating suite; the static guard in Test-ModuleRollback only parses the declared target lists.

Test-CustomFeatureApply.ps1 runs each apply and undo body with every OS-touching command mocked, and powercfg/netsh shadowed by no-op functions so a missed mock cannot reach the real machine. It asserts:

  • the values each body writes, and that missing keys are created first
  • -WhatIf gates every registry/service/firewall change (nothing runs)
  • each undo reverses the right values (services restarted, RDP re-enabled, AutoRun default restored, Phone Link/clipboard reverted)
  • scheduled-task and Recall-component branches only fire when the target is present
  • a runtime drift check: every path+name a body writes is declared by its registry-target provider, catching a wrong key path that the static name-only guard misses

Test-only. New file wired into the CI workflow. Validation run locally: static validation clean (139 files), full unit suite 279 passed / 0 failed (was 252). Not run locally: the Sandbox mutating suite (unchanged) and CI's pwsh/MTA pass, which runs on the PR.

The Enable/Disable functions for gaming mode, performance tweaks,
security hardening and the extended AI purge do real registry, service,
power, firewall and optional-feature changes, but nothing ran a body
outside the Windows Sandbox mutating suite. The static guard in
Test-ModuleRollback only parses the declared target lists.

New unit tests run each body with every OS-touching command mocked, and
powercfg and netsh shadowed by no-op functions so a missed mock cannot
reach the real machine. They assert the values written, that missing
keys are created, that -WhatIf gates every change, and that each undo
reverses the right values.

The runtime drift check is stronger than the static one: it confirms
every path and name a body actually writes is declared by that module's
registry-target provider, so a wrong key path is caught, not just a
wrong value name. Wired the new file into the CI workflow.
@BiosSystem
BiosSystem merged commit 04b01f7 into master Sep 29, 2026
1 check passed
@BiosSystem
BiosSystem deleted the feature/custom-feature-apply-tests branch September 29, 2026 13:56
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