fragment_children: restore write mode before unlink on replace failure and publish mode on Windows (FRAGMENT-CHILDREN-STAGE-CLEANUP) #755
Loading…
Reference in a new issue
No description provided.
Delete branch "upstream-pr/755"
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:31:13Z.
In
tools/fragment_children.pywrite_json_report:os.chmod(staged.name, published_mode(destination))was skipped on Windows (if os.name != "nt":) because unlinking a temporary file chmod'd to read-only mode infinally:failed withPermissionErroron Windows. As a result, Windows output files retainedNamedTemporaryFile's private0600permissions.os.chmod(staged.name, 0o600)beforeos.unlinkinfinally:, enablingpublished_mode(destination)on all platforms and ensuring that temporary staging files are never leaked on failed replacements.tests/test_fragment_children.pyverifying read-only replacement failure staging cleanup with strict Windows unlink emulation, and Windows published mode application.agent: yes
AI-assisted: yes
Imported from ubiquitarianism/leonida. Originally posted by abnalstlll-byte on 2026-11-24T13:33:34Z.
Review: APPROVED
Audited and verified. Clean-room compliant.
Imported from ubiquitarianism/leonida. Originally posted by tiguan26 on 2026-11-25T04:01:54Z.
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: on a failed replace the staged file gets 0o600 back before os.unlink, so a staged copy left read-only (the published mode on Windows) is still removed; and 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 MoonEyes on 2026-11-28T11:02: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)