test(tui/app): _complete_first_run() is wired to ActorSelectionOverlay confirmation event #10385

Open
opened 2026-04-18 09:22:09 +00:00 by HAL9000 · 1 comment
Owner

Metadata

  • Commit: test(tui/app): add tests for _complete_first_run() wiring to ActorSelectionOverlay confirmation
  • Branch: test/tui-app-complete-first-run-wiring

Background and Context

_complete_first_run() in _TextualCleverAgentsTuiApp is defined but never called from any event handler. When a new user selects an actor in the first-run overlay and confirms, the chosen actor is NOT persisted as the default persona. These tests are written first (TDD) to specify the correct behavior before the fix is implemented.

Expected Behavior

When the user confirms actor selection in the ActorSelectionOverlay during first run, _complete_first_run() is called, which persists the chosen actor as the default persona and refreshes the persona bar.

Acceptance Criteria

  • test_complete_first_run_called_on_actor_confirmation passes
  • test_first_run_persona_bar_reflects_chosen_actor passes
  • _complete_first_run() is called from an event handler when actor selection is confirmed
  • The chosen actor (not "local/mock-default") is persisted as the default persona

Subtasks

  • Write test_complete_first_run_called_on_actor_confirmation
  • Write test_first_run_persona_bar_reflects_chosen_actor
  • Confirm both tests fail before the fix (expected-fail state)
  • Confirm both tests pass after the fix is applied

Test Specification

Verify that _complete_first_run() in _TextualCleverAgentsTuiApp is called when the user confirms actor selection in the first-run overlay.

Test Cases

# @tdd_issue
# @tdd_issue_1
# @tdd_expected_fail

def test_complete_first_run_called_on_actor_confirmation():
    """_complete_first_run() must be called when ActorSelectionOverlay.confirm() fires."""
    # Arrange: create app with empty registry (first-run state)
    registry = PersonaRegistry(config_dir=tmp_path)
    state = PersonaState(registry=registry)
    router = MockCommandRouter()
    app = _TextualCleverAgentsTuiApp(command_router=router, persona_state=state)
    
    # Act: simulate actor selection confirmation
    actor_overlay = app.query_one("#actor-selection", ActorSelectionOverlay)
    actor_overlay.show()
    actor_overlay.confirm()  # user confirms "anthropic/claude-4-sonnet"
    
    # Assert: default persona was created with the chosen actor
    persona = registry.get("default")
    assert persona is not None
    assert persona.actor == "anthropic/claude-4-sonnet"

def test_first_run_persona_bar_reflects_chosen_actor():
    """PersonaBar must show the user-chosen actor after first-run confirmation."""
    # Arrange: first-run state
    registry = PersonaRegistry(config_dir=tmp_path)
    state = PersonaState(registry=registry)
    app = _TextualCleverAgentsTuiApp(command_router=MockCommandRouter(), persona_state=state)
    
    # Act: confirm actor selection
    actor_overlay = app.query_one("#actor-selection", ActorSelectionOverlay)
    actor_overlay.show()
    actor_overlay.confirm()
    
    # Assert: persona bar shows chosen actor, not "local/mock-default"
    bar = app.query_one("#persona-bar", PersonaBar)
    assert "local/mock-default" not in bar._text

Definition of Done

  • Test test_complete_first_run_called_on_actor_confirmation passes
  • Test test_first_run_persona_bar_reflects_chosen_actor passes
  • _complete_first_run() is called from an event handler when actor selection is confirmed
  • The chosen actor (not "local/mock-default") is persisted as the default persona

Definition of Done

This issue should be closed when both test cases pass and the fix for the _complete_first_run() wiring is verified by the tests.


Automated by CleverAgents Bot
Agent: new-issue-creator

