[Bug][Testmo] Runs, milestones and automation runs: only the first 100 are collected

Aperta Adatta ai principianti
#9,332 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

@ShivamSharma43 ci sta già lavorando.

Dal 4/11/2026.

  • #9333 di @ShivamSharma43 — aperta

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
go

Direzione di ricerca

Inizia con GetTotalPagesFromResponse in backend/plugins/testmo/tasks/shared.go e confronta il modo in cui analizza la paginazione con ProjectPage in backend/plugins/testmo/api/remote_api.go. Aggiungi un test unitario che utilizzi la risposta last_page di primo livello descritta nell’issue, quindi verifica che la funzione restituisca 3 (e gestisca un valore null come 1). Il lavoro è completato quando le esecuzioni, i milestone e le esecuzioni di automazione possono richiedere pagine tramite last_page.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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

The Testmo collectRuns, collectMilestones and collectAutomationRuns subtasks only collect the first page (100 items) of a project.

They all use GetTotalPagesFromResponse in backend/plugins/testmo/tasks/shared.go, which reads the page count from meta.total_pages:

body := &models.TestmoResponse{} // data, links, meta, errors
...
if meta, ok := body.Meta.(map[string]interface{}); ok {
    if totalPages, exists := meta["total_pages"]; exists { ... }
}
return 1, nil

Testmo list responses have no meta object. The pagination fields are at the top level of the body: the Testmo REST API spec (RunPage, MilestonePage, AutomationRunPage) lists page, prev_page, next_page, last_page, per_page, total and result. The plugin's own remote scope API already reads this format (ProjectPage in backend/plugins/testmo/api/remote_api.go follows next_page). So meta is always nil, the function always returns 1, and the ApiCollector never requests page 2.

What do you expect to happen

All runs, milestones and automation runs of the project are collected, i.e. the collectors fetch pages 2..last_page.

How to reproduce
  1. Add a Testmo project with more than 100 runs (or milestones / automation runs) as a data scope.
  2. Run the blueprint.
  3. _raw_testmo_runs (and _tool_testmo_runs) hold only 100 rows for the project, while the project's run_count is higher.

A unit test that passes {"page": 1, "next_page": 2, "last_page": 3, "per_page": 100, "total": 250, "result": [...]} to GetTotalPagesFromResponse gets 1 instead of 3.

Anything else

Proposed fix (I have a PR ready): read the top-level last_page in GetTotalPagesFromResponse (1 when it is null), plus a unit test.

Version

main

Are you willing to submit PR?
  • Yes I am willing to submit a PR!
Code of Conduct
Lingua principale
Go
Stelle
3.2k
Fork
832
Merge medio
1g 21h
PR unite (30g)
78

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

  • Nessun Dockerfile né file Docker Compose
  • Ha un modello di pull request
  • Nessuna guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di apache/devlake

Tutte le issue di apache/devlake

Issue simili

Altre issue su Go

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.