59 lines
1.9 KiB
Python
59 lines
1.9 KiB
Python
"""ASV benchmarks for automation_level legacy cleanup.
|
|
|
|
Measures the baseline performance of:
|
|
- Plan creation without automation_level (profile-only flow)
|
|
- Profile resolution without legacy mapping
|
|
"""
|
|
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
from pathlib import Path
|
|
from unittest.mock import MagicMock
|
|
|
|
try:
|
|
from cleveragents.application.services.plan_lifecycle_service import (
|
|
PlanLifecycleService,
|
|
)
|
|
from cleveragents.domain.models.core.plan import ProjectLink
|
|
except ModuleNotFoundError:
|
|
sys.path.insert(
|
|
0,
|
|
str(Path(__file__).resolve().parents[1] / "src"),
|
|
)
|
|
from cleveragents.application.services.plan_lifecycle_service import (
|
|
PlanLifecycleService,
|
|
)
|
|
from cleveragents.domain.models.core.plan import ProjectLink
|
|
|
|
|
|
class LegacyCleanupSuite:
|
|
"""Benchmark plan creation after automation_level removal."""
|
|
|
|
timeout = 30
|
|
|
|
def setup(self) -> None:
|
|
"""Create service instance for benchmarks."""
|
|
self.settings = MagicMock()
|
|
self.settings.default_automation_profile = "manual"
|
|
self.service = PlanLifecycleService(settings=self.settings)
|
|
action = self.service.create_action(
|
|
name="local/bench-action",
|
|
description="Benchmark action",
|
|
definition_of_done="Done",
|
|
strategy_actor="openai/gpt-4",
|
|
execution_actor="openai/gpt-4",
|
|
)
|
|
self.action_name = str(action.namespaced_name)
|
|
|
|
def time_use_action_profile_only(self) -> None:
|
|
"""Benchmark plan creation with profile-only flow."""
|
|
self.service.use_action(
|
|
action_name=self.action_name,
|
|
project_links=[ProjectLink(project_name="proj-bench")],
|
|
)
|
|
|
|
def time_service_instantiation(self) -> None:
|
|
"""Benchmark service instantiation without legacy level resolution."""
|
|
PlanLifecycleService(settings=self.settings)
|