a73x

specs/008-commit-browser/plan.md

Ref:   Size: 2.8 KiB

# Implementation Plan: Commit Browser in TUI Dashboard

**Branch**: `008-commit-browser` | **Date**: 2026-03-21 | **Spec**: [spec.md](spec.md)

## Summary

Add an in-dashboard commit/event browser to the TUI. When viewing a patch or issue, the user presses a key to see the full event DAG as a scrollable list (type, author, timestamp, signature status). Selecting an event shows its full details including commit ID, payload, and signature info. All changes primarily in `src/tui.rs`, reading from existing `dag::walk_events()` and `signing::verify_signed_event()`.

## Technical Context

**Language/Version**: Rust 2021 edition
**Primary Dependencies**: ratatui 0.30, crossterm 0.29, git2 0.19, ed25519-dalek 2, serde/serde_json 1
**Testing**: cargo test
**Project Type**: CLI tool with TUI dashboard

## Design Decisions

### 1. ViewMode Extension

Add a `CommitList` variant to the existing `ViewMode` enum:
- `Details` — existing behavior
- `Diff` — existing diff view
- `CommitList` — event history list
- `CommitDetail` — single event detail view

This reuses the existing view mode pattern. The commit browser key (e.g., `c`) toggles into `CommitList` from the detail pane.

### 2. Event Data Loading

On entering `CommitList` mode, call `dag::walk_events(repo, ref_name)` where `ref_name` is constructed from the selected item's ID (e.g., `refs/collab/issues/{id}` or `refs/collab/patches/{id}`). Store the result as `Vec<(Oid, Event)>` in a new `event_history` field on App, along with an `event_list_state: ListState` for navigation.

For signature verification (US3), also call `signing::verify_ref(repo, ref_name)` to get `Vec<SignatureVerificationResult>` and store alongside.

### 3. Event List Rendering

Render the event list in the detail pane area (right side). Each row shows:
```
[sig_icon] EventType | author_name | timestamp
```
Where `sig_icon` is a single character: `✓` (valid), `✗` (invalid), `?` (untrusted), `-` (missing).

### 4. Event Detail Rendering

On Enter, show the selected event's full details in the detail pane:
- Commit: `{short_oid}`
- Author: `{name} <{email}>`
- Date: `{timestamp}`
- Type: `{action_type}`
- Signature: `{status}` (and pubkey if present)
- Content: event-specific payload (comment body, review verdict+body, etc.)

### 5. Navigation

- `c` from detail pane → enter CommitList mode
- Up/Down in CommitList → navigate events
- Enter in CommitList → show CommitDetail
- Escape in CommitDetail → back to CommitList
- Escape in CommitList → back to previous ViewMode (Details)

## Source Code

```text
src/
├── tui.rs    # PRIMARY: Add ViewMode variants, event loading, rendering, navigation
├── dag.rs    # READ ONLY: walk_events() for loading event history
├── signing.rs # READ ONLY: verify_dag() for signature status
├── event.rs  # READ ONLY: Event/Action types for display formatting
```