Skip to content

fix(api): filter "Updated At" by updated_at column, not created_at - #9323

Closed
sanjibani wants to merge 1 commit into
makeplane:previewfrom
sanjibani:fix/9316-updated-at-filter-uses-correct-column
Closed

fix(api): filter "Updated At" by updated_at column, not created_at#9323
sanjibani wants to merge 1 commit into
makeplane:previewfrom
sanjibani:fix/9316-updated-at-filter-uses-correct-column

Conversation

@sanjibani

@sanjibani sanjibani commented Jun 26, 2026

Copy link
Copy Markdown

Summary

filter_updated_at in apps/api/plane/utils/issue_filters.py was passing created_at__date as the date_term to date_filter — a copy-paste from filter_created_at. The "Updated At -> is -> today" filter was therefore checking the issue's creation date instead of its last-modified date. Work items created earlier but updated today silently disappeared from the results.

The typo was in both the GET and POST branches of filter_updated_at. Replaced created_at__date with updated_at__date and added a focused unit test in apps/api/plane/tests/unit/utils/test_issue_filters.py that pins the column name.

Test plan

  • New unit test TestFilterUpdatedAt covers the GET, GET-with-CSV, POST, and prefixed-cycle_issue__ cases, asserting every emitted filter key references updated_at and none reference created_at.
  • Existing tests in tests/unit/utils/ continue to apply.

Refs #9316

Summary by CodeRabbit

  • Bug Fixes

    • Fixed issue date filtering so updated_at now matches against the correct update date field for both GET and POST inputs (including date-based filtering).
  • Tests

    • Added unit test coverage to ensure updated_at filtering targets the right date field, supports comma-separated and list-style parameters, honors optional prefixes, and treats empty filter values as a no-op.

@CLAassistant

CLAassistant commented Jun 26, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@coderabbitai

coderabbitai Bot commented Jun 26, 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

Run ID: 02316e39-34d8-4b68-86da-b8dffa36509f

📥 Commits

Reviewing files that changed from the base of the PR and between c8c22ca and d2e8d10.

📒 Files selected for processing (2)
  • apps/api/plane/tests/unit/utils/test_issue_filters.py
  • apps/api/plane/utils/issue_filters.py
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/api/plane/tests/unit/utils/test_issue_filters.py
  • apps/api/plane/utils/issue_filters.py

📝 Walkthrough

Walkthrough

filter_updated_at now filters both GET and non-GET requests on updated_at__date instead of created_at__date. New unit tests cover GET and POST inputs, comma-separated and list date values, prefixes, and empty input behavior.

Changes

Updated-at filter fix

Layer / File(s) Summary
Filter target and regression coverage
apps/api/plane/utils/issue_filters.py, apps/api/plane/tests/unit/utils/test_issue_filters.py
filter_updated_at uses updated_at__date in both branches, and new tests verify GET/POST handling, CSV/list inputs, prefix support, and no-op behavior for empty values.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

A rabbit hopped by moonlit code,
And sniffed where dates were gently turned;
No created_at in the trail tonight,
Just updated_at, all crisp and earned.
🐰✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise and accurately reflects the core fix from created_at to updated_at.
Description check ✅ Passed The description has a detailed summary, test plan, and issue reference; the omitted template sections are non-critical.
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 unit tests (beta)
  • Create PR with unit tests

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.

filter_updated_at was passing `created_at__date` as the date_term to
date_filter, so the "Updated At -> is -> today" filter checked the
issue's creation date instead of its last-modified date. Work items
created earlier but updated today silently disappeared from the
results.

Fix the typo in both the GET and POST branches and add a focused
unit test that pins the column name.

Refs makeplane#9316
@sanjibani
sanjibani force-pushed the fix/9316-updated-at-filter-uses-correct-column branch from c8c22ca to d2e8d10 Compare June 27, 2026 20:34
dheeru0198 pushed a commit that referenced this pull request Jul 30, 2026
…eated_at (#9514)

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>
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.

2 participants