)]}'
{
  "commit": "c113a315c6e4ca60b98b714eb68017828c94725e",
  "tree": "2e52794414ed423af99f6d6e1dbd395c23b9991d",
  "parents": [
    "fe7aaaf7c97f640834c94d170ab120a400d907df"
  ],
  "author": {
    "name": "Edwin Kempin",
    "email": "ekempin@google.com",
    "time": "Mon Aug 12 15:19:17 2024 +0000"
  },
  "committer": {
    "name": "Edwin Kempin",
    "email": "ekempin@google.com",
    "time": "Wed Aug 14 13:43:51 2024 +0000"
  },
  "message": "CheckCodeOwner: Replace \u0027code_owner_config_file_paths\u0027 field\n\nThe \u0027code_owner_config_file_paths\u0027 field contained the paths of the code\nowner config files that assign code ownership to the given email for the\nspecified path. We are dropping this field now and instead return this\ninformation via a new \u0027assigns_code_ownership_to_user\u0027 field that is\nreturned for the inspected code owner config files. For this we change\nthe \u0027code_owner_configs\u0027 field that has been recently added by change\nIb3a57feac to a \u0027checked_code_owner_configs\u0027 field which contains the\ncode owner config files as CheckedCodeOwnerConfigFileInfos instead of\nCodeOwnerConfigFileInfos. CheckedCodeOwnerConfigFileInfo is a wrapper\naround CodeOwnerConfigFileInfo that also contains results of checking\nthe code owner config file, e.g. the new\n\u0027assigns_code_ownership_to_user\u0027 field.\n\nBefore this change:\n...\n\"code_owner_configs\": [\n{\n  \"project\": \"Code-Owners-Test\",\n  \"branch\": \"refs/heads/master\",\n  \"path\": \"/foo/bar/OWNERS\"\n},\n{\n  \"project\": \"Code-Owners-Test\",\n  \"branch\": \"refs/heads/master\",\n  \"path\": \"/foo/OWNERS\"\n},\n{\n  \"project\": \"Code-Owners-Test\",\n  \"branch\": \"refs/heads/master\",\n  \"path\": \"/OWNERS\"\n},\n\"code_owner_config_file_paths\": [\n  \"foo/OWNERS\"\n]\n...\n\nNow:\n...\n\"checked_code_owner_configs\": [\n{\n  \"code_owner_config\": {\n    \"project\": \"Code-Owners-Test\",\n    \"branch\": \"refs/heads/master\",\n    \"path\": \"/foo/bar/OWNERS\"\n  },\n  \"assigns_code_ownership_to_user\": false\n},\n{\n  \"code_owner_config\": {\n    \"project\": \"Code-Owners-Test\",\n    \"branch\": \"refs/heads/master\",\n    \"path\": \"/foo/OWNERS\"\n  },\n  \"assigns_code_ownership_to_user\": true\n},\n{\n  \"code_owner_config\": {\n    \"project\": \"Code-Owners-Test\",\n    \"branch\": \"refs/heads/master\",\n    \"path\": \"/OWNERS\"\n  },\n  \"assigns_code_ownership_to_user\": false\n},\n...\n\nThe new JSON is better as from the name of the old\n\u0027code_owner_config_file_paths\u0027 field it was not clear that in only\ncontained the files that assign code ownership to the user, but not as\none could think, all inspected code owner config files.\n\nAlso with the new JSON we have the possibility to return further\ninformation per code owner config file in the future (e.g. a\n\u0027are_folder_code_owners_ignored\u0027 field that informs about whether folder\ncode owners are being ignored).\n\nCode owner config files are returned in multiple places (when listing\ncode owners and when checking code ownership), but the new\n\u0027assigns_code_ownership_to_user\u0027 field should only be set when checking\ncode ownership. To avoid confusion when this field is being set we do\nnot want to add it as an optional field to CodeOwnerConfigFileInfo but\nwe rather add CheckedCodeOwnerConfigFileInfo as a wrapper for\nCodeOwnerConfigFileInfo that can also contain results of checking the\ncode owner config file. This way CodeOwnerConfigFileInfo that is\nreturned when listing code owners doesn\u0027t have the field and\nCheckCodeOwnerInfo can use CheckedCodeOwnerConfigFileInfo where this\nfield is always set.\n\nHaving this clearly seperated gets more important if we want to add\nfurther fields for check results for code owner config files in the\nfuture.\n\nOne drawback of the old \u0027code_owner_config_file_paths\u0027 field was that it\nonly considered the inspected code owner config files from the parent\ndirectories, but not the special code owner config file in\nrefs/meta/config that may declare default code owners for a repository\nE.g. for a file \u0027/foo/bar/baz.txt\u0027 we inspect the following code owner\nconfig files: \u0027/foo/bar/OWNERS\u0027, \u0027/foo/OWNERS\u0027, \u0027/OWNERS\u0027 and \u0027/OWNERS\u0027\nin \u0027refs/meta/config\u0027. The latter one was not included in the\n\u0027code_owner_config_file_paths\u0027 field if it assigned code ownership to\nthe user (because the field only contained a path, but not a branch\nname, hence \u0027/OWNERS\u0027 in the code branch couldn\u0027t be distinguished from\n\u0027/OWNERS\u0027 in \u0027refs/meta/config\u0027). With the new \u0027code_owner_configs\u0027\nfield, now \u0027checked_code_owner_configs\u0027, we no longer have this problem\nas the entries in this field have the full code owner config key\n(project, branch, path) and hence the \u0027/OWNERS\u0027 file in\n\u0027refs/meta/config\u0027 is returned there too (if it exists).\n\nStrinctly speaking dropping the \u0027code_owner_config_file_paths\u0027 field and\nchanging the \u0027code_owner_configs\u0027 field is a backwards incompatible\nchange, but since the CheckCodeOwner REST endpoint is intended to be\nused for debugging only it should be fine to break the API. I checked\nour request logs internally and in the last month there were only 9\ncalls of this REST endpoint, so it\u0027s unlikely we\u0027ll break any importany\nautomation if we drop this field.\n\nBug: Google b/345161989\nChange-Id: Ib654acccdf5fcfbbce2f6e4cf893bbf13f4d21bc\nSigned-off-by: Edwin Kempin \u003cekempin@google.com\u003e\n",
  "tree_diff": [
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c5f8fa23eaa96427221ab6654de1c58e499ba74a",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/api/CheckedCodeOwnerConfigFileInfo.java"
    },
    {
      "type": "modify",
      "old_id": "15c8558413c49e3fa43d7487b7298cdc54ae5bc0",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/api/CodeOwnerCheckInfo.java",
      "new_id": "55172a6f6bfd51c77391b360af78ed1c383022e0",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/api/CodeOwnerCheckInfo.java"
    },
    {
      "type": "modify",
      "old_id": "84e5faf8967b5d7d74d9c69d070e3802af8075aa",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwner.java",
      "new_id": "eedbff450e7a37a0b820e0fa49ae9dc7eaf26399",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/restapi/CheckCodeOwner.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "fbc326a5422fd52a194bbc664a9314fe68717a5f",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/restapi/CheckedCodeOwnerConfigFileJson.java"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ca696e18f45502d1516630a190b67b04d814cd00",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/testing/CheckedCodeOwnerConfigFileInfoSubject.java"
    },
    {
      "type": "modify",
      "old_id": "532fdd7240221e09db08f5ab38e7c6ba968a2b21",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerCheckInfoSubject.java",
      "new_id": "ecf5a725bc8f48ae9c21809a89458cca799ce453",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerCheckInfoSubject.java"
    },
    {
      "type": "modify",
      "old_id": "67ddce79fe14a004a5fcf239dba31ee9e60aed48",
      "old_mode": 33188,
      "old_path": "java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerConfigFileInfoSubject.java",
      "new_id": "d6f6fa8f18e4095ce60f5f47d76dcb11b3f58a54",
      "new_mode": 33188,
      "new_path": "java/com/google/gerrit/plugins/codeowners/testing/CodeOwnerConfigFileInfoSubject.java"
    },
    {
      "type": "modify",
      "old_id": "fe449a4d3a258d9cec86be95141eb8a0628595ce",
      "old_mode": 33188,
      "old_path": "javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerIT.java",
      "new_id": "e7a0e2ab6a01d51ae82d290ddd27315685a723a9",
      "new_mode": 33188,
      "new_path": "javatests/com/google/gerrit/plugins/codeowners/acceptance/api/CheckCodeOwnerIT.java"
    },
    {
      "type": "modify",
      "old_id": "cd19faca4802ee19c11cae9bcd3914a146d67f1a",
      "old_mode": 33188,
      "old_path": "resources/Documentation/rest-api.md",
      "new_id": "cbb4d21a1291fac285d0c55dde5f43717d86184f",
      "new_mode": 33188,
      "new_path": "resources/Documentation/rest-api.md"
    }
  ]
}
