Implement comprehensive task management system with GITEA integration
Replace mock endpoints with real database-backed task management:
- Add tasks table with full relationships and indexes
- Create generic task management service supporting multiple sources
- Implement GITEA integration service for issue synchronization
- Add task creation, retrieval, assignment, and status updates
Database schema changes:
- New tasks table with external_id mapping for GITEA/GitHub/Jira
- Foreign key relationships to teams and agents
- Task workflow tracking (claimed_at, started_at, completed_at)
- JSONB fields for labels, tech_stack, requirements
Task management features:
- Generic TaskFilter with pagination and multi-field filtering
- Automatic tech stack inference from labels and descriptions
- Complexity scoring based on multiple factors
- Real task assignment to teams and agents
- GITEA webhook integration for automated task sync
API endpoints now use real database operations:
- GET /api/v1/tasks (real filtering and pagination)
- GET /api/v1/tasks/{id} (database lookup)
- POST /api/v1/tasks/ingest (creates actual task records)
- POST /api/v1/tasks/{id}/claim (real assignment operations)
GITEA integration includes:
- Issue-to-task synchronization with configurable task labels
- Priority mapping from issue labels
- Estimated hours extraction from issue descriptions
- Webhook processing for real-time updates
This removes the major mocked components and provides
a foundation for genuine E2E testing with real data.
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
11
migrations/002_add_tasks_table.down.sql
Normal file
11
migrations/002_add_tasks_table.down.sql
Normal file
@@ -0,0 +1,11 @@
|
||||
-- Rollback tasks table creation
|
||||
ALTER TABLE teams DROP COLUMN IF EXISTS current_task_id;
|
||||
DROP INDEX IF EXISTS idx_tasks_external_id_source;
|
||||
DROP INDEX IF EXISTS idx_tasks_created_at;
|
||||
DROP INDEX IF EXISTS idx_tasks_priority;
|
||||
DROP INDEX IF EXISTS idx_tasks_repository;
|
||||
DROP INDEX IF EXISTS idx_tasks_assigned_agent;
|
||||
DROP INDEX IF EXISTS idx_tasks_assigned_team;
|
||||
DROP INDEX IF EXISTS idx_tasks_source_type;
|
||||
DROP INDEX IF EXISTS idx_tasks_status;
|
||||
DROP TABLE IF EXISTS tasks;
|
||||
57
migrations/002_add_tasks_table.up.sql
Normal file
57
migrations/002_add_tasks_table.up.sql
Normal file
@@ -0,0 +1,57 @@
|
||||
-- Tasks table for generic task management
|
||||
-- Supports GITEA, GitHub, Jira, and other task sources
|
||||
CREATE TABLE tasks (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
external_id VARCHAR(255) NOT NULL, -- GITEA issue ID, GitHub issue ID, etc.
|
||||
external_url TEXT NOT NULL, -- Full URL to external task
|
||||
source_type VARCHAR(50) NOT NULL DEFAULT 'gitea', -- 'gitea', 'github', 'jira', 'manual'
|
||||
source_config JSONB DEFAULT '{}', -- Source-specific configuration
|
||||
|
||||
-- Core task data
|
||||
title VARCHAR(500) NOT NULL,
|
||||
description TEXT,
|
||||
status VARCHAR(50) NOT NULL DEFAULT 'open',
|
||||
priority VARCHAR(20) NOT NULL DEFAULT 'medium',
|
||||
|
||||
-- Assignment and team data
|
||||
assigned_team_id UUID REFERENCES teams(id) ON DELETE SET NULL,
|
||||
assigned_agent_id UUID REFERENCES agents(id) ON DELETE SET NULL,
|
||||
|
||||
-- Repository and project context
|
||||
repository VARCHAR(255), -- e.g., "owner/repo"
|
||||
project_id VARCHAR(255),
|
||||
|
||||
-- Task metadata
|
||||
labels JSONB DEFAULT '[]',
|
||||
tech_stack JSONB DEFAULT '[]',
|
||||
requirements JSONB DEFAULT '[]',
|
||||
estimated_hours INTEGER,
|
||||
complexity_score FLOAT,
|
||||
|
||||
-- Workflow tracking
|
||||
claimed_at TIMESTAMP WITH TIME ZONE,
|
||||
started_at TIMESTAMP WITH TIME ZONE,
|
||||
completed_at TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
-- Timestamps
|
||||
created_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
updated_at TIMESTAMP WITH TIME ZONE DEFAULT NOW(),
|
||||
external_created_at TIMESTAMP WITH TIME ZONE,
|
||||
external_updated_at TIMESTAMP WITH TIME ZONE,
|
||||
|
||||
-- Constraints
|
||||
UNIQUE(external_id, source_type) -- Prevent duplicate external tasks
|
||||
);
|
||||
|
||||
-- Indexes for performance
|
||||
CREATE INDEX idx_tasks_status ON tasks(status);
|
||||
CREATE INDEX idx_tasks_source_type ON tasks(source_type);
|
||||
CREATE INDEX idx_tasks_assigned_team ON tasks(assigned_team_id);
|
||||
CREATE INDEX idx_tasks_assigned_agent ON tasks(assigned_agent_id);
|
||||
CREATE INDEX idx_tasks_repository ON tasks(repository);
|
||||
CREATE INDEX idx_tasks_priority ON tasks(priority);
|
||||
CREATE INDEX idx_tasks_created_at ON tasks(created_at);
|
||||
CREATE INDEX idx_tasks_external_id_source ON tasks(external_id, source_type);
|
||||
|
||||
-- Update teams table to link back to tasks
|
||||
ALTER TABLE teams ADD COLUMN IF NOT EXISTS current_task_id UUID REFERENCES tasks(id) ON DELETE SET NULL;
|
||||
Reference in New Issue
Block a user