Emit null pushed_at instead of a zero date for commits#778
Conversation
GitHub deprecated the GraphQL Commit.pushedDate field and now always returns null for it (verified against the live API). The commits and commit-files queries mapped that null straight into a time.Time field, so every row showed a bogus pushed_at of 0001-01-01 instead of an empty value. Make the pushed_at field nullable and emit nil when the pushed date is absent, so it renders as a null cell rather than the Go zero date. Fixes grafana#469 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
|
|
2 similar comments
|
|
|
|
What this PR does
Fixes #469.
The Commits (and Commit Files) query types show an incorrect
pushed_attimestamp — every row is0001-01-01.The root cause is that GitHub deprecated the GraphQL
Commit.pushedDatefield and now always returnsnullfor it. Verified against the live API:{ repository(name:"github-datasource", owner:"grafana") { object(expression:"main") { ... on Commit { history(first:5) { nodes { committedDate authoredDate pushedDate } } } } } }→
pushedDateisnullfor every commit (committedDate/authoredDateare populated).The code mapped that null straight into a non-nullable
time.Timefield, so it surfaced as the Go zero date0001-01-01on every row.Fix
Make
pushed_atnullable (*time.Time) and emitnilwhen the pushed date is absent, so it renders as a null cell instead of a bogus zero date. Applied to both the commits and commit-files frames via a smallnullableTimehelper.Tests
Updated
TestCommitsDataframeso the first commit has no pushed date (matching real API behavior) and the second keeps one, exercising both the null and populated paths. Golden files regenerated —pushed_atis now"nullable": trueand the null commit yieldsnull.go test ./pkg/...is green.