mirror of
https://github.com/psmux/psmux.git
synced 2026-06-19 09:46:56 +08:00
Bundles the standing investigation harnesses used while triaging four open issues so future maintainers can re-run them without rebuilding the test plan from scratch. Findings on master at the time of writing: #261 (iTerm2 -CC control mode): NOT reproducible. -CC attach emits DCS opener, %begin/%end framing, and command responses correctly. Likely fixed by 0f08d18 (release workflow / argv escaping) earlier in the cycle. Verification suite passes 17/17. #263 (box-drawing chars rendered in fixed grey): NOT reproducible on 3.3.4. Byte-level dump-state inspection shows fg colours are distinct across SGR 8/7/240/250/rgb cases. May have been 3.3.3-specific, or a host-terminal rendering issue at the reporter's end. #264 (paste-buffer does not deliver to pane): NOT reproducible. TUI-verified paste-buffer flow delivers content correctly, both single and sequential operations. 5/5 pass. #266 (automatic-rename overrides explicit -n): REPRODUCES in 3.3.4 (7 pass / 2 fail). Real bug, fix not in this commit; the script stays as a regression guard for whoever picks it up. Each script is self-contained — sets its own session name, cleans up on exit, and prints a verdict line indicating whether the bug is present on the current build.
134 lines
5.6 KiB
PowerShell
134 lines
5.6 KiB
PowerShell
# Issue #266 — exact reproduction matching reporter's environment.
|
|
#
|
|
# The reporter's pane was running python and they saw window_name flip
|
|
# to "python". Our previous test used Start-Sleep (so active cmd stayed
|
|
# 'pwsh'/'shell') and didn't observe a flip. Now we run REAL python in
|
|
# the pane to trigger any process-based rename mechanism.
|
|
#
|
|
# ALSO: probe whether -c "$HOME" affects the bug (the reporter used it).
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
$PSMUX = (Get-Command psmux -EA Stop).Source
|
|
$VERSION = (& $PSMUX -V).Trim()
|
|
$PY = (Get-Command python -EA Stop).Source
|
|
$psmuxDir = "$env:USERPROFILE\.psmux"
|
|
|
|
function Write-Pass($m) { Write-Host " [PASS] $m" -F Green }
|
|
function Write-Fail($m) { Write-Host " [FAIL] $m" -F Red }
|
|
function Write-Info($m) { Write-Host " [INFO] $m" -F DarkCyan }
|
|
|
|
Write-Host "`n=== Issue #266 PYTHON-PROCESS REPRODUCTION ===" -F Cyan
|
|
Write-Host " Build: $VERSION"
|
|
Write-Host " Python at: $PY"
|
|
Write-Host " Goal: see if python running in pane flips window_name to 'python'"
|
|
Write-Host ""
|
|
|
|
# === SCENARIO 1: matches reporter's exact command ===
|
|
$S1 = "issue266_repro1"
|
|
& $PSMUX kill-session -t $S1 2>&1 | Out-Null
|
|
Start-Sleep -Milliseconds 500
|
|
Remove-Item "$psmuxDir\$S1.*" -Force -EA SilentlyContinue
|
|
|
|
Write-Host "[Scenario 1] Reporter's exact command (with -c HOME)" -F Yellow
|
|
Write-Info "psmux new-session -d -s $S1 -n my_explicit_name -c `"$env:USERPROFILE`""
|
|
& $PSMUX new-session -d -s $S1 -n my_explicit_name -c "$env:USERPROFILE" 2>&1 | Out-Null
|
|
Start-Sleep -Milliseconds 1500 # match reporter's `sleep 1.5`
|
|
|
|
$out1 = & $PSMUX list-windows -t $S1 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "list-windows immediately after creation:`n $($out1.Trim())"
|
|
|
|
# Then start python and wait
|
|
& $PSMUX send-keys -t $S1 "& '$PY'" Enter
|
|
Write-Info "Started python; waiting 5s for any rename to trigger..."
|
|
Start-Sleep -Seconds 5
|
|
|
|
$out1b = & $PSMUX list-windows -t $S1 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "list-windows AFTER python started:`n $($out1b.Trim())"
|
|
|
|
# Exit python
|
|
& $PSMUX send-keys -t $S1 "exit()" Enter
|
|
Start-Sleep -Seconds 2
|
|
|
|
$out1c = & $PSMUX list-windows -t $S1 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "list-windows AFTER python exited:`n $($out1c.Trim())"
|
|
|
|
# Read each cell separately for asserting
|
|
$nameNow = (& $PSMUX display-message -t "${S1}:0" -p '#{window_name}' 2>&1).Trim()
|
|
Write-Info "window_name now = '$nameNow'"
|
|
|
|
if ($nameNow -eq "my_explicit_name") {
|
|
Write-Pass "S1: explicit name 'my_explicit_name' SURVIVED python session"
|
|
} else {
|
|
Write-Fail "S1: BUG: window_name = '$nameNow' instead of 'my_explicit_name'"
|
|
}
|
|
|
|
& $PSMUX kill-session -t $S1 2>&1 | Out-Null
|
|
|
|
# === SCENARIO 2: explicit -n with renamed-to-python check WITHOUT -c flag ===
|
|
$S2 = "issue266_repro2"
|
|
& $PSMUX kill-session -t $S2 2>&1 | Out-Null
|
|
Start-Sleep -Milliseconds 500
|
|
Remove-Item "$psmuxDir\$S2.*" -Force -EA SilentlyContinue
|
|
|
|
Write-Host "`n[Scenario 2] -n only (no -c flag)" -F Yellow
|
|
& $PSMUX new-session -d -s $S2 -n my_explicit_name 2>&1 | Out-Null
|
|
Start-Sleep -Milliseconds 1500
|
|
$out2 = & $PSMUX list-windows -t $S2 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "After 1.5s: $($out2.Trim())"
|
|
|
|
& $PSMUX send-keys -t $S2 "& '$PY'" Enter
|
|
Start-Sleep -Seconds 5
|
|
$out2b = & $PSMUX list-windows -t $S2 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "While python running: $($out2b.Trim())"
|
|
|
|
$nameNow2 = (& $PSMUX display-message -t "${S2}:0" -p '#{window_name}' 2>&1).Trim()
|
|
if ($nameNow2 -eq "my_explicit_name") {
|
|
Write-Pass "S2: explicit name SURVIVED with python active"
|
|
} else {
|
|
Write-Fail "S2: BUG: window_name = '$nameNow2'"
|
|
}
|
|
|
|
& $PSMUX kill-session -t $S2 2>&1 | Out-Null
|
|
|
|
# === SCENARIO 3: CONTROL — no -n, with python ===
|
|
$S3 = "issue266_repro3"
|
|
& $PSMUX kill-session -t $S3 2>&1 | Out-Null
|
|
Start-Sleep -Milliseconds 500
|
|
Remove-Item "$psmuxDir\$S3.*" -Force -EA SilentlyContinue
|
|
|
|
Write-Host "`n[Scenario 3] CONTROL: NO -n flag, with python" -F Yellow
|
|
& $PSMUX new-session -d -s $S3 2>&1 | Out-Null
|
|
Start-Sleep -Milliseconds 1500
|
|
$out3 = & $PSMUX list-windows -t $S3 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "After 1.5s (no python): $($out3.Trim())"
|
|
|
|
& $PSMUX send-keys -t $S3 "& '$PY'" Enter
|
|
Start-Sleep -Seconds 5
|
|
$out3b = & $PSMUX list-windows -t $S3 -F "#{window_id} #{window_name} #{pane_current_command}" 2>&1 | Out-String
|
|
Write-Info "After python started: $($out3b.Trim())"
|
|
|
|
$nameNow3 = (& $PSMUX display-message -t "${S3}:0" -p '#{window_name}' 2>&1).Trim()
|
|
$paneCmd3 = (& $PSMUX display-message -t "${S3}:0" -p '#{pane_current_command}' 2>&1).Trim()
|
|
|
|
if ($paneCmd3 -match 'python') {
|
|
Write-Pass "S3 (control): pane_current_command correctly tracked python"
|
|
} else {
|
|
Write-Info "S3 (control): pane_current_command = '$paneCmd3' (not 'python')"
|
|
}
|
|
|
|
if ($nameNow3 -match 'python|pwsh') {
|
|
Write-Pass "S3 (control): automatic-rename DID change name to active cmd '$nameNow3'"
|
|
} else {
|
|
Write-Info "S3 (control): name = '$nameNow3' (rename mechanism may not be re-triggering after creation)"
|
|
}
|
|
|
|
& $PSMUX kill-session -t $S3 2>&1 | Out-Null
|
|
|
|
Write-Host "`n============================================" -F Cyan
|
|
Write-Host "FINDING" -F Cyan
|
|
Write-Host "============================================" -F Cyan
|
|
Write-Host " Compare these three scenarios to determine the bug nature:"
|
|
Write-Host " - S1 (with -n + -c HOME + python): name was '$nameNow'"
|
|
Write-Host " - S2 (with -n + python): name was '$nameNow2'"
|
|
Write-Host " - S3 (no -n + python — control): name was '$nameNow3'"
|