image_query_probe: publish mode on Windows (IMAGE-QUERY-PROBE-STAGE-CLEANUP) #796
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/796"
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 trigger337 on 2026-11-24T13:56:03Z.
In
tools/image_query_probe.py,_write_jsonalready restored0o600before unlinking on failure in itsexcept BaseExceptionblock, but previously skipped applyingpublished_modeon Windows viaif os.name != "nt":.Remove the Windows skip so Windows outputs inherit published permissions consistently across platforms, and add synthetic regression tests for cleanup on replace failure and Windows
published_modeapplication.Tests pass (21/21 in
test_image_query_probe.py),scripts/check_no_game_data.pypasses cleanly.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T03:59:52Z.
Review: APPROVED
Approving. Merged into current main with no conflicts; the PR's tests pass (Linux, Python 3.13). Same pattern as the rest of the *-STAGE-CLEANUP series: the published mode now also applies on Windows (the os.name guard is gone), using file_mode.published_mode. Only the staging/permission lines change.
AI-assisted (Claude).
Imported from ubiquitarianism/leonida. Originally posted by DeadlyChirp on 2026-11-25T15:23:55Z.
Tested on Windows 11, Python 3.12.10, with this PR merged onto upstream main
b0f3d3998(merge commit 5fc3e33b4).python -I tests/test_image_query_probe.py:(AI-assisted test run; output checked by hand.)
Imported from ubiquitarianism/leonida. Originally posted by PierreEbele on 2026-11-25T20:41:32Z.
Reviewed
9e7e655: I rantests/test_image_query_probe.pyon the PR (21 OK) and onmain(19 OK), with this PR's test file onmain(onlytest_publish_applies_published_mode_on_windowsfails there, so it does pin the fix), plustest_file_mode,test_replace_retry,test_missing_input_exit_codes,check_no_game_data.py, and a probe comparing the two trees. The guard removal is right and matches the other staging writers; two issues in the new tests: (1)test_publish_cleans_up_staged_file_when_replace_fails_even_if_readonlynever reaches the staging code - with a0o444destination,os.open(destination, os.O_WRONLY)(line 302) raises before any temp file is created (probe: replace/unlink mocks 0 calls, onmaintoo). Please patchpublished_modeto return0o444while keeping the destination writable so the cleanup path is actually exercised; (2) that test also leavesreport.jsonat0o444, which on a native Windows run makesTemporaryDirectoryteardown fail withPermissionError- restore0o600in afinallylike the existing readonly test does. I could not run Windows here, so (2) is fromshutil.rmtree/read-only semantics, not an execution. AI-assisted review.Recommendation: Fix first
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-26T06:59:08Z.
Confirming @PierreEbele's finding: with this PR's test file against main's tool, only
test_publish_applies_published_mode_on_windowsfails here (Linux, run as root), so that one pins the change. The cleanup test passes on main even as root and never reaches the staging code. My approval was for the guard removal, which is right; I didn't check each test against main. Patchingpublished_modeto 0o444 on a writable destination, as suggested, would let the cleanup test do its job, and restoring the destination's mode before the temporary directory is removed avoids the Windows teardown error. AI-assisted (Claude).Imported from ubiquitarianism/leonida. Originally posted by MoonEyes on 2026-11-28T11:07:15Z.
Red/green: the PR's tests fail on main and pass with this PR (Linux, Python 3.13.18).
Targeted batch of 23 PRs (their tests, the tests importing the changed modules, the docs tests) on main
3ca0707: no new failure, Linux / Python 3.13.AI-assisted (Claude Code, Claude Opus 5.5)