Skip to content

Conversation

@mjunaidca
Copy link
Owner

Summary

  • Fix critical N+1 query bug using SQLAlchemy selectinload (51 → 2 queries for 50 tasks)
  • Add server-side search with case-insensitive ILIKE matching (max 200 chars)
  • Add sorting by created_at, due_date, priority, title with custom priority ordering (critical > high > medium > low)
  • Add filters: tags (AND logic with PostgreSQL JSONB), has_due_date (boolean)
  • Implement proper null handling: nullslast for ascending, nullsfirst for descending
  • Update frontend with useDeferredValue for 300ms debounced search
  • Add sort dropdowns and remove redundant client-side filtering
  • Add 15 new tests covering all search/filter/sort functionality

Key Changes

Backend (packages/api/src/taskflow_api/routers/tasks.py)

  • Added selectinload(Task.assignee) to fix N+1 query issue
  • New query parameters: search, tags, has_due_date, sort_by, sort_order
  • Custom priority ordering using SQLAlchemy case() expression
  • Proper null handling for due_date sorting

Frontend

  • web-dashboard/src/types/index.ts - Extended TaskFilterParams with new params
  • web-dashboard/src/lib/api.ts - Updated getProjectTasks to pass new params
  • web-dashboard/src/app/tasks/page.tsx - Added useDeferredValue, sort dropdowns, removed client-side filtering

Tests (packages/api/src/taskflow_api/tests/test_tasks.py)

  • Added 15 new tests for search, filter, and sort functionality
  • 3 tests skipped (tags filter requires PostgreSQL JSONB, not supported in SQLite)

Test Results

74 passed, 3 skipped, 709 warnings in 3.68s

Test Plan

  • Backend tests pass (74 passed, 3 skipped for PostgreSQL-only features)
  • Frontend TypeScript build succeeds
  • Ruff linting passes
  • N+1 fix verified (selectinload pattern)
  • Backward compatibility maintained (default sort unchanged)

Closes #14

🤖 Generated with Claude Code

mjunaidca and others added 8 commits December 10, 2025 21:06
- Fix critical N+1 query issue using SQLAlchemy selectinload (51→2 queries)
- Add server-side search with case-insensitive ILIKE (max 200 chars)
- Add sort by created_at, due_date, priority, title with custom priority ordering
- Add filters: tags (AND logic), has_due_date (boolean)
- Implement null handling: nullslast for asc, nullsfirst for desc
- Update frontend with useDeferredValue for 300ms debounced search
- Add sort dropdowns and remove client-side filtering
- Add 15 new tests (74 passed, 3 skipped for PostgreSQL-only features)

Closes #14

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Update ListTasksInput model with new optional params:
  - search: case-insensitive title search (max 200 chars)
  - tags: comma-separated tags filter (AND logic)
  - has_due_date: boolean filter for due date existence
  - sort_by: created_at, due_date, priority, title
  - sort_order: asc, desc

- Update api_client.py to pass new params to REST API
- Update taskflow_list_tasks tool to use new params
- Add tags field to task response output
- All params are optional for backward compatibility

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Changed the import of the tailwindcss animate plugin from `require` to ES module import for consistency and improved readability.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Added new fields for due date and tags in the subtask creation form.
- Implemented state management for subtask due date and tags.
- Updated API call to include due date and tags when creating a subtask.
- Enhanced UI to allow users to input due date and comma-separated tags.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…nd task hierarchy

- Add GET /api/tasks/recent endpoint for optimized dashboard (single query across all projects)
- Add project settings page with edit form and delete functionality
- Add cascade delete for tasks (deleting parent removes all subtasks)
- Add task hierarchy indicators on tasks page (↳ for subtasks, 🔀 N for parents)
- Add parent_task_id and subtask_count to TaskListItem response
- Update test to verify cascade delete behavior

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@mjunaidca mjunaidca merged commit 2fa87bd into main Dec 10, 2025
5 checks passed
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.

Performance: N+1 queries in list_tasks and list_projects causing slow API responses

2 participants