Skip to content

[WEB-8477] fix(api): filter "Updated At" by updated_at column, not created_at - #9514

Merged
dheeru0198 merged 1 commit into
previewfrom
web-8477/updated-at-filter-column
Jul 30, 2026
Merged

[WEB-8477] fix(api): filter "Updated At" by updated_at column, not created_at#9514
dheeru0198 merged 1 commit into
previewfrom
web-8477/updated-at-filter-column

Conversation

@mguptahub

@mguptahub mguptahub commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

Re-raise of #9323 by @sanjibani. That PR is technically ready but cannot merge — its CLA is unsigned. Opening from a covered account so the fix can land. Credit for the fix and the tests belongs to @sanjibani; please close #9323 as superseded by this one once merged.

Problem

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 "Created at" / "Updated at" filters returned identical result sets.

This is the legacy issue_filters.py query-param path (pre-existing — present in v1.3.1, not a v1.4.0 regression).

Fix

-                date_term=f"{prefix}created_at__date",
+                date_term=f"{prefix}updated_at__date",

in both branches of filter_updated_at(), plus the unit tests from #9323.

Adjustments made while porting

Two small issues in the original patch:

  1. test_get_method_targets_updated_at_column always failed. It asserted the exact key "updated_at__date", but date_filter()'s single-value branch appends a lookup suffix, producing updated_at__date__contains. Changed to match on the key prefix. (Confirmed: a bare date yields {'updated_at__date__contains': '2026-06-26'}, while ;after yields {'updated_at__date__gte': ...}.)
  2. Added the missing trailing newline to the new test file.

Verification (local canary build, Django 5.2.15)

With 5 work items — one created 2020-01-01 but updated today, four created today:

Query Before After
?updated_at=2026-07-01;after 4 ❌ 5 ✅ (includes the 2020-created row)
?created_at=2026-07-01;after 4 4 ✅ (unchanged)

Before 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 + format clean.

Related

Part of WEB-8477 (canary bug sweep). Complements — does not overlap — the other two fixes:

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Bug Fixes
    • Fixed the “Updated At” filter so it correctly searches by issue update dates instead of creation dates.
    • Ensured filtering works consistently for single dates, multiple dates, and different request methods.
    • Empty “Updated At” filters now leave existing results unchanged.

…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>
Copilot AI review requested due to automatic review settings July 30, 2026 14:56

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.

@makeplane

makeplane Bot commented Jul 30, 2026

Copy link
Copy Markdown

Linked to Plane Work Item(s)

This comment was auto-generated by Plane

@coderabbitai

coderabbitai Bot commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Corrects filter_updated_at to filter on updated_at__date instead of created_at__date, with regression tests covering GET, POST, CSV, prefixes, and empty input.

Changes

Updated-at filter correction

Layer / File(s) Summary
Filter correction and regression coverage
apps/api/plane/utils/issue_filters.py, apps/api/plane/tests/unit/utils/test_issue_filters.py
filter_updated_at now generates updated_at__date filters, with tests covering GET and POST inputs, CSV dates, prefixes, and empty parameters.

Estimated code review effort: 2 (Simple) | ~10 minutes

Possibly related PRs

Suggested reviewers: pablohashescobar

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly states the core fix: Updated At now filters on updated_at instead of created_at.
Description check ✅ Passed The PR includes a clear problem/fix summary, testing details, and related references, though it doesn't use the exact template headings.
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/updated-at-filter-column

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.

@coderabbitai coderabbitai Bot 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.

🧹 Nitpick comments (1)
apps/api/plane/tests/unit/utils/test_issue_filters.py (1)

24-25: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Assert 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

📥 Commits

Reviewing files that changed from the base of the PR and between e496b24 and c547c85.

📒 Files selected for processing (2)
  • apps/api/plane/tests/unit/utils/test_issue_filters.py
  • apps/api/plane/utils/issue_filters.py

@dheeru0198
dheeru0198 merged commit 3985693 into preview Jul 30, 2026
18 of 19 checks passed
@dheeru0198
dheeru0198 deleted the web-8477/updated-at-filter-column branch July 30, 2026 15:00
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