🐛 Bug: Profile sidebar assigned count includes stale soft-deleted assignees
@NarayanBavisetti is already working on this.
Since Apr 9, 2026.
- Dominant language
- TypeScript
- Stars
- 59.6k
- Forks
- 5.8k
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 49
Description
Summary
The user profile page can show inconsistent assigned-work-item counts between the overview cards and the project sidebar breakdown.
Affected area
- Profile overview cards
/[workspaceSlug]/profile/[userId]/assigned- Backend endpoint:
WorkspaceUserProfileEndpoint
Symptoms
A user can see:
Work items assigned = 1in the overview cards- but
Assigned = 3 Work itemsin the profile sidebar/project summary
This happens when the user used to be assigned to additional work items, but those assignee relations were later removed.
Minimal reproduction
- Create a user and assign them to 3 work items in the same project.
- Remove the user from 2 of those work items so the corresponding
IssueAssigneerows are soft-deleted. - Open the user's profile overview and assigned tab.
- Observe:
- the overview cards correctly show
1assigned work item - the project sidebar breakdown can still show
3assigned work items
- the overview cards correctly show
Root cause
WorkspaceUserProfileEndpoint currently aggregates project counts with filters like:
project_issue__assignees__in=[user_id]
That can include stale rows from the IssueAssignee through table when older assignee records were soft-deleted.
Other profile count paths already guard against this by filtering active assignee relations with:
issue_assignee__deleted_at__isnull=True
So the profile sidebar can drift from the overview counts.
Expected behavior
Project-level assigned/completed/pending counts on the profile sidebar should only count active assignee relations.
Suggested fix
In WorkspaceUserProfileEndpoint, count assigned-related aggregates via active IssueAssignee rows instead of the raw M2M relation, for example:
project_issue__issue_assignee__assignee_id=user_idproject_issue__issue_assignee__deleted_at__isnull=Truedistinct=True
Regression coverage
A regression test should cover:
- one active assignment
- two historical assignments whose
IssueAssignee.deleted_atis set - sidebar endpoint returns
assigned_issues == 1, not3
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.