)]}'
{"/COMMIT_MSG":[{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"73434e28c6c1aeb8142c521dde1b4c6281f66092","unresolved":true,"context_lines":[{"line_number":4,"context_line":"Commit:     Alfredo Moralejo \u003camoralej@redhat.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2026-02-24 12:37:45 +0100"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Check Audit state in the applier before starting the execution"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In some cases, a oneshot audit may be CANCELLED before being executed"},{"line_number":10,"context_line":"and before it\u0027s moved to ONGOING. In those cases, the applier is moving"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"c33069bf_f56ac313","line":7,"range":{"start_line":7,"start_character":25,"end_line":7,"end_character":32},"updated":"2026-02-24 11:45:04.000000000","message":"decision-engine","commit_id":"80fe57a0c2643bed72fa702dd906cbb9db00f4aa"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"52dc854ee2c297ffb9d9358389339f60a3d8c9d9","unresolved":false,"context_lines":[{"line_number":4,"context_line":"Commit:     Alfredo Moralejo \u003camoralej@redhat.com\u003e"},{"line_number":5,"context_line":"CommitDate: 2026-02-24 12:37:45 +0100"},{"line_number":6,"context_line":""},{"line_number":7,"context_line":"Check Audit state in the applier before starting the execution"},{"line_number":8,"context_line":""},{"line_number":9,"context_line":"In some cases, a oneshot audit may be CANCELLED before being executed"},{"line_number":10,"context_line":"and before it\u0027s moved to ONGOING. In those cases, the applier is moving"}],"source_content_type":"text/x-gerrit-commit-message","patch_set":1,"id":"c3fb5625_cb19d850","line":7,"range":{"start_line":7,"start_character":25,"end_line":7,"end_character":32},"in_reply_to":"c33069bf_f56ac313","updated":"2026-02-24 11:56:10.000000000","message":"Thanks!","commit_id":"80fe57a0c2643bed72fa702dd906cbb9db00f4aa"}],"/PATCHSET_LEVEL":[{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"8e9a39e82098bc8c6f701e197cd88e8557bc620e","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"548872dd_29a6f720","updated":"2026-02-24 19:23:46.000000000","message":"code looks good. I would add a releasenote for this fix since this could affect users (Audits with ONGOING state after cancelling it)","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b29a8944c04879ff91ca7014c18471210543e829","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":2,"id":"4b2c12dc_0ebdc5bf","in_reply_to":"548872dd_29a6f720","updated":"2026-02-25 10:01:54.000000000","message":"Done","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"},{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"b68732f749af7d8520511a6023678675b0f06b26","unresolved":false,"context_lines":[],"source_content_type":"","patch_set":3,"id":"726cbd4b_4f87ff30","updated":"2026-02-26 13:08:14.000000000","message":"I\u0027m fine with merging to avoid many issues that we face in CI. We should indeed work in a improvement to cover more places that have this kind of concurrent and for more resources.","commit_id":"ccbe3ec3b812face313071fa2889ac927d955e47"}],"watcher/common/exception.py":[{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b29a8944c04879ff91ca7014c18471210543e829","unresolved":false,"context_lines":[{"line_number":277,"context_line":"                \"plans\")"},{"line_number":278,"context_line":""},{"line_number":279,"context_line":""},{"line_number":280,"context_line":"class AuditCancelled(WatcherException):"},{"line_number":281,"context_line":"    msg_fmt \u003d _(\"Audit with UUID %(uuid)s is cancelled\")"},{"line_number":282,"context_line":""},{"line_number":283,"context_line":""}],"source_content_type":"text/x-python","patch_set":2,"id":"51fc036d_fadd8217","line":280,"in_reply_to":"69a347d8_d408b3e1","updated":"2026-02-25 10:01:54.000000000","message":"WatcherException is the right to inherit from in this case as it\u0027s not a specific case of wider ones as invalid or notfound.","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"}],"watcher/decision_engine/audit/base.py":[{"author":{"_account_id":30002,"name":"Douglas Viroel","email":"viroel@gmail.com","username":"dviroel"},"change_message_id":"8e9a39e82098bc8c6f701e197cd88e8557bc620e","unresolved":true,"context_lines":[{"line_number":129,"context_line":"            self.check_ongoing_action_plans(request_context)"},{"line_number":130,"context_line":"        # check current state of the audit right before moving to ONGOING"},{"line_number":131,"context_line":"        # to avoid race conditions"},{"line_number":132,"context_line":"        audit \u003d objects.Audit.get_by_uuid("},{"line_number":133,"context_line":"            request_context, audit.uuid, eager\u003dTrue)"},{"line_number":134,"context_line":"        if audit.state \u003d\u003d objects.audit.State.CANCELLED:"},{"line_number":135,"context_line":"            raise exception.AuditCancelled(uuid\u003daudit.uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"0d66b09d_ede9074a","line":132,"range":{"start_line":132,"start_character":0,"end_line":132,"end_character":42},"updated":"2026-02-24 19:23:46.000000000","message":"IIUC, this solution mitigates but still doesn\u0027t avoid that other thread change the Audit state right before the read. Another way to implement is to have the update_state method to acquire a SQL lock when reading for update and then update the state right after, but would require more changes in the DBAPI.\nI think that this issue affects more CI and automated tests other than regular users, so if we still continue to face the issue in CI, we can think on a better solution..","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b29a8944c04879ff91ca7014c18471210543e829","unresolved":true,"context_lines":[{"line_number":129,"context_line":"            self.check_ongoing_action_plans(request_context)"},{"line_number":130,"context_line":"        # check current state of the audit right before moving to ONGOING"},{"line_number":131,"context_line":"        # to avoid race conditions"},{"line_number":132,"context_line":"        audit \u003d objects.Audit.get_by_uuid("},{"line_number":133,"context_line":"            request_context, audit.uuid, eager\u003dTrue)"},{"line_number":134,"context_line":"        if audit.state \u003d\u003d objects.audit.State.CANCELLED:"},{"line_number":135,"context_line":"            raise exception.AuditCancelled(uuid\u003daudit.uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"999f1b6a_d9e3a375","line":132,"range":{"start_line":132,"start_character":0,"end_line":132,"end_character":42},"in_reply_to":"0d66b09d_ede9074a","updated":"2026-02-25 10:01:54.000000000","message":"Correct, this is mitigating the issue by reducing the time from state check to update. Still, the API may move it to CANCELLED if a user request it right between the check and the update_audit_state, but i\u0027d say likelihood is really low and mostly found in CI.","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"},{"author":{"_account_id":11604,"name":"sean mooney","email":"smooney@redhat.com","username":"sean-k-mooney"},"change_message_id":"91af228245ceef5439448b8e73a513a051d8ca86","unresolved":false,"context_lines":[{"line_number":129,"context_line":"            self.check_ongoing_action_plans(request_context)"},{"line_number":130,"context_line":"        # check current state of the audit right before moving to ONGOING"},{"line_number":131,"context_line":"        # to avoid race conditions"},{"line_number":132,"context_line":"        audit \u003d objects.Audit.get_by_uuid("},{"line_number":133,"context_line":"            request_context, audit.uuid, eager\u003dTrue)"},{"line_number":134,"context_line":"        if audit.state \u003d\u003d objects.audit.State.CANCELLED:"},{"line_number":135,"context_line":"            raise exception.AuditCancelled(uuid\u003daudit.uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"ef428c2b_a831e64f","line":132,"range":{"start_line":132,"start_character":0,"end_line":132,"end_character":42},"in_reply_to":"999f1b6a_d9e3a375","updated":"2026-02-26 13:20:50.000000000","message":"Acknowledged","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"},{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b29a8944c04879ff91ca7014c18471210543e829","unresolved":false,"context_lines":[{"line_number":129,"context_line":"            self.check_ongoing_action_plans(request_context)"},{"line_number":130,"context_line":"        # check current state of the audit right before moving to ONGOING"},{"line_number":131,"context_line":"        # to avoid race conditions"},{"line_number":132,"context_line":"        audit \u003d objects.Audit.get_by_uuid("},{"line_number":133,"context_line":"            request_context, audit.uuid, eager\u003dTrue)"},{"line_number":134,"context_line":"        if audit.state \u003d\u003d objects.audit.State.CANCELLED:"},{"line_number":135,"context_line":"            raise exception.AuditCancelled(uuid\u003daudit.uuid)"}],"source_content_type":"text/x-python","patch_set":2,"id":"6efadeba_17202a58","line":132,"in_reply_to":"c88d6e73_35756098","updated":"2026-02-25 10:01:54.000000000","message":"Actually, I think this is already doing what it is suggesting","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"}],"watcher/tests/unit/decision_engine/audit/test_audit_handlers.py":[{"author":{"_account_id":16312,"name":"Alfredo Moralejo","email":"amoralej@redhat.com","username":"amoralej"},"change_message_id":"b29a8944c04879ff91ca7014c18471210543e829","unresolved":false,"context_lines":[{"line_number":164,"context_line":"            expected_calls,"},{"line_number":165,"context_line":"            self.m_audit_notifications.send_action_notification.call_args_list)"},{"line_number":166,"context_line":""},{"line_number":167,"context_line":"    @mock.patch.object(oneshot.OneShotAuditHandler, \"update_audit_state\")"},{"line_number":168,"context_line":"    def test_pre_execute_audit_cancelled(self, m_update_audit_state):"},{"line_number":169,"context_line":"        audit_handler \u003d oneshot.OneShotAuditHandler()"},{"line_number":170,"context_line":"        self.audit.state \u003d objects.audit.State.CANCELLED"}],"source_content_type":"text/x-python","patch_set":2,"id":"6217eda4_1c3d6875","line":167,"in_reply_to":"7a3964d9_10e9a4c7","updated":"2026-02-25 10:01:54.000000000","message":"Done.","commit_id":"4b1f24373c5aee59de253f835d3fc16fae79246d"}]}
