chore: finish PowerShell script audit for issue #25#447
Open
EnmaJim wants to merge 32 commits into
Open
Conversation
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.
Linked issue
Closes #25
Summary of changes
Completes the three remaining acceptance criteria on the script audit:
error handling, UTF-8 file encoding, and logging-helper consistency.
.ps1entry-point now setsSet-StrictMode -Version 3.0and$ErrorActionPreference = 'Stop',variables are initialised before
tryblocks so strict-mode readson early
throwno longer surface as "property cannot be found",optional JSON-RPC and workflow-manifest fields are guarded under
strict mode, and empty/silent-discard
catchblocks have beenreplaced with
Write-BotLogcalls (atlassian-download, InboxWatcherworker log, ui/server port probe, etc.).
Set-Content/Add-Content/Out-Filecall now declares-Encoding utf8NoBOM, and.gitattributespins LF line endings for*.ps1,*.psm1,*.psd1.Write-Warningand bare errorprints in long-running paths are routed through
Write-BotLog, andthe strict-mode leak that broke
/api/state(dot-sourcing a scriptwith top-level
Set-StrictModefromGet-BotState) is fixed atsource: dot-sourceable scripts keep strict mode inside function
bodies.
in place so the audit cannot silently regress:
tests/Test-ErrorHandling.ps1- entry-point directives + noempty / silent-discard
catchblocks.tests/Test-FileEncoding.ps1- no BOM, explicit-Encoding,.gitattributesLF declarations.tests/Test-DotSourceIsolation.ps1- dot-sourced.ps1filesmust not leak strict mode into the caller (runtime probe + AST
lint).
stdin write failure, regenerating the Claude session ID per retry
attempt, cleaning session artefacts between retries, and a
background stderr drain so worktree
gitchatter no longer leaksinto pipelines.
Screenshots / recordings
Not applicable - no UI changes.
Testing notes
pwsh tests/Test-ErrorHandling.ps1- all rules pass.pwsh tests/Test-FileEncoding.ps1- all rules pass.pwsh tests/Run-Tests.ps1- full Layer-1 + component + workflowsuites green, including the new
Test-WorkflowSessionRetry,Test-RuntimeHelpers,Test-RouteHandlerSmoke, andTest-McpHelpers.Checklist
unchanged