feat(activity): add shared data types for activity cache #284

Merged
fuzzy merged 1 commit from phase01-types into main 2026-07-07 07:52:28 +00:00
Owner

What

Add internal/activity/types.go with shared data types for the daily activity cache, the foundation for Phase 1 of the activity view feature.

Types defined

  • ContextType — string enum (user, repo, org) for scoping activity data
  • DailyActivity — one day of aggregated metrics (PRs opened/closed, issues opened/closed, additions/deletions, fetch timestamp)
  • ActivityWindow — 7-day window container with context info and cached-at timestamp
  • CurrentDateTTL — cache TTL constant (5 * time.Minute) for the current (volatile) day

Why

First step toward the activity view feature. These types are the data contract between the SQLite cache layer, the Forgejo API fetcher, and the sparkline renderer.

References: #181, #177, #178, #179, #180

Testing

  • 7 subtests covering ContextType values, zero-value invariants, round-trip field assignment, and CachePolicy constant
  • go build ./internal/activity/ passes
  • All pre-commit hooks pass
## What Add `internal/activity/types.go` with shared data types for the daily activity cache, the foundation for Phase 1 of the activity view feature. ### Types defined - **ContextType** — string enum (`user`, `repo`, `org`) for scoping activity data - **DailyActivity** — one day of aggregated metrics (PRs opened/closed, issues opened/closed, additions/deletions, fetch timestamp) - **ActivityWindow** — 7-day window container with context info and cached-at timestamp - **CurrentDateTTL** — cache TTL constant (`5 * time.Minute`) for the current (volatile) day ## Why First step toward the activity view feature. These types are the data contract between the SQLite cache layer, the Forgejo API fetcher, and the sparkline renderer. References: #181, #177, #178, #179, #180 ## Testing - [x] 7 subtests covering ContextType values, zero-value invariants, round-trip field assignment, and CachePolicy constant - [x] `go build ./internal/activity/` passes - [x] All pre-commit hooks pass
feat(activity): add shared data types for activity cache
Some checks failed
Test and Release / lint (pull_request) Has been cancelled
Test and Release / test (pull_request) Has been cancelled
135ae51d4d
- ContextType enum (user, repo, org)
- DailyActivity struct with all metrics
- ActivityWindow struct containing 7-day data
- CurrentDateTTL constant (5 min)
- Table-driven tests for all types and zero values

Ref: #181, #177, #178, #179, #180
fuzzy force-pushed phase01-types from 135ae51d4d
Some checks failed
Test and Release / lint (pull_request) Has been cancelled
Test and Release / test (pull_request) Has been cancelled
to 75ff7d2b37
All checks were successful
Test and Release / test (pull_request) Successful in 1m57s
Test and Release / lint (pull_request) Successful in 11m17s
2026-07-07 07:41:07 +00:00
Compare
the.auditor left a comment

Review

Result: Approved — no blocking issues.

Summary: Adds internal/activity/types.go with shared data types (ContextType, DailyActivity, ActivityWindow, CurrentDateTTL) for the activity cache feature. 7 table-driven subtests covering enum values, zero-value invariants, field assignment, and cache policy constant.

Non-blocking suggestions (filed as issues):

  • #285 — Add package-level godoc to internal/activity
  • #286 — Document CurrentDateTTL rationale
  • #287 — Clarify Date field timezone semantics

Checklist:

  • Correctness: Types are well-structured and correct
  • Completeness: Covers all needed types for Phase 1 data contract
  • Test coverage: 7 subtests covering invariants and round-trip
  • Maintainability: Clean, minimal, single-responsibility package
## Review **Result: Approved** — no blocking issues. **Summary:** Adds `internal/activity/types.go` with shared data types (`ContextType`, `DailyActivity`, `ActivityWindow`, `CurrentDateTTL`) for the activity cache feature. 7 table-driven subtests covering enum values, zero-value invariants, field assignment, and cache policy constant. **Non-blocking suggestions (filed as issues):** - #285 — Add package-level godoc to `internal/activity` - #286 — Document `CurrentDateTTL` rationale - #287 — Clarify Date field timezone semantics **Checklist:** - Correctness: ✅ Types are well-structured and correct - Completeness: ✅ Covers all needed types for Phase 1 data contract - Test coverage: ✅ 7 subtests covering invariants and round-trip - Maintainability: ✅ Clean, minimal, single-responsibility package
fuzzy scheduled this pull request to auto merge when all checks succeed 2026-07-07 07:45:36 +00:00
fuzzy merged commit 75ff7d2b37 into main 2026-07-07 07:52:28 +00:00
fuzzy deleted branch phase01-types 2026-07-07 07:52:28 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
3 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!284
No description provided.