FIRST-LOOK-PS1-GAMEDIR-VALIDATION-HANDLE-CLEANUP-AND-REPORT-CHECK #2345
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/2345"
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?
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-26T14:19:11Z.
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.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T20:50:19Z.
Code review location:
scripts/first_look.ps1; line 120[P3] A second invocation can satisfy this existence check with the previous report. I kept
game.exe.jsonfrom the first invocation, put a distinctive DLL name in it, and ran the PR'sLEONIDA_SKIP_PE_REPORT=1fixture. The wrapper exited 0 and listed that old DLL. The committed test deletes the earlier report, so it covers a clean output directory only. Could this invocation use a fresh report path or otherwise verify that its inspector produced the JSON before derivingshim-todo.txt?Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-26T20:50:19Z.
Review: COMMENTED
On the merge with
mainatfac8b4bb9, all 10test_first_look_*.pytests passed on Windows 11 with the standard Windows PowerShell module path. I also ran the missing-report fixture a second way, retaining the previous JSON as happens when the command is rerun. The wrapper returned success and printed a shim from the previous report. Details inline.AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by kirigayakazima on 2026-11-27T12:02:48Z.
Code review location:
scripts/first_look.ps1; line 120Fixed:
first_look.ps1now removes any existing$reportPathbefore invokingpe_inspect.py, so a failed or skipped report cannot silently reuse an earlier run's JSON. Updatedtests/test_first_look_safety.pyto keep a stalegame.exe.jsonand verify it fails cleanly. All 5test_first_look_*.pysuites + 5 repo checks pass.Imported from ubiquitarianism/leonida. Originally posted by lixonik on 2026-11-27T14:23:21Z.
Review: COMMENTED
Re-checked at
f43076b07(merged ontomainec91d695c).Clearing `` before invoking
pe_inspect.pyand testing with a pre-existing stale JSON intests/test_first_look_safety.pycleanly address the stale-report issue.Verified locally on Windows 11 (PowerShell + Python 3):
tests/test_first_look_exit.py,test_first_look_paths.py,test_first_look_rebuild.py,test_first_look_safety.py,test_first_look_shim_report.py: 10/10 passedtools/first_look.ps1: cleanscripts/check_no_game_data.pyandgit diff --check: cleanNo remaining findings.
AI-assisted.
Imported from ubiquitarianism/leonida. Originally posted by zmasi on 2026-11-28T20:31:08Z.
#2345 | head
f43076b07f(merged cleanly with main1bc055e6c2) |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.Imported from ubiquitarianism/leonida. Originally posted by TheGeogeo on 2026-11-28T23:38:06Z.
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).
Imported from ubiquitarianism/leonida. Originally posted by DadaCap on 2026-11-29T00:59:22Z.
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.