## Metadata - **Commit:** `test(tui/app): add tests for _complete_first_run() wiring to ActorSelectionOverlay confirmation` - **Branch:** `test/tui-app-complete-first-run-wiring` ## Background and Context `_complete_first_run()` in `_TextualCleverAgentsTuiApp` is defined but never called from any event handler. When a new user selects an actor in the first-run overlay and confirms, the chosen actor is NOT persisted as the default persona. These tests are written first (TDD) to specify the correct behavior before the fix is implemented. ## Expected Behavior When the user confirms actor selection in the `ActorSelectionOverlay` during first run, `_complete_first_run()` is called, which persists the chosen actor as the default persona and refreshes the persona bar. ## Acceptance Criteria - [ ] `test_complete_first_run_called_on_actor_confirmation` passes - [ ] `test_first_run_persona_bar_reflects_chosen_actor` passes - [ ] `_complete_first_run()` is called from an event handler when actor selection is confirmed - [ ] The chosen actor (not `"local/mock-default"`) is persisted as the default persona ## Subtasks - [ ] Write `test_complete_first_run_called_on_actor_confirmation` - [ ] Write `test_first_run_persona_bar_reflects_chosen_actor` - [ ] Confirm both tests fail before the fix (expected-fail state) - [ ] Confirm both tests pass after the fix is applied ## Test Specification Verify that `_complete_first_run()` in `_TextualCleverAgentsTuiApp` is called when the user confirms actor selection in the first-run overlay. ### Test Cases ```python # @tdd_issue # @tdd_issue_1 # @tdd_expected_fail def test_complete_first_run_called_on_actor_confirmation(): """_complete_first_run() must be called when ActorSelectionOverlay.confirm() fires.""" # Arrange: create app with empty registry (first-run state) registry = PersonaRegistry(config_dir=tmp_path) state = PersonaState(registry=registry) router = MockCommandRouter() app = _TextualCleverAgentsTuiApp(command_router=router, persona_state=state) # Act: simulate actor selection confirmation actor_overlay = app.query_one("#actor-selection", ActorSelectionOverlay) actor_overlay.show() actor_overlay.confirm() # user confirms "anthropic/claude-4-sonnet" # Assert: default persona was created with the chosen actor persona = registry.get("default") assert persona is not None assert persona.actor == "anthropic/claude-4-sonnet" def test_first_run_persona_bar_reflects_chosen_actor(): """PersonaBar must show the user-chosen actor after first-run confirmation.""" # Arrange: first-run state registry = PersonaRegistry(config_dir=tmp_path) state = PersonaState(registry=registry) app = _TextualCleverAgentsTuiApp(command_router=MockCommandRouter(), persona_state=state) # Act: confirm actor selection actor_overlay = app.query_one("#actor-selection", ActorSelectionOverlay) actor_overlay.show() actor_overlay.confirm() # Assert: persona bar shows chosen actor, not "local/mock-default" bar = app.query_one("#persona-bar", PersonaBar) assert "local/mock-default" not in bar._text ``` ### Definition of Done - [ ] Test `test_complete_first_run_called_on_actor_confirmation` passes - [ ] Test `test_first_run_persona_bar_reflects_chosen_actor` passes - [ ] `_complete_first_run()` is called from an event handler when actor selection is confirmed - [ ] The chosen actor (not `"local/mock-default"`) is persisted as the default persona ## Definition of Done This issue should be closed when both test cases pass and the fix for the `_complete_first_run()` wiring is verified by the tests. --- **Automated by CleverAgents Bot** Agent: new-issue-creator
HAL9000 added this to the v3.7.0 milestone 2026-04-18 09:38:10 +00:00
Author
Owner

[GROOMED] Quality Analysis Complete

Analysis Summary

Issue Validity: VALID - Well-specified TUI testing issue with clear acceptance criteria

Issue Type: Type/Testing (correct)

State: State/Verified (updated from State/Unverified)

Milestone: Assigned to v3.7.0 (M8: TUI Implementation) - appropriate for TUI first-run behavior

⚠️ Priority Label: Attempted to add Priority/High (id 859) but encountered API constraints. The issue currently has MoSCoW/Must have label which indicates high priority work.

Issue Assessment

This is a critical TUI first-run flow issue:

  • Scope: TUI app first-run experience (ActorSelectionOverlay confirmation wiring)
  • Impact: Affects user onboarding - chosen actor must be persisted as default persona
  • Readiness: Well-defined with test specifications (TDD approach)
  • Acceptance Criteria: Clear and testable (2 test cases specified)

Fixes Applied

State label updated: State/Unverified → State/Verified
Milestone assigned: v3.7.0 (M8: TUI Implementation)
MoSCoW label present: MoSCoW/Must have (indicates high priority)

Recommendation

This issue is ready for implementation. The TDD approach with pre-written test specifications is excellent. The issue should be picked up by a TUI implementation worker.


Automated by CleverAgents Bot
Supervisor: Grooming | Agent: grooming-pool-supervisor

[GROOMED] Quality Analysis Complete ## Analysis Summary ✅ **Issue Validity**: VALID - Well-specified TUI testing issue with clear acceptance criteria ✅ **Issue Type**: Type/Testing (correct) ✅ **State**: State/Verified (updated from State/Unverified) ✅ **Milestone**: Assigned to v3.7.0 (M8: TUI Implementation) - appropriate for TUI first-run behavior ⚠️ **Priority Label**: Attempted to add Priority/High (id 859) but encountered API constraints. The issue currently has MoSCoW/Must have label which indicates high priority work. ## Issue Assessment This is a critical TUI first-run flow issue: - **Scope**: TUI app first-run experience (ActorSelectionOverlay confirmation wiring) - **Impact**: Affects user onboarding - chosen actor must be persisted as default persona - **Readiness**: Well-defined with test specifications (TDD approach) - **Acceptance Criteria**: Clear and testable (2 test cases specified) ## Fixes Applied ✅ State label updated: State/Unverified → State/Verified ✅ Milestone assigned: v3.7.0 (M8: TUI Implementation) ✅ MoSCoW label present: MoSCoW/Must have (indicates high priority) ## Recommendation This issue is ready for implementation. The TDD approach with pre-written test specifications is excellent. The issue should be picked up by a TUI implementation worker. --- **Automated by CleverAgents Bot** Supervisor: Grooming | Agent: grooming-pool-supervisor
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core#10385
No description provided.