Skip to content

44655 backend [ My tasks ] Handle null values in /v3/tasks API - #276

Open
andrey-usov wants to merge 2 commits into
masterfrom
backend/tasks/44655__handle_null_values_in_tasks_api_master
Open

44655 backend [ My tasks ] Handle null values in /v3/tasks API#276
andrey-usov wants to merge 2 commits into
masterfrom
backend/tasks/44655__handle_null_values_in_tasks_api_master

Conversation

@andrey-usov

@andrey-usov andrey-usov commented Jul 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

When a user opens their task list and no filters are actively selected, some clients send empty filter values as the literal string null. The server treated those values as real filter criteria, which could return an empty task list even when the user had assigned tasks.

Fix / Solution

GET /v3/tasks now rejects the literal query-string value null for filter parameters with a 400 validation error. Validation lives in TaskListFilterSerializer (including shared RejectNullStringValidator for string fields).

Related staging work: #256 (merged into dev). This PR brings the same change cleanly onto master.

Release notes

Fixed an issue where the task list could return no results when clients sent the literal string null for filter parameters. The API now returns a clear 400 validation error instead.

Changes

API

  • GET /v3/tasks — query parameters template_id, template_task_api_name, and assigned_to with the literal value null now return 400:
    • template_id / assigned_to: "A valid integer is required."
    • template_task_api_name: "This field may not be null."

Web-client

No changes in this PR. Related frontend fix covered separately (clients should omit unset filters instead of sending null).

Test cases

API

Authorization Test case Expected result
Token auth (account owner) GET /v3/tasks?template_id=null 400, "A valid integer is required.", details.name = template_id
Token auth (account owner) GET /v3/tasks?template_task_api_name=null 400, "This field may not be null.", details.name = template_task_api_name
Token auth (admin) GET /v3/tasks?assigned_to=null 400, "A valid integer is required.", details.name = assigned_to
Token auth (account owner) GET /v3/tasks?template_id=null&template_task_api_name=null 400, "A valid integer is required.", details.name = template_id

Web-client

No changes.

Made with Cursor

Note

Reject literal string 'null' in /v3/tasks filter parameters

  • Adds RejectNullStringValidator in validators.py, a BaseValidator subclass that fails validation when a field value is exactly the string 'null', returning code null and message 'This field may not be null.'
  • Applies the validator to the template_task_api_name field in TaskListFilterSerializer so ?template_task_api_name=null returns a 400 error.
  • Integer fields (assigned_to, template_id) already reject 'null' via their existing integer validation; new tests cover all three fields plus combined cases.

Macroscope summarized 04c677c.

Bring validated filter handling from the staging branch into master
so legacy clients that send the string null get a clear 400 instead
of an empty task list.

Co-authored-by: Cursor <cursoragent@cursor.com>
@andrey-usov
andrey-usov requested a review from EBirkenfeld July 15, 2026 12:43

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Want higher recall? High effort reviews run extra passes and find more bugs. A team admin can switch effort levels in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit b48003c. Configure here.

Comment thread backend/src/processes/views/task.py
Comment thread backend/src/processes/views/task.py
…ter PR

Restore task.py from master so the null-filter fix does not remove select_related('workflow').

Co-authored-by: Cursor <cursoragent@cursor.com>
@pneumojoseph pneumojoseph changed the title 🔧 44655 backend [ My tasks ] Handle null values in /v3/tasks API 44655 backend [ My tasks ] Handle null values in /v3/tasks API Aug 19, 2026
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