ShivamSharma43 opened a new pull request, #9321:
URL: https://github.com/apache/devlake/pull/9321

   ### Summary
   
   Two places in `backend/plugins/tempo/api` read `GET /4/teams` with a single 
request:
   
   - `GetTeams` (`GET /plugins/tempo/connections/{id}/teams`) decoded the 
response into `[]models.TempoTeamResponse`. Tempo v4 returns a page object 
(`PageableTeam`: `self`, `metadata`, `results`), so the endpoint always failed 
with `failed to unmarshal teams response`. Even with the right type, it would 
only have returned the first page.
   - `searchTempoRemoteTeams` (`search-remote-scopes`) sent one `GET 
/4/teams?name=...` without `offset`/`limit`, so it only searched the first 50 
teams the API returned (Tempo's default `limit`). Its `page`/`pageSize` paging 
then worked on that truncated list.
   
   Changes:
   
   - `api/remote.go`: new `listAllTempoTeams` helper. It pages through `GET 
/4/teams` with `offset`/`limit` (keeping the caller's query, e.g. `name`) until 
`metadata.next` is absent, the same pagination signal `listTempoRemoteTeams` 
has used since #9307. `searchTempoRemoteTeams` uses it; its filtering and 
paging are unchanged.
   - `api/connection.go`: `GetTeams` uses the same helper.
   - `api/remote_test.go`: the fake client can serve a body per `offset` and 
records every query. New tests `TestListAllTempoTeams` (follows `next`, keeps 
the `name` filter, stops on the last page) and 
`TestSearchTempoRemoteTeamsSearchesEveryPage` (finds a match on the second API 
page; fails on `main`).
   
   No model, migration or API-surface changes.
   
   ### Does this close any open issues?
   
   Closes #9320
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   - `go test ./plugins/tempo/api/ ./plugins/tempo/tasks/` and the tempo e2e 
tests (`E2E_DB_URL` on a local PostgreSQL 18): pass. `go vet`, `gofmt` and 
`golangci-lint run ./plugins/tempo/...`: clean.
   - Independent of #9319 (team collector/extractor, different files).
   - 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 Tempo API spec it relies 
on. 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]

Reply via email to