Report deletes as directory relative paths - #1863
Merged
Merged
Conversation
The Delete: section emitted Path.GetFileName while every other section emits a
path relative to the reported directory, and the parser rebuilds each entry with
Path.Combine(directory, name). UseUniqueDirectory and VerifyDirectory keep their
snapshots in a subdirectory, so a stale {Directory}\Type.Method\old.verified.txt
was reported as old.verified.txt and parsed back as the nonexistent
{Directory}\old.verified.txt. Same named files in different subdirectories
collapsed onto one entry.
Also documents that the file listing paths are directory relative.
This was referenced Aug 26, 2026
This was referenced Aug 27, 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.
The
Delete:section emittedPath.GetFileName(file), whileNew:,NotEqual:andEqual:all emit a path relative to the reported directory, andVerify.ExceptionParsingrebuilds each delete entry withPath.Combine(directory, name).For flat layouts the two agree, so this only shows up where snapshots live in a subdirectory —
UseUniqueDirectory()andVerifyDirectory. A stale{Directory}\Type.Method\old.verified.txtwas reported as justold.verified.txtand parsed back as{Directory}\old.verified.txt, which does not exist. Same-named files in different subdirectories also collapsed onto one entry.The section now uses
IoHelpers.GetRelativePath, the same call the other sections use, so the round trip holds.Also documents the invariant in
exception-message-format.md: the file listing paths are relative to the reported directory and keep any subdirectory. The doc previously only said the inline paths are absolute, leaving the file sections implicit.Two tests, one per side of the round trip:
VerifyExceptionMessageBuilderTests.DeleteInSubDirectoryfor what is emitted, andExceptionParsingTests.DeleteInSubDirectoryfor what comes back. Onmainboth produceold.verified.txt/{ProjectDirectory}old.verified.txt.Verify.ExceptionParsing.Tests(84 across net11.0 and net48),Verify.Tests(1299) andStaticSettingsTestspass. No existing snapshot changed — the otherDelete:snapshots all use flat paths.