Skip to content

fix(testmo): read the page count from the top-level last_page - #9333

Open
ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/testmo-pagination
Open

ShivamSharma43 wants to merge 1 commit into
apache:mainfrom
ShivamSharma43:fix/testmo-pagination

Conversation

@ShivamSharma43

Copy link
Copy Markdown
Contributor

Summary

The Testmo collectRuns, collectMilestones and collectAutomationRuns subtasks only collected the first page (100 items) of a project.

They use GetTotalPagesFromResponse, which read the page count from meta.total_pages. Testmo list responses have no meta object: per the Testmo REST API spec (RunPage, MilestonePage, AutomationRunPage), page, prev_page, next_page, last_page, per_page and total are top-level fields next to result. The plugin's remote scope API already reads them there (ProjectPage in api/remote_api.go). So the function always returned 1 and the ApiCollector never requested page 2.

Changes:

  • tasks/shared.go: GetTotalPagesFromResponse reads the top-level last_page, and returns 1 when it is null or below 2.
  • tasks/shared_test.go (new): first page of three, a single page, and an empty result (last_page: null).

models.TestmoResponse is no longer used by the collectors. I left it in place to keep the change small.

Does this close any open issues?

Closes #9332

Screenshots

N/A

Other Information

  • go test ./plugins/testmo/...: pass. The "first of several pages" case fails on main (expected 3, got 1).
  • go vet, gofmt and golangci-lint run ./plugins/testmo/...: clean.
  • No open PR touches the testmo plugin.
  • Suggested label: pr-type/bug-fix.
  • AI assistance disclosure: this change was prepared with the help of Claude Code (Claude Opus 5.5). I reviewed the diff and the Testmo API spec it relies on. The commit carries a Generated-by: trailer per the ASF generative tooling guidance.

🤖 Generated with Claude Code

GetTotalPagesFromResponse read meta.total_pages, but Testmo list
responses (RunPage, MilestonePage, AutomationRunPage) have no meta
object: page, next_page, last_page, per_page and total are top-level
fields. The function always returned 1, so collectRuns,
collectMilestones and collectAutomationRuns only collected the first
100 items of a project. Read last_page instead.

Closes apache#9332

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 4, 2026 12:29

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][Testmo] Runs, milestones and automation runs: only the first 100 are collected

2 participants