Files
cleveragents-core/features/steps/tui_conversation_pruning_steps.py
T
HAL9000 c5df00c6d3 feat(tui): fix lint, add robot/benchmark/changelog for pruning
- Fix ruff format violations in app.py, conversation.py, and
  tui_conversation_pruning_steps.py (3 files reformatted)
- Fix ruff E501 line-too-long in helper_tui_conversation_pruning.py
- Expand ConversationSettings docstring to explain hysteresis design
- Add _note_active invariant comment in ConversationStream.__init__
- Add full docstring to load_conversation_settings (config path, keys,
  fallback behaviour)
- Narrow bare except Exception to (OSError, json.JSONDecodeError) and
  (ValueError, TypeError) in load_conversation_settings
- Add Robot Framework integration tests (tui_conversation_pruning.robot
  + helper) covering prune-trigger, note-inserted, protected-blocks,
  clear-resets-state, settings-defaults
- Add ASV benchmarks (conversation_stream_bench.py) covering add_block
  baseline, heavy-load pruning, render after prune, clear+repopulate
- Add CHANGELOG.md entry for feat(tui) conversation content pruning

ISSUES CLOSED: #6350
2026-06-17 00:57:51 -04:00

32 lines
1.1 KiB
Python

"""Step definitions for TUI conversation pruning behaviours."""
from __future__ import annotations
from behave import then, when
@when("I deliver {count:d} conversation messages of {line_count:d} lines each")
def step_deliver_messages(context, count, line_count):
app = context._tui_app
for index in range(1, count + 1):
lines = [f"message-{index} line-{line}" for line in range(1, line_count + 1)]
payload = "\n".join(lines)
app._append_conversation_block(payload, block_type="message")
@then('the conversation widget should not contain "{text}"')
def step_conversation_not_contains(context, text):
mock_static = context._tui_mock_static
conversation = context._tui_app.query_one("#conversation", mock_static)
assert text not in conversation._text, (
f"Unexpected '{text}' in conversation: {conversation._text!r}"
)
@then("the session transcript should contain {count:d} entries")
def step_transcript_entry_count(context, count):
transcript = context._tui_app._session.transcript
assert len(transcript) == count, (
f"Expected {count} transcript entries, found {len(transcript)}"
)