Follow up #143: share hive state and protect nested repair handoffs - #148
Closed
Marcus Ferreira (mvaferreira) wants to merge 1 commit into
Closed
Follow up #143: share hive state and protect nested repair handoffs#148Marcus Ferreira (mvaferreira) wants to merge 1 commit into
Marcus Ferreira (mvaferreira) wants to merge 1 commit into
Conversation
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: cf64bab1-6099-4e7e-aef4-57ffea10ce6b
Author
This was referenced Sep 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why this follow-up exists
#143 merged as
1b2a597while the additional #146/#147 review fixes were being validated.This PR contains only the shared-foundation changes those reviews need; it does not alter the
approved/merged #143 history.
OfflineRepairCommon.ps1Get-OfflineWindowsDisk.ps1ProblemVMor an explicit custom IdREADME.mdNo scenario or
map.jsonentry is added. #146 and #147 use this shared contract; consumingscenario PRs must wait until all three outstanding helper changes have merged.
Registry state across dot-source scopes
Set-OfflineWindowsDrivebinds the selected root and publishes the default throughGet-OfflineRepairState. Scope-private variables are no longer independent sources of truth.The same state owns hive depth and active file bindings, preventing an inner callback from
unloading its outer caller's hive or silently switching the file/default underneath it.
Nested-guest coordination
Discovery previously turned off every running Hyper-V guest. It now fails before any disk
preparation when another guest is active or #147's helper has marked a guest as managed. It does
not merely skip that guest and attempt to online its disk.
The persistent
repair-script-library:nested-repair:v1Notes line works across PowerShellprocesses. A shared mutex serializes ownership/start/stop and disk-preparation transitions.
The owning flow must explicitly call
Stop-NestedRepairVmGraceful, confirmStopped, andthen rediscover the disk. Automatic unmanaged shutdown uses an exact VM object and verifies Off;
no wildcard-name shutdown or success-shaped enumeration failure remains.
Validation and limits
across all eight helper files.
writable synthetic hives, strict selected-set writes, cross-scope calls and unwind/cleanup.
disks. Fresh-process discovery refuses to interrupt them; disk return is verified. Five
original guests and seven original disks remain unchanged.
presented as Windows guest boot/payload validation or a fresh
--previewscenario matrix.Local test tooling stays outside the contribution, as requested. No protection was disabled,
and no existing lab guest or original disk was repurposed for these checks.