Skip to content

Fix/bitbucket microsecond timestamp#8765

Open
JakubHelis wants to merge 2 commits intoapache:mainfrom
JakubHelis:fix/bitbucket-microsecond-timestamp
Open

Fix/bitbucket microsecond timestamp#8765
JakubHelis wants to merge 2 commits intoapache:mainfrom
JakubHelis:fix/bitbucket-microsecond-timestamp

Conversation

@JakubHelis
Copy link

Bitbucket Cloud returns timestamps with 6-digit fractional seconds (e.g. 2025-09-15T08:53:36.337932+00:00). The PR extractor used time.Time directly for created_on/updated_on fields, causing a time.ParseError since Go's json.Unmarshal uses RFC3339 which does not accept microseconds.

Fix:

  • Change BitbucketCreatedAt/BitbucketUpdatedAt in BitbucketApiPullRequest struct from time.Time to *common.Iso8601Time
  • Add microsecond format (6-digit fractional seconds) to DateTimeFormats in Iso8601Time, before the existing 3-digit format, so that ConvertStringToTime correctly parses these timestamps

Fixes #8708

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • [ x ] I have read through the Contributing Documentation.
  • [x ] I have added relevant tests.
  • [ x] I have added relevant documentation.
  • [ x] I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

What does this PR do?
Bitbucket Cloud returns timestamps with 6-digit microsecond precision (e.g. 2025-09-15T08:53:36.337932+00:00). The PR extractor stored created_on and updated_on directly as time.Time, which caused a time.ParseError during extraction because Go's json.Unmarshal uses RFC3339 — a format that does not accept microseconds.

Does this close any open issues?

Closes #8708

Screenshots

Other Information

Developed with the assistance of an AI coding agent. While I am not proficient in Go, I have a general software engineering background and verified that the fix is minimal, targeted, and does not introduce regressions.

Bitbucket Cloud returns timestamps with 6-digit fractional seconds (e.g. 2025-09-15T08:53:36.337932+00:00). The PR extractor used time.Time directly for created_on/updated_on fields, causing a time.ParseError since Go's json.Unmarshal uses RFC3339 which does not accept microseconds. Fix: - Change BitbucketCreatedAt/BitbucketUpdatedAt in BitbucketApiPullRequest struct from time.Time to *common.Iso8601Time - Add microsecond format (6-digit fractional seconds) to DateTimeFormats in Iso8601Time, before the existing 3-digit format, so that ConvertStringToTime correctly parses these timestamps Fixes apache#8708
Adds ConvertStringToTime test cases for: - 3-digit millisecond precision (existing format) - 6-digit microsecond precision (Bitbucket Cloud format, fixes apache#8708)
@dosubot dosubot bot added size:S This PR changes 10-29 lines, ignoring generated files. component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug severity/p1 This bug affects functionality or significantly affect ux labels Mar 13, 2026
Copy link
Contributor

@klesh klesh left a comment

Choose a reason for hiding this comment

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

Please fix the linting error so I can merge it.

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

Labels

component/plugins This issue or PR relates to plugins pr-type/bug-fix This PR fixes a bug severity/p1 This bug affects functionality or significantly affect ux size:S This PR changes 10-29 lines, ignoring generated files.

2 participants