Skip to content

Emit null pushed_at instead of a zero date for commits#778

Open
Tarasusrus wants to merge 1 commit into
grafana:mainfrom
Tarasusrus:fix/commits-pushed-at-null
Open

Emit null pushed_at instead of a zero date for commits#778
Tarasusrus wants to merge 1 commit into
grafana:mainfrom
Tarasusrus:fix/commits-pushed-at-null

Conversation

@Tarasusrus

Copy link
Copy Markdown

What this PR does

Fixes #469.

The Commits (and Commit Files) query types show an incorrect pushed_at timestamp — every row is 0001-01-01.

The root cause is that GitHub deprecated the GraphQL Commit.pushedDate field and now always returns null for it. Verified against the live API:

{ repository(name:"github-datasource", owner:"grafana") {
    object(expression:"main") { ... on Commit { history(first:5) { nodes {
      committedDate authoredDate pushedDate
} } } } } }

pushedDate is null for every commit (committedDate/authoredDate are populated).

The code mapped that null straight into a non-nullable time.Time field, so it surfaced as the Go zero date 0001-01-01 on every row.

Fix

Make pushed_at nullable (*time.Time) and emit nil when 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 small nullableTime helper.

Tests

Updated TestCommitsDataframe so 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_at is now "nullable": true and the null commit yields null. go test ./pkg/... is green.

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>
@Tarasusrus Tarasusrus requested a review from a team as a code owner July 4, 2026 07:08
@cla-assistant

cla-assistant Bot commented Jul 4, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

2 similar comments
@cla-assistant

cla-assistant Bot commented Jul 4, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@cla-assistant

cla-assistant Bot commented Jul 4, 2026

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

@mattvella07 mattvella07 self-assigned this Jul 10, 2026

@mattvella07 mattvella07 left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: commits query type has incorrect pushed_at timestamp

3 participants