UAT: PermissionQuestionWidget inline diff display never enabled — _show_diff always False #10368

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

Metadata

  • Commit Message: fix(tui): enable inline diff toggle in PermissionQuestionWidget
  • Branch: fix/tui-permission-question-inline-diff

Background and Context

During UAT testing of the TuiMaterializer A2A Integration feature area, it was discovered that the PermissionQuestionWidget never displays inline diffs. The spec requires that PermissionQuestionWidget renders inline diffs when the permission question has diff content.

Evidence of the bug in src/cleveragents/tui/widgets/permission_question.py:

  1. _show_diff is always False (line ~140):

    def __init__(self, question, *args, **kwargs):
        ...
        self._show_diff: bool = False  # initialized to False
        ...
    
  2. No mechanism to set _show_diff = True: The handle_key() method handles "v" by setting self._open_full_screen = True, but there is no key binding or method that sets self._show_diff = True.

  3. render_permission_question() supports show_diff but the widget never passes True:

    def _refresh(self) -> None:
        self._text = render_permission_question(
            self._question,
            self._selected_index,
            show_diff=self._show_diff,  # always False
        )
    

The render_permission_question() function correctly renders diff content when show_diff=True and question.has_diff is True, but the widget never enables this path.

Expected Behavior (from spec)

Per the TuiMaterializer A2A Integration specification:

  • PermissionQuestionWidget must render inline diffs when the permission question has diff content
  • Users must be able to toggle inline diff display within the widget
  • When question.has_diff is True, the widget should display the diff content inline

Actual Behavior

  • _show_diff is always False in PermissionQuestionWidget
  • No key binding or method exists to toggle inline diff display
  • Inline diff content is never shown, even when question.has_diff is True
  • The render_permission_question() function's show_diff parameter is never set to True

Steps to Reproduce

from cleveragents.tui.widgets.permission_question import PermissionQuestionWidget
from cleveragents.domain.models.core.inline_permission_question import InlinePermissionQuestion

question = InlinePermissionQuestion(
    file_path="src/main.py",
    request_type="file_write",
    diff_content="@@ -1,3 +1,4 @@\n+import os"
)
widget = PermissionQuestionWidget(question)
# widget._show_diff is False — diff is never shown
# No key press can enable inline diff display
assert "+import os" not in widget._text  # True — diff never shown

Acceptance Criteria

  • A key binding (e.g., d) toggles _show_diff between True and False
  • When _show_diff=True and question.has_diff=True, the diff content is rendered inline
  • The toggle key is documented in the widget's UI (e.g., "Press d to toggle inline diff")
  • handle_key("d") toggles _show_diff and refreshes the display
  • Existing key bindings (a, A, r, R, v, up, down, enter) are unaffected
  • New Behave BDD scenarios cover inline diff toggle behavior
  • Coverage remains >= 97%

Subtasks

  • Add _show_diff toggle logic to handle_key() for a designated key (e.g., "d")
  • Update render_permission_question() hint text to mention the diff toggle key
  • Add Behave BDD scenarios for inline diff toggle
  • Verify coverage >= 97% via nox -s coverage_report
  • Run nox (all default sessions), fix any errors

Definition of Done

This issue is complete when:

  • All subtasks above are completed and checked off.
  • 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 lines providing relevant details about the implementation.
  • 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 - **Commit Message**: `fix(tui): enable inline diff toggle in PermissionQuestionWidget` - **Branch**: `fix/tui-permission-question-inline-diff` ## Background and Context During UAT testing of the TuiMaterializer A2A Integration feature area, it was discovered that the `PermissionQuestionWidget` never displays inline diffs. The spec requires that `PermissionQuestionWidget` renders inline diffs when the permission question has diff content. Evidence of the bug in `src/cleveragents/tui/widgets/permission_question.py`: 1. **`_show_diff` is always `False`** (line ~140): ```python def __init__(self, question, *args, **kwargs): ... self._show_diff: bool = False # initialized to False ... ``` 2. **No mechanism to set `_show_diff = True`**: The `handle_key()` method handles `"v"` by setting `self._open_full_screen = True`, but there is no key binding or method that sets `self._show_diff = True`. 3. **`render_permission_question()` supports `show_diff`** but the widget never passes `True`: ```python def _refresh(self) -> None: self._text = render_permission_question( self._question, self._selected_index, show_diff=self._show_diff, # always False ) ``` The `render_permission_question()` function correctly renders diff content when `show_diff=True` and `question.has_diff` is `True`, but the widget never enables this path. ## Expected Behavior (from spec) Per the TuiMaterializer A2A Integration specification: - `PermissionQuestionWidget` must render inline diffs when the permission question has diff content - Users must be able to toggle inline diff display within the widget - When `question.has_diff` is `True`, the widget should display the diff content inline ## Actual Behavior - `_show_diff` is always `False` in `PermissionQuestionWidget` - No key binding or method exists to toggle inline diff display - Inline diff content is never shown, even when `question.has_diff` is `True` - The `render_permission_question()` function's `show_diff` parameter is never set to `True` ## Steps to Reproduce ```python from cleveragents.tui.widgets.permission_question import PermissionQuestionWidget from cleveragents.domain.models.core.inline_permission_question import InlinePermissionQuestion question = InlinePermissionQuestion( file_path="src/main.py", request_type="file_write", diff_content="@@ -1,3 +1,4 @@\n+import os" ) widget = PermissionQuestionWidget(question) # widget._show_diff is False — diff is never shown # No key press can enable inline diff display assert "+import os" not in widget._text # True — diff never shown ``` ## Acceptance Criteria - [ ] A key binding (e.g., `d`) toggles `_show_diff` between `True` and `False` - [ ] When `_show_diff=True` and `question.has_diff=True`, the diff content is rendered inline - [ ] The toggle key is documented in the widget's UI (e.g., "Press d to toggle inline diff") - [ ] `handle_key("d")` toggles `_show_diff` and refreshes the display - [ ] Existing key bindings (`a`, `A`, `r`, `R`, `v`, `up`, `down`, `enter`) are unaffected - [ ] New Behave BDD scenarios cover inline diff toggle behavior - [ ] Coverage remains >= 97% ## Subtasks - [ ] Add `_show_diff` toggle logic to `handle_key()` for a designated key (e.g., `"d"`) - [ ] Update `render_permission_question()` hint text to mention the diff toggle key - [ ] Add Behave BDD scenarios for inline diff toggle - [ ] Verify coverage >= 97% via `nox -s coverage_report` - [ ] Run `nox` (all default sessions), fix any errors ## Definition of Done This issue is complete when: - All subtasks above are completed and checked off. - 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 lines providing relevant details about the implementation. - 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#10368
No description provided.