Windows: eagerly bind state directory filesystem identity - #216
Merged
Conversation
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.
Authorization
Problem
A Windows production CI run for #215 exposed an existing failure in
TestStoreRejectsReplacementDirectoryAfterBinding: a renamed/recreated state directory was accepted once by the Store.This is not caused by #215. The root cause is Windows
os.SameFilelaziness: Go's WindowsFileInforetains the path and resolvesVolumeSerialNumber/FileIndexHigh/FileIndexLowon the firstSameFilecall. If the directory path is replaced before that first call, the historicalFileInfocan resolve the replacement object. The existing CreationTime secondary comparison can also collide for rapidly created directories.Fix
os.SameFile(info, info)immediately while validating/binding the state directory so Go caches its Win32 volume/file-index identity before later path replacement.os.SameFile+ CreationTime comparison as defense in depth after both snapshots have been primed.Deterministic regression
A Windows-only regression test creates and binds the original state directory, renames it, creates a replacement at the original path, deliberately gives the replacement the same CreationTime, and requires the bound identity comparison to reject it.
Change isolation
internal/config.Validation gate
Exact final head:
1f4d61f73ac360a1a8068a1d163efc1bd3d25de7.mainremained exact83b5344bebc6b690add09cfe1099aa0acee322d4before merge and the PR remained mergeable. Merge is guarded by the exact final head SHA. After merge, exact post-mergemainpush workflows must be verified before #215 is revalidated.