Skip to content

Run the Native Windows Check for the Bootstrap Dash-Name Refusal #3161

Closed

Description

@ptr727

Context

#3156 (for #3129) makes both bootstrap loaders refuse an -Agents name that starts with a dash. On the PowerShell side, that includes the U+2013, U+2014, and U+2015 dashes, because PowerShell binds those as a parameter prefix. CI's Windows unit-test job and a local pwsh 7 run pass. Neither one covers native Windows PowerShell 5.1 or the en dash case on real Windows.

Check

In an unelevated pwsh 7 window on Windows, paste the whole block below. It clones the repository into $env:TEMP at #3156's squash commit on develop. It runs every case with -DryRun, so nothing installs even if a refusal fails, and it runs the cases under both pwsh and powershell. Then it deletes the clone. Expect about a minute.

& {
  $ErrorActionPreference = 'Stop'
  $sha = 'a040949784d829f1b80bb27df5e82bd0edcf3514'
  $wt = Join-Path $env:TEMP "pt-check-$(Get-Random)"
  git clone --quiet https://github.com/ptr727/ProjectTemplate.git $wt
  if ($LASTEXITCODE) { throw 'clone failed' }
  Push-Location $wt
  try {
    git checkout --quiet $sha
    if ($LASTEXITCODE) { throw 'checkout failed' }
    $ErrorActionPreference = 'Continue'
    $d = [char]0x2013
    foreach ($exe in 'pwsh', 'powershell') {
      foreach ($name in '-All', '-a', 'herdr,-All', "${d}All") {
        $out = & $exe -NoProfile -ExecutionPolicy Bypass -File .\host-setup\bootstrap.ps1 -Ref develop -DryRun -Agents $name 2>&1 | Out-String
        $code = $LASTEXITCODE
        $why = ($out -split "`n" | Where-Object { $_ -match 'ERROR|Missing an argument' } | Select-Object -First 1)
        $r = if ($code) { 'PASS' } else { 'FAIL' }
        "$r  $exe -Agents '$name' exit=$code (expect nonzero)  $why"
      }
      $null = & $exe -NoProfile -ExecutionPolicy Bypass -File .\host-setup\bootstrap.ps1 -Ref develop -DryRun -Agents herdr 2>&1
      $code = $LASTEXITCODE
      $r = if ($code) { 'FAIL' } else { 'PASS' }
      "$r  $exe -Agents 'herdr' exit=$code (expect 0)"
    }
  } finally {
    Pop-Location
    Remove-Item -Recurse -Force $wt
  }
}

Expected

Every printed line starts with PASS: each dash-led name exits nonzero, and the plain herdr name exits 0. A single dash-led value may be stopped by pwsh with "Missing an argument for parameter 'Agents'" instead of the new message, which still counts as refused. Post the printed lines as a comment, then close this issue if all of them pass.

Activity

  1. ptr727 commented on Oct 16, 2026

    @ptr727
    OwnerAuthor
    PASS  pwsh -Agents '-All' exit=1 (expect nonzero)  ERROR: -Agents takes tool names, and '-All' starts with a dash
    PASS  pwsh -Agents '-a' exit=1 (expect nonzero)  bootstrap.ps1: Missing an argument for parameter 'Agents'. Specify a parameter of type 'System.String[]' and try again.
    PASS  pwsh -Agents 'herdr,-All' exit=1 (expect nonzero)  ERROR: -Agents takes tool names, and '-All' starts with a dash
    PASS  pwsh -Agents '–All' exit=1 (expect nonzero)  ERROR: -Agents takes tool names, and '-All' starts with a dash
    PASS  pwsh -Agents 'herdr' exit=0 (expect 0)
    PASS  powershell -Agents '-All' exit=1 (expect nonzero)  ERROR: -Agents takes tool names, and '-All' starts with a dash
    PASS  powershell -Agents '-a' exit=1 (expect nonzero)  C:\Users\piete\AppData\Local\Temp\pt-check-648721139\host-setup\bootstrap.ps1 : Missing an argument for parameter 'Agents'. Specify a parameter of type 'System.String[]' and try again.
    PASS  powershell -Agents 'herdr,-All' exit=1 (expect nonzero)  ERROR: -Agents takes tool names, and '-All' starts with a dash
    PASS  powershell -Agents '–All' exit=1 (expect nonzero)  ERROR: -Agents takes tool names, and '-All' starts with a dash
    PASS  powershell -Agents 'herdr' exit=0 (expect 0)
    
  2. ptr727 commented on Oct 16, 2026

    @ptr727
    OwnerAuthor

    All ten cases pass natively under pwsh 7 and Windows PowerShell 5.1, the en dash case included, so #3156 is verified on Windows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    scriptA defect in hub tooling

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions