Fix: Fixed lint again
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 23s
CI / build (pull_request) Successful in 25s
CI / security (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 29s
CI / integration_tests (pull_request) Successful in 2m40s
CI / unit_tests (pull_request) Successful in 6m8s
CI / docker (pull_request) Successful in 58s
CI / benchmark-regression (pull_request) Successful in 15m39s
CI / coverage (pull_request) Successful in 22m8s
CI / lint (push) Successful in 13s
CI / build (push) Successful in 17s
CI / quality (push) Successful in 18s
CI / typecheck (push) Successful in 28s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 35s
CI / integration_tests (push) Successful in 3m22s
CI / unit_tests (push) Successful in 6m44s
CI / docker (push) Successful in 40s
CI / benchmark-publish (push) Successful in 9m50s
CI / coverage (push) Successful in 22m26s
CI / benchmark-publish (pull_request) Has been skipped
CI / lint (pull_request) Successful in 15s
CI / quality (pull_request) Successful in 23s
CI / build (pull_request) Successful in 25s
CI / security (pull_request) Successful in 28s
CI / typecheck (pull_request) Successful in 29s
CI / integration_tests (pull_request) Successful in 2m40s
CI / unit_tests (pull_request) Successful in 6m8s
CI / docker (pull_request) Successful in 58s
CI / benchmark-regression (pull_request) Successful in 15m39s
CI / coverage (pull_request) Successful in 22m8s
CI / lint (push) Successful in 13s
CI / build (push) Successful in 17s
CI / quality (push) Successful in 18s
CI / typecheck (push) Successful in 28s
CI / benchmark-regression (push) Has been skipped
CI / security (push) Successful in 35s
CI / integration_tests (push) Successful in 3m22s
CI / unit_tests (push) Successful in 6m44s
CI / docker (push) Successful in 40s
CI / benchmark-publish (push) Successful in 9m50s
CI / coverage (push) Successful in 22m26s
This commit was merged in pull request #150.
This commit is contained in:
@@ -14,7 +14,6 @@ from cleveragents.application.services.correction_service import CorrectionServi
|
||||
from cleveragents.core.exceptions import ResourceNotFoundError, ValidationError
|
||||
from cleveragents.domain.models.core.correction import CorrectionMode
|
||||
|
||||
|
||||
# -------------------------------------------------------------------
|
||||
# Helpers
|
||||
# -------------------------------------------------------------------
|
||||
|
||||
@@ -17,11 +17,7 @@ from behave import given, then, when
|
||||
from ulid import ULID
|
||||
|
||||
from cleveragents.infrastructure.database.models import (
|
||||
Base,
|
||||
LifecycleActionModel,
|
||||
LifecyclePlanModel,
|
||||
PlanArgumentModel,
|
||||
SessionMessageModel,
|
||||
SessionModel,
|
||||
SkillItemModel,
|
||||
SkillModel,
|
||||
|
||||
@@ -210,7 +210,7 @@ def step_mock_service_for_add(context):
|
||||
|
||||
@when('I invoke invariant add with "{flags}" and text "{text}"')
|
||||
def step_run_add(context, flags, text):
|
||||
args = ["add"] + flags.split() + [text]
|
||||
args = ["add", *flags.split(), text]
|
||||
context.inv_result = _runner.invoke(app, args)
|
||||
|
||||
|
||||
@@ -279,7 +279,7 @@ def step_run_list_no_filters(context):
|
||||
|
||||
@when('I invoke invariant list with flags "{flags}"')
|
||||
def step_run_list_with_flags(context, flags):
|
||||
args = ["list"] + flags.split()
|
||||
args = ["list", *flags.split()]
|
||||
context.inv_result = _runner.invoke(app, args)
|
||||
|
||||
|
||||
@@ -343,7 +343,7 @@ def step_mock_service_for_remove(context):
|
||||
|
||||
@when('I invoke invariant remove with "{flags}" for id "{inv_id}"')
|
||||
def step_run_remove_with_flags(context, flags, inv_id):
|
||||
args = ["remove"] + flags.split() + [inv_id]
|
||||
args = ["remove", *flags.split(), inv_id]
|
||||
context.inv_result = _runner.invoke(app, args)
|
||||
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ from behave import given, then, when
|
||||
from behave.runner import Context
|
||||
from typer.testing import CliRunner
|
||||
|
||||
from cleveragents.cli.commands.lsp import app, _get_registry, _reset_registry
|
||||
from cleveragents.cli.commands.lsp import _get_registry, _reset_registry, app
|
||||
from cleveragents.lsp.registry import LspRegistry
|
||||
|
||||
_runner = CliRunner()
|
||||
|
||||
@@ -25,7 +25,6 @@ from cleveragents.application.services.plan_executor import (
|
||||
ExecuteResult,
|
||||
ExecuteStubActor,
|
||||
PlanExecutor,
|
||||
StrategizeResult,
|
||||
StrategizeStubActor,
|
||||
StrategyDecision,
|
||||
)
|
||||
@@ -34,11 +33,11 @@ from cleveragents.domain.models.core.plan import PlanPhase, ProcessingState
|
||||
from cleveragents.tool.registry import ToolRegistry
|
||||
from cleveragents.tool.runner import ToolRunner
|
||||
|
||||
|
||||
# ---------------------------------------------------------------------------
|
||||
# Helpers
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
def _make_plan_mock(
|
||||
phase: PlanPhase = PlanPhase.STRATEGIZE,
|
||||
state: ProcessingState = ProcessingState.QUEUED,
|
||||
@@ -96,6 +95,7 @@ def _make_decisions(count: int = 2) -> list[StrategyDecision]:
|
||||
# PlanExecutor __init__ validation
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@when("I construct a PlanExecutor with None lifecycle_service")
|
||||
def step_construct_pe_none_lc(ctx: Any) -> None:
|
||||
ctx.pe_error = None
|
||||
@@ -141,12 +141,15 @@ def step_assert_no_error(ctx: Any) -> None:
|
||||
# has_runtime property
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a mock execution context")
|
||||
def step_given_mock_exec_ctx(ctx: Any) -> None:
|
||||
ctx.exec_ctx = PlanExecutionContext(plan_id=ctx.plan_id)
|
||||
|
||||
|
||||
@when("I construct a PlanExecutor with the mock lifecycle service and execution context")
|
||||
@when(
|
||||
"I construct a PlanExecutor with the mock lifecycle service and execution context"
|
||||
)
|
||||
def step_construct_pe_with_ctx(ctx: Any) -> None:
|
||||
ctx.executor = PlanExecutor(
|
||||
lifecycle_service=ctx.lifecycle,
|
||||
@@ -168,6 +171,7 @@ def step_assert_has_runtime_false(ctx: Any) -> None:
|
||||
# changeset_store property
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a mock execution context with a changeset store")
|
||||
def step_given_exec_ctx_with_store(ctx: Any) -> None:
|
||||
ctx.mock_store = MagicMock()
|
||||
@@ -190,6 +194,7 @@ def step_assert_changeset_store_none(ctx: Any) -> None:
|
||||
# run_strategize guard: wrong phase
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a PlanExecutor with the mock lifecycle service")
|
||||
def step_given_pe_with_lc(ctx: Any) -> None:
|
||||
ctx.executor = PlanExecutor(lifecycle_service=ctx.lifecycle)
|
||||
@@ -225,6 +230,7 @@ def step_assert_pe_plan_error_contains(ctx: Any, text: str) -> None:
|
||||
# run_strategize guard: empty plan_id
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@when("I attempt to run strategize with an empty plan_id")
|
||||
def step_attempt_strategize_empty_plan_id(ctx: Any) -> None:
|
||||
ctx.pe_error = None
|
||||
@@ -238,6 +244,7 @@ def step_attempt_strategize_empty_plan_id(ctx: Any) -> None:
|
||||
# run_strategize exception handling
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("the lifecycle returns a plan in STRATEGIZE phase")
|
||||
def step_lifecycle_returns_strategize_phase(ctx: Any) -> None:
|
||||
plan = _make_plan_mock(
|
||||
@@ -299,7 +306,10 @@ def step_assert_raised_runtime_error(ctx: Any) -> None:
|
||||
# run_strategize exception during actor execute (except branch line 314)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@given("the lifecycle returns a plan in STRATEGIZE phase that fails during actor execute")
|
||||
|
||||
@given(
|
||||
"the lifecycle returns a plan in STRATEGIZE phase that fails during actor execute"
|
||||
)
|
||||
def step_lifecycle_strategize_fails_in_actor(ctx: Any) -> None:
|
||||
"""Set up lifecycle so start_strategize succeeds but actor.execute raises."""
|
||||
plan = _make_plan_mock(
|
||||
@@ -324,6 +334,7 @@ def step_assert_error_details_exception_type(ctx: Any) -> None:
|
||||
# _guard_execute: wrong phase
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("the lifecycle returns a plan in STRATEGIZE phase for execute guard")
|
||||
def step_lifecycle_returns_strategize_for_execute(ctx: Any) -> None:
|
||||
plan = _make_plan_mock(phase=PlanPhase.STRATEGIZE)
|
||||
@@ -343,6 +354,7 @@ def step_attempt_run_execute(ctx: Any) -> None:
|
||||
# _guard_execute: wrong state
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("the lifecycle returns a plan in EXECUTE phase with PROCESSING state")
|
||||
def step_lifecycle_returns_execute_processing(ctx: Any) -> None:
|
||||
plan = _make_plan_mock(
|
||||
@@ -356,7 +368,10 @@ def step_lifecycle_returns_execute_processing(ctx: Any) -> None:
|
||||
# _guard_execute: None decision_root_id
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@given("the lifecycle returns a plan in EXECUTE phase with QUEUED state but no decision root")
|
||||
|
||||
@given(
|
||||
"the lifecycle returns a plan in EXECUTE phase with QUEUED state but no decision root"
|
||||
)
|
||||
def step_lifecycle_returns_execute_queued_no_root(ctx: Any) -> None:
|
||||
plan = _make_plan_mock(
|
||||
phase=PlanPhase.EXECUTE,
|
||||
@@ -370,6 +385,7 @@ def step_lifecycle_returns_execute_queued_no_root(ctx: Any) -> None:
|
||||
# run_execute routing to stub
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a PlanExecutor with the mock lifecycle service and no execution context")
|
||||
def step_given_pe_no_ctx(ctx: Any) -> None:
|
||||
ctx.executor = PlanExecutor(lifecycle_service=ctx.lifecycle)
|
||||
@@ -414,7 +430,10 @@ def step_assert_complete_execute_called(ctx: Any) -> None:
|
||||
# run_execute routing to runtime
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
@given("a PlanExecutor with the mock lifecycle service and execution context and tool runner")
|
||||
|
||||
@given(
|
||||
"a PlanExecutor with the mock lifecycle service and execution context and tool runner"
|
||||
)
|
||||
def step_given_pe_with_ctx_and_runner(ctx: Any) -> None:
|
||||
ctx.tool_runner = ToolRunner(registry=ToolRegistry())
|
||||
ctx.executor = PlanExecutor(
|
||||
@@ -449,6 +468,7 @@ def step_assert_runtime_execute_result_type(ctx: Any) -> None:
|
||||
# StrategizeStubActor with stream_callback
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a stream event collector")
|
||||
def step_given_stream_collector(ctx: Any) -> None:
|
||||
ctx.stream_events = []
|
||||
@@ -503,6 +523,7 @@ def step_assert_strategize_result_has_decisions(ctx: Any) -> None:
|
||||
# ExecuteStubActor with stream_callback
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a list of two strategy decisions")
|
||||
def step_given_two_decisions(ctx: Any) -> None:
|
||||
ctx.decisions = _make_decisions(2)
|
||||
@@ -554,6 +575,7 @@ def step_assert_execute_result_tool_calls_zero(ctx: Any) -> None:
|
||||
# run_strategize happy path with stream_callback
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@when("I run strategize with the stream callback")
|
||||
def step_run_strategize_with_callback(ctx: Any) -> None:
|
||||
ctx.pe_error = None
|
||||
@@ -581,6 +603,7 @@ def step_assert_complete_strategize_called(ctx: Any) -> None:
|
||||
# PlanExecutor with execution context (for run_strategize + context scenario)
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("a PlanExecutor with the mock lifecycle and execution context")
|
||||
def step_given_pe_with_lc_and_ctx(ctx: Any) -> None:
|
||||
ctx.executor = PlanExecutor(
|
||||
@@ -593,6 +616,7 @@ def step_given_pe_with_lc_and_ctx(ctx: Any) -> None:
|
||||
# run_strategize sets execution_context.decision_root_id
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@when("I run strategize successfully")
|
||||
def step_run_strategize_successfully(ctx: Any) -> None:
|
||||
ctx.pe_error = None
|
||||
@@ -613,6 +637,7 @@ def step_assert_exec_ctx_decision_root_id_set(ctx: Any) -> None:
|
||||
# run_execute stub exception path
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
@given("the stub execute actor is patched to raise an error")
|
||||
def step_patch_stub_execute_to_fail(ctx: Any) -> None:
|
||||
ctx.executor._execute_actor.execute = MagicMock(
|
||||
|
||||
Reference in New Issue
Block a user