Files
PSProxmoxVE/tests
goodolclint-claude[bot] 27145ee53e fix: store the active PVE session per runspace instead of in a static (#226)
A binary module assembly loads once per process, so the internal static
ActiveSession slot was shared by every runspace in the host. Under
ForEach-Object -Parallel, a multi-runspace host or a JEA endpoint, one
runspace's Connect-PveServer retargeted another runspace's next cmdlet,
and a credential established in one runspace was reachable from all of
them.

The session now lives in the module's own session state, which
PowerShell creates once per runspace, read and written through
ModuleState.GetActiveSession/SetActiveSession behind the existing single
read point PveCmdletBase.GetSession(). The name is scope-qualified so a
nested scope cannot write a copy that dies with it, nor read through to a
same-named global. A module imported from the assembly rather than the
manifest has no session state; that path falls back to the runspace's
global scope, which is still per-runspace.

No IModuleAssemblyCleanup: no mutable static remains to clear.

Closes #150

Co-authored-by: goodolclint-claude[bot] <323206664+goodolclint-claude[bot]@users.noreply.github.com>
2026-09-03 18:14:47 +00:00
..