Skip to content

fix(jira): repair truncated changelogs on incremental syncs - #9420

Open
dmorfav wants to merge 1 commit into
apache:mainfrom
dmorfav:fix/jira-repair-truncated-changelogs
Open

dmorfav wants to merge 1 commit into
apache:mainfrom
dmorfav:fix/jira-repair-truncated-changelogs

Conversation

@dmorfav

@dmorfav dmorfav commented Nov 19, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes the second point of #9419: changelogs truncated to the newest 40 histories (by builds that already collected issues through the search API but did not have #9377) are never repaired by incremental syncs after upgrading.

In incremental mode collectIssueChangelogs only selected issues with i.updated > since. An issue whose changelog was truncated by an affected build and has not changed since is never selected again, so its oldest histories (often its first status transitions) stay missing unless the user runs a full sync.

This PR:

  • in incremental mode, also selects the issues whose stored changelog has fewer rows in _tool_jira_issue_changelogs than changelog_total, so they are re-collected once and repaired. Issues with a complete changelog keep being skipped, so steady-state syncs do not do extra work (_tool_jira_issue_changelogs.issue_id is indexed);
  • extracts the selection into BuildChangelogCollectorClauses, so it can be tested;
  • adds TestChangelogCollectorClauses (e2e, plugins/jira/e2e), with an updated issue, a truncated issue that was not updated, a complete issue that was not updated, an issue below the search API limit, an epic and an issue from another board. It fails on main (the truncated issue is not selected) and passes with this change.

go vet ./plugins/jira/... and go test ./plugins/jira/... (with E2E_DB_URL on MySQL 8.0) pass locally.

Does this close any open issues?

Closes #9419 (the first point there, shipping #9377 in a release, is up to the maintainers).

Screenshots

Not applicable (backend change).

Other Information

The repair relies on changelog_total matching the number of histories the changelog endpoint returns. If, for some issue, Jira reports more histories than it returns (for example, entries hidden by permissions), that issue would be re-collected on every incremental sync. That is the same cost a full sync already pays for every issue, so I kept it simple; happy to add a guard (for example, comparing against IssueUpdated) if you prefer.

collectIssueChangelogs only selected issues updated since the previous
sync in incremental mode. Changelogs truncated to the newest 40
histories by builds without apache#9377 were therefore never re-collected
after upgrading, unless a full sync was run.

In incremental mode, also select the issues whose stored changelog has
fewer rows than changelog_total. The selection is extracted into
BuildChangelogCollectorClauses and covered by an e2e test.

Closes apache#9419
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug][Jira] Changelogs truncated before #9377 are not repaired by incremental syncs (affects v1.0.3-beta19)

1 participant