Skip to content

Fix full-history skyline for accounts created before GitHub's launch - #142

Open
chiliec wants to merge 1 commit into
github:mainfrom
chiliec:fix/full-history-pre-2008
Open

chiliec wants to merge 1 commit into
github:mainfrom
chiliec:fix/full-history-pre-2008

Conversation

@chiliec

@chiliec chiliec commented Oct 16, 2026

Copy link
Copy Markdown

Fixes #136.

Problem

gh skyline -f (full history) sets the start year to the account's join year without bounding it to GitHub's launch year (2008). For accounts created before 2008 (e.g. mojombo, created 2006), this requests contribution data for a pre-launch year, which the API rejects:

Error: failed to fetch contributions: [VALIDATION] year cannot be before GitHub's launch (2008)

Fix

Clamp the computed full-history start year to the launch year in GenerateSkyline, so pre-2008 accounts render from 2008 onward (no contribution data exists earlier). The launch-year constant in internal/utils is exported (GitHubLaunchYear) so the clamp and the existing range validation share one source of truth.

Tests

Added a full range for account created before GitHub's launch case (join year 2006) to TestGenerateSkyline. To make the test meaningful, MockGitHubClient.FetchContributions now enforces the same year >= 2008 contract the real client does — previously the mock accepted any year, which masked this bug.

Validation

Go 1.26.3 on Linux:

  • go test ./... — all packages pass.
  • RED → GREEN confirmed: with the clamp removed, the new case fails with the exact issue error (failed to fetch contributions: [VALIDATION] year cannot be before GitHub's launch (2008)); with the clamp in place it passes.
  • go vet ./... — clean.
  • golangci-lint run on the touched packages — 0 issues.

The -f/--full-history flag set the start year to the account's join year
without bounding it to GitHub's launch year (2008). For accounts created
before 2008 (e.g. mojombo), this requested contribution data for a
pre-launch year, which the API rejects with a validation error.

Clamp the computed start year to the launch year so full-history
skylines work for pre-2008 accounts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Needs Review

Development

Successfully merging this pull request may close these issues.

[Bug]: gh skyline -f fails for accounts created before GitHub's launch

1 participant