Use ticks to decide date precision - #1856
Merged
Merged
Conversation
GetJsonDatePart and GetParameterDatePart used the Second and Millisecond properties to decide how much of the time to render, but sub-millisecond ticks leave both of those zero. So a value one tick past midnight rendered as a plain date, and AddTicks(1) and AddTicks(2) rendered identically. As parameters that means two cases sharing one snapshot prefix, surfacing as a spurious "prefix has already been used" or as both cases silently sharing one verified file. The checks are now remainder-of-ticks based, so anything below the rendered precision falls through to the FFFFFFF format.
This was referenced Aug 26, 2026
This was referenced Aug 27, 2026
tom-wolfe
pushed a commit
to tom-wolfe/Wolfe.CommandLine
that referenced
this pull request
Aug 27, 2026
Updated [Verify.XunitV3](https://github.com/VerifyTests/Verify) from 31.28.0 to 32.0.0. <details> <summary>Release notes</summary> _Sourced from [Verify.XunitV3's releases](https://github.com/VerifyTests/Verify/releases)._ ## 32.0.0 - [x] [#1832](VerifyTests/Verify#1832) Add Inline snpashot support - [x] [#1835](VerifyTests/Verify#1835) Add SettingsTask.AddContext - [x] [#1847](VerifyTests/Verify#1847) Honor explicit DefaultValueHandling for bools - [x] [#1850](VerifyTests/Verify#1850) Stray extension-less snapshot file crashes every run of its test - [x] [#1851](VerifyTests/Verify#1851) Static UniqueForTargetFramework(Assembly) overloads ignore the assembly passed to them - [x] [#1852](VerifyTests/Verify#1852) Appended files skip scrubbing and newline normalization when a stream converter is registered - [x] [#1853](VerifyTests/Verify#1853) IgnoreParameters() ignore-all sentinel is lost when combined with another ignore source - [x] [#1854](VerifyTests/Verify#1854) Format UTC offsets with the invariant culture - [x] [#1855](VerifyTests/Verify#1855) Format UTC offsets with invariant culture - [x] [#1856](VerifyTests/Verify#1856) Use ticks to decide date precision - [x] [#1857](VerifyTests/Verify#1857) Clean # out of file name parameters - [x] [#1858](VerifyTests/Verify#1858) Escape one character trimmed date formats - [x] [#1859](VerifyTests/Verify#1859) Prefer the exact type when resolving a member converter - [x] [#1860](VerifyTests/Verify#1860) Keep empty collections ignored alongside instance predicates - [x] [#1861](VerifyTests/Verify#1861) Key the combinations name cache by reference - [x] [#1862](VerifyTests/Verify#1862) Match MSTest overloads against the test data - [x] [#1863](VerifyTests/Verify#1863) Report deletes as directory relative paths - [x] [#1864](VerifyTests/Verify#1864) Name the guarded API in ThrowIfVerifyHasBeenRun - [x] [#1865](VerifyTests/Verify#1865) Keep stack frames that have no parameter list - [x] [#1866](VerifyTests/Verify#1866) Generate the TestContext property for record test classes - [x] [#1867](VerifyTests/Verify#1867) Fix two CombinationResultsConverter edge cases - [x] [#1868](VerifyTests/Verify#1868) Sign sub-hour UTC offsets - [x] [#1869](VerifyTests/Verify#1869) Write the received file from the stream for handle based FileStreams - [x] [#1870](VerifyTests/Verify#1870) Compare prefixes ignoring case - [x] [#1871](VerifyTests/Verify#1871) Guard the counter value caches with a lock - [x] [#1872](VerifyTests/Verify#1872) Sign sub-hour UTC offsets ## 32.0.0-beta.16 ## 32.0.0-beta.15 ## 32.0.0-beta.14 ## 32.0.0-beta.13 ## 32.0.0-beta.12 ## 32.0.0-beta.10 ## 32.0.0-beta.8 ## 32.0.0-beta.7 ## 32.0.0-beta.6 ## 32.0.0-beta.5 ## 32.0.0-beta.4 ## 32.0.0-beta.3 ## 32.0.0-beta.2 ## 32.0.0-beta.1 Commits viewable in [compare view](VerifyTests/Verify@31.28.0...32.0.0). </details> [](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores) Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore <dependency name> major version` will close this group update PR and stop Dependabot creating any more for the specific dependency's major version (unless you unignore this specific dependency's major version or upgrade to it yourself) - `@dependabot ignore <dependency name> minor version` will close this group update PR and stop Dependabot creating any more for the specific dependency's minor version (unless you unignore this specific dependency's minor version or upgrade to it yourself) - `@dependabot ignore <dependency name>` will close this group update PR and stop Dependabot creating any more for the specific dependency (unless you unignore this specific dependency or upgrade to it yourself) - `@dependabot unignore <dependency name>` will remove all of the ignore conditions of the specified dependency - `@dependabot unignore <dependency name> <ignore condition>` will remove the ignore condition of the specified dependency and ignore conditions </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
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.
GetJsonDatePart/GetParameterDatePart(both theDateTimeandDateTimeOffsetvariants) used theSecondandMillisecondproperties to decide how much of the time component to render. Sub-millisecond ticks leave both of those zero, so:new DateTime(2000, 10, 1).AddTicks(1)rendered as2000-10-01, dropping the tick entirely.AddTicks(1)andAddTicks(2)rendered identically.As parameters that means two distinct cases sharing one snapshot prefix, which surfaces either as a spurious "prefix has already been used" or as both cases silently sharing one verified file.
The checks are now remainder-of-ticks based (
ticks % TimeSpan.TicksPerMinute,ticks % TimeSpan.TicksPerSecond), so any value below the rendered precision falls through to theFFFFFFFformat. Values that land exactly on a second or minute render as before, so existing snapshots are unaffected.Tests:
SubMillisecondTicksDoNotCollidepins the collision, andSubMillisecondTickssnapshots both types across tick offsets spanning the boundaries.Verify.Tests(1301),ApplyScrubbersTestsandStaticSettingsTestsall pass.