a73x

specs/008-commit-browser/tasks.md

Ref:   Size: 6.0 KiB

# Tasks: Commit Browser in TUI Dashboard

**Input**: Design documents from `/specs/008-commit-browser/`
**Prerequisites**: plan.md (required), spec.md (required for user stories)

**Tests**: Not explicitly requested — test tasks omitted.

**Organization**: Tasks grouped by user story for independent implementation and testing.

## Format: `[ID] [P?] [Story] Description`

- **[P]**: Can run in parallel (different files, no dependencies)
- **[Story]**: Which user story this task belongs to (e.g., US1, US2, US3)

## Phase 1: Setup (Shared Infrastructure)

**Purpose**: Extend ViewMode and add event storage fields to App

- [ ] T001 Add `CommitList` and `CommitDetail` variants to `ViewMode` enum in `src/tui.rs`
- [ ] T002 Add `event_history: Vec<(git2::Oid, Event)>` and `event_list_state: ListState` fields to App struct in `src/tui.rs`
- [ ] T003 Add `signature_results: Vec<SignatureVerificationResult>` field to App struct in `src/tui.rs`
- [ ] T004 Add helper method `fn action_type_label(action: &Action) -> &str` to format event types for display in `src/tui.rs`

**Checkpoint**: App compiles with new fields and ViewMode variants; existing functionality unaffected

---

## Phase 2: User Story 1 - View Event History (Priority: P1) 🎯 MVP

**Goal**: User presses `c` in detail pane to see scrollable event list with type, author, timestamp

**Independent Test**: Select an issue/patch, press `c`, verify event list appears with chronological events

### Implementation for User Story 1

- [ ] T005 [US1] Handle `c` keypress in detail pane Normal mode: construct ref name from selected item ID, call `dag::walk_events()`, store results in `event_history`, set `mode` to `CommitList` in `src/tui.rs`
- [ ] T006 [US1] Handle Up/Down navigation in `CommitList` mode using `event_list_state` in `src/tui.rs`
- [ ] T007 [US1] Handle Escape in `CommitList` mode: clear event history, return to `Details` mode in `src/tui.rs`
- [ ] T008 [US1] Render event list in detail pane when `mode` is `CommitList` — show each event as `EventType | author_name | timestamp` in a scrollable List widget in `src/tui.rs`
- [ ] T009 [US1] Handle error from `walk_events()`: show error in `status_msg` and stay in current mode in `src/tui.rs`

**Checkpoint**: User Story 1 fully functional — user can browse event history for any item

---

## Phase 3: User Story 2 - Inspect Individual Event Details (Priority: P2)

**Goal**: User selects an event and presses Enter to see full details including commit ID, author email, payload

**Independent Test**: Open event list, press Enter on an event, verify detail view shows commit ID, author, type, and payload content

### Implementation for User Story 2

- [ ] T010 [US2] Handle Enter in `CommitList` mode: set `mode` to `CommitDetail` in `src/tui.rs`
- [ ] T011 [US2] Handle Escape in `CommitDetail` mode: return to `CommitList` mode in `src/tui.rs`
- [ ] T012 [US2] Add helper method `fn format_event_detail(oid: &Oid, event: &Event) -> String` that formats commit ID (7-char short hash), author name+email, timestamp, event type, and action-specific payload in `src/tui.rs`
- [ ] T013 [US2] Render event detail in detail pane when `mode` is `CommitDetail` — show formatted detail as a scrollable Paragraph in `src/tui.rs`
- [ ] T014 [US2] Handle scroll (Up/Down or PageUp/PageDown) in `CommitDetail` mode for long content in `src/tui.rs`

**Checkpoint**: User Stories 1 AND 2 both work — full browse and inspect flow functional

---

## Phase 4: User Story 3 - Signature Status (Priority: P3)

**Goal**: Each event shows signature verification status in the list and in detail view

**Independent Test**: Open event list for signed items, verify signature indicators appear

### Implementation for User Story 3

- [ ] T015 [US3] On entering `CommitList` mode, also call `signing::verify_ref()` and store results in `signature_results` in `src/tui.rs`
- [ ] T016 [US3] Update event list rendering to prepend signature icon (`✓`/`✗`/`?`/`-`) from matched `SignatureVerificationResult` in `src/tui.rs`
- [ ] T017 [US3] Update event detail rendering to include signature status and public key (if present) from `SignatureVerificationResult` in `src/tui.rs`

**Checkpoint**: All user stories independently functional with signature verification

---

## Phase 5: Polish & Cross-Cutting Concerns

**Purpose**: Edge case handling and UX refinement

- [ ] T018 Ensure `c` keypress is ignored when not in detail pane or when no item is selected in `src/tui.rs`
- [ ] T019 Ensure `c` keypress is ignored during all input modes (Search, CreateTitle, CreateBody) — guard against all non-Normal InputMode variants in `src/tui.rs`

---

## Dependencies & Execution Order

### Phase Dependencies

- **Setup (Phase 1)**: No dependencies — T001-T004 must complete first
- **User Story 1 (Phase 2)**: Depends on Phase 1 (ViewMode variants and fields exist)
- **User Story 2 (Phase 3)**: Depends on Phase 2 (event list loaded and navigable)
- **User Story 3 (Phase 4)**: Depends on Phase 2 (event list exists to add indicators to)
- **Polish (Phase 5)**: Depends on all user stories being complete

### Parallel Opportunities

- T002 and T003 can be done in parallel (independent fields)
- US3 (Phase 4) can be done in parallel with US2 (Phase 3) — signature display is independent of detail view
- Polish tasks T018 and T019 are independent

---

## Implementation Strategy

### MVP First (User Story 1 Only)

1. Complete Phase 1: Setup (ViewMode + fields)
2. Complete Phase 2: User Story 1 (event list browsing)
3. **STOP and VALIDATE**: Test event browsing works
4. Proceed to Phase 3-4

### Incremental Delivery

1. Setup → ViewMode extended, fields added
2. Add US1 → Event list browsing works (MVP!)
3. Add US2 → Event detail inspection works
4. Add US3 → Signature status shown
5. Polish → Edge cases handled

---

## Notes

- All changes in single file (`src/tui.rs`) — limited parallel editing
- `dag::walk_events()` and `signing::verify_dag()` are read-only dependencies
- Total tasks: 19
- Tasks per story: Setup=4, US1=5, US2=5, US3=3, Polish=2
- Suggested MVP scope: Phase 1 + Phase 2 (event list browsing)