ShivamSharma43 opened a new pull request, #9381: URL: https://github.com/apache/devlake/pull/9381
### Summary `CollectUserSpend` paged `POST /teams/spend` with `nextPostPage`. That function was written for `filtered-usage-events` and stops unless the response has `pagination.hasNextPage: true`. The spend endpoint has no `pagination` object. Per the [Admin API docs](https://cursor.com/docs/account/teams/admin-api) ("Get Spending Data"), it returns `teamMemberSpend`, `subscriptionCycleStart`, `totalMembers` and a top-level `totalPages`. Because `hasNextPage` always decoded as `false`, the collector stopped after page 1. With `pageSize` 100, teams with more than 100 members lost the spend of every member past the first page. Changes: - `tasks/user_spend_collector.go`: new `nextSpendPage` reads the top-level `totalPages`. It requests the next page until the current page reaches `totalPages`, and stops right away when `totalPages` is 0 (no members). `CollectUserSpend` now uses it. `nextPostPage` is unchanged for usage events and daily usage, which do return `pagination.hasNextPage`. - `tasks/user_spend_collector_test.go`: tests that pages continue from 1 to 2 to 3 when `totalPages` is 3 and stop on the last page. Also covers single-page and empty responses. ### Does this close any open issues? Closes #9379 ### Screenshots N/A ### Other Information - `go test ./plugins/cursor/...`: pass. - `gofmt` and `golangci-lint run ./plugins/cursor/...`: clean. - No open PR touches the cursor plugin. - 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](https://claude.com/claude-code) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
