Skip to content

Fix date-only range stop dropping the final day (half-open [start, stop)) - #312

Closed
Shadow_Lu (LuShadowX) wants to merge 1 commit into
microsoft:mainfrom
LuShadowX:fix-daterange-end-of-day
Closed

Fix date-only range stop dropping the final day (half-open [start, stop))#312
Shadow_Lu (LuShadowX) wants to merge 1 commit into
microsoft:mainfrom
LuShadowX:fix-daterange-end-of-day

Conversation

@LuShadowX

Copy link
Copy Markdown
Contributor

Replaces #296 and #309. Bernhard Merkle (@bmerkle) offered on #296 to hand this back to me to land, and I took him up on it; GitHub refused to reopen #296 after the force-push, hence a new PR. The design and the test shape are his — he is credited on the commit.

A stop_date with no time compiled to that day's midnight, so "Jan 1 to Jan 5" became [Jan 1 00:00, Jan 5 00:00) and everything on Jan 5 was dropped.

  • searchlang.py: new exclusive_stop_from_date_time(); a date-only stop rolls to the next midnight.
  • interfaces_core.py: DateRange.end is now documented and implemented as exclusive (__contains__ uses <), matching both timestamp index backends, which already filtered exclusively.
  • convutils.py: docstring only, warning that get_time_range_for_conversation returns an inclusive-looking bound.

end is None still means "unbounded" in DateRange but a point query in the indexes. Left alone — separate decision.

make format check test: pyright clean on 3.12 and 3.14, 744 passed, 12 skipped (737 on main; the 7 new tests are the only difference). The regression test fails on main and passes here.

…op))

date_range_from_datetime_range compiled a stop_date with no time to that
day's midnight, so "Jan 1 to Jan 5" became [Jan 1 00:00, Jan 5 00:00) and
every message on Jan 5 was dropped.

A bare date now rolls forward to the next midnight via
exclusive_stop_from_date_time(). DateRange.end is documented and
implemented as exclusive to match both timestamp index backends, which
already filtered exclusively while __contains__ was inclusive.

Co-authored-by: bmerkle <232471+bmerkle@users.noreply.github.com>
@bmerkle

Copy link
Copy Markdown
Collaborator

sorry, already fixed in #309

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants