fix: show events starting at Unix timestamp 0#1240
Open
MiMoHo wants to merge 1 commit into
Open
Conversation
Several EventsDao queries carried a stale `start_ts != 0` clause from the Simple Calendar era. Because start_ts is a Unix timestamp in seconds, start_ts == 0 is exactly 1970-01-01 00:00:00 UTC, so any event at that instant (including all-day or yearly-recurring events whose start lands on epoch 0) was stored in the DB but never shown in day/search views nor rescheduled at reboot. Remove the clause from the five affected queries (one-time, one-time search, repeatable, repeatable search, and the reboot reminder query). Removing it from the reboot query is safe: a non-repeating event at ts 0 is still excluded by (start_ts > :currentTS OR repeat_interval != 0). Unwrap the existing bug440 instrumented test so it now passes and update the detekt baseline. Closes FossifyOrg#440
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.
Type of change(s)
What changed and why
Several
EventsDaoqueries carried a staleAND start_ts != 0clause inherited from the Simple Calendar era.start_tsis a Unix timestamp in seconds, sostart_ts == 0is exactly 1970-01-01 00:00:00 UTC. Any event landing on that instant — including all-day or yearly-recurring events whose start falls on epoch 0 (e.g. New Year's Day 1970 in GMT+0) — was stored in the database but silently filtered out of day/list views, search, and reboot reminder rescheduling, so it never became visible.The clause was also inconsistent: the sibling queries without
calendarIds(getOneTimeEventsOrTasksFromTo,getRepeatableEventsOrTasksWithCalendarIds(toTS)) never had it, confirming it is a legacy heuristic rather than intentional behaviour. No code insertsstart_ts = 0as a hidden sentinel (only theEventmodel default0Land the UI-onlyListEvent.empty).This PR removes the clause from the five affected queries:
getOneTimeEventsFromToWithCalendarIdsgetOneTimeEventsFromToWithTypesForSearchgetRepeatableEventsOrTasksWithCalendarIds(toTS, calendarIds)getRepeatableEventsOrTasksWithTypesForSearchgetEventsOrTasksAtRebootRemoving it from the reboot query is safe: a non-repeating event at ts 0 is already excluded by
(start_ts > :currentTS OR repeat_interval != 0), while a repeating one legitimately has future occurrences that need reminders. The now-obsolete legacy comment above that query is dropped.The existing instrumented test
bug440_EventAtMidnightOnFirstJan1970(previously wrapped inexpectedFailure) is unwrapped so it now passes, and the detekt baseline is updated to match the shortened query lines.Tests performed
Built the
fossDebugvariant and verified on an Android 15 (API 35) emulator:Set device timezone to UTC (Etc/GMT); created event at Jan 1 1970 12:00 AM (start_ts=0). Reminder notification fired showing 'January 1 1970, 12:00 AM'. Searching 'Epoch' returned the event under JANUARY 1970 / 1 Thursday / Epoch 12:00 AM. Previously start_ts!=0 filter would hide it.
Also confirmed
detekt,lint, unit tests and the build all pass locally (CI-equivalent).Closes the following issue(s)
Checklist
CHANGELOG.md(if applicable).Coded with Opus 4.8 ultracode.