A network failure while posting the status comment rolls back the decision

Description

Problem

The status comment (work item comment in Jira, page comment in Confluence) is posted inside the transaction of the decision. ApprovalAccess.addCommentSafely catches only ModelException and HttpException. When the call fails without an HTTP answer (timeout, refused or reset connection), guarana's HttpClient throws a plain RuntimeException, which is not caught. The transaction rolls back, so the decision that completes the approval is lost and the person deciding gets an error, although the status comment is only an optional notification.

The same call is used when an approval is deleted (single and bulk), so a network failure there can also undo the deletion.

Found in the review of AP-2224, which does not change it.

Change

  • A network failure while posting the status comment is logged and returned as a warning, the same way an HTTP error is today, and the decision or deletion is saved.

  • All callers of addCommentSafely behave the same: decisions that complete an approval, single and bulk delete, outdated approvals.

Acceptance criteria

  • When the status comment cannot be posted because of a timeout or a refused or reset connection, the decision is saved and the approval reaches its final status.

  • The person deciding sees the decision as saved, with the same warning as for a failed HTTP call.

  • Errors of the database inside the transaction still roll it back.

  • Tests cover a network failure in Jira and in Confluence, for a completing decision and for a deletion.

Manual tester notes

  • A network failure cannot be forced in the UI; covered by tests. Regression on QA in Jira and Confluence: approve and reject the last step of an approval with status comments on; the status comment appears and the approval is completed.

  • Delete an approval (single and bulk) with status comments on: the comment appears and the approvals are deleted.