Skip to content

[WEB-8477] fix: created_at/updated_at filters return no work items - #9513

Merged
dheeru0198 merged 1 commit into
previewfrom
web-8477/canary-bug-fixes
Jul 30, 2026
Merged

[WEB-8477] fix: created_at/updated_at filters return no work items#9513
dheeru0198 merged 1 commit into
previewfrom
web-8477/canary-bug-fixes

Conversation

@mguptahub

@mguptahub mguptahub commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Problem (WEB-8477, Bug 5)

Filtering the work item list by a creation/update date returns no work items.

created_at / updated_at are DateTimeFields, but the UI sends a bare calendar date, and the filterset only exposed exact and range lookups. Both are wrong for a datetime column:

Request the UI sends What the ORM did Result
{"created_at__exact":"2026-07-30"} coerced to 2026-07-30 00:00:00 matched only rows stamped exactly midnight → always empty
{"created_at__range":"2026-07-28,2026-07-30"} upper bound capped at 2026-07-30 00:00:00 silently dropped everything created during the final day (only "worked" if you overshot the end date by a day)

Reproduced from the bug report's exact query strings on a local canary build — both returned total_count: 0 with 4 matching work items present.

Fix

Compare the date component instead, so a calendar date means the whole day and both range bounds are inclusive:

  • created_at / created_at__exactlookup_expr="date"
  • created_at__rangelookup_expr="date__range" via a new DateCSVRangeFilter (BaseCSVFilter + DateFilter) that parses the UI's "a,b" CSV value
  • same for updated_at

The UI's existing query format is unchanged — no frontend change needed.

Verification (local canary build, Django 5.2.15)

Query Before After
created_at__exact=2026-07-30 0 4
created_at__range=2026-07-28,2026-07-30 (report's case) 0 4
created_at__range=2026-07-30,2026-07-30 0 4
created_at__exact=2020-01-01 (backdated row) 0 1
created_at__range=2019-01-01,2019-12-31 0 0 ✅ (negative control)
updated_at__exact=2026-07-30 0 5 ✅ (incl. a row created in 2020 but updated today)

Adds plane/tests/unit/utils/test_issue_datetime_filters.py (7 tests). 6 of the 7 fail without this change (verified by reverting the fix); the 7th is a negative control that passes either way. ruff check + format clean.

Scope notes

  • Pre-existing, not a v1.4.0 regressionfilterset.py is byte-identical on master (v1.3.1).
  • Not covered by fix: cast avatar_asset to CharField to resolve mixed type errors in URL concatenation #9512 (Django 5 mixed-type FieldError, which fixes WEB-8477 Bugs 2 & 3) or fix(api): filter "Updated At" by updated_at column, not created_at #9323 (the legacy issue_filters.py updated_atcreated_at copy-paste bug). This is a third, independent cause.
  • ⚠️ Known remaining issue, deliberately not fixed here: __date is evaluated in the active timezone, which TimezoneMixin takes from the user's profile (user_timezone) rather than the browser's timezone. A user whose profile timezone differs from their browser can still see off-by-one-day results (verified: same data returns different rows for user_timezone=UTC vs Asia/Kolkata). Needs a product decision on which timezone is authoritative, so it's tracked separately.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Improved issue date filtering for creation and update dates.
    • Exact-date filters now include all issues from the selected calendar day, regardless of time.
    • Date-range filters now include the full final day and exclude issues outside the selected range.
    • Added regression coverage to ensure consistent filtering behavior.

Bug 5: filtering the work item list by a creation/update date returned an empty
list. created_at and updated_at are DateTimeFields, but the UI sends a bare
calendar date, and the filterset only exposed `exact` and `range` lookups:

- {"created_at__exact": "2026-07-30"} was coerced to 2026-07-30 00:00:00, so it
  matched only rows stamped exactly midnight — effectively never.
- {"created_at__range": "2026-07-28,2026-07-30"} capped the upper bound at
  2026-07-30 00:00:00, silently dropping everything created during that final
  day (the range only "worked" if you overshot the end date by one day).

Compare the date component instead (`date` / `date__range` via a CSV-parsing
DateCSVRangeFilter), so a calendar date means the whole day and both range
bounds are inclusive. The UI's existing query format is unchanged.

Verified against a local canary build: the exact requests from the bug report
now return 4 and 4 (previously 0 and 0). Adds unit coverage; 6 of the 7 new
tests fail without this change.

Note: `__date` is evaluated in the active timezone, which TimezoneMixin takes
from the user's profile (user_timezone) rather than the browser's timezone, so a
profile/browser timezone mismatch can still shift results by a day. Tracked
separately — not addressed here.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 30, 2026 14:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: d9a7625b-ff80-4658-80b0-9d4d1281e1c0

📥 Commits

Reviewing files that changed from the base of the PR and between 7564480 and 79f5529.

📒 Files selected for processing (2)
  • apps/api/plane/tests/unit/utils/test_issue_datetime_filters.py
  • apps/api/plane/utils/filters/filterset.py

📝 Walkthrough

Walkthrough

Issue datetime filters now interpret UI-provided dates as calendar-day values for exact and inclusive range lookups. New unit tests cover created_at and updated_at filtering across matching and non-matching dates.

Changes

Issue datetime filters

Layer / File(s) Summary
Calendar-day filter implementation
apps/api/plane/utils/filters/filterset.py
Adds DateCSVRangeFilter and changes issue created_at and updated_at exact/range filters to use date-component lookups.
Calendar-day filter regression tests
apps/api/plane/tests/unit/utils/test_issue_datetime_filters.py
Adds controlled timestamp fixtures and tests for exact-day matching, inclusive final days, and exclusion of dates outside the requested range.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Suggested reviewers: dheeru0198, pablohashescobar, copilot

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing created_at/updated_at filters returning no work items.
Description check ✅ Passed The description is detailed and mostly follows the template, covering the problem, fix, verification, and references.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch web-8477/canary-bug-fixes

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@makeplane

makeplane Bot commented Jul 30, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@dheeru0198
dheeru0198 merged commit e496b24 into preview Jul 30, 2026
18 of 20 checks passed
@dheeru0198
dheeru0198 deleted the web-8477/canary-bug-fixes branch July 30, 2026 14:21
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.

3 participants