Files
temp/features/steps/plan_namespaced_name_tdd_steps.py
freemo eaf15dd17c fix(ci): restore all CI quality gates to passing on master
Apply remaining fixes not covered by the 4278ba91 commit:

1. src/cleveragents/cli/main.py:
   info and diagnostics commands now call configure_structlog(WARNING)
   before build_info_data()/build_diagnostics_data() when non-rich format
   is requested. This prevents debug-level structlog messages from
   corrupting --format json/yaml output in integration tests.

2. robot/helper_config_cli.py:
   Call configure_structlog(WARNING) before importing cleveragents CLI
   commands so plugin_manager debug messages don't pollute CliRunner
   captured output (fixes Config List JSON Format test).

3. features/steps/aimodelscredentials_steps.py:
   ModelProviderOption config checks now use getattr fallback so they
   work both when context.model_config is set (via explicit 'I examine
   the ModelProviderOption model_config' step) and when context.model_instance
   is set (via 'I create a ModelProviderOption with only priority set to N').

4. features/steps/plan_namespaced_name_tdd_steps.py:
   @when steps now set context.error and context.lsp_error in addition to
   context.exception so the existing @then steps from service_steps.py
   and lsp_registry_steps.py match and validate correctly.

No quality gates suppressed. All changes are to test and source files.

ISSUES CLOSED: #2597
2026-04-04 20:38:16 +00:00

52 lines
1.7 KiB
Python

"""Behave step definitions for NamespacedName TDD validation tests."""
from behave import when
from behave.runner import Context
from pydantic import ValidationError
from cleveragents.domain.models.core.plan import NamespacedName
@when('I parse the namespaced name "{full_name}" expecting an error')
def step_when_parse_namespaced_name_expecting_error(
context: Context, full_name: str
) -> None:
"""Parse a namespaced name string and capture any error.
Sets context.exception (generic), context.error (service_steps compat),
and context.lsp_error (lsp_registry_steps compat).
"""
try:
context.namespaced_name = NamespacedName.parse(full_name)
context.exception = None
context.error = None
context.lsp_error = None
except (ValueError, ValidationError) as e:
context.exception = e
context.error = e
context.lsp_error = e
context.namespaced_name = None
@when(
'I construct a NamespacedName with namespace "{namespace}" and name "{name}" expecting an error'
)
def step_when_construct_namespaced_name_expecting_error(
context: Context, namespace: str, name: str
) -> None:
"""Create a NamespacedName and capture any error.
Sets context.exception (generic), context.error (service_steps compat),
and context.lsp_error (lsp_registry_steps compat).
"""
try:
context.namespaced_name = NamespacedName(namespace=namespace, name=name)
context.exception = None
context.error = None
context.lsp_error = None
except (ValueError, ValidationError) as e:
context.exception = e
context.error = e
context.lsp_error = e
context.namespaced_name = None