Conversation
Co-authored-by: Jeff Stokes <jeffstokes1972@gmail.com>
|
Cursor Agent can help with this pull request. Just |
|
|
||
| # Process each BLG in parallel; within each BLG, run all selected threshold XMLs. | ||
| $results = $blg | ForEach-Object -Parallel { | ||
| param($blgPath) |
There was a problem hiding this comment.
Parallel scriptblock param makes pipeline variable null
High Severity
The ForEach-Object -Parallel scriptblock declares param($blgPath), but this parameter set mechanism isn't how -Parallel delivers the pipeline item. The current pipeline object is available as $_ (or $PSItem), not through a param() block. As a result, $blgPath is always $null, and the entire parallel processing loop fails immediately when it tries to call $blgPath.Equals(...) or pass $blgPath to functions like Get-RelativePath.
| $counts = Get-PalAlertCountsFromReportXml -ReportXmlPath $runOut.XmlPath | ||
| $score = ([int]$counts.Criticals * 10) + ([int]$counts.Warnings * 2) + (if (-not $ok) { 1000 } else { 0 }) | ||
|
|
||
| $reportLink = Get-RelativePath -BasePath $outputRoot -FullPath $runOut.HtmlPath |
There was a problem hiding this comment.
Resolve-Path fails on non-existent error-case report path
Medium Severity
When Invoke-PalSingleRun throws (caught at the catch block), $runOut.HtmlPath is set to a path for a file that doesn't exist on disk. Then Get-RelativePath calls Resolve-Path -LiteralPath on that non-existent path, which throws an unhandled error. This means any PAL analysis failure cascades into a secondary exception, losing the original error information and the result entry for that run.
Additional Locations (2)
|
|
||
| $indexPath = Join-Path -Path $OutputRoot -ChildPath "index.html" | ||
|
|
||
| $sorted = @($Results | Sort-Object -Property Score -Descending, Criticals -Descending, Warnings -Descending) |
There was a problem hiding this comment.
Invalid Sort-Object syntax breaks master report generation
High Severity
The Sort-Object call uses invalid syntax for multi-property sorting. The form -Property Score -Descending, Criticals -Descending, Warnings -Descending only binds Score to -Property and sets the -Descending switch; the remaining tokens Criticals and Warnings become unbound positional arguments, which causes a runtime error since Sort-Object has no positional parameter to accept them. The correct syntax is -Property Score, Criticals, Warnings -Descending. This prevents Write-PalMasterHtmlReport from completing, so no master HTML report is ever generated.
|
Bugbot Autofix prepared fixes for 3 of the 3 bugs found in the latest run.
Or push these changes by commenting: Preview (3d49380850)diff --git a/PAL2/PALWizard/bin/Debug/PALMass.ps1 b/PAL2/PALWizard/bin/Debug/PALMass.ps1
--- a/PAL2/PALWizard/bin/Debug/PALMass.ps1
+++ b/PAL2/PALWizard/bin/Debug/PALMass.ps1
@@ -79,7 +79,11 @@
[Parameter(Mandatory=$true)][string] $FullPath
)
$base = (Resolve-Path -LiteralPath $BasePath).Path
- $full = (Resolve-Path -LiteralPath $FullPath).Path
+ if (Test-Path -LiteralPath $FullPath) {
+ $full = (Resolve-Path -LiteralPath $FullPath).Path
+ } else {
+ $full = [IO.Path]::GetFullPath($FullPath)
+ }
$baseUri = New-Object System.Uri(($base.TrimEnd([IO.Path]::DirectorySeparatorChar) + [IO.Path]::DirectorySeparatorChar))
$fullUri = New-Object System.Uri($full)
@@ -192,7 +196,7 @@
$indexPath = Join-Path -Path $OutputRoot -ChildPath "index.html"
- $sorted = @($Results | Sort-Object -Property Score -Descending, Criticals -Descending, Warnings -Descending)
+ $sorted = @($Results | Sort-Object -Property Score, Criticals, Warnings -Descending)
$top = @($sorted | Select-Object -First $HighlightTopN)
$topSet = @{}
foreach ($r in $top) { $topSet[$r.RunId] = $true }
@@ -329,7 +333,7 @@
# Process each BLG in parallel; within each BLG, run all selected threshold XMLs.
$results = $blg | ForEach-Object -Parallel {
- param($blgPath)
+ $blgPath = $_
. $using:palMassLibPath |



Add a PowerShell 7+ mass-processing webform and headless script to analyze directory trees of BLG files, generate mirrored reports, and create a master HTML index with worst-case highlighting.
Note
Medium Risk
Introduces substantial new PowerShell automation with parallel execution and a local HTTP server/job runner; risk is mainly around filesystem traversal, concurrency, and serving local files (path handling).
Overview
Adds PowerShell 7+ mass-processing support for PAL BLG analysis: a new
Invoke-PalMasslibrary (PALMass.ps1) that scans one or more input directory trees for.blgfiles, runs PAL in parallel across multiple threshold XMLs, and writes a mirrored output tree plusresults.csv/results.jsonand a masterindex.htmlsorted by “worst” (derived from parsed XML alert counts).Introduces two entrypoints:
Invoke-PALMass.ps1for headless batch runs (optionally opening the master report) andStart-PALMassWeb.ps1, a lightweight localHttpListenerweb UI to pick directories/thresholds, start a background job, poll status viastatus.json, and serve generated outputs under/out/. Documentation inReadme.txtis updated with usage, defaults, and outputs.Written by Cursor Bugbot for commit bf607e3. This will update automatically on new commits. Configure here.