fix(start.ps1): drop non-functional @args splat under [CmdletBinding()]

Copilot's review of this PR caught that the `& $Python $serverPath @args`
splat at the launcher line was always empty in practice: PowerShell does
NOT populate the automatic $args variable when a script declares
[CmdletBinding()] with an explicit param() block, which start.ps1 does.

Any caller who tried to pass extra args (matching start.sh's
"$@" behavior) would already hit "A positional parameter cannot be
found that accepts argument ..." before this line ever ran — so the
@args here was dead code that misled readers into thinking pass-through
worked when it didn't.

Two options to address:

1. Drop @args. Restores honesty — script is documented as the
   env-var-driven launcher, and the param block already covers the two
   explicit parameters (-Port, -BindHost). No behavior change for any
   working call shape.

2. Add `[Parameter(ValueFromRemainingArguments=$true)] [string[]]$ServerArgs`
   to the param block and splat that. Adds pass-through capability that
   start.sh has but start.ps1 didn't.

Picked (1) for this hardening PR — keeps scope focused on the two
Copilot-flagged issues I already addressed (TryParse + exit-after-finally).
Option (2) is a small follow-up if anyone reports needing it.

Note attached at the launch site documenting why @args was dropped and
how to add ValueFromRemainingArguments if the need surfaces later.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
Dustin
2026-05-23 18:05:38 -05:00
parent f53b93087f
commit 7b6e0722de
+7 -1
View File
@@ -174,7 +174,13 @@ if (-not (Test-Path $serverPath)) {
$script:serverExitCode = 0
Push-Location $RepoRoot
try {
& $Python $serverPath @args
# @args was non-functional here — PowerShell does NOT populate $args when the
# script declares [CmdletBinding()] with an explicit param() block (Copilot's
# finding on PR #2807). Dropped rather than added a ValueFromRemainingArguments
# parameter, because the existing tracked use case is the launcher running
# server.py with the env-var-driven config — no pass-through args are needed.
# If pass-through becomes a requirement later, add a [Parameter(ValueFromRemainingArguments=$true)] [string[]]$ServerArgs and splat that.
& $Python $serverPath
$script:serverExitCode = $LASTEXITCODE
} finally {
Pop-Location