Skip to content

PSUseShouldProcessForStateChangingFunctions: Set-CodexSessionDirectory missing ShouldProcess support #4

@eigenverft

Description

@eigenverft

Issue

The Set-CodexSessionDirectory function modifies session state but does not support ShouldProcess, which violates PowerShell best practices for functions that change system state.

Location

Eigenverft.Manifested.Agent.InvokeCodexTask.ps1, line 261

Current Behavior

function Set-CodexSessionDirectory {
    [CmdletBinding()]
    param(
        [Alias('Session')]
        [Parameter(Mandatory = $true)]
        [string]$SessionName,

        [Parameter(Mandatory = $true)]
        [string]$Directory
    )
    # ... modifies session store without ShouldProcess support
}

Expected Behavior

The function should support -WhatIf and -Confirm parameters by implementing SupportsShouldProcess:

function Set-CodexSessionDirectory {
    [CmdletBinding(SupportsShouldProcess = $true)]
    param(
        # ... parameters
    )
    
    if ($PSCmdlet.ShouldProcess($sessionKey, 'Update stored Codex session directory')) {
        # ... perform the modification
    }
}

Impact

  • Users cannot use -WhatIf to preview changes
  • Users cannot use -Confirm to require confirmation before changes
  • Violates PowerShell best practices for state-changing functions

Related

  • Similar issue may exist in other session-modifying functions

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions