Commit Graph

16 Commits

Author SHA1 Message Date
The App Agency
3931d10af3 fix(dashboard): use registered rigs for merge queue instead of hardcoded repos (#863)
The FetchMergeQueue function was hardcoded to query PRs from
michaellady/roxas and michaellady/gastown, causing the dashboard
to show unrelated PRs regardless of which rigs are actually registered.

This fix:
- Adds townRoot to LiveConvoyFetcher to access workspace config
- Loads registered rigs from mayor/rigs.json dynamically
- Adds gitURLToRepoPath helper to convert git URLs (HTTPS/SSH) to
  owner/repo format for the gh CLI
- Updates comments to reflect the new behavior

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-21 19:11:29 -08:00
Mike Lady
c9b601c429 test(dashboard): Add E2E tests with httptest.Server
Comprehensive end-to-end tests for convoy dashboard:
- TestE2E_Server_FullDashboard: Full dashboard with all sections
- TestE2E_Server_ActivityColors: Activity color rendering (green/yellow/red)
- TestE2E_Server_MergeQueueEmpty: Always-visible section with empty state
- TestE2E_Server_MergeQueueStatuses: All PR status combinations
- TestE2E_Server_HTMLStructure: HTML document structure validation
- TestE2E_Server_RefineryInPolecats: Refinery appears in workers section

Tests use httptest.NewServer for real HTTP server testing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:25:37 -08:00
Mike Lady
f30f46192f test(dashboard): Add unit tests for convoy dashboard fetcher
Add table-driven tests for:
- calculateWorkStatus: complete, active, stale, stuck, waiting states
- determineCIStatus: pass, fail, pending with various check combinations
- determineMergeableStatus: ready, conflict, pending states
- determineColorClass: mq-green, mq-yellow, mq-red combinations
- getRefineryStatusHint: idle, singular, multiple PR messages
- truncateStatusHint: line truncation to 60 chars with ellipsis
- parsePolecatSessionName: gt-<rig>-<polecat> parsing
- isWorkerSession: worker vs non-worker session detection
- parseActivityTimestamp: Unix timestamp parsing from tmux

Also refactors inline logic into testable helper functions.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:23:45 -08:00
Mike Lady
d967b33c00 test(dashboard): Add comprehensive integration tests for ConvoyHandler
Added 11 new integration tests covering:
- Error handling: FetchConvoys error returns 500
- Merge queue rendering: PR numbers, repos, CI status badges
- Empty merge queue state
- Polecat workers rendering: names, rigs, activity colors, status hints
- Work status rendering: complete/active/stale/stuck/waiting states
- Progress bar rendering with percentage calculation
- HTMX auto-refresh attributes (hx-get, hx-trigger, every 10s)
- Full dashboard integration with all sections
- Non-fatal errors: merge queue/polecat failures don't break convoys

Tests use MockConvoyFetcher interface to simulate various data scenarios.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:23:06 -08:00
Mike Lady
d0bdbc4499 feat(dashboard): Always show Refinery Merge Queue section
The Refinery Merge Queue section now displays always, even when idle:
- Shows 'No PRs in queue' message when merge queue is empty
- Displays PR table with number, title, CI status, and mergeable when PRs exist
- Added empty-state-inline CSS for consistent styling

Previously the section was hidden entirely when no PRs existed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:18:49 -08:00
Mike Lady
8ec7bbd8ab fix(dashboard): Use window_activity for more accurate polecat timing
session_activity only updates on session-level events. window_activity
tracks actual window activity (keypresses, output) for more accurate
last activity times in the Polecat Workers section.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:14:31 -08:00
Mike Lady
fe72bd4ddc feat(dashboard): Add dynamic work status column for convoys
The status column now shows computed work status based on progress and activity:
- "complete" (green) - all tracked items are done
- "active" (green) - recent polecat activity (within 1 min)
- "stale" (yellow) - older activity (1-5 min)
- "stuck" (red) - stale activity (5+ min)
- "waiting" (gray) - no assignee/activity

Previously the status column always showed "open" since we only fetch
open convoys, making it static and uninformative.

Changes:
- templates.go: Add WorkStatus field to ConvoyRow, add workStatusClass func
- fetcher.go: Add calculateWorkStatus() to compute status from progress/activity
- convoy.html: Add work status badge styling, use WorkStatus in table

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 18:03:51 -08:00
Mike Lady
6e8c43fc0f fix(lint): Add nolint directive for GitHub API spelling
The misspell linter flags "cancelled" but this is the actual value
returned by GitHub's Check Runs API (British spelling). Added nolint
directive with explanation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:57:20 -08:00
Mike Lady
9a02d18101 Merge fix/convoy-last-activity into feature/convoy-dashboard
Merges PR #85 (fix/convoy-last-activity) into PR #71 (feature/convoy-dashboard).
Resolved conflict in fetcher.go by taking the simplified tmux-based activity tracking.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:39:22 -08:00
Mike Lady
565b2a0d52 feat(dashboard): Add Polecat Workers section with activity monitoring
- Add FetchPolecats() to fetch tmux session data for active polecats
- Display polecat name, rig, activity status (green/yellow/red)
- Show status hint from last line of pane output
- Add FetchMergeQueue stub for interface compliance
- Update handler to pass polecats data to template
- Add Polecat Workers table section to convoy.html

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:34:22 -08:00
Mike Lady
6d4f2c40d1 fix(test): Update htmx refresh test to expect 10s interval
The template was updated to refresh every 10s (2bb1f1e) but the test
still expected 30s. Update test to match the new intended behavior.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:22:39 -08:00
Mike Lady
2bb1f1e726 feat(dashboard): Increase auto-refresh rate to every 10 seconds
Changed htmx trigger from 30s to 10s for faster convoy status updates.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:17:35 -08:00
Mike Lady
f512598783 fix(dashboard): Handle unassigned convoys and show fallback activity
Improvements to convoy dashboard last_activity column:

1. When issues have no assignee:
   - Fall back to issue's updated_at timestamp
   - Show age with "(unassigned)" suffix, e.g., "2m (unassigned)"

2. When issues have assignee but no active tmux session:
   - Show "idle" instead of "no activity"

3. Added UpdatedAt field to track issue timestamps

This provides better context for convoys that haven't been assigned yet.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:12:26 -08:00
Mike Lady
d7b035dc66 fix(dashboard): Use tmux session activity for convoy last_activity
The convoy dashboard last_activity column was showing "no activity" because
the old code looked for agent records in beads databases at wrong paths.

Changed approach:
- Use the issue's assignee field (e.g., "roxas/polecats/dag")
- Parse assignee to get rig and polecat name
- Query tmux for session activity directly (#{session_activity})

This is more reliable since it uses actual tmux session state instead of
trying to find agent records in beads databases.

Fixes hq-kdhf

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 17:00:06 -08:00
dag
fc805595bb Add Convoy Tracking Web UI Dashboard (hq-vr35)
Complete convoy dashboard feature with real-time status tracking:

- Activity package: LastActivity calculation with color thresholds
  (green <2min, yellow 2-5min, red >5min)
- Web package: Template, handler, fetcher for convoy list
- CLI: `gt dashboard [--port=8080] [--open]` command
- Browser E2E tests with rod (headless Chrome)

Features:
- Real-time convoy status with htmx auto-refresh (30s)
- Progress tracking for each convoy
- Last activity indicator with color coding
- Empty state handling

Supersedes: PRs #55, #57, #58, #65, #66

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 16:23:44 -08:00
Mike Lady
3488933cc2 Add 'gt dashboard' CLI command (hq-s1bg) (#65)
* Add LastActivity calculation for convoy dashboard (hq-x2xy)

Adds internal/activity package with color-coded activity tracking:
- Green: <2 minutes (active)
- Yellow: 2-5 minutes (stale)
- Red: >5 minutes (stuck)

Features:
- Calculate() function returns Info with formatted age and color class
- Helper methods: IsActive(), IsStale(), IsStuck()
- Handles edge cases: zero time, future time (clock skew)

Tests: 8 test functions with 25 sub-tests covering all thresholds.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add convoy dashboard HTML template with Last Activity (hq-fq1g)

Adds internal/web package with convoy dashboard template:
- convoy.html with Last Activity column and color coding
- Green (<2min), Yellow (2-5min), Red (>5min) activity indicators
- htmx auto-refresh every 30 seconds
- Progress bars for convoy completion
- Status indicators for open/closed convoys
- Empty state when no convoys

Also includes internal/activity package (dependency from hq-x2xy):
- Calculate() returns Info with formatted age and color class
- Helper methods: IsActive(), IsStale(), IsStuck()

Tests: 6 template tests + 8 activity tests, all passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add convoy list handler with activity data (hq-3edt)

Adds HTTP handler that wires convoy dashboard template to real data:
- ConvoyHandler: HTTP handler for GET / rendering convoy dashboard
- LiveConvoyFetcher: Fetches convoys from beads with activity data
- ConvoyFetcher interface: Enables mocking for tests

Features:
- Fetches open convoys from town beads
- Calculates progress (completed/total) from tracked issues
- Gets Last Activity from worker agent beads
- Color codes activity: Green (<2min), Yellow (2-5min), Red (>5min)

Includes dependencies (not yet merged):
- internal/activity: Activity calculation (hq-x2xy)
- internal/web/templates: HTML template (hq-fq1g)

Tests: 5 handler tests + 6 template tests + 8 activity tests = 19 total

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* Add 'gt dashboard' CLI command (hq-s1bg)

Add dashboard command to start the convoy tracking web server.

Usage: gt dashboard [--port=8080] [--open]

Features:
- --port: Configurable HTTP port (default 8080)
- --open: Auto-open browser on start
- Cross-platform browser launch (darwin/linux/windows)
- Graceful workspace detection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-03 11:49:42 -08:00