FIRST-LOOK-PS1-GAMEDIR-VALIDATION-HANDLE-CLEANUP-AND-REPORT-CHECK #2345
No reviewers
No assignees
Labels
No labels
bug
dependencies
documentation
enhancement
missing claim
needs rebase
needs-triage
question
ready-for-agent
submodules
No project
No milestone
Dependencies
No dependencies set
Notifications
1 participant
Due date
No due date set.
Reference
leonida/mandy!2345
Loading…
Reference in a new issue
No description provided.
Delete branch "fix/first-look-ps1-safety"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Pull request successfully merged and closed
Claimed in the coordination issue as: FIRST-LOOK-PS1-GAMEDIR-VALIDATION-HANDLE-CLEANUP-AND-REPORT-CHECK (https://github.com/ubiquitarianism/leonida/issues/1608#issuecomment-7194523743)
What and why
-GameDirarguments viaGetUnresolvedProviderPathFromPSPathinscripts/first_look.ps1and validate-PathType Containerbefore creating the report directory underreports\exe.$outwithTest-Path -LiteralPath $out -PathType Leafand create it via[IO.Directory]::CreateDirectory($out)so wildcard-metacharacter exe names and file-occupied report paths fail cleanly.[IO.File]::OpenRead($Exe)stream intry/finallyand verify a 2-byte read before checking the"MZ"header so non-MZ or 0-byte inputs do not leak open handles.$global:LASTEXITCODE = 0before invokingbuild_runtime.ps1and throw when$LASTEXITCODE -ne 0; check$reportPathexists with-PathType LeafbeforeGet-Content | ConvertFrom-Json.tests/test_first_look_safety.py.Tested
python -I tests/test_first_look_safety.py -v: 2 passed, 0 failed (detachedupstream/mainbaseline with only the new test file fails with 2 failures).python -I tests/test_first_look_exit.py -v: 1 passed (11 subtests).python -I tests/test_first_look_paths.py -v: 1 passed.python -I tests/test_first_look_rebuild.py -v: 5 passed.python -I tests/test_first_look_shim_report.py -v: 1 passed.python -I tests/test_ci_registration.py: 16 passed.python -I tests/test_text_write_line_endings.py: 3 passed.python -I scripts/check_no_game_data.py,python -I -m compileall -q tests/test_first_look_safety.py, andgit diff --cached --check: passed.GPUs tested: n/a
AI-assisted: yes
Checklist
mainand merges cleanly (a conflicting pull request is labeledneeds rebase).docs/design.md, with how it was confirmed.#2345 | head f43076b07f1d792616cf68ad1d1940ced13e9c54 (merged cleanly with main 1bc055e6c2) |
python -I tests/test_first_look_safety.py| red on main:FAILED (failures=2)(accepted missing/file-GameDirand createdreports/exebefore failing, leaked open file handle on 0-byte non-MZ exe, ignored non-zerobuild_runtime.ps1exit code, and read stalegame.exe.jsonwhenpe_inspect.pyproduced no output) | green on PR+main:2 tests OK(all 7 runtime guard cases + static checks) | Windows 11 (10.0.26200.9974,powershell.exe5.1.26100.9818), Python 3.12.10 | AI-assisted: yesAudited
scripts/first_look.ps1andtests/test_first_look_safety.pyon Windows 11 PowerShell 5.1, verifying literal provider-path resolution and-PathType Containervalidation on-GameDir(including bracketeddata [1]),try / finally$fs.Dispose()+$read -ne 2guard on short/non-MZ files so Windows file handles never leak, leaf-blocker check on$out,$global:LASTEXITCODE = 0+ exit-code check aroundbuild_runtime.ps1, and stale$reportPathremoval + existence verification aroundpe_inspect.py. Also verifiedtests/test_ci_registration.py(18 OK),tests/test_text_write_line_endings.py(3 OK), andscripts/check_no_game_data.py.Tested
f43076b07merged (no commit) withmainaa918e5d9: Python 3.12.4, Windows 11 10.0.26300, CPU only.check_no_game_data.pyis clean.tests/test_first_look_safety.py, 2 tests pass.scripts/first_look.ps1back tomain, it fails:GetUnresolvedProviderPathFromPSPath($GameDir)is not found.No blocker from my side.
AI-assisted (Claude Code).
Merged, thank you! Its own tests failed on main without the change and passed with it, and a batch test with eight other tool PRs (main's Python suite plus a game run on an RTX 5080) showed no regression.
AI-assisted (Claude Code, Claude Opus 5.5), on behalf of DadaCap.