TDD: TUI BINDINGS missing ctrl+n and ctrl+w session management keys #10391

Open
opened 2026-04-18 09:25:41 +00:00 by HAL9000 · 0 comments
Owner

Metadata

Field Value
Branch fix/tui-bindings-session-management
Commit Message fix(tui): add ctrl+n and ctrl+w session management key bindings
Milestone v3.7.0
Parent Epic #5308
Related UAT Issue #10390

Background and Context

The TUI specification requires that app.py BINDINGS includes ALL of the following keys: ctrl+n, ctrl+w, ctrl+s, ctrl+r, shift+tab, f2/ctrl+,, tab (persona), ctrl+tab (preset), ctrl+[, ctrl+], alt+up, alt+down, escape. The current implementation is missing ctrl+n (new session) and ctrl+w (close session).

This TDD issue tracks the test coverage requirements for the fix described in #10390. All new functionality must be covered by Behave BDD scenarios and unit tests before the fix is considered complete.

Expected Behavior (from spec)

The BINDINGS class variable in app.py must include:

  • ctrl+n → Create a new session tab
  • ctrl+w → Close the current session tab

Test coverage must verify:

  • ctrl+n binding is present in BINDINGS
  • ctrl+w binding is present in BINDINGS
  • action_new_session() creates a new session tab correctly
  • action_close_session() closes the current session tab correctly
  • Edge cases: closing the last session, creating sessions at limit

Actual Behavior

src/cleveragents/tui/app.py BINDINGS (lines 88–92):

BINDINGS: ClassVar[list[tuple[str, str, str]]] = [
    ("ctrl+q", "quit", "Quit"),
    ("f1", "help", "Help"),
    ("ctrl+t", "cycle_preset", "Cycle Preset"),
]

No tests exist for ctrl+n (new session) or ctrl+w (close session) bindings because the bindings themselves are absent.

Code Location

  • src/cleveragents/tui/app.pyBINDINGS class variable (lines 88–92)
  • tests/ — Behave feature files and step definitions for TUI key bindings

Subtasks

  • Write Behave feature file: features/tui/session_management_bindings.feature
  • Write scenario: ctrl+n creates a new session tab
  • Write scenario: ctrl+w closes the current session tab
  • Write scenario: ctrl+w on last session shows appropriate behavior (no crash)
  • Write unit tests for action_new_session() method
  • Write unit tests for action_close_session() method
  • Verify all new tests fail before the fix (red phase)
  • Confirm all new tests pass after the fix from #10390 (green phase)
  • Run nox (all default sessions), fix any errors
  • Verify coverage >= 97%

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • Behave scenarios for ctrl+n and ctrl+w are written and passing.
  • Unit tests for action_new_session() and action_close_session() are written and passing.
  • The fix from #10390 is merged and all tests pass.
  • Coverage remains >= 97%.
  • A Git commit is created where the first line of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional details.
  • The commit is pushed to the remote on the branch matching the Branch in Metadata exactly.
  • The commit is submitted as a pull request to master, reviewed, and merged before this issue is marked done.

Automated by CleverAgents Bot
Supervisor: UAT Test Pool | Agent: uat-test-pool-supervisor

## Metadata | Field | Value | |---|---| | **Branch** | `fix/tui-bindings-session-management` | | **Commit Message** | `fix(tui): add ctrl+n and ctrl+w session management key bindings` | | **Milestone** | v3.7.0 | | **Parent Epic** | #5308 | | **Related UAT Issue** | #10390 | --- ## Background and Context The TUI specification requires that `app.py BINDINGS` includes ALL of the following keys: `ctrl+n`, `ctrl+w`, `ctrl+s`, `ctrl+r`, `shift+tab`, `f2/ctrl+,`, `tab` (persona), `ctrl+tab` (preset), `ctrl+[`, `ctrl+]`, `alt+up`, `alt+down`, `escape`. The current implementation is missing `ctrl+n` (new session) and `ctrl+w` (close session). This TDD issue tracks the test coverage requirements for the fix described in #10390. All new functionality must be covered by Behave BDD scenarios and unit tests before the fix is considered complete. ## Expected Behavior (from spec) The `BINDINGS` class variable in `app.py` must include: - `ctrl+n` → Create a new session tab - `ctrl+w` → Close the current session tab Test coverage must verify: - `ctrl+n` binding is present in `BINDINGS` - `ctrl+w` binding is present in `BINDINGS` - `action_new_session()` creates a new session tab correctly - `action_close_session()` closes the current session tab correctly - Edge cases: closing the last session, creating sessions at limit ## Actual Behavior `src/cleveragents/tui/app.py` `BINDINGS` (lines 88–92): ```python BINDINGS: ClassVar[list[tuple[str, str, str]]] = [ ("ctrl+q", "quit", "Quit"), ("f1", "help", "Help"), ("ctrl+t", "cycle_preset", "Cycle Preset"), ] ``` No tests exist for `ctrl+n` (new session) or `ctrl+w` (close session) bindings because the bindings themselves are absent. ## Code Location - `src/cleveragents/tui/app.py` — `BINDINGS` class variable (lines 88–92) - `tests/` — Behave feature files and step definitions for TUI key bindings ## Subtasks - [ ] Write Behave feature file: `features/tui/session_management_bindings.feature` - [ ] Write scenario: `ctrl+n` creates a new session tab - [ ] Write scenario: `ctrl+w` closes the current session tab - [ ] Write scenario: `ctrl+w` on last session shows appropriate behavior (no crash) - [ ] Write unit tests for `action_new_session()` method - [ ] Write unit tests for `action_close_session()` method - [ ] Verify all new tests fail before the fix (red phase) - [ ] Confirm all new tests pass after the fix from #10390 (green phase) - [ ] Run `nox` (all default sessions), fix any errors - [ ] Verify coverage >= 97% ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - Behave scenarios for `ctrl+n` and `ctrl+w` are written and passing. - Unit tests for `action_new_session()` and `action_close_session()` are written and passing. - The fix from #10390 is merged and all tests pass. - Coverage remains >= 97%. - A Git commit is created where the **first line** of the commit message matches the Commit Message in Metadata exactly, followed by a blank line, then additional details. - The commit is pushed to the remote on the branch matching the **Branch** in Metadata exactly. - The commit is submitted as a **pull request** to `master`, reviewed, and **merged** before this issue is marked done. --- **Automated by CleverAgents Bot** Supervisor: UAT Test Pool | Agent: uat-test-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#10391
No description provided.