feat(activity): implement view coordinator for activity dashboard #306

Merged
fuzzy merged 1 commit from phase04-view-coordinator into main 2026-07-07 10:22:23 +00:00
Owner

What

Add internal/activity/view.go with the main activity view coordinator, completing #219.

View struct

The central coordinator that ties the data pipeline to rendering:

Method Purpose
NewView(client, cache, ctxType, ctxID, username) Initialize with context (user/repo/org)
Refresh(ctx) Load from cache, fetch updates via RefreshContext
Render(width) Produce formatted output string
Window() Access current activity data
Loaded() / LastError() State queries

Render output format

Context: user/alice  [Last updated: 2m ago]

────────────────────────────────────────────────
PRs        ⢀⢂⣄⣆...
Issues     ⢀⢂⢄⣆...
+ Additions ⢀⢂⣄⣆...
- Deletions ⢀⢂⢄⣆...
────────────────────────────────────────────────

States handled

  • Loading: before first Refresh() call
  • Empty: no activity data in window
  • Stale: fetch error with cached fallback (shows [stale data] indicator)
  • Normal: full dashboard with header, sparklines, and timestamp

Roadmap progress

  • #215 — View initialization with context ✓
  • #216 — Grid layout (text-based, heatmap placeholder) ✓
  • #217 — Progressive rendering (cache-first via RefreshContext) ✓
  • #218 — Loading/empty/stale states ✓

References: #219, #215, #216, #217, #218

Testing

  • 5 new tests: creation, pre-load render, full refresh+render, empty data, stale data
  • 38 total subtests in activity package
  • golangci-lint run ./internal/activity/ — 0 issues
  • go test ./... — all pass
## What Add `internal/activity/view.go` with the main activity view coordinator, completing #219. ### View struct The central coordinator that ties the data pipeline to rendering: | Method | Purpose | |--------|---------| | `NewView(client, cache, ctxType, ctxID, username)` | Initialize with context (user/repo/org) | | `Refresh(ctx)` | Load from cache, fetch updates via `RefreshContext` | | `Render(width)` | Produce formatted output string | | `Window()` | Access current activity data | | `Loaded()` / `LastError()` | State queries | ### Render output format ``` Context: user/alice [Last updated: 2m ago] ──────────────────────────────────────────────── PRs ⢀⢂⣄⣆... Issues ⢀⢂⢄⣆... + Additions ⢀⢂⣄⣆... - Deletions ⢀⢂⢄⣆... ──────────────────────────────────────────────── ``` ### States handled - **Loading**: before first `Refresh()` call - **Empty**: no activity data in window - **Stale**: fetch error with cached fallback (shows `[stale data]` indicator) - **Normal**: full dashboard with header, sparklines, and timestamp ### Roadmap progress - [x] #215 — View initialization with context ✓ - [x] #216 — Grid layout (text-based, heatmap placeholder) ✓ - [x] #217 — Progressive rendering (cache-first via RefreshContext) ✓ - [x] #218 — Loading/empty/stale states ✓ References: #219, #215, #216, #217, #218 ## Testing - [x] 5 new tests: creation, pre-load render, full refresh+render, empty data, stale data - [x] 38 total subtests in activity package - [x] `golangci-lint run ./internal/activity/` — 0 issues - [x] `go test ./...` — all pass
feat(activity): implement view coordinator for activity dashboard
All checks were successful
Test and Release / test (pull_request) Successful in 3m46s
Test and Release / lint (pull_request) Successful in 4m21s
acfa539753
- View struct: orchestrates RefreshContext, cache, and renderers
- NewView(client, cache, ctxType, ctxID, username): initialize with
  context (user/repo/org)
- Refresh(ctx): progressive rendering - loads from cache first,
  fetches async updates via RefreshContext
- Render(width): produces formatted output with context header,
  last-updated timestamp, separator line, PR/Issue/Contribution
  sparklines, empty state, stale data indicator
- Loading state before first Refresh, empty state for no data,
  stale indicator on fetch errors with cached fallback

Ref: #219, #215, #216, #217, #218
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Adds internal/activity/view.go with the View coordinator tying the full data pipeline together. NewView initializes with context, Refresh calls RefreshContext (cache-first, then fetch), Render produces formatted output with header, separators, and all 3 sparkline types. States handled: loading, empty, stale (with [stale data] indicator), and normal. ROADMAP2.md updated.

Non-blocking:

  • #307 — Add godoc for View type and NewView constructor

Checklist:

  • Correctness: Data flow correct — RefreshContext handles cache/fetch orchestration
  • Completeness: #215-#218 covered — init, layout, progressive render, state handling
  • Test coverage: 5 tests (creation, pre-load render, full refresh+render, empty data, stale data)
  • Error handling: Stale data indicator on fetch error, loading state before first refresh
  • Maintainability: Clean coordinator pattern, delegates to existing components
## Review **Result: Approved** — no blocking issues. **Summary:** Adds `internal/activity/view.go` with the `View` coordinator tying the full data pipeline together. `NewView` initializes with context, `Refresh` calls `RefreshContext` (cache-first, then fetch), `Render` produces formatted output with header, separators, and all 3 sparkline types. States handled: loading, empty, stale (with `[stale data]` indicator), and normal. ROADMAP2.md updated. **Non-blocking:** - #307 — Add godoc for `View` type and `NewView` constructor **Checklist:** - Correctness: ✅ Data flow correct — RefreshContext handles cache/fetch orchestration - Completeness: ✅ #215-#218 covered — init, layout, progressive render, state handling - Test coverage: ✅ 5 tests (creation, pre-load render, full refresh+render, empty data, stale data) - Error handling: ✅ Stale data indicator on fetch error, loading state before first refresh - Maintainability: ✅ Clean coordinator pattern, delegates to existing components
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 10:19:34 +00:00
fuzzy added this to the Steeper project 2026-07-07 10:21:51 +00:00
fuzzy self-assigned this 2026-07-07 10:21:53 +00:00
fuzzy merged commit acfa539753 into main 2026-07-07 10:22:23 +00:00
fuzzy deleted branch phase04-view-coordinator 2026-07-07 10:22:23 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
2 participants
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
thwap/steeper!306
No description provided.