Repository navigation
Use extended-length paths for Tsavorite test MethodTestDir - #2045
Merged
Merged
Conversation
Recovery tests in Tsavorite.test fail with "Path ... is too long" when run from deep directory paths, because derived checkpoint/device file paths exceed the 260-char Win32 MAX_PATH limit. Route MethodTestDir through a new EnsureExtendedLengthPathIfNeeded helper, which rewrites the directory as a Win32 extended-length path (\\?\..., or \\?\UNC\... for shares) when its fully-qualified length is within 100 chars of MAX_PATH. Short paths (normal checkouts and CI) are returned unchanged. The device layer and BCL file APIs already honor \\?\ paths, so no production code changes are needed. Add regression test LogPathExtendedLengthSupport. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a0a4e097-0130-46dd-89a9-84d071a69307
Ted Hart (TedHartMS)
requested review from
Badrish Chandramouli (badrishc) and
Vasileios Zois (vazois)
and
a lite review from Copilot
August 7, 2026 23:38
Contributor
There was a problem hiding this comment.
Pull request overview
This PR hardens the Tsavorite test infrastructure on Windows by automatically switching the per-test output directory (TestUtils.MethodTestDir) to a Win32 extended-length path (\\?\... / \\?\UNC\...) when the fully-qualified path is close to the 260-character MAX_PATH limit, preventing recovery and checkpoint tests from failing under deep checkout/worktree locations.
Changes:
- Route
TestUtils.MethodTestDirthrough a newEnsureExtendedLengthPathIfNeeded(...)helper that conditionally applies the extended-length prefix on Windows. - Add a Windows-only regression test (
LogPathExtendedLengthSupport) validating idempotent conversion and successful log device creation beyondMAX_PATH.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| libs/storage/Tsavorite/cs/test/TestUtils.cs | Adds extended-length path helper and applies it to MethodTestDir to avoid long-path failures in tests. |
| libs/storage/Tsavorite/cs/test/BasicTests.cs | Adds a Windows-guarded regression test covering extended-length path behavior and device creation beyond MAX_PATH. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Address PR review feedback: the remarks implied Path.GetFullPath normalization always runs, but the short-path branch returns the original input unchanged. Reword to make clear canonicalization only happens on the extended-length rewrite path. Co-authored-by: Copilot App <[email protected]> Copilot-Session: a0a4e097-0130-46dd-89a9-84d071a69307
Badrish Chandramouli (badrishc)
approved these changes
Aug 8, 2026
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
Route the Tsavorite test helper
TestUtils.MethodTestDirthrough a newEnsureExtendedLengthPathIfNeededhelper that rewrites the test directory as a Win32 extended-length path (\\?\..., or\\?\UNC\...for network shares) when its fully-qualified length gets within 100 chars of the 260-charMAX_PATHlimit. Short paths (normal checkouts and CI) are returned unchanged.Why
Recovery tests in
Tsavorite.test(e.g.Tsavorite.test.recovery) fail withPath ... is too longwhen the repo is checked out under a deep directory path. The test base dir itself fits underMAX_PATH, but derived checkpoint/device files (e.g....\<iter>\checkpoints\cpr-checkpoints\<guid>\snapshot.obj.dat) push the full path past 260 chars, and the device layer rejects non-extended paths longer thanWIN32_MAX_PATH - 11.Extended-length paths are exempt from
MAX_PATHand are already honored by the device layer (passed straight toCreateFileW) and the BCL file APIs, so no production code changes are needed — this is a test-infrastructure-only fix.How
MethodTestDirnow wraps its result inEnsureExtendedLengthPathIfNeeded(...).Path.GetFullPath, so forward slashes / relative segments are normalized to backslashes as extended-length paths require), then prefixes\\?\(or\\?\UNC\) only when needed. It's a no-op on non-Windows, on already-extended paths, and on short paths.LogPathExtendedLengthSupport(Windows-guarded) verifying short paths are untouched, over-MAX_PATHpaths get the\\?\prefix idempotently, and a device can be created at an extended path beyond 260 chars.Testing
Tsavorite.test.recovery(before)Path ... is too longTsavorite.test.recovery(after)Tsavorite.testsuitedotnet format/ build