[codex] Fix search date filters to use event dates#2192
Draft
TheLordArgus wants to merge 1 commit into
Draft
Conversation
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
Fixes temporal search filtering so
since/untiloperate on page event time first, usingeffective_datebefore falling back toupdated_at/created_at. It also makes the lower bound inclusive and normalizes plainYYYY-MM-DDuntilvalues to the next day for the existing exclusive upper-bound comparison.Root Cause
The Postgres search paths were filtering dates against
COALESCE(p.updated_at, p.created_at), so recently reimported or refreshed pages could appear in a recent-event query even when their actualeffective_datewas old. PGLite already usedeffective_date, but its lower bound was exclusive.Impact
Temporal queries such as "what happened since May 20" can otherwise include old pages that were merely touched recently, or miss events that fall exactly on the lower-bound date.
Changes
COALESCE(p.effective_date, p.updated_at, p.created_at)in Postgres search date filters.untilvalues to the next-day timestamp before passing them to the exclusive upper-bound engine filter.afterDate, while the boundary date is included.Validation
bun test test/chunk-grain-fts.test.ts