Skip to content

fix(github): leave lead time unset when an issue closes before creation - #9314

Merged
klesh merged 1 commit into
apache:mainfrom
MRNAQA:fix/github-negative-issue-lead-time
Nov 6, 2026
Merged

klesh merged 1 commit into
apache:mainfrom
MRNAQA:fix/github-negative-issue-lead-time

Conversation

@MRNAQA

@MRNAQA MRNAQA commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

GitHub can return an issue with closedAt before createdAt. We saw this on an issue that was closed and then transferred from another repository: createdAt 2026-11-01T09:49:53Z, closedAt 2026-11-01T09:05:12Z.

Both GitHub issue extractors cast the negative duration to uint:

  • plugins/github/tasks/issue_extractor.go
  • plugins/github_graphql/tasks/issue_extractor.go

The value wraps to 18446744073709551572 in _tool_github_issues.lead_time_minutes. Then Convert Issues fails on every run, and the blueprint stops at that repository:

subtask Convert Issues ended unexpectedly
Error 1264 (22003): Out of range value for column 'lead_time_minutes' at row 96

This PR adds one helper, IssueLeadTimeMinutes, and uses it in both extractors. When the close time is before the creation time, the helper leaves lead time unset. The Linear plugin already does this (plugins/linear/tasks/issue_convertor.go). Other issues keep the same value as before.

Does this close any open issues?

No open issue. Found on v1.0.3-beta18. main has the same code.

Screenshots

None. The change has no UI.

Other Information

  • Tests: new TestIssueLeadTimeMinutes. go vet and go test pass for ./plugins/github/tasks and ./plugins/github_graphql/tasks (Go 1.27, mocks from make mock).
  • The GitLab and Gitee issue extractors use the same cast. I did not change them, because I could not reproduce a negative duration there. I can add them to this PR if you want.
  • Please add the pr-type/bug-fix label. I do not have permission to set labels.

GitHub can report closedAt before createdAt, for example for an issue that
was closed and then transferred from another repository. Both GitHub issue
extractors cast the negative duration to uint, which wraps to
18446744073709551572. The Convert Issues subtask then fails on every run with
MySQL Error 1264 (out of range for issues.lead_time_minutes).

Leave lead time unset in that case, as the Linear plugin already does.

@klesh klesh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good catch.
Thanks for your contribution.

@klesh
klesh merged commit 956c906 into apache:main Nov 6, 2026
10 checks passed
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.

2 participants