[WEB-8477] fix(api): filter "Updated At" by updated_at column, not created_at - #9514
Conversation
…eated_at filter_updated_at() passed `created_at__date` as the date term in both its GET and POST branches, so filtering by "Updated At" actually filtered on the creation date. Work items updated today but created earlier never appeared under "Updated At -> is -> today", and the two filters returned identical result sets. Re-raise of community PR #9323 by @sanjibani, which is approved-ready but cannot merge because the CLA is unsigned. Original patch and tests carried over unchanged apart from the two fixes below; credit for the fix is theirs. Adjustments made while porting: - test_get_method_targets_updated_at_column asserted the exact key "updated_at__date", but date_filter's single-value branch appends a lookup suffix ("updated_at__date__contains"), so the assertion always failed. Match on the key prefix instead. - Added the missing trailing newline to the new test file. Verified on a local canary build: with one work item created 2020-01-01 but updated today, `?updated_at=2026-07-01;after` now returns 5 while `?created_at=2026-07-01;after` returns 4 — previously both returned 4. Unit tests pass (5); 4 of the 5 fail without the source change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Linked to Plane Work Item(s) This comment was auto-generated by Plane |
📝 WalkthroughWalkthroughCorrects ChangesUpdated-at filter correction
Estimated code review effort: 2 (Simple) | ~10 minutes Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
apps/api/plane/tests/unit/utils/test_issue_filters.py (1)
24-25: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick winAssert the generated filters more precisely.
These checks only inspect key substrings; the
all(...)assertions also pass for an empty dictionary. Assert that the expected keys and values are present so the tests cannot pass when filtering produces no or malformed entries.Also applies to: 31-32, 38-39, 46-47
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@apps/api/plane/tests/unit/utils/test_issue_filters.py` around lines 24 - 25, Strengthen the assertions in the issue-filter tests around the generated filter mapping, including the repeated assertion blocks at the referenced cases. Verify the exact expected filter keys and their corresponding values, rather than relying on substring checks or vacuous all/any assertions, so empty or malformed filter dictionaries fail the tests.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@apps/api/plane/tests/unit/utils/test_issue_filters.py`:
- Around line 24-25: Strengthen the assertions in the issue-filter tests around
the generated filter mapping, including the repeated assertion blocks at the
referenced cases. Verify the exact expected filter keys and their corresponding
values, rather than relying on substring checks or vacuous all/any assertions,
so empty or malformed filter dictionaries fail the tests.
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro Plus
Run ID: 98dc8c4b-4bb2-4a0a-ac67-461a707fd7ca
📒 Files selected for processing (2)
apps/api/plane/tests/unit/utils/test_issue_filters.pyapps/api/plane/utils/issue_filters.py
Problem
filter_updated_at()passedcreated_at__dateas the date term in both its GET and POST branches, so filtering by "Updated At" actually filtered on the creation date. Work items updated today but created earlier never appeared underUpdated At → is → today, and the "Created at" / "Updated at" filters returned identical result sets.This is the legacy
issue_filters.pyquery-param path (pre-existing — present in v1.3.1, not a v1.4.0 regression).Fix
in both branches of
filter_updated_at(), plus the unit tests from #9323.Adjustments made while porting
Two small issues in the original patch:
test_get_method_targets_updated_at_columnalways failed. It asserted the exact key"updated_at__date", butdate_filter()'s single-value branch appends a lookup suffix, producingupdated_at__date__contains. Changed to match on the key prefix. (Confirmed: a bare date yields{'updated_at__date__contains': '2026-06-26'}, while;afteryields{'updated_at__date__gte': ...}.)Verification (local canary build, Django 5.2.15)
With 5 work items — one created
2020-01-01but updated today, four created today:?updated_at=2026-07-01;after?created_at=2026-07-01;afterBefore the fix both returned 4 (identical sets — the tell-tale symptom). Unit tests: 5 pass, and 4 of the 5 fail with the source change reverted.
ruff check+formatclean.Related
Part of WEB-8477 (canary bug sweep). Complements — does not overlap — the other two fixes:
FieldError(Bugs 1, 2, 3). Also blocked on an unsigned CLA.created_at/updated_atdate lookups (Bug 5). Different code path: this PR fixes the legacy?updated_at=query param, [WEB-8477] fix: created_at/updated_at filters return no work items #9513 fixes thefilters={"updated_at__exact":...}rich-filter path. Both are needed.🤖 Generated with Claude Code
Summary by CodeRabbit