Fix flaky ExpandedFileAttributesAreUpdated test#1923
Draft
tyrielv wants to merge 1 commit intomicrosoft:masterfrom
Draft
Fix flaky ExpandedFileAttributesAreUpdated test#1923tyrielv wants to merge 1 commit intomicrosoft:masterfrom
tyrielv wants to merge 1 commit intomicrosoft:masterfrom
Conversation
The test was flaky because setting CreationTime on a placeholder opens a write handle which triggers ProjFS to asynchronously hydrate the file. When LastAccessTime was set immediately after (while hydration was still in progress), ProjFS could silently drop the set. Diagnostics confirmed this is deterministic: the set is lost, not overwritten later. Fix: reorder the property sets so CreationTime (the only one that triggers hydration via handle open) is set LAST, after LastAccessTime, LastWriteTime, and Attributes are already pending on the placeholder. This ensures all metadata is in place before hydration begins. Also adds a post-hydration timestamp verification after the attribute retry loop to confirm all three timestamps persist through hydration. No production code in VFSForGit sets CreationTime on placeholder files, so this ProjFS race does not affect production behavior. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
d2caf3d to
ae767b8
Compare
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.
Fix flaky ExpandedFileAttributesAreUpdated test
Problem
The functional test
BasicFileSystemTests.ExpandedFileAttributesAreUpdatedintermittently fails in CI with:Example failure: https://github.com/microsoft/VFSForGit/actions/runs/23504116617/job/68407908415?pr=1920#step:9:7144
Root Cause
Setting
CreationTimeon a placeholder file opens a write handle, which triggers ProjFS to asynchronously hydrate the file from placeholder to full. The original test setCreationTimefirst, then immediately setLastAccessTime,LastWriteTime, andAttributes. Diagnostic testing (PR #1922) revealed thatLastAccessTimeis silently dropped by ProjFS when the set occurs while hydration is in progress:Key findings from diagnostic CI runs:
LastAccessTimeis reliably affected;CreationTimeandLastWriteTimealways succeedorigA == readAin every failureLastAccessTime,LastWriteTime, andAttributesdo not trigger hydration on their own (they don't open a write handle)Fix
Move the
CreationTimeset (the only one that triggers hydration) to after the other three property sets. This way,LastAccessTime,LastWriteTime, andAttributesare all pending on the placeholder when hydration begins, and ProjFS preserves them through the transition.Also adds a post-hydration timestamp verification after the attribute retry loop to confirm all three timestamps persist through the full hydration cycle.
Validation
Stress-tested in CI via PR #1922:
Diagnostic runs: v1, diagnostic, final
No production code in VFSForGit sets
CreationTimeon placeholder files, so the ProjFS race does not affect production behavior.ProjFS Bug
This investigation revealed a bug in ProjFS: when
CreationTimeis set on a placeholder (triggering hydration via a write handle open), subsequent metadata sets — particularlyLastAccessTime— can be silently dropped if they occur while the async hydration is still in progress. This is a ProjFS kernel driver issue. VFSForGit has no timestamp management code and delegates metadata handling entirely to ProjFS, so there is nothing VFSForGit can do to fix this at the application layer.The test fix works around the ProjFS bug by reordering property sets so that hydration is triggered last, after all other metadata is already in place on the placeholder.