[Bug] Jira worklogs not collected when issue has fewer than 20 worklogs
- Dominant language
- Go
- Stars
- 3.1k
- Forks
- 808
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 49
Description
### Search before asking
- [x] I had searched in the [issues](https://github.com/apache/incubator-devlake/issues?q=is%3Aissue) and found no similar issues.
### What happened
Jira issue worklogs are not collected by DevLake when a Jira issue has fewer than 20 worklogs. Issues with 20+ worklogs are collected correctly.
Steps to reproduce
1. Configure a Jira connection and scope with worklog collection enabled.
2. Trigger a pipeline run.
3. Observe that worklogs for Jira issues with fewer than 20 worklogs do not appear in the jira_issue_worklogs table.
Expected behavior
All worklogs for all issues should be collected, regardless of the total worklog count per issue.
Actual behavior
Issues with fewer than 20 worklogs have no entries in jira_issue_worklogs. For example, an issue with 7 worklogs returns 0 rows after a full pipeline run.
Root cause hypothesis
The Jira REST API's worklog endpoint (GET /rest/api/2/issue/{issueId}/worklog) paginates results with a default maxResults of 20. The response body includes a total field alongside maxResults and startAt. If the collection logic only follows up with paginated requests when total > maxResults — but skips fetching the first page altogether under some condition — then issues with total < 20 may be silently skipped.
Alternatively, if worklogs are collected via the bulk-updated worklogs endpoint (/rest/api/2/worklog/updated) and an issue's worklogs fall below a threshold that triggers a different code path, the same silent skip could occur.
Environment
- DevLake version: v1.0.3-beta14 (or the version you are running)
- Jira plugin version: bundled
- Jira Server on premise
Additional context
Confirmed on a real project: one Jira issue has exactly 7 worklogs; none are present in the database after a successful pipeline run. Issues on the same board with higher worklog counts collect correctly.
### What do you expect to happen
All worklogs for all issues should be collected, regardless of the total worklog count per issue.
### How to reproduce
1. Configure a Jira connection and scope with worklog collection enabled.
2. Trigger a pipeline run.
3. Observe that worklogs for Jira issues with fewer than 20 worklogs do not appear in the jira_issue_worklogs table.
### Anything else
I got this error when trying to understand if it is possible to get worklogs also from jira to devlake. Problem is that I do not have tasks that have more than 20 worklogs. All this text is generated by AI, but as far as I understand, then problem is there, if not, then sorry for bothering. Our jira is onprem, not in cloud.
### Version
v1.0.3-beta14@50f664e
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct)
Contributor guide
No contributing guide indexed for this repository
Research direction
Reproduce the pipeline with a Jira issue containing fewer than 20 worklogs, then inspect the Jira worklog collection path around GET /rest/api/2/issue/{issueId}/worklog and /rest/api/2/worklog/updated. Check the resulting jira_issue_worklogs rows against the API response; done means all worklogs are collected regardless of the issue's total count.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go
- Domain
- data-engineering
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 52/100