feat(activity): implement two-pass render pipeline #308

Merged
fuzzy merged 1 commit from phase04-render-pipeline into main 2026-07-07 10:28:58 +00:00
Owner

What

Implement the two-pass render pipeline on the View coordinator, completing #224.

Changes

Method Purpose
RenderPass1(width) Synchronous render from cache — no API calls, sub-millisecond
RenderPass2(ctx) Async background refresh — checks staleness, fetches, upserts
Render(width) Checks staleness, marks stale graphs, delegates to RenderPass1
StaleGraphs() Returns []string of graphs needing refresh
NeedsRefresh() Returns whether any data needs updating
statusLine() Pipe-separated header: Context: user/alice | Last updated: 2m ago

Render pipeline flow

Render(width)
  ├── Checks GetRefreshWindow() for staleness
  ├── Marks individual graphs stale if needed
  └── Delegates to RenderPass1(width)

RenderPass2(ctx)
  ├── If NeedsRefresh: calls Refresh(ctx)
  ├── Clears stale flags
  └── Returns (changed, err)

statusLine() output:
  Context: user/alice  |  Last updated: 2m ago  |  refreshing...

graphKind enum

Tracks per-graph staleness (PRs, Issues, Contributions) for targeted re-renders. StaleGraphs() returns only graphs with stale data.

References: #224, #220, #221, #222, #223

Testing

  • 5 new tests: RenderPass1, RenderPass2, StaleGraphs, statusLine, NeedsRefresh lifecycle
  • 10 total view tests
  • golangci-lint run ./internal/activity/ — 0 issues
  • go test ./... — all pass
## What Implement the two-pass render pipeline on the `View` coordinator, completing #224. ### Changes | Method | Purpose | |--------|---------| | `RenderPass1(width)` | Synchronous render from cache — no API calls, sub-millisecond | | `RenderPass2(ctx)` | Async background refresh — checks staleness, fetches, upserts | | `Render(width)` | Checks staleness, marks stale graphs, delegates to RenderPass1 | | `StaleGraphs()` | Returns `[]string` of graphs needing refresh | | `NeedsRefresh()` | Returns whether any data needs updating | | `statusLine()` | Pipe-separated header: `Context: user/alice \| Last updated: 2m ago` | ### Render pipeline flow ``` Render(width) ├── Checks GetRefreshWindow() for staleness ├── Marks individual graphs stale if needed └── Delegates to RenderPass1(width) RenderPass2(ctx) ├── If NeedsRefresh: calls Refresh(ctx) ├── Clears stale flags └── Returns (changed, err) statusLine() output: Context: user/alice | Last updated: 2m ago | refreshing... ``` ### graphKind enum Tracks per-graph staleness (PRs, Issues, Contributions) for targeted re-renders. `StaleGraphs()` returns only graphs with stale data. References: #224, #220, #221, #222, #223 ## Testing - [x] 5 new tests: RenderPass1, RenderPass2, StaleGraphs, statusLine, NeedsRefresh lifecycle - [x] 10 total view tests - [x] `golangci-lint run ./internal/activity/` — 0 issues - [x] `go test ./...` — all pass
feat(activity): implement two-pass render pipeline
All checks were successful
Test and Release / test (pull_request) Successful in 3m43s
Test and Release / lint (pull_request) Successful in 4m38s
05db214d06
- RenderPass1(width): synchronous render from cache with status line,
  separator, and all sparklines. Sub-millisecond, no API calls.
- RenderPass2(ctx): async background refresh. Checks staleness,
  fetches new data if needed, clears stale flags. Returns (changed, err)
  to signal whether re-render is needed.
- Render(width): intelligently checks staleness first, marks graphs
  stale if missing data, then delegates to RenderPass1.
- StaleGraphs(): returns names of graphs needing refresh (PRs, Issues,
  Contributions).
- statusLine(): pipe-separated header with context, last-updated
  timestamp, and staleness indicators.
- graphKind enum tracks per-graph staleness for targeted re-renders.
- Updated Render() to use statusLine() instead of hardcoded header.

Ref: #224, #220, #221, #222, #223
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 10:25:36 +00:00
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Implements the two-pass render pipeline on View: Render(width) checks staleness and delegates to RenderPass1(width) for synchronous cache render; RenderPass2(ctx) handles async background refresh. New statusLine() uses pipe-separated format with context, timestamp, and stale data indicator. graphKind enum + graphStale array track per-graph staleness. StaleGraphs() and NeedsRefresh() expose state to callers. ROADMAP2.md updated.

Non-blocking:

  • #309 — Add godocs for exported pipeline methods + note unused width param in renderSparklines

Checklist:

  • Correctness: Two-pass flow correct — pass1 renders cache, pass2 refreshes
  • Completeness: #224 sub-tasks all covered — sync render, async update, graph-level triggers, status line
  • Test coverage: 5 new tests (RenderPass1, RenderPass2, StaleGraphs, statusLine, NeedsRefresh lifecycle) — 10 total view tests
  • Maintainability: Clean extraction of statusLine(), renderSparklines() reduces Render complexity
## Review **Result: Approved** — no blocking issues. **Summary:** Implements the two-pass render pipeline on `View`: `Render(width)` checks staleness and delegates to `RenderPass1(width)` for synchronous cache render; `RenderPass2(ctx)` handles async background refresh. New `statusLine()` uses pipe-separated format with context, timestamp, and stale data indicator. `graphKind` enum + `graphStale` array track per-graph staleness. `StaleGraphs()` and `NeedsRefresh()` expose state to callers. ROADMAP2.md updated. **Non-blocking:** - #309 — Add godocs for exported pipeline methods + note unused `width` param in `renderSparklines` **Checklist:** - Correctness: ✅ Two-pass flow correct — pass1 renders cache, pass2 refreshes - Completeness: ✅ #224 sub-tasks all covered — sync render, async update, graph-level triggers, status line - Test coverage: ✅ 5 new tests (RenderPass1, RenderPass2, StaleGraphs, statusLine, NeedsRefresh lifecycle) — 10 total view tests - Maintainability: ✅ Clean extraction of statusLine(), renderSparklines() reduces Render complexity
fuzzy merged commit 05db214d06 into main 2026-07-07 10:28:58 +00:00
fuzzy deleted branch phase04-render-pipeline 2026-07-07 10:28:59 +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!308
No description provided.