Skip to content

feat(cli): dashboard keeps its place across refreshes and shows a finding detail pane (devops dashboard, devops tui) #684

Closed

Description

@dan-petty

Context & Rationale

devops dashboard and its alias devops tui (src/devops_cli/main.py:66-67) are already the reactive Textual app this item asked for. PR #361 (from #317) runs each domain refresh on its own worker thread (@work(thread=True), src/devops_cli/ui/dashboard.py:225-230). Those workers publish into a thread-safe store (src/devops_cli/ui/state.py:59-157). The same PR added a bounded, virtualized pod-log tail (src/devops_cli/ui/log_buffer.py; src/devops_cli/ui/widgets.py:264-451).

The app has five domain tabs (Kubernetes, Docker, Telemetry, AI Review and Valkey Cache; src/devops_cli/config/constants.py:1942-1961) plus a Logs tab, all switched by key (dashboard.py:139-154). Two master-to-detail paths exist already:

  • Selecting a pod opens its followed log (dashboard.py:263-277).
  • Selecting a review session loads its findings (dashboard.py:232-239).

What is wrong, measured against the code:

  1. The dashboard loses the operator's place every 5 seconds.

    • Every DEFAULT_DASHBOARD_REFRESH_SECONDS = 5 (src/devops_cli/config/defaults.py:773; scheduled at dashboard.py:193-195), each table is redrawn with table.clear() followed by add_rows (widgets.py:102, 184, 253, 258).
    • In the pinned Textual 8.2.8 (pyproject.toml:40), DataTable.clear() resets the cursor to (0,0) and the scroll offset to 0 (textual/widgets/_data_table.py:1582-1608).
    • So a cursor moved to a pod, container or finding jumps back to the first row within 5 seconds. This happens on visible and hidden tabs alike.
    • Switching tabs loses nothing. TabbedContent only hides the inactive pane (display = False, textual/widgets/_content_switcher.py:97), so its widgets stay mounted. The refresh is the cause.
    • No test checks cursor or scroll position across a refresh. The only cursor calls in tests/test_ui_*.py are move_cursor(row=0) (tests/test_ui_reactive.py:1375, 1409, 1543).
    • A detail pane that follows the cursor would be reset along with it, so this is fixed first.
  2. A finding cannot be read in the dashboard.

    • The AI Review table has four columns: severity, title cut to 45 characters, location and status (src/devops_cli/ui/projections.py:44, 214-224).

    • Each finding record also carries:

      • description and fix
      • observed and expected values
      • category, confidence and references
      • the text explaining its verdict: invalidation_reason, mitigating_mechanism and verification_note

      (src/devops_cli/ai/review_schema.py:547-633)

    • The newest local review session (20260930-232803) has 190 findings. Of those:

      • 120 titles are longer than 45 characters
      • the median description is 327 characters
      • 108 fixes span several lines
      • 66 findings carry a mitigating_mechanism, including both MITIGATED ones

      None of this text is shown.

    • The CLI shows part of it. devops review findings --details prints the description, fix, invalidation reason and references in a panel for each finding (src/devops_cli/commands/review.py:785-808, 914-930). The dashboard has nothing equivalent.

    • The provider also keeps only the first 50 findings (src/devops_cli/ui/data_providers.py:548), while the banner reports the full total (data_providers.py:544; projections.py:151-155). In that session, 140 of 190 findings cannot be reached. The cap dates from the first dashboard (b861fc4, v0.2.13), and no reason for it was recorded.

  3. Only the findings table hides record text. Every other table's record fits in its columns: pods, containers, images, networks, volumes, registries, telemetry and review sessions (data_providers.py:165-297; projections.py:195-257, 321-339).

    • The one exception is Valkey uptime_seconds. It is fetched (data_providers.py:595) but shown in neither valkey_rows (projections.py:247-257) nor the banner.
    • Showing it needs a table row, not an inspector, so it is not part of this item.

What is vision, not need:

Nothing here touches a removed component.

Scope & Deliverables

  • Deliverable: Refreshes keep the operator's place.
    • Every row of every dashboard table gets a stable string key.
    • The keys come from new pure functions in src/devops_cli/ui/projections.py, one per table, registered beside _ROWS and DOCKER_RESOURCE_ROWS. Each function returns one identity tuple per row, in row order, built from the record:
      • pod: namespace, name
      • container, image, network: id
      • volume, registry: name
      • telemetry: type, name
      • Valkey: property name
      • review session: name
      • finding: persona, location, full title. finding_id is None on all 190 findings of the measured session, and the row holds neither the persona nor the full title.
    • The existing projection functions keep their signatures: render_domain, render_rows, ai_rows, docker_resource_rows and review_session_rows.
    • One shared helper turns identities into keys:
      • It appends an occurrence number to each identity: 0 for the first, 1 for the first repeat, and so on.
      • It encodes the result with json.dumps, because Textual's add_row takes key: str | None (_data_table.py:1669-1675) and mypy runs in strict mode (pyproject.toml:96-99).
      • Because this happens in one place, a repeated identity cannot raise DuplicateKey (_data_table.py:1693) in any table. Two containers with the empty-id fallback (data_providers.py:200) are one example. Without this, the error would blank the whole panel through apply_snapshot's error path (dashboard.py:253-261).
    • One redraw helper replaces the four bare clear()/add_rows sites (widgets.py:102, 184, 253, 258). It:
      1. saves the highlighted row key, the cursor index and scroll_y;
      2. redraws the rows with add_row(..., key=...);
      3. puts the cursor back on the same key. If that key is gone, the cursor keeps its index, moved back to the last row if the table is now shorter;
      4. restores scroll_y.
    • Restore order: move_cursor(row=i, scroll=False), then call_after_refresh(table.scroll_to, y=saved, animate=False) (proposed). scroll=False alone is not enough. Whenever the cursor moves, the cursor watcher schedules its own _scroll_cursor_into_view for after the next refresh (_data_table.py:1193-1212), which would undo an earlier restore.
    • Sometimes the findings table shows a different review session from the last render: a session was picked in the Sessions table, or a newer review completed while none was picked. In that case the findings cursor and scroll return to the top instead.
  • Deliverable: A finding detail pane on the AI Review "Findings" sub-tab.
    • Layout. The findings table is on the left (3fr) and a scrollable detail pane on the right (2fr). The pane is a Static(markup=False) inside a VerticalScroll.
    • Source. The pane's text comes from a pure function, finding_detail(record: dict[str, Any]) -> str, in projections.py. It reads the raw finding dict the snapshot already holds (data_providers.py:528), so nothing is refetched.
    • Text layout. A header of label: value lines, then a titled section for each long text field, in this order:
      • Header:
        • title (full)
        • severity
        • status
        • persona: persona_title, falling back to persona, as review findings --details does (commands/review.py:787)
        • category
        • confidence, to 2 decimals, as at review.py:885
        • location
        • citation line
        • verified by
      • Sections:
        • description
        • observed value
        • expected value
        • fix
        • references, one per line
        • verification note
        • invalidation reason
        • mitigating mechanism
    • Cleaning. Description and fix pass through format_clean_text_field (src/devops_cli/ai/review_schema.py:114), the cleaner the CLI panel already uses (review.py:797, 800).
    • Empty fields. A field is omitted only when it is None, a blank string or an empty list. 0 and 0.0 are shown.
    • Fields left out on purpose:
      • recommendation: the persona's merge verdict from derive_recommendation (review_schema.py:1102-1105, 1146-1160). It is "REQUEST CHANGES" on all 190 findings, so it is not advice about the finding. fix is.
      • thinking: this is feat(ai): ai constellation topology, rag health & review findings studio (tab-ai) #690's rationale scratchpads.
      • Bookkeeping fields: verification_criteria, invalidation_criteria, criteria_execution_results, verified_criteria_matched, invalidated_criteria_matched, perimeter_files, regression_test, relocated_from, verified_at, reportable, verified, mitigated and finding_id.
    • Control characters. Control characters (Unicode category Cc) other than newline and tab are written as visible escapes such as \x1b. Textual strips only bell, backspace, vertical tab, form feed and carriage return (textual/content.py:56-62), so a raw ESC in model-written text would otherwise reach the terminal.
    • The field list and labels are declared in src/devops_cli/config/constants.py.
    • Following the cursor.
      • The pane follows DataTable.RowHighlighted from #ai-table only. Highlights in the sessions table are ignored.
      • It looks the record up by the event's row key in the current snapshot. That way a highlight queued before a refresh cannot show the wrong finding.
      • With no findings, the pane reads No finding selected.
    • The i key.
      • i shows and hides the pane.
      • It is bound on ReviewPanel with show=False, because the footer already truncates (dashboard.py:136-138). It therefore acts only while focus is inside AI Review.
      • The help screen (dashboard.py:104-120) gains the line i : toggle finding detail (AI Review).
  • Deliverable: Every finding in a session is listed. The 50-finding cap at data_providers.py:548 is removed. The largest local session has 382 findings.
  • Deliverable: The delivering commit rewrites the task file docs/agent/tasks/task-684-reactive-multi-workspace-textual-tui-architecture-master-det.md and the roadmap entry (docs/ROADMAP.md:601-604) to this item's scope. Both still describe the seven workspaces and hash routing.
  • Deliverable: Pilot and unit tests in tests/test_ui_reactive.py for each acceptance criterion.
  • Acceptance criteria:
    • The tests pass 3-row overrides to the existing fixture: patched_fetchers(k8s=..., docker=..., ai=...) (tests/test_ui_reactive.py:929-932). The default samples hold one row each (78-157). With the cursor on row 2 of the Kubernetes, Docker containers and findings tables, action_refresh_data() with unchanged data leaves (cursor_row, highlighted row key) unchanged. These tests fail on the current code.
    • A Kubernetes table with 50 pods, in run_test(size=(100, 24)), keeps its place across action_refresh_data():
      • cursor on row 12 and scroll_y=10: afterwards (cursor_row, scroll_y) == (12, 10)
      • cursor on row 2 and scroll_y=20, so the cursor is scrolled out of view: afterwards (cursor_row, scroll_y) == (2, 20)
    • If the highlighted record is missing from the next snapshot, the cursor keeps its index, moved back to the last row if the table is now shorter, and nothing raises.
    • Two findings with the same persona, location and title render as two rows, and a cursor on the second stays there across a refresh. Two containers with an empty id also render as two rows, with no error banner.
    • Moving the cursor to row 20 and then applying a findings snapshot with a different session_name gives (ai-table.cursor_row, ai-table.scroll_y) == (0, 0).
    • For every domain and every Docker resource, the identity function returns as many entries as the row projection does for the sample snapshots.
    • Highlighting a finding shows its full title, description, fix and mitigating mechanism in the pane, and no thinking or recommendation text.
    • Moving the cursor updates the pane. A refresh with unchanged data leaves the pane's text unchanged. With an empty findings table, the pane reads No finding selected.
    • finding_detail keeps confidence_score=0.0 and citation_line=0, and omits fields that are None, "" or [].
    • A finding whose description is a \x1b[31mred\x1b[0m [bold]x[/] renders without MarkupError. The pane's text contains [bold]x[/] and the four characters \x1b verbatim, and no ESC (U+001B) character.
    • With the findings table focused, pressing i hides the pane and pressing it again shows it. Pressing i on the Kubernetes tab changes nothing. The help text lists i.
    • A session written with _make_sessions(tmp_path, {"20260930-000000": 60}) (tests/test_ui_reactive.py:1713-1724), with DEVOPS_CLI_DATA_DIR set, gives (len(summary.findings), summary.total_findings) == (60, 60) from fetch_review_status(). The current code gives (50, 60).
    • Every existing test in tests/test_ui_reactive.py and tests/test_ui_dashboard.py passes unmodified. This covers the widget ids (#k8s-table, #docker-table, #ai-table, #review-sessions-table), pod-to-logs selection and session selection.
    • uv run devops ci passes.
  • Key questions:
  • Constraint: Finding text is model output that quotes repository content, so the pane renders it with Rich markup off and with control characters escaped. In the measured session, 47 of 190 findings contain [ in their description or fix.
  • Constraint: The control-character rule uses the complete Unicode Cc category, not a hand-picked list. The field list and labels live in constants.py (AGENTS.md:21-24).
  • Constraint: No new dependency. Textual 8.2.8 is already pinned (pyproject.toml:40).
  • Constraint: Tests use only patched fetchers, direct apply() calls or a temporary DEVOPS_CLI_DATA_DIR built with _make_sessions. They need no cluster, Docker daemon, Valkey or network.
  • Constraint: Cyclomatic complexity of 10 or less, nesting depth of 5 or less, and tuple-equality assertions in tests (AGENTS.md:14-17).
  • Constraint: Out of scope:

Strategic Alignment

Activity

  1. added this to the v0.2.24 milestone on Sep 28, 2026
  2. added
    type/feature
    scope/cli
    priority/p0-critical
    on Sep 28, 2026
  3. changed the title [-]feat(cli): reactive multi-workspace textual tui architecture & master-detail navigation (`devops dashboard`, `devops tui`)[/-] [+]feat(cli): dashboard keeps its place across refreshes and shows a finding detail pane (`devops dashboard`, `devops tui`)[/+] on Oct 1, 2026
  4. added
    priority/p1-high
    and removed
    priority/p0-critical
    on Oct 1, 2026
  5. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Relabelled from priority/p0-critical to priority/p1-high, as this item's refinement proposes: it is a feature, not a critical fix. It stays in v0.2.24, which it was already in when the release started.

  6. dan-petty commented on Oct 1, 2026

    @dan-petty
    OwnerAuthor

    Closed by #830, merged into release/v0.2.24.

    GitHub only acts on closing keywords when a pull request merges into the default branch, so this was closed by devops gh issues close-merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    priority/p1-highscope/clitype/feature

    Type

    No type

    Projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions