Merged
Conversation
…ySetResult, async continuations)
Contributor
There was a problem hiding this comment.
Pull Request Overview
This PR stabilizes flaky SystemFolder watcher tests by addressing race conditions and filesystem permission issues that were causing intermittent test failures.
- Creates unique temporary directories per test run to avoid permission issues and cross-test interference
- Replaces unsafe
TaskCompletionSource.SetResultcalls withTrySetResultand proper async continuation options to handle duplicate filesystem events - Uses GUID-based names for test files/folders to prevent naming collisions
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
Arlodotexe
added a commit
that referenced
this pull request
Aug 18, 2025
OwlCore.Storage 0.14.0 PRs closed: - [Add DFS/BFS traversal, override/composite folders, truncation](#95) - [Add ranged ReadText/WriteText extensions, IFile.CopyToAsync, tests](#96) - [Stabilize SystemFolder watcher tests](#97) - [Added async-iterable relative path traversal helpers](#98) - [Add CreateRelativeStorageExtensions and tests](#99) - [Add net9.0 as TFM, upgrade CI to .NET 9 SDK](#100) [New] Added DepthFirstRecursiveFolder: depth-first async traversal wrapper over any IFolder with optional MaxDepth. Added BreadthFirstRecursiveFolder: breadth-first async traversal wrapper over any IFolder with optional MaxDepth. Added ItemsOverrideFolder: override a folder's GetItemsAsync by projecting its async enumerable. Added ReadOnlyCompositeFolder: present a read-only folder view materialized from a set of files. Added ParentOverrideChildFile: wrap any IFile with a custom parent, exposing it as IChildFile. Added TruncatedFile: wrap a file and cap the readable length of its underlying stream. Added TruncatedFilesFolder: wrap a folder so each file is exposed with a maximum byte length. Added TruncatedStream: stream wrapper enforcing a maximum readable length. Added FileReadExtensions.ReadTextAsync (line + column range): iterate a specific line range and slice per-line columns. Added FileWriteExtensions.WriteTextAsync (line range; line + column range): write sliced text content into a file (line end inclusive, column end exclusive). Added CopyExtensions.CopyToAsync: async file-to-file copy extension over IFile. Added CreateByRelativePathAsync (start from folder or child file): create a file or folder at a relative path (supports "." and ".."; explicit target type). Added CreateFolderByRelativePathAsync (start from folder or child file): convenience wrapper for creating folders by relative path. Added CreateFileByRelativePathAsync (start from folder or child file): convenience wrapper for creating files by relative path. Added CreateFoldersAlongRelativePathAsync (start from folder or child file): async sequence yielding each folder visited/created along a relative path. Added CreateAlongRelativePathAsync (start from folder or child file): async sequence yielding parents, then the file when targeting a file; folders only when targeting a folder. [Improvements] Added StorableExtensions.GetItemsAlongRelativePathAsync: navigates a relative path from any IStorable, yielding each visited node in order (supports '.', '..', and normalizes path separators). Added FolderExtensions.GetItemsAlongRelativePathToAsync: yields items along the path from a source IFolder to a descendant IStorableChild in traversal order. [Tests] Added traversal tests for DepthFirstRecursiveFolder and BreadthFirstRecursiveFolder covering BFS/DFS order, type filtering, and MaxDepth semantics. Added range read/write tests for IFile covering line range and line + column range.
Arlodotexe
added a commit
that referenced
this pull request
Aug 18, 2025
… truncated IO, range read/write extensions (#101) * Release 0.14.0. See release notes or expand full commit message. OwlCore.Storage 0.14.0 PRs closed: - [Add DFS/BFS traversal, override/composite folders, truncation](#95) - [Add ranged ReadText/WriteText extensions, IFile.CopyToAsync, tests](#96) - [Stabilize SystemFolder watcher tests](#97) - [Added async-iterable relative path traversal helpers](#98) - [Add CreateRelativeStorageExtensions and tests](#99) - [Add net9.0 as TFM, upgrade CI to .NET 9 SDK](#100) [New] Added DepthFirstRecursiveFolder: depth-first async traversal wrapper over any IFolder with optional MaxDepth. Added BreadthFirstRecursiveFolder: breadth-first async traversal wrapper over any IFolder with optional MaxDepth. Added ItemsOverrideFolder: override a folder's GetItemsAsync by projecting its async enumerable. Added ReadOnlyCompositeFolder: present a read-only folder view materialized from a set of files. Added ParentOverrideChildFile: wrap any IFile with a custom parent, exposing it as IChildFile. Added TruncatedFile: wrap a file and cap the readable length of its underlying stream. Added TruncatedFilesFolder: wrap a folder so each file is exposed with a maximum byte length. Added TruncatedStream: stream wrapper enforcing a maximum readable length. Added FileReadExtensions.ReadTextAsync (line + column range): iterate a specific line range and slice per-line columns. Added FileWriteExtensions.WriteTextAsync (line range; line + column range): write sliced text content into a file (line end inclusive, column end exclusive). Added CopyExtensions.CopyToAsync: async file-to-file copy extension over IFile. Added CreateByRelativePathAsync (start from folder or child file): create a file or folder at a relative path (supports "." and ".."; explicit target type). Added CreateFolderByRelativePathAsync (start from folder or child file): convenience wrapper for creating folders by relative path. Added CreateFileByRelativePathAsync (start from folder or child file): convenience wrapper for creating files by relative path. Added CreateFoldersAlongRelativePathAsync (start from folder or child file): async sequence yielding each folder visited/created along a relative path. Added CreateAlongRelativePathAsync (start from folder or child file): async sequence yielding parents, then the file when targeting a file; folders only when targeting a folder. [Improvements] Added StorableExtensions.GetItemsAlongRelativePathAsync: navigates a relative path from any IStorable, yielding each visited node in order (supports '.', '..', and normalizes path separators). Added FolderExtensions.GetItemsAlongRelativePathToAsync: yields items along the path from a source IFolder to a descendant IStorableChild in traversal order. [Tests] Added traversal tests for DepthFirstRecursiveFolder and BreadthFirstRecursiveFolder covering BFS/DFS order, type filtering, and MaxDepth semantics. Added range read/write tests for IFile covering line range and line + column range. * Fixed build errors around compilations conditionals uncovered by merge
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.
Background
OwlCore.Storageincludes integration tests for theSystemFolderwatcher built onFileSystemWatcher. These tests validate that create/delete events are surfaced viaIFolderWatcher.CollectionChanged.Problem
TaskCompletionSource.SetResultbeing invoked multiple times due to duplicate/rapidFileSystemWatcherevents.%TEMP%, and occasional name collisions from predictable test item names.Solution
tests/OwlCore.Storage.Tests/SystemIO/SystemFolderTests.cs:%TEMP%\{Guid}) to avoid permission issues and cross-test interference.TaskCompletionSource.SetResultwithTrySetResultand useTaskCreationOptions.RunContinuationsAsynchronouslyto safely handle duplicate events without deadlocks.