Repository navigation
test: pin DateTimeKind and offsets through Shift, Expand and Split - #228
Merged
Merged
Conversation
A tsrange holds no kind, so a DateTimeRange bound's DateTimeKind lives only in memory, and the EF Core write leg reads it (E09). Nothing held it through the 10.0.0 arithmetic: the pre-tag analysis seeded new DateTime(value.Add(delta).Ticks) into Shift and only a clone-sweep waiver noticed, because the source text changed. RangeShiftExpandTests now holds each bound's kind through Shift, Expand, the unbounded shapes and every Split piece, with the two bounds of different kinds so a rebuild that copied one kind to both fails too, and each bound's offset for DateTimeOffsetRange. Seeding the dropped kind into Shift, into Expand and into Split each fails it. Closes #221 Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Closes #221
Problem
Nothing held that
DateTimeRange.Shift,ExpandandSplitkeep each bound'sDateTimeKind. The pre-tag analysis (#179) seedednew DateTime(value.Add(delta).Ticks)intoShift, and every behavioural test passed. Only a clone-sweep waiver failed, and only because the source text changed. Atsrangeholds no kind, so the kind lives only in memory. The EF Core write leg reads it (E09), so a bound that comes backUnspecifiedfrom aUtcone is a different instant on the way to the column, while every comparison in memory still agrees. The current code is right; this PR is tests only.Change
RangeShiftExpandTests.DateTimeRange_ShiftExpandSplit_KeepEachBoundsKind, one row per kind. Each row gives the two bounds different kinds (Unspecified/Utc, Local/Unspecified, Utc/Local), so a rebuild that copies one bound's kind to both fails too. It checks:Start.KindandEnd.KindthroughShift(±1h)andExpand(±1h), and throughUnboundedEnd.ShiftandUnboundedStart.ExpandSplitpiece: each starts withStart's kind, every piece but the last ends with it, and the last ends withEnd's kindRangeShiftExpandTests.DateTimeOffsetRange_ShiftExpandSplit_KeepEachBoundsOffsetdoes the same for each bound's offset.DateTimeOffsetequality ignores the offset, so the test reads the offset off each bound instead of comparing values.Tests
Proved by seeding, each in isolation on top of this branch:
DateTimeRange.csShift:new DateTime(value.Add(delta).Ticks)(the issue's seed)Shift: End.KindExpand:new DateTime(value.Subtract(amount).Ticks)Expand: Start.KindSplit:new DateTime(start.AddTicks(…).Ticks)Split piece 0: End.Kinddotnet test: coreRangeShiftExpandTests11/11 and conventions all green.🤖 Generated with Claude Code