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:
@@ -12,9 +12,8 @@ Note: These tests mock actual execution since they would require
|
||||
LLM calls and database access in production.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestRunAgentStepTask:
|
||||
@@ -22,8 +21,8 @@ class TestRunAgentStepTask:
|
||||
|
||||
def test_run_agent_step_task_exists(self):
|
||||
"""Test that run_agent_step task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.agent # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.agent.run_agent_step" in celery_app.tasks
|
||||
|
||||
@@ -93,8 +92,8 @@ class TestSpawnAgentTask:
|
||||
|
||||
def test_spawn_agent_task_exists(self):
|
||||
"""Test that spawn_agent task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.agent # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.agent.spawn_agent" in celery_app.tasks
|
||||
|
||||
@@ -165,8 +164,8 @@ class TestTerminateAgentTask:
|
||||
|
||||
def test_terminate_agent_task_exists(self):
|
||||
"""Test that terminate_agent task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.agent # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.agent.terminate_agent" in celery_app.tasks
|
||||
|
||||
@@ -236,8 +235,8 @@ class TestAgentTaskRouting:
|
||||
|
||||
def test_run_agent_step_routing(self):
|
||||
"""Test that run_agent_step task routes to agent queue."""
|
||||
from app.tasks.agent import run_agent_step
|
||||
from app.celery_app import celery_app
|
||||
from app.tasks.agent import run_agent_step
|
||||
|
||||
# Get the routing configuration for this specific task
|
||||
task_name = run_agent_step.name
|
||||
@@ -293,12 +292,13 @@ class TestAgentTaskSignatures:
|
||||
def test_agent_task_chain_creation(self):
|
||||
"""Test that agent tasks can be chained together."""
|
||||
from celery import chain
|
||||
from app.tasks.agent import spawn_agent, run_agent_step, terminate_agent
|
||||
|
||||
from app.tasks.agent import spawn_agent
|
||||
|
||||
# Create a chain of tasks (this doesn't execute, just builds the chain)
|
||||
agent_type_id = str(uuid.uuid4())
|
||||
project_id = str(uuid.uuid4())
|
||||
agent_instance_id = str(uuid.uuid4())
|
||||
str(uuid.uuid4())
|
||||
|
||||
# Note: In real usage, the chain would pass results between tasks
|
||||
workflow = chain(
|
||||
@@ -314,8 +314,8 @@ class TestAgentTaskLogging:
|
||||
|
||||
def test_run_agent_step_logs_execution(self):
|
||||
"""Test that run_agent_step logs when executed."""
|
||||
|
||||
from app.tasks.agent import run_agent_step
|
||||
import logging
|
||||
|
||||
agent_instance_id = str(uuid.uuid4())
|
||||
context = {}
|
||||
|
||||
@@ -9,8 +9,6 @@ These tests verify:
|
||||
- Beat schedule is configured for periodic tasks
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch, MagicMock
|
||||
|
||||
|
||||
class TestCeleryAppConfiguration:
|
||||
@@ -172,10 +170,9 @@ class TestTaskDiscovery:
|
||||
|
||||
def test_agent_tasks_are_discoverable(self):
|
||||
"""Test that agent tasks can be discovered and accessed."""
|
||||
from app.celery_app import celery_app
|
||||
|
||||
# Force task registration by importing
|
||||
import app.tasks.agent # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
# Check that agent tasks are registered
|
||||
registered_tasks = celery_app.tasks
|
||||
@@ -186,10 +183,9 @@ class TestTaskDiscovery:
|
||||
|
||||
def test_git_tasks_are_discoverable(self):
|
||||
"""Test that git tasks can be discovered and accessed."""
|
||||
from app.celery_app import celery_app
|
||||
|
||||
# Force task registration by importing
|
||||
import app.tasks.git # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
registered_tasks = celery_app.tasks
|
||||
|
||||
@@ -201,10 +197,9 @@ class TestTaskDiscovery:
|
||||
|
||||
def test_sync_tasks_are_discoverable(self):
|
||||
"""Test that sync tasks can be discovered and accessed."""
|
||||
from app.celery_app import celery_app
|
||||
|
||||
# Force task registration by importing
|
||||
import app.tasks.sync # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
registered_tasks = celery_app.tasks
|
||||
|
||||
@@ -216,10 +211,9 @@ class TestTaskDiscovery:
|
||||
|
||||
def test_workflow_tasks_are_discoverable(self):
|
||||
"""Test that workflow tasks can be discovered and accessed."""
|
||||
from app.celery_app import celery_app
|
||||
|
||||
# Force task registration by importing
|
||||
import app.tasks.workflow # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
registered_tasks = celery_app.tasks
|
||||
|
||||
@@ -231,10 +225,9 @@ class TestTaskDiscovery:
|
||||
|
||||
def test_cost_tasks_are_discoverable(self):
|
||||
"""Test that cost tasks can be discovered and accessed."""
|
||||
from app.celery_app import celery_app
|
||||
|
||||
# Force task registration by importing
|
||||
import app.tasks.cost # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
registered_tasks = celery_app.tasks
|
||||
|
||||
|
||||
@@ -12,9 +12,8 @@ Note: These tests mock actual execution since they would require
|
||||
database access and Redis operations in production.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestAggregateDailyCostsTask:
|
||||
@@ -22,8 +21,8 @@ class TestAggregateDailyCostsTask:
|
||||
|
||||
def test_aggregate_daily_costs_task_exists(self):
|
||||
"""Test that aggregate_daily_costs task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.cost # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.cost.aggregate_daily_costs" in celery_app.tasks
|
||||
|
||||
@@ -55,8 +54,8 @@ class TestCheckBudgetThresholdsTask:
|
||||
|
||||
def test_check_budget_thresholds_task_exists(self):
|
||||
"""Test that check_budget_thresholds task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.cost # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.cost.check_budget_thresholds" in celery_app.tasks
|
||||
|
||||
@@ -85,8 +84,8 @@ class TestRecordLlmUsageTask:
|
||||
|
||||
def test_record_llm_usage_task_exists(self):
|
||||
"""Test that record_llm_usage task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.cost # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.cost.record_llm_usage" in celery_app.tasks
|
||||
|
||||
@@ -159,8 +158,8 @@ class TestGenerateCostReportTask:
|
||||
|
||||
def test_generate_cost_report_task_exists(self):
|
||||
"""Test that generate_cost_report task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.cost # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.cost.generate_cost_report" in celery_app.tasks
|
||||
|
||||
@@ -211,8 +210,8 @@ class TestResetDailyBudgetCountersTask:
|
||||
|
||||
def test_reset_daily_budget_counters_task_exists(self):
|
||||
"""Test that reset_daily_budget_counters task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.cost # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.cost.reset_daily_budget_counters" in celery_app.tasks
|
||||
|
||||
@@ -363,7 +362,8 @@ class TestCostTaskSignatures:
|
||||
def test_cost_task_chain_creation(self):
|
||||
"""Test that cost tasks can be chained together."""
|
||||
from celery import chain
|
||||
from app.tasks.cost import record_llm_usage, check_budget_thresholds
|
||||
|
||||
from app.tasks.cost import check_budget_thresholds, record_llm_usage
|
||||
|
||||
agent_id = str(uuid.uuid4())
|
||||
project_id = str(uuid.uuid4())
|
||||
|
||||
@@ -12,9 +12,8 @@ Note: These tests mock actual execution since they would require
|
||||
Git operations and external APIs in production.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestCloneRepositoryTask:
|
||||
@@ -22,8 +21,8 @@ class TestCloneRepositoryTask:
|
||||
|
||||
def test_clone_repository_task_exists(self):
|
||||
"""Test that clone_repository task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.git # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.git.clone_repository" in celery_app.tasks
|
||||
|
||||
@@ -72,8 +71,8 @@ class TestCommitChangesTask:
|
||||
|
||||
def test_commit_changes_task_exists(self):
|
||||
"""Test that commit_changes task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.git # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.git.commit_changes" in celery_app.tasks
|
||||
|
||||
@@ -114,8 +113,8 @@ class TestCreateBranchTask:
|
||||
|
||||
def test_create_branch_task_exists(self):
|
||||
"""Test that create_branch task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.git # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.git.create_branch" in celery_app.tasks
|
||||
|
||||
@@ -156,8 +155,8 @@ class TestCreatePullRequestTask:
|
||||
|
||||
def test_create_pull_request_task_exists(self):
|
||||
"""Test that create_pull_request task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.git # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.git.create_pull_request" in celery_app.tasks
|
||||
|
||||
@@ -201,8 +200,8 @@ class TestPushChangesTask:
|
||||
|
||||
def test_push_changes_task_exists(self):
|
||||
"""Test that push_changes task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.git # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.git.push_changes" in celery_app.tasks
|
||||
|
||||
@@ -254,7 +253,6 @@ class TestGitTaskRouting:
|
||||
|
||||
def test_all_git_tasks_match_routing_pattern(self):
|
||||
"""Test that all git task names match the routing pattern."""
|
||||
from app.tasks import git
|
||||
|
||||
task_names = [
|
||||
"app.tasks.git.clone_repository",
|
||||
|
||||
@@ -12,9 +12,8 @@ Note: These tests mock actual execution since they would require
|
||||
external API calls in production.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestSyncIssuesIncrementalTask:
|
||||
@@ -22,8 +21,8 @@ class TestSyncIssuesIncrementalTask:
|
||||
|
||||
def test_sync_issues_incremental_task_exists(self):
|
||||
"""Test that sync_issues_incremental task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.sync # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.sync.sync_issues_incremental" in celery_app.tasks
|
||||
|
||||
@@ -56,8 +55,8 @@ class TestSyncIssuesFullTask:
|
||||
|
||||
def test_sync_issues_full_task_exists(self):
|
||||
"""Test that sync_issues_full task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.sync # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.sync.sync_issues_full" in celery_app.tasks
|
||||
|
||||
@@ -90,8 +89,8 @@ class TestProcessWebhookEventTask:
|
||||
|
||||
def test_process_webhook_event_task_exists(self):
|
||||
"""Test that process_webhook_event task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.sync # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.sync.process_webhook_event" in celery_app.tasks
|
||||
|
||||
@@ -149,8 +148,8 @@ class TestSyncProjectIssuesTask:
|
||||
|
||||
def test_sync_project_issues_task_exists(self):
|
||||
"""Test that sync_project_issues task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.sync # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.sync.sync_project_issues" in celery_app.tasks
|
||||
|
||||
@@ -190,8 +189,8 @@ class TestPushIssueToExternalTask:
|
||||
|
||||
def test_push_issue_to_external_task_exists(self):
|
||||
"""Test that push_issue_to_external task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.sync # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.sync.push_issue_to_external" in celery_app.tasks
|
||||
|
||||
|
||||
@@ -12,9 +12,8 @@ Note: These tests mock actual execution since they would require
|
||||
database access and state machine operations in production.
|
||||
"""
|
||||
|
||||
import pytest
|
||||
from unittest.mock import patch
|
||||
import uuid
|
||||
from unittest.mock import patch
|
||||
|
||||
|
||||
class TestRecoverStaleWorkflowsTask:
|
||||
@@ -22,8 +21,8 @@ class TestRecoverStaleWorkflowsTask:
|
||||
|
||||
def test_recover_stale_workflows_task_exists(self):
|
||||
"""Test that recover_stale_workflows task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.workflow # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.workflow.recover_stale_workflows" in celery_app.tasks
|
||||
|
||||
@@ -59,8 +58,8 @@ class TestExecuteWorkflowStepTask:
|
||||
|
||||
def test_execute_workflow_step_task_exists(self):
|
||||
"""Test that execute_workflow_step task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.workflow # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.workflow.execute_workflow_step" in celery_app.tasks
|
||||
|
||||
@@ -111,8 +110,8 @@ class TestHandleApprovalResponseTask:
|
||||
|
||||
def test_handle_approval_response_task_exists(self):
|
||||
"""Test that handle_approval_response task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.workflow # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.workflow.handle_approval_response" in celery_app.tasks
|
||||
|
||||
@@ -167,8 +166,8 @@ class TestStartSprintWorkflowTask:
|
||||
|
||||
def test_start_sprint_workflow_task_exists(self):
|
||||
"""Test that start_sprint_workflow task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.workflow # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.workflow.start_sprint_workflow" in celery_app.tasks
|
||||
|
||||
@@ -198,8 +197,8 @@ class TestStartStoryWorkflowTask:
|
||||
|
||||
def test_start_story_workflow_task_exists(self):
|
||||
"""Test that start_story_workflow task is registered."""
|
||||
from app.celery_app import celery_app
|
||||
import app.tasks.workflow # noqa: F401
|
||||
from app.celery_app import celery_app
|
||||
|
||||
assert "app.tasks.workflow.start_story_workflow" in celery_app.tasks
|
||||
|
||||
@@ -331,15 +330,14 @@ class TestWorkflowTaskSignatures:
|
||||
def test_workflow_chain_creation(self):
|
||||
"""Test that workflow tasks can be chained together."""
|
||||
from celery import chain
|
||||
|
||||
from app.tasks.workflow import (
|
||||
start_sprint_workflow,
|
||||
execute_workflow_step,
|
||||
handle_approval_response,
|
||||
)
|
||||
|
||||
project_id = str(uuid.uuid4())
|
||||
sprint_id = str(uuid.uuid4())
|
||||
workflow_id = str(uuid.uuid4())
|
||||
str(uuid.uuid4())
|
||||
|
||||
# Build a chain (doesn't execute, just creates the workflow)
|
||||
workflow = chain(
|
||||
|
||||
Reference in New Issue
Block a user