Repository navigation
Conversation
The hydrate source identity is (st_size, st_mtime_ns). The replacement in this test has the same size as the file it replaces, so detection depended on timestamp granularity.
deanq
marked this pull request as ready for review
November 1, 2026 15:13
deanq
requested review from
a team and
KAJdev
and
a balanced review from Copilot
November 2, 2026 01:56
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the test-only adjustment that gives the replacement file a distinct modification time.
No open issues 🎉
What changed in this PR
Stabilizes the VolumeCache source-replacement test by ensuring the replacement has a distinct modification time, avoiding intermittent failures on filesystems with coarse timestamps.
Changes:
- Sets the replacement file’s mtime to the original’s plus one second.
- Documents why the explicit timestamp is needed; production identity logic remains unchanged.
| File | Description |
|---|---|
tests/test_serverless/test_utils/test_rp_volume_cache.py |
Forces a distinct replacement mtime in the between-ranges source-replacement test. |
Review effort: Balanced
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.
Problem
test_hydrate_rejects_source_replaced_between_rangesfails intermittently withassert restored == 0(assert 1 == 0). Observed on Python 3.14 in CI on #665 (run 41127886501, attempts 2 and 3) and on thefix/preserve-empty-endpoint-inputbranch. It passed in the main runs checked. The test came from #621.Cause
_file_identitycompares only(st_size, st_mtime_ns); it skips the inode on purpose because of FUSE mounts (see its docstring). The test replaces the mirror file with random bytes of the same size, so detection depends only on mtime.sync()copies the source mtime onto the mirror withos.utime, and the replacement is written a few milliseconds later. On a filesystem with coarse timestamps both can land on the same mtime. The swap is then not detected and hydrate publishes the file (restored == 1).Fix
Test-only. After writing the replacement, set its mtime to the original's plus one second, with a one-line comment. Production identity logic is unchanged: a replacement with the same size and the same mtime remains an accepted blind spot, and widening the identity (for example adding the inode) would reintroduce the FUSE false rejections the docstring describes.
Verification
assert 1 == 0, the same assertion as CI._file_identityof two same-size files with equal mtime compares equal; with mtime +1s it differs.make quality-check: 2181 passed, coverage gate satisfied.