Skip to content

fix(bitbucket): follow next when collecting pull request commits - #9373

Open
ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/bitbucket-pr-commit-next
Open

ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/bitbucket-pr-commit-next

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

The Bitbucket Cloud Collect PR Commits subtask stopped after the first page of each pull request's commits.

Its query sets fields to a list of values.* keys only. Bitbucket's partial response returns just the listed fields, so the response had no top-level next. GetNextPageCustomData in tasks/api_common.go reads next and returns api.ErrFinishCollect when it is empty, so on a full first page (100 commits) the collection ended. Pull requests with more than 100 commits were cut off at 100.

Checked against the public API (pagelen=2 on a PR with 6 commits): with fields=values.hash the response is only {"values": [...]}; with fields=values.hash,next it includes "next": ".../commits?pagelen=2&fields=values.hash%2Cnext&page=E8Ux". Details in #9372.

Changes:

  • tasks/pr_commit_collector.go: add next to the fields list. The query closure moves into getPrCommitsQuery, unchanged apart from that.
  • tasks/pr_commit_collector_test.go (new): builds the query, filters a sample response to the requested top-level fields the way Bitbucket does, and checks that GetNextPageCustomData returns the next page token and that the next query sends it as page. It fails without the fix.

The raw table, extractor and converter are unchanged.

Does this close any open issues?

Fixes #9372

Screenshots

N/A

Other Information

  • go test ./plugins/bitbucket/tasks/: pass.
  • go vet ./plugins/bitbucket/tasks/ ./plugins/bitbucket/impl/, gofmt and golangci-lint run ./plugins/bitbucket/tasks/...: clean. (go vet ./plugins/bitbucket/... needs the generated mockery mocks for plugins/bitbucket/api, which aren't in the tree.)
  • No open PR or issue touches the Bitbucket PR commits collector.
  • Suggested label: pr-type/bug-fix.
  • AI assistance disclosure: this change was prepared with the help of Claude Code (Claude Opus 5.5), and I reviewed the diff. The commit carries a Generated-by: trailer per the ASF generative tooling guidance.

🤖 Generated with Claude Code

The PR commits query set a fields filter with only values.* keys.
Bitbucket returns only the listed fields, so the response had no next,
and GetNextPageCustomData ended the collection after the first page.
Pull requests with more than 100 commits were cut off at 100.

Add next to the fields list and move the query into getPrCommitsQuery
with a unit test.

Fixes apache#9372

Generated-by: Claude Code (Claude Opus 5.5)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Shivam Sharma <192242476+ShivamSharma43@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 11, 2026 12:36

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

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][Bitbucket] PR commits collector stops after 100 commits because the fields filter drops next

2 participants