Files
cleveragents-core/features/steps/tui_persona_cycle_steps.py
T
HAL9000 30c93bc95e
CI / lint (pull_request) Successful in 53s
CI / quality (pull_request) Successful in 48s
CI / typecheck (pull_request) Successful in 59s
CI / build (pull_request) Successful in 54s
CI / push-validation (pull_request) Successful in 39s
CI / helm (pull_request) Successful in 45s
CI / security (pull_request) Successful in 1m30s
CI / unit_tests (pull_request) Successful in 6m53s
CI / integration_tests (pull_request) Successful in 8m21s
CI / docker (pull_request) Successful in 1m36s
CI / coverage (pull_request) Successful in 8m54s
CI / status-check (pull_request) Successful in 2s
fix(lsp,tui): repair five unit_test scenarios in CI
features/lsp_actor_service_wiring.feature scenarios "handles multiple
LSP servers" and "tool specs have correct schema": add an explicit
`| CAPABILITIES |` header to the capability tables. Behave treats the
first table row as the heading, so `| DIAGNOSTICS |` (the only row)
was being silently dropped, leaving the registered server with zero
capabilities and the adapter generating no tool specs.

features/steps/lsp_actor_service_steps.py: strip surrounding double
quotes from each entry in the comma-separated `fields` placeholder of
the `requires "..."` Then step so a feature line like `requires
"file_path", "line", "column"` resolves to the three unquoted field
names rather than `file_path"`, `"line"`, `"column"`.

features/steps/tui_persona_cycle_steps.py: include the surrounding
double quotes in the step pattern for "the registry last persona
should be set to ..." so the feature literal `"p2"` matches as `p2`
(without the quotes the placeholder captured `"p2"` and the equality
check against the registry value failed).

src/cleveragents/tui/persona/registry.py: reject absolute paths from
`resolve_export_path` and `resolve_import_path` with the messages the
"Persona export/import rejects absolute path targets" scenarios in
features/repl_input_modes.feature expect. The previous behaviour
silently accepted absolute paths, defeating the working-directory
sandboxing intent.

ISSUES CLOSED: #5663
2026-06-04 13:06:20 -04:00

37 lines
1.3 KiB
Python

"""Behave steps for TUI persona cycling.
Shared persona steps (registry setup, set-active-persona, active-persona
assertion) live in ``tui_persona_system_steps.py``; behave loads step
files into a single global registry so we only need to define each step
in one place. Only cycle-specific steps live here.
"""
from __future__ import annotations
from behave import given, then, when
from behave.runner import Context
from cleveragents.tui.persona.schema import Persona
from cleveragents.tui.persona.state import PersonaState
@given('I save TUI persona "{name}" with actor "{actor}" and cycle order {cycle:d}')
def step_save_persona_cycle(
context: Context, name: str, actor: str, cycle: int
) -> None:
persona = Persona(name=name, actor=actor, cycle_order=cycle)
context.tui_registry.save(persona)
@when('I cycle persona for session "{session_id}"')
def step_cycle_persona(context: Context, session_id: str) -> None:
if not hasattr(context, "tui_state"):
context.tui_state = PersonaState(registry=context.tui_registry)
context.tui_state.cycle_persona(session_id)
@then('the registry last persona should be set to "{persona_name}"')
def step_registry_last_persona(context: Context, persona_name: str) -> None:
last = context.tui_registry.get_last_persona()
assert last == persona_name, f"expected {persona_name!r}, got {last!r}"