Skip to content

fix(jira): do not overwrite newer issues with outdated epic responses - #9462

Open
Alexandrshy wants to merge 1 commit into
apache:mainfrom
Alexandrshy:fix/jira-stale-epic-overwrite
Open

Alexandrshy wants to merge 1 commit into
apache:mainfrom
Alexandrshy:fix/jira-stale-epic-overwrite

Conversation

@Alexandrshy

Copy link
Copy Markdown
Contributor

⚠️ Pre Checklist

Please complete ALL items in this checklist, and remove before submitting

  • I have read through the Contributing Documentation.
  • I have added relevant tests.
  • I have added relevant documentation.
  • I will add labels to the PR, such as pr-type/bug-fix, pr-type/feature-development, etc.

Summary

extractIssues and extractEpics write the same rows of _tool_jira_issues. An epic that matches the board filter is collected into _raw_jira_api_issues by collectIssues and, while board issues refer to it by epic_key, into _raw_jira_api_epics by collectEpics. Once nothing refers to it, its last response in _raw_jira_api_epics is no longer refreshed. In full-sync mode extractEpics replays every row of that table after extractIssues and saved it without comparing updated, so the epic went back to the status, resolution, type and custom fields of that old response (details in #9461).

With this PR extractEpics leaves the issue row alone when _tool_jira_issues already holds a more recently updated version of the issue:

  • Only the JiraIssue record of the outdated response is dropped. Its changelogs, comments, worklogs and other records are saved as before: they have their own ids, and an older response can be the only one that carries them (epics are excluded from collectIssueChangelogs).
  • A response that is as new as the stored row, or newer, is saved as before. Epics outside the board, and epics collected by collectEpics after collectIssues, behave as they did.
  • extractIssues and the extractor helper are not changed.

TestEpicExtractorKeepsNewerIssue (e2e) covers an epic whose responses in _raw_jira_api_epics are older than the one in _raw_jira_api_issues, an epic with a newer epic response, and an epic outside the board. It fails on main (the first epic ends up with the status of its old epic response) and passes with this change.

Does this close any open issues?

Closes #9461

Screenshots

N/A

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] extractEpics overwrites an up-to-date epic with an outdated response when it runs in full-sync mode

1 participant