Skip to content

Semantic renaming: Unify 'tickets' and 'tasks' terminology and API endpoints #1914

@tomsmith8

Description

@tomsmith8

Problem

The codebase uses both "tickets" and "tasks" terminology interchangeably, causing semantic confusion and API duplication. While the database already merged tickets into the task table (migration 20251020105526_merge_tickets_into_tasks), the UI layer and API endpoints still use mixed terminology.

Current Issues:

  • Component named TicketsList but manages tasks
  • Variables like newTicketTitle, creatingTicket but create task records
  • Duplicate API endpoints: /api/tickets/[ticketId] and /api/tasks/[taskId] operating on same database table
  • Service layer split: roadmap service for tickets vs direct Prisma for tasks
  • Mixed types: TicketListItem, TicketDetail vs task types

Proposed Solution

1. Rename all "ticket" terminology to "task"

Components:

  • src/components/features/TicketsList/TasksList/
  • Component: TicketsListTasksList
  • Props: TicketsListPropsTasksListProps

Variables & Functions:

  • newTicketTitlenewTaskTitle
  • isCreatingTicketisCreatingTask
  • handleCreateTickethandleCreateTask
  • handleCancelCreateTickethandleCancelCreateTask

Types:

  • TicketListItemTaskListItem (if not already unified)
  • TicketDetailTaskDetail
  • TicketResponseTaskResponse
  • CreateTicketRequestCreateTaskRequest
  • UpdateTicketRequestUpdateTaskRequest

2. Unify API endpoints under /api/tasks

New unified structure:

/api/tasks                           # List all tasks (with filtering)
/api/tasks/[taskId]                  # Get/update/delete any task
/api/tasks/reorder                   # Reorder tasks
/api/features/[featureId]/tasks      # Create tasks scoped to a feature

Merge operations:

  • Consolidate /api/tickets/[ticketId] (GET, PATCH, DELETE) into /api/tasks/[taskId]
  • Merge roadmap service layer operations with general task operations
  • Keep Stakwork workflow integration
  • Maintain real-time Pusher broadcasting

Deprecation path:

  • Add redirects from /api/tickets/* to /api/tasks/* for backward compatibility
  • Log deprecation warnings
  • Remove after 1-2 releases

3. Service layer consolidation

Current:

  • @/services/roadmap: getTicket, updateTicket, deleteTicket, createTicket
  • Direct Prisma: Task workflow operations

Proposed:

  • Merge into unified task service: @/services/tasks
  • Include both roadmap operations and workflow operations
  • Single source of truth for task CRUD

Benefits

Semantic clarity - One concept, one name
Already aligned with database - Tickets merged into tasks
Simpler API - Single endpoint for task operations
Easier maintenance - No duplicate code paths
Better DX - New developers won't wonder about the difference
Modern terminology - "Tasks" is standard in PM tools

Files Affected (Estimated)

  • src/components/features/TicketsList/index.tsx
  • src/app/api/tickets/[ticketId]/route.ts → merge into tasks
  • src/app/api/tickets/reorder/route.ts → merge into tasks
  • src/app/api/features/[featureId]/tickets/route.ts → rename to tasks
  • src/services/roadmap/tickets.ts → merge into unified task service
  • src/types/roadmap.ts - type definitions
  • Various page components using tickets terminology
  • Test files referencing tickets

Migration Strategy

  1. Phase 1: Rename UI components and variables (no API changes)
  2. Phase 2: Create unified /api/tasks endpoint with merged functionality
  3. Phase 3: Add redirects from /api/tickets to /api/tasks with deprecation warnings
  4. Phase 4: Update all internal references to use new endpoints
  5. Phase 5: Remove old /api/tickets endpoints after deprecation period

Priority

Medium - This is technical debt cleanup that improves maintainability but doesn't block features. Good candidate for including in the feature/simplify-feature-page-cleanup branch or a follow-up PR.

Related

  • Migration 20251020105526_merge_tickets_into_tasks already unified database
  • Current PR: (feature/simplify-feature-page-cleanup) - could include this work

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions