Fix case-sensitivity probe corrupting directory path in MergeOutputFileHelper#10014
Merged
Conversation
…leHelper IsDirectoryCaseSensitive lower-cased the entire probe path, corrupting the directory portion. A case-insensitive child directory beneath a case-sensitive parent was then probed at a non-existent lowercased parent, so File.Exists returned false and the location was misreported as case-sensitive (Ordinal). That let EnsureOutputDoesNotAliasInput miss that a.trx and A.trx are the same file, risking overwrite of a read-only input. Now only the generated probe file name is lower-cased, keeping the real directory path intact. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes case-sensitivity detection to prevent report mergers from overwriting aliased input files.
Changes:
- Preserves directory casing when probing filesystem sensitivity.
- Adds a case-only output alias test, though it does not reproduce the mixed-sensitivity regression.
Show a summary per file
| File | Description |
|---|---|
src/Platform/SharedExtensionHelpers/MergeOutputFileHelper.cs |
Lowercases only the probe filename. |
test/UnitTests/Microsoft.Testing.Extensions.UnitTests/CtrfReportMergerTests.cs |
Adds filesystem case-sensitivity coverage. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 1
- Review effort level: Medium
This comment has been minimized.
This comment has been minimized.
Evangelink
enabled auto-merge (squash)
July 16, 2026 14:33
… regression test Addresses review feedback: the previous black-box test could not distinguish the fix from the bug on ordinary filesystems (the regression only manifests on a mixed-sensitivity topology). Extract the probe-path construction into an internal BuildCaseFoldedProbePath seam and assert directly that only the generated file name is case-folded while the directory path is preserved. Reverting the production fix now fails this test on every platform. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
… tests Addresses the automated test-quality grade: the end-to-end case-only alias test used an if/else on filesystem sensitivity to pick which assertions ran. Split it into two focused tests (one asserting rejection on a case-insensitive filesystem, one asserting the merge is allowed on a case-sensitive filesystem), each skipping via Assert.Inconclusive on the non-matching host so exactly one scenario drives the assertions. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: 34f1a49b-b1e0-4f38-b8a1-3870dd0842d2
Contributor
🧪 Test quality grade — PR #10014
This advisory comment was generated automatically. Grades are heuristic Warning Firewall blocked 1 domainThe following domain was blocked by the firewall during workflow execution:
network:
allowed:
- defaults
- "awmgmcpg"See Network Configuration for more information.
|
0101
approved these changes
Jul 16, 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.
Summary
Follow-up bug fix for the post-merge review comment on #9805: #9805 (comment)
MergeOutputFileHelper.IsDirectoryCaseSensitive(string directory)probed case sensitivity by lower-casing the entire candidate path:upper.ToLowerInvariant()also lower-cases thedirectoryportion. For a case-insensitive/case-folded child directory (e.g. an ext4casefolddir named with UPPERCASE chars) sitting beneath a case-sensitive parent, the lower-cased parent no longer exists, soFile.Existsreturnsfalseand the method wrongly reports the directory as case-sensitive (Ordinal).That makes
EnsureOutputDoesNotAliasInputuseStringComparison.Ordinal, so it can miss thata.trxandA.trxare the same file, and the subsequentReplaceFilecan overwrite an input that RFC 018 requires to stay read-only (data loss).Fix
Lower-case only the generated probe file name, preserving the real
directorypath, and expand the comment to explain why.Test
Adds a regression test
MergeToFileAsync_WhenOutputDiffersFromInputOnlyByCase_IsRejectedOnCaseInsensitiveDirectoryinCtrfReportMergerTests.csthat goes through the publicMergeToFileAsyncsurface: on a case-insensitive directory a case-only output (report.jsoninput vsREPORT.jsonoutput) must be rejected as an alias; on a genuinely case-sensitive directory the two names are distinct and the merge proceeds. The directory's real case sensitivity is probed independently (correctly, lower-casing only the file name).Validation (Windows)
Microsoft.Testing.Extensions.TrxReport,Microsoft.Testing.Extensions.CtrfReport,Microsoft.Testing.Extensions.JUnitReport./p:TreatWarningsAsErrors=true.