fix: Comprehensive validation and bug fixes
Infrastructure: - Add Redis and Celery workers to all docker-compose files - Fix celery migration race condition in entrypoint.sh - Add healthchecks and resource limits to dev compose - Update .env.template with Redis/Celery variables Backend Models & Schemas: - Rename Sprint.completed_points to velocity (per requirements) - Add AgentInstance.name as required field - Rename Issue external tracker fields for consistency - Add IssueSource and TrackerType enums - Add Project.default_tracker_type field Backend Fixes: - Add Celery retry configuration with exponential backoff - Remove unused sequence counter from EventBus - Add mypy overrides for test dependencies - Fix test file using wrong schema (UserUpdate -> dict) Frontend Fixes: - Fix memory leak in useProjectEvents (proper cleanup) - Fix race condition with stale closure in reconnection - Sync TokenWithUser type with regenerated API client - Fix expires_in null handling in useAuth - Clean up unused imports in prototype pages - Add ESLint relaxed rules for prototype files CI/CD: - Add E2E testing stage with Testcontainers - Add security scanning with Trivy and pip-audit - Add dependency caching for faster builds Tests: - Update all tests to use renamed fields (velocity, name, etc.) - Fix 14 schema test failures - All 1500 tests pass with 91% coverage 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -15,8 +15,11 @@ from .agent_type import AgentType
|
||||
from .enums import (
|
||||
AgentStatus,
|
||||
AutonomyLevel,
|
||||
ClientMode,
|
||||
IssuePriority,
|
||||
IssueStatus,
|
||||
IssueType,
|
||||
ProjectComplexity,
|
||||
ProjectStatus,
|
||||
SprintStatus,
|
||||
SyncStatus,
|
||||
@@ -30,10 +33,13 @@ __all__ = [
|
||||
"AgentStatus",
|
||||
"AgentType",
|
||||
"AutonomyLevel",
|
||||
"ClientMode",
|
||||
"Issue",
|
||||
"IssuePriority",
|
||||
"IssueStatus",
|
||||
"IssueType",
|
||||
"Project",
|
||||
"ProjectComplexity",
|
||||
"ProjectStatus",
|
||||
"Sprint",
|
||||
"SprintStatus",
|
||||
|
||||
@@ -57,6 +57,9 @@ class AgentInstance(Base, UUIDMixin, TimestampMixin):
|
||||
index=True,
|
||||
)
|
||||
|
||||
# Agent instance name (e.g., "Dave", "Eve") for personality
|
||||
name = Column(String(100), nullable=False, index=True)
|
||||
|
||||
# Status tracking
|
||||
status: Column[AgentStatus] = Column(
|
||||
Enum(AgentStatus),
|
||||
@@ -103,6 +106,6 @@ class AgentInstance(Base, UUIDMixin, TimestampMixin):
|
||||
|
||||
def __repr__(self) -> str:
|
||||
return (
|
||||
f"<AgentInstance {self.id} type={self.agent_type_id} "
|
||||
f"<AgentInstance {self.name} ({self.id}) type={self.agent_type_id} "
|
||||
f"project={self.project_id} status={self.status.value}>"
|
||||
)
|
||||
|
||||
@@ -23,6 +23,34 @@ class AutonomyLevel(str, PyEnum):
|
||||
AUTONOMOUS = "autonomous"
|
||||
|
||||
|
||||
class ProjectComplexity(str, PyEnum):
|
||||
"""
|
||||
Project complexity level for estimation and planning.
|
||||
|
||||
SCRIPT: Simple automation or script-level work
|
||||
SIMPLE: Straightforward feature or fix
|
||||
MEDIUM: Standard complexity with some architectural considerations
|
||||
COMPLEX: Large-scale feature requiring significant design work
|
||||
"""
|
||||
|
||||
SCRIPT = "script"
|
||||
SIMPLE = "simple"
|
||||
MEDIUM = "medium"
|
||||
COMPLEX = "complex"
|
||||
|
||||
|
||||
class ClientMode(str, PyEnum):
|
||||
"""
|
||||
How the client prefers to interact with agents.
|
||||
|
||||
TECHNICAL: Client is technical and prefers detailed updates
|
||||
AUTO: Agents automatically determine communication level
|
||||
"""
|
||||
|
||||
TECHNICAL = "technical"
|
||||
AUTO = "auto"
|
||||
|
||||
|
||||
class ProjectStatus(str, PyEnum):
|
||||
"""
|
||||
Project lifecycle status.
|
||||
@@ -57,6 +85,22 @@ class AgentStatus(str, PyEnum):
|
||||
TERMINATED = "terminated"
|
||||
|
||||
|
||||
class IssueType(str, PyEnum):
|
||||
"""
|
||||
Issue type for categorization and hierarchy.
|
||||
|
||||
EPIC: Large feature or body of work containing stories
|
||||
STORY: User-facing feature or requirement
|
||||
TASK: Technical work item
|
||||
BUG: Defect or issue to be fixed
|
||||
"""
|
||||
|
||||
EPIC = "epic"
|
||||
STORY = "story"
|
||||
TASK = "task"
|
||||
BUG = "bug"
|
||||
|
||||
|
||||
class IssueStatus(str, PyEnum):
|
||||
"""
|
||||
Issue workflow status.
|
||||
@@ -113,11 +157,13 @@ class SprintStatus(str, PyEnum):
|
||||
|
||||
PLANNED: Sprint has been created but not started
|
||||
ACTIVE: Sprint is currently in progress
|
||||
IN_REVIEW: Sprint work is done, demo/review pending
|
||||
COMPLETED: Sprint has been finished successfully
|
||||
CANCELLED: Sprint was cancelled before completion
|
||||
"""
|
||||
|
||||
PLANNED = "planned"
|
||||
ACTIVE = "active"
|
||||
IN_REVIEW = "in_review"
|
||||
COMPLETED = "completed"
|
||||
CANCELLED = "cancelled"
|
||||
|
||||
@@ -6,7 +6,17 @@ An Issue represents a unit of work that can be assigned to agents or humans,
|
||||
with optional synchronization to external issue trackers (Gitea, GitHub, GitLab).
|
||||
"""
|
||||
|
||||
from sqlalchemy import Column, DateTime, Enum, ForeignKey, Index, Integer, String, Text
|
||||
from sqlalchemy import (
|
||||
Column,
|
||||
Date,
|
||||
DateTime,
|
||||
Enum,
|
||||
ForeignKey,
|
||||
Index,
|
||||
Integer,
|
||||
String,
|
||||
Text,
|
||||
)
|
||||
from sqlalchemy.dialects.postgresql import (
|
||||
JSONB,
|
||||
UUID as PGUUID,
|
||||
@@ -15,7 +25,7 @@ from sqlalchemy.orm import relationship
|
||||
|
||||
from app.models.base import Base, TimestampMixin, UUIDMixin
|
||||
|
||||
from .enums import IssuePriority, IssueStatus, SyncStatus
|
||||
from .enums import IssuePriority, IssueStatus, IssueType, SyncStatus
|
||||
|
||||
|
||||
class Issue(Base, UUIDMixin, TimestampMixin):
|
||||
@@ -39,6 +49,29 @@ class Issue(Base, UUIDMixin, TimestampMixin):
|
||||
index=True,
|
||||
)
|
||||
|
||||
# Parent issue for hierarchy (Epic -> Story -> Task)
|
||||
parent_id = Column(
|
||||
PGUUID(as_uuid=True),
|
||||
ForeignKey("issues.id", ondelete="CASCADE"),
|
||||
nullable=True,
|
||||
index=True,
|
||||
)
|
||||
|
||||
# Issue type (Epic, Story, Task, Bug)
|
||||
type: Column[IssueType] = Column(
|
||||
Enum(IssueType),
|
||||
default=IssueType.TASK,
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
|
||||
# Reporter (who created this issue - can be user or agent)
|
||||
reporter_id = Column(
|
||||
PGUUID(as_uuid=True),
|
||||
nullable=True, # System-generated issues may have no reporter
|
||||
index=True,
|
||||
)
|
||||
|
||||
# Issue content
|
||||
title = Column(String(500), nullable=False)
|
||||
body = Column(Text, nullable=False, default="")
|
||||
@@ -83,16 +116,19 @@ class Issue(Base, UUIDMixin, TimestampMixin):
|
||||
# Story points for estimation
|
||||
story_points = Column(Integer, nullable=True)
|
||||
|
||||
# Due date for the issue
|
||||
due_date = Column(Date, nullable=True, index=True)
|
||||
|
||||
# External tracker integration
|
||||
external_tracker = Column(
|
||||
external_tracker_type = Column(
|
||||
String(50),
|
||||
nullable=True,
|
||||
index=True,
|
||||
) # 'gitea', 'github', 'gitlab'
|
||||
|
||||
external_id = Column(String(255), nullable=True) # External system's ID
|
||||
external_url = Column(String(1000), nullable=True) # Link to external issue
|
||||
external_number = Column(Integer, nullable=True) # Issue number (e.g., #123)
|
||||
external_issue_id = Column(String(255), nullable=True) # External system's ID
|
||||
remote_url = Column(String(1000), nullable=True) # Link to external issue
|
||||
external_issue_number = Column(Integer, nullable=True) # Issue number (e.g., #123)
|
||||
|
||||
# Sync status with external tracker
|
||||
sync_status: Column[SyncStatus] = Column(
|
||||
@@ -116,14 +152,17 @@ class Issue(Base, UUIDMixin, TimestampMixin):
|
||||
foreign_keys=[assigned_agent_id],
|
||||
)
|
||||
sprint = relationship("Sprint", back_populates="issues")
|
||||
parent = relationship("Issue", remote_side="Issue.id", backref="children")
|
||||
|
||||
__table_args__ = (
|
||||
Index("ix_issues_project_status", "project_id", "status"),
|
||||
Index("ix_issues_project_priority", "project_id", "priority"),
|
||||
Index("ix_issues_project_sprint", "project_id", "sprint_id"),
|
||||
Index("ix_issues_external_tracker_id", "external_tracker", "external_id"),
|
||||
Index("ix_issues_external_tracker_id", "external_tracker_type", "external_issue_id"),
|
||||
Index("ix_issues_sync_status", "sync_status"),
|
||||
Index("ix_issues_project_agent", "project_id", "assigned_agent_id"),
|
||||
Index("ix_issues_project_type", "project_id", "type"),
|
||||
Index("ix_issues_project_status_priority", "project_id", "status", "priority"),
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
||||
@@ -15,7 +15,7 @@ from sqlalchemy.orm import relationship
|
||||
|
||||
from app.models.base import Base, TimestampMixin, UUIDMixin
|
||||
|
||||
from .enums import AutonomyLevel, ProjectStatus
|
||||
from .enums import AutonomyLevel, ClientMode, ProjectComplexity, ProjectStatus
|
||||
|
||||
|
||||
class Project(Base, UUIDMixin, TimestampMixin):
|
||||
@@ -48,6 +48,20 @@ class Project(Base, UUIDMixin, TimestampMixin):
|
||||
index=True,
|
||||
)
|
||||
|
||||
complexity: Column[ProjectComplexity] = Column(
|
||||
Enum(ProjectComplexity),
|
||||
default=ProjectComplexity.MEDIUM,
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
|
||||
client_mode: Column[ClientMode] = Column(
|
||||
Enum(ClientMode),
|
||||
default=ClientMode.AUTO,
|
||||
nullable=False,
|
||||
index=True,
|
||||
)
|
||||
|
||||
# JSON field for flexible project configuration
|
||||
# Can include: mcp_servers, webhook_urls, notification_settings, etc.
|
||||
settings = Column(JSONB, default=dict, nullable=False)
|
||||
@@ -82,6 +96,7 @@ class Project(Base, UUIDMixin, TimestampMixin):
|
||||
Index("ix_projects_slug_status", "slug", "status"),
|
||||
Index("ix_projects_owner_status", "owner_id", "status"),
|
||||
Index("ix_projects_autonomy_status", "autonomy_level", "status"),
|
||||
Index("ix_projects_complexity_status", "complexity", "status"),
|
||||
)
|
||||
|
||||
def __repr__(self) -> str:
|
||||
|
||||
@@ -55,7 +55,7 @@ class Sprint(Base, UUIDMixin, TimestampMixin):
|
||||
|
||||
# Progress metrics
|
||||
planned_points = Column(Integer, nullable=True) # Sum of story points at start
|
||||
completed_points = Column(Integer, nullable=True) # Sum of completed story points
|
||||
velocity = Column(Integer, nullable=True) # Sum of completed story points
|
||||
|
||||
# Relationships
|
||||
project = relationship("Project", back_populates="sprints")
|
||||
|
||||
Reference in New Issue
Block a user