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

   ### Summary
   
   `_tool_tempo_teams` is both the scope table and the output of 
`extract_teams`, but the team subtasks worked on the whole connection: 
`collect-teams` fetched every team of the Tempo instance with raw params 
`{"ConnectionId":1,"TeamId":0}`, and `extract_teams` turned each one into a 
`TempoTeam` with `ScopeConfigId` 0. The extractor's batch save deletes rows 
with the same raw params before inserting, so one team scope's pipeline 
re-created every team scope of the connection:
   
   - teams that were never selected became data scopes of the connection;
   - the selected team scopes lost their scope config (`scope_config_id` reset 
to 0);
   - a team scope deleted from the connection came back on the next run.
   
   Changes (`backend/plugins/tempo/tasks`):
   
   - `team_collector.go`: raw params are now `{ConnectionId, TeamId}`, matching 
`TempoTeam.ScopeParams()` and the worklog collector, so extracting one team 
scope only replaces that team's row. The request filters on the scope's team 
with `teamIds`. The `updatedFrom` parameter is dropped because `GET /4/teams` 
doesn't support it (the Tempo OpenAPI spec lists `offset`, `limit`, 
`teamMembers`, `name`, `teamIds`). The collector is now a plain `ApiCollector`, 
so each run replaces the raw rows; before, an incremental run fetched all teams 
again and appended them.
   - `team_extractor.go`: skips teams other than the scope's team (when 
`teamId` is set) and keeps the `scope_config_id` of existing team scopes.
   - Without a `teamId` option (plain connection-level task), all teams are 
still collected and extracted, as before.
   
   Rows that earlier runs added with the old connection-wide params are left 
untouched (they can't be told apart from scopes the user added on purpose), so 
no migration. Users can remove the unwanted teams from the connection's data 
scopes, and they won't come back.
   
   ### Does this close any open issues?
   
   Closes #9318
   
   ### Screenshots
   
   N/A
   
   ### Other Information
   
   - New unit tests: `TestBuildTeamQuery` (`teamIds` set, no `updatedFrom`) and 
`TestExtractTeam` (other teams skipped, scope config kept).
   - New e2e test `TestTeamScopeExtraction`: two team scopes with scope 
configs, team 71 extracted. Team 71 is refreshed and keeps `scope_config_id = 
3`, and team 17 is untouched. It fails on `main`.
   - `go test ./plugins/tempo/...` and the tempo e2e tests (`E2E_DB_URL` on a 
local PostgreSQL 18): pass. `go vet`, `gofmt` and `golangci-lint run 
./plugins/tempo/...`: clean.
   - Related: #9284 / #9303 (team summary longer than 255 characters). That PR 
touches different files. Since only the scope's own team is extracted now, a 
long summary on some other team no longer breaks `extract_teams`.
   - 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