[Bug][Tempo] Worklog domain ids lack the connection id, so connections with the same worklog id overwrite each other

Ouverte Adaptée aux débutants
#9,330 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Les mainteneurs répondent en général sous 2 jours

@ShivamSharma43 y travaille déjà.

Depuis le 4/11/2026.

  • #9331 par @ShivamSharma43 — ouverte

Évaluation

Difficulté
2/5
Temps estimé
1-3 heures
Accessibilité débutants
78/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
go

Piste de recherche

Commence par backend/plugins/tempo/tasks/worklog_convertor.go et examine comment il construit l’ID de domaine du worklog ; compare-le à la clé primaire de TempoWorklog et aux autres ID propres à une connexion décrits dans l’issue. Ajoute un test unitaire couvrant des ID de worklog identiques provenant de deux connexions. Le travail est terminé lorsque chaque connexion produit une ligne issue_worklogs distincte et que le test réussit.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Search before asking
  • I had searched in the issues and found no similar issues.
What happened

The Tempo convert_worklogs subtask (backend/plugins/tempo/tasks/worklog_convertor.go) builds the issue_worklogs id from the Tempo worklog id alone:

domainWorklogId := fmt.Sprintf("tempo:TempoWorklog:%d", tempoWorklog.TempoWorklogId)

The tool layer keys worklogs by (connection_id, tempo_worklog_id) (models.TempoWorklog), and the other ids of the same row (jira:JiraIssue:<conn>:<id>, jira:JiraAccount:<conn>:<id>) carry the connection id. Domain ids that didgen generates for other plugins carry it too. The worklog id doesn't.

So when two Tempo connections have a worklog with the same tempoWorklogId (two connections to the same Tempo instance, or two instances whose worklog ids overlap), both convert to the same issue_worklogs primary key. The connection converted last overwrites the other connection's row (its issue_id, author_id and _raw_data_params), so one of the two worklogs disappears from the domain layer.

Example: connection 1 and connection 2 both have worklog 12345. After converting connection 1 and then connection 2, issue_worklogs has one row, tempo:TempoWorklog:12345, which points to jira:JiraIssue:2:.... Connection 1's worklog is gone. Re-running connection 1 brings it back and drops connection 2's.

What do you expect to happen

Each connection's worklog gets its own domain row: tempo:TempoWorklog:<connectionId>:<tempoWorklogId>, the id didgen would generate from the TempoWorklog primary key.

How to reproduce
  1. Create two Tempo connections (ids 1 and 2) that both return a worklog with the same tempoWorklogId.
  2. Collect, extract and convert worklogs for a team scope of each connection.
  3. SELECT id, issue_id, _raw_data_params FROM issue_worklogs WHERE id LIKE 'tempo:%' shows one row for that worklog instead of two.
Anything else

Proposed fix (I have a PR ready): add the connection id to the domain worklog id and add a unit test. No migration is needed: the converter is a full-sync DataConverter, so its first batch deletes the scope's old rows (same _raw_data_table / _raw_data_params) before it saves the rows with the new ids.

Version

main

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
Langage dominant
Go
Étoiles
3.2k
Forks
832
Merge moyen
1 j 21 h
PR mergées (30 j)
78

Préparer son environnement

Ouvrir dans Codespaces

Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.

  • Aucun Dockerfile ni fichier Docker Compose
  • Propose un modèle de pull request
  • Aucun guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de apache/devlake

Toutes les issues de apache/devlake

Issues similaires

Plus d'issues Go

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.