)]}'
{
  "commit": "d15276b70ec585146ea6ad44419e23de6ae09e74",
  "tree": "a8b70165e0f9b86b135dc756314e9f9262dbcfca",
  "parents": [
    "91e5198448305dd89c9e9d5d7ce5757ddf0e8b72"
  ],
  "author": {
    "name": "Antonio Barone",
    "email": "syntonyze@gmail.com",
    "time": "Tue Jan 23 20:40:57 2024 +0100"
  },
  "committer": {
    "name": "Antonio Barone",
    "email": "syntonyze@gmail.com",
    "time": "Tue Feb 06 14:17:26 2024 +0100"
  },
  "message": "Properly propagate failure when ref deletion fails\n\nRefs deletions are implemented via the `DeleteCommand.deleteRef()`\nmethod which attempts to delete refs locally after checking for\npermissions and relevant configuration settings (i.e. `isMirror` flag).\n\nExceptions thrown during the deletion are then propagated to the caller,\nwhich is correct, in order for the caller to take appropriate actions.\n\nThe problem however, is that not every ref deletion failure causes an\nexception: failures are also represented as a result status of the\ndelete operation.\n\nTake for example the existence of a ref lock on the ref being deleted:\nthis will cause the delete to return `LOCK_FAILURE`, rather than\nthrowing an exception.\n\nHowever, because failure results are completely ignored, every\nref-update deletion that is not causing an exception is erroneously\ntreated as successful.\n\nThis behaviour impacts, as an example, the\n`/pull-replication~batch-apply-object` and the\n`/pull-replication-apply-object` HTTP endpoints, which invoke\n`DeleteCommand.deleteRef()` when handling the deletion of a ref.\n\nIn case of an exception the endpoints will return the relevant HTTP\nstatus code, informing the client of the failure, in all other cases\n(even upon failing result statuses), the endpoint will erroneously\nreport success, misleading the client into believing that the deletion\nwas successful.\n\nStop ignoring the result statuses of ref-update deletions so that\ncallers can be made aware on the actual result of the failure and take\nappropriate action.\n\nBug: Issue 288965464\nChange-Id: Ib49247a1bb167c0b265151a1b1f5a6be15006012\n",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "0eabf4297a5bea7c561f4cfe191a6043e6d0956a",
      "old_mode": 33188,
      "old_path": "src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchRefReplicatedEvent.java",
      "new_id": "2c18983945c14c9c5d2f791e122583e3b3f8111e",
      "new_mode": 33188,
      "new_path": "src/main/java/com/googlesource/gerrit/plugins/replication/pull/FetchRefReplicatedEvent.java"
    },
    {
      "type": "modify",
      "old_id": "3150fe1600d53d18511ebf0252abaf9dd7b79d06",
      "old_mode": 33188,
      "old_path": "src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/DeleteRefCommand.java",
      "new_id": "3a7d0ffb055947b814596be1c3e64c62424905b2",
      "new_mode": 33188,
      "new_path": "src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/DeleteRefCommand.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a1d68761c887cdeceb06b7962f802927d143aa11",
      "new_mode": 33188,
      "new_path": "src/main/java/com/googlesource/gerrit/plugins/replication/pull/api/exception/DeleteRefException.java"
    },
    {
      "type": "modify",
      "old_id": "40912ac9a4453a43a8bbaa0edf86798390119d05",
      "old_mode": 33188,
      "old_path": "src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/DeleteRefCommandTest.java",
      "new_id": "5ede40ba44fe90f772e87001f3cb2102700403df",
      "new_mode": 33188,
      "new_path": "src/test/java/com/googlesource/gerrit/plugins/replication/pull/api/DeleteRefCommandTest.java"
    }
  ]
}
