Repository navigation
fix(testmo): read the page count from the top-level last_page - #9333
Open
ShivamSharma43 wants to merge 1 commit into
Open
ShivamSharma43 wants to merge 1 commit into
ShivamSharma43 wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
The Testmo
collectRuns,collectMilestonesandcollectAutomationRunssubtasks only collected the first page (100 items) of a project.They use
GetTotalPagesFromResponse, which read the page count frommeta.total_pages. Testmo list responses have nometaobject: per the Testmo REST API spec (RunPage,MilestonePage,AutomationRunPage),page,prev_page,next_page,last_page,per_pageandtotalare top-level fields next toresult. The plugin's remote scope API already reads them there (ProjectPageinapi/remote_api.go). So the function always returned 1 and theApiCollectornever requested page 2.Changes:
tasks/shared.go:GetTotalPagesFromResponsereads the top-levellast_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.TestmoResponseis 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 onmain(expected 3, got 1).go vet,gofmtandgolangci-lint run ./plugins/testmo/...: clean.pr-type/bug-fix.Generated-by:trailer per the ASF generative tooling guidance.🤖 Generated with Claude Code