Repository navigation
fix(files): avoid false stale writes from Windows stat/fstat ctime differences - #125285
Draft
MariusYvard wants to merge 1 commit into
Draft
MariusYvard wants to merge 1 commit into
MariusYvard wants to merge 1 commit into
Conversation
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Fix false incomplete/stale-write refusals when Windows
os.stat(path)andos.fstat(fd)report differentst_ctime_nsvalues for the same unchanged file._file_version()currently compares descriptor metadata directly with path metadata. On the tested Windows 11 / Python 3.14.7 environment the ctime disagreement makes it returnNone, so a complete read or a successful write can fail to establish the full-current-content baseline required for a subsequent overwrite.Changes made
_file_metadata()comparisons remain compatible.Only
tools/file_tools_read_tracking.pyandtests/tools/test_file_snapshot.pychange. Two parameterized behavioral tests cover stable/mutating snapshots and real registry-dispatched read/write/edit/replacement sequences. The latter hasplatforms("any")so Windows CI selects it.Existing work checked
All-state searches included
st_ctime_ns,fstat,file_tools_read_tracking, stat/fstat/write and Windows snapshot terms. Adjacent PRs were inspected:No matching open snapshot-consistency repair was found. No new issue is claimed or closed.
Verification
Windows 11, Python 3.14.7, PM-built environment, canonical runner with explicit
HERMES_PYTHON:scripts/run_tests.sh tests/tools/test_file_snapshot.py tests/tools/test_file_staleness.py tests/tools/test_known_file_write_baseline.py tests/tools/test_binary_document_write_guard.py tests/tools/test_remote_binary_write_guard.py -j 2 # 60 passed, 0 failed-m platforms).any.git diff --check: passed.Not claimed: complete repository suite, local POSIX execution or upstream exact-head CI success.
Checklist
AI assistance was used for investigation, implementation and independent reviews under the contributor's direction.