hopefully done refining
This commit is contained in:
@@ -1,32 +1,95 @@
|
||||
# Implementation Plan: Track Progress Visualization (track_progress_viz_20260306)
|
||||
|
||||
> **Reference:** [Spec](./spec.md) | [Architecture Guide](../../../docs/guide_architecture.md)
|
||||
|
||||
## Phase 1: Progress Calculation
|
||||
- [ ] Task: Initialize MMA Environment
|
||||
- [ ] Task: Implement progress calculation
|
||||
- WHERE: src/gui_2.py or app_controller
|
||||
- WHAT: Calculate % from ticket states
|
||||
- HOW: Count completed vs total
|
||||
Focus: Calculate progress metrics from ticket states
|
||||
|
||||
## Phase 2: Visualization
|
||||
- [ ] Task: Render progress bar
|
||||
- WHERE: src/gui_2.py
|
||||
- WHAT: Visual progress bar
|
||||
- HOW: imgui.progress_bar
|
||||
- [ ] Task: Render percentage text
|
||||
- WHERE: src/gui_2.py
|
||||
- WHAT: Numeric % display
|
||||
- HOW: imgui.text
|
||||
- [ ] Task 1.1: Initialize MMA Environment
|
||||
- Run `activate_skill mma-orchestrator` before starting
|
||||
|
||||
## Phase 3: Additional Features
|
||||
- [ ] Task: Implement ticket counts
|
||||
- WHERE: src/gui_2.py
|
||||
- WHAT: Completed/remaining counts
|
||||
- HOW: Text display
|
||||
- [ ] Task: Implement ETA
|
||||
- WHERE: src/gui_2.py
|
||||
- WHAT: Time estimate
|
||||
- HOW: Average time per ticket
|
||||
- [ ] Task 1.2: Implement progress calculation function
|
||||
- WHERE: `src/gui_2.py` or helper in `src/project_manager.py`
|
||||
- WHAT: Calculate completion percentage from tickets
|
||||
- HOW:
|
||||
```python
|
||||
def calculate_track_progress(tickets: list[Ticket]) -> dict:
|
||||
total = len(tickets)
|
||||
if total == 0:
|
||||
return {"percentage": 0, "completed": 0, "total": 0, "in_progress": 0, "blocked": 0, "todo": 0}
|
||||
completed = sum(1 for t in tickets if t.status == "completed")
|
||||
in_progress = sum(1 for t in tickets if t.status == "in_progress")
|
||||
blocked = sum(1 for t in tickets if t.status == "blocked")
|
||||
todo = sum(1 for t in tickets if t.status == "todo")
|
||||
percentage = (completed / total) * 100
|
||||
return {"percentage": percentage, "completed": completed, "total": total,
|
||||
"in_progress": in_progress, "blocked": blocked, "todo": todo}
|
||||
```
|
||||
|
||||
## Phase 4: Verification
|
||||
- [ ] Task: Test progress display
|
||||
- [ ] Task: Conductor - Phase Verification
|
||||
## Phase 2: Progress Bar Rendering
|
||||
Focus: Display visual progress bar
|
||||
|
||||
- [ ] Task 2.1: Add progress bar to MMA Dashboard
|
||||
- WHERE: `src/gui_2.py` `_render_mma_dashboard()`
|
||||
- WHAT: Visual progress bar with percentage
|
||||
- HOW:
|
||||
```python
|
||||
progress = calculate_track_progress(self.track.tickets)
|
||||
imgui.text(f"Progress: {progress['completed']}/{progress['total']} tickets")
|
||||
imgui.progress_bar(progress['percentage'] / 100.0, size=(300, 20))
|
||||
imgui.same_line()
|
||||
imgui.text(f"{progress['percentage']:.1f}%")
|
||||
```
|
||||
- SAFETY: Handle empty ticket list
|
||||
|
||||
## Phase 3: Ticket Breakdown Display
|
||||
Focus: Show status breakdown
|
||||
|
||||
- [ ] Task 3.1: Add status breakdown text
|
||||
- WHERE: `src/gui_2.py` `_render_mma_dashboard()`
|
||||
- WHAT: Show counts per status
|
||||
- HOW:
|
||||
```python
|
||||
imgui.text(f"Completed: {progress['completed']}")
|
||||
imgui.text(f"In Progress: {progress['in_progress']}")
|
||||
imgui.text(f"Blocked: {progress['blocked']}")
|
||||
imgui.text(f"Todo: {progress['todo']}")
|
||||
```
|
||||
|
||||
## Phase 4: ETA Estimation
|
||||
Focus: Estimate time remaining
|
||||
|
||||
- [ ] Task 4.1: Track ticket completion times
|
||||
- WHERE: `src/gui_2.py` or `src/app_controller.py`
|
||||
- WHAT: Track average time per completed ticket
|
||||
- HOW:
|
||||
```python
|
||||
self._ticket_start_times: dict[str, float] = {}
|
||||
self._avg_ticket_time: float = 0.0
|
||||
self._completed_count: int = 0
|
||||
# On ticket start: self._ticket_start_times[ticket.id] = time.time()
|
||||
# On ticket complete: elapsed = time.time() - start; update average
|
||||
```
|
||||
|
||||
- [ ] Task 4.2: Calculate and display ETA
|
||||
- WHERE: `src/gui_2.py`
|
||||
- WHAT: Show estimated time remaining
|
||||
- HOW:
|
||||
```python
|
||||
remaining = progress['total'] - progress['completed']
|
||||
eta_seconds = self._avg_ticket_time * remaining
|
||||
eta_minutes = int(eta_seconds / 60)
|
||||
imgui.text(f"ETA: ~{eta_minutes}m ({remaining} tickets remaining)")
|
||||
```
|
||||
|
||||
## Phase 5: Testing
|
||||
Focus: Verify all functionality
|
||||
|
||||
- [ ] Task 5.1: Write unit tests for progress calculation
|
||||
- WHERE: `tests/test_progress_viz.py` (new file)
|
||||
- WHAT: Test percentage calculation, edge cases
|
||||
- HOW: Create mock tickets with various statuses
|
||||
|
||||
- [ ] Task 5.2: Conductor - Phase Verification
|
||||
- Run: `uv run pytest tests/test_progress_viz.py -v`
|
||||
- Manual: Verify progress bar displays correctly
|
||||
|
||||
@@ -1,34 +1,111 @@
|
||||
# Track Specification: Track Progress Visualization (track_progress_viz_20260306)
|
||||
|
||||
## Overview
|
||||
Progress bars and percentage completion for active tracks and tickets.
|
||||
Progress bars and percentage completion for active tracks and tickets. Better visualization of DAG execution state.
|
||||
|
||||
## Current State Audit
|
||||
|
||||
### Already Implemented
|
||||
- **`models.Track`**: Has tickets list
|
||||
- **`project_manager.get_all_tracks()`**: Returns track progress
|
||||
- **GUI**: Shows ticket status but no progress bar
|
||||
### Already Implemented (DO NOT re-implement)
|
||||
|
||||
### Gaps to Fill
|
||||
- No visual progress bar
|
||||
#### Track Model (src/models.py)
|
||||
- **`Track` dataclass**: Has `tickets: list[Ticket]` field
|
||||
- **`Ticket.status`**: "todo" | "in_progress" | "completed" | "blocked"
|
||||
|
||||
#### Track Listing (src/project_manager.py)
|
||||
- **`get_all_tracks()`**: Returns list of track metadata with progress
|
||||
- **Progress calculation exists**: Counts completed vs total tickets
|
||||
|
||||
#### DAG Engine (src/dag_engine.py)
|
||||
- **`TrackDAG`**: Manages ticket dependency graph
|
||||
- **Status tracking via `update_task_status()`**
|
||||
|
||||
### Gaps to Fill (This Track's Scope)
|
||||
- No visual progress bar in GUI
|
||||
- No percentage completion display
|
||||
- No ETA estimation
|
||||
- No ticket breakdown display
|
||||
|
||||
## Architectural Constraints
|
||||
|
||||
### Accurate State
|
||||
- Progress MUST reflect actual ticket status
|
||||
- Count completed, in_progress, blocked, todo separately
|
||||
|
||||
### Efficient Updates
|
||||
- Status changes trigger immediate UI update
|
||||
- No polling - event-driven via MMA state updates
|
||||
|
||||
## Architecture Reference
|
||||
|
||||
### Key Integration Points
|
||||
|
||||
| File | Lines | Purpose |
|
||||
|------|-------|---------|
|
||||
| `src/gui_2.py` | 2650-2750 | MMA Dashboard - add progress display |
|
||||
| `src/project_manager.py` | 289-320 | `get_all_tracks()` - progress data |
|
||||
| `src/dag_engine.py` | 50-80 | Status tracking |
|
||||
|
||||
### Progress Calculation
|
||||
```python
|
||||
def calculate_progress(tickets: list[Ticket]) -> dict:
|
||||
total = len(tickets)
|
||||
completed = sum(1 for t in tickets if t.status == "completed")
|
||||
in_progress = sum(1 for t in tickets if t.status == "in_progress")
|
||||
blocked = sum(1 for t in tickets if t.status == "blocked")
|
||||
todo = sum(1 for t in tickets if t.status == "todo")
|
||||
percentage = (completed / total * 100) if total > 0 else 0
|
||||
return {
|
||||
"total": total, "completed": completed, "in_progress": in_progress,
|
||||
"blocked": blocked, "todo": todo, "percentage": percentage
|
||||
}
|
||||
```
|
||||
|
||||
## Functional Requirements
|
||||
- Progress bar showing % complete
|
||||
- Ticket count: X/Y completed
|
||||
- ETA estimation based on average time per ticket
|
||||
|
||||
## Key Integration Points
|
||||
| File | Purpose |
|
||||
|-----|---------|
|
||||
| `src/gui_2.py` | Progress bar rendering |
|
||||
| `src/dag_engine.py` | Completion calculation |
|
||||
### FR1: Progress Bar
|
||||
- Visual progress bar using `imgui.progress_bar()`
|
||||
- Show 0-100% completion
|
||||
- Color based on progress (red < 25%, yellow < 75%, green >= 75%)
|
||||
|
||||
### FR2: Percentage Text
|
||||
- Display "X% complete" below bar
|
||||
- Show "X/Y tickets completed"
|
||||
|
||||
### FR3: Ticket Breakdown
|
||||
- Show counts: completed, in_progress, blocked, todo
|
||||
- Use colored indicators per status
|
||||
|
||||
### FR4: ETA Estimation
|
||||
- Track average time per completed ticket
|
||||
- Estimate remaining time: `avg_time * remaining_tickets`
|
||||
- Display as "ETA: ~Xm"
|
||||
|
||||
## Non-Functional Requirements
|
||||
|
||||
| Requirement | Constraint |
|
||||
|-------------|------------|
|
||||
| Update Latency | <100ms after status change |
|
||||
| Memory | <100 bytes for ETA state |
|
||||
|
||||
## Testing Requirements
|
||||
|
||||
### Unit Tests
|
||||
- Test progress calculation accuracy
|
||||
- Test ETA estimation logic
|
||||
|
||||
### Integration Tests
|
||||
- Complete tickets, verify progress updates
|
||||
- Verify ETA recalculates
|
||||
|
||||
## Out of Scope
|
||||
- Historical progress tracking
|
||||
- Progress export
|
||||
- Multi-track comparison
|
||||
|
||||
## Acceptance Criteria
|
||||
- [ ] Progress bar renders
|
||||
- [ ] Percentage accurate
|
||||
- [ ] Counts match actual tickets
|
||||
- [ ] ETA calculation works
|
||||
- [ ] 1-space indentation
|
||||
- [ ] Progress bar renders correctly
|
||||
- [ ] Percentage accurate (X/Y completed)
|
||||
- [ ] Ticket breakdown displayed
|
||||
- [ ] ETA estimation works
|
||||
- [ ] Updates on ticket status change
|
||||
- [ ] 1-space indentation maintained
|
||||
|
||||
Reference in New Issue
Block a user