)]}'
{
  "commit": "7053e26e858e703d27b2c32a09e09cfd2fdb8e48",
  "tree": "13381b92dd095816866f17ec08c68bad8e223763",
  "parents": [
    "42c8e752e4f236b7fa0e88d77b751ea663f939d2"
  ],
  "author": {
    "name": "Tao Wang",
    "email": "tao.ryan.wang@gmail.com",
    "time": "Thu Jun 11 09:46:30 2026 -0700"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Thu Jun 11 16:46:30 2026 +0000"
  },
  "message": "Gazelle: Delete stale py_library and py_test targets (#3817)\n\n## Summary\nFix the issue #3375\nRight now the `py_library` and `py_test` targets with missing srcs\nwouldn\u0027t be cleaned up by Gazelle in file mode.\n\nThis can be reproduced by a unit test added in commit\nad0e48ce0849ef9a0e89fb75a51345afb1947eb6\n\n\n## Testing\nIn commit ad0e48ce0849ef9a0e89fb75a51345afb1947eb6 , without the fix,\n`bazel test //python/...` failed in the newly added tests. The stale\n`py_library ` and `py_test ` cannot be removed.\n\nIn latest HEAD d32fb7bb70a996e2d1215944a17941c5c4a708ed, `bazel test\n//python/...` can pass\n\n```\nINFO: From Testing //python:python_test_remove_invalid_per_file:\n\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d\u003d Test output for //python:python_test_remove_invalid_per_file:\n--- FAIL: TestGazelleBinary (0.02s)\n    --- FAIL: TestGazelleBinary/remove_invalid_per_file (0.08s)\n        python_test.go:186: remove_invalid_per_file/BUILD diff (-want,+got):\n              (\n                \"\"\"\n                ... // 8 identical lines\n                )\n              \n            +   py_library(\n            +       name \u003d \"deleted_lib\",\n            +       srcs \u003d [\"deleted.py\"],\n            +       visibility \u003d [\"//:__subpackages__\"],\n            +   )\n            + \n            +   py_test(\n            +       name \u003d \"bar_test\",\n            +       srcs \u003d [\"bar_test.py\"],\n            +   )\n            + \n                py_test(\n            -       name \u003d \"bar_test\",\n            -       srcs \u003d [\"bar_test.py\"],\n            +       name \u003d \"deleted_test\",\n            +       srcs \u003d [\"deleted_test.py\"],\n                )\n                \"\"\"\n              )\n```\n\n---------\n\nCo-authored-by: Tao Wang \u003cwatao@microsoft.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "43e05b6dd0094b147d2be727d0ae206db5eb3cc2",
      "old_mode": 33188,
      "old_path": "CHANGELOG.md",
      "new_id": "978464f9dbff12e154159aecb1fa180aebffd2be",
      "new_mode": 33188,
      "new_path": "CHANGELOG.md"
    },
    {
      "type": "modify",
      "old_id": "6fa6252ebb5897a49008ad9e71ba42d35641c5cf",
      "old_mode": 33188,
      "old_path": "gazelle/python/generate.go",
      "new_id": "90e06a154650094c36b5fdbf29c1a5ea0639f3a7",
      "new_mode": 33188,
      "new_path": "gazelle/python/generate.go"
    },
    {
      "type": "rename",
      "old_id": "815e673ee1931a0d48a592537ae5eb80360447ab",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/BUILD.in",
      "new_id": "815e673ee1931a0d48a592537ae5eb80360447ab",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/BUILD.in",
      "score": 100
    },
    {
      "type": "rename",
      "old_id": "80d47076c31bb2b72dba0e4d77964d87c4e360ec",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/BUILD.out",
      "new_id": "80d47076c31bb2b72dba0e4d77964d87c4e360ec",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/BUILD.out",
      "score": 100
    },
    {
      "type": "rename",
      "old_id": "7a35167857538b7c6a3b4746ca0dad32831a020f",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/README.md",
      "new_id": "7a35167857538b7c6a3b4746ca0dad32831a020f",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/README.md",
      "score": 100
    },
    {
      "type": "copy",
      "old_id": "faff6af87ac0ef60c3f9dacae80ca00b08118b58",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/WORKSPACE",
      "new_id": "faff6af87ac0ef60c3f9dacae80ca00b08118b58",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/WORKSPACE",
      "score": 100
    },
    {
      "type": "rename",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/my_test.py",
      "score": 100
    },
    {
      "type": "rename",
      "old_id": "557832772d3bb3f8532ae0aa4ace17a0a324ebe7",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/others/BUILD.in",
      "new_id": "557832772d3bb3f8532ae0aa4ace17a0a324ebe7",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/others/BUILD.in",
      "score": 100
    },
    {
      "type": "rename",
      "old_id": "557832772d3bb3f8532ae0aa4ace17a0a324ebe7",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/others/BUILD.out",
      "new_id": "557832772d3bb3f8532ae0aa4ace17a0a324ebe7",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/others/BUILD.out",
      "score": 100
    },
    {
      "type": "rename",
      "old_id": "fcea77710fc791c34d6a09da4cfd0e38a515fdb0",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/test.yaml",
      "new_id": "fcea77710fc791c34d6a09da4cfd0e38a515fdb0",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_library_package_mode/test.yaml",
      "score": 100
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "d3b15a786617a9952e8c81ab2c588d7b9a25aab6",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/BUILD.in"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "376c14c0e137db559783abd517bbb04531bdd406",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/BUILD.out"
    },
    {
      "type": "rename",
      "old_id": "faff6af87ac0ef60c3f9dacae80ca00b08118b58",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/WORKSPACE",
      "new_id": "faff6af87ac0ef60c3f9dacae80ca00b08118b58",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/WORKSPACE",
      "score": 100
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/__main__.py",
      "score": 100
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e56ea1617a40ee6d685638f1bb42456eece5d29f",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/alias_kind/BUILD.in"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "19d6c017896095eab66da379691b9696bc075a5c",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/alias_kind/BUILD.out"
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/alias_kind/bar.py",
      "score": 100
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/alias_kind/bar_test.py",
      "score": 100
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/bar.py",
      "score": 100
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/bar_test.py",
      "score": 100
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "00b9a60d6f97f813d1ea14147faea1d04a92633d",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/map_kind/BUILD.in"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "84ca905031a39d48f64cb8da8d0d3935883b9f67",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/map_kind/BUILD.out"
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/map_kind/bar.py",
      "score": 100
    },
    {
      "type": "copy",
      "old_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "old_mode": 33188,
      "old_path": "gazelle/python/testdata/remove_invalid_library/my_test.py",
      "new_id": "e69de29bb2d1d6434b8b29ae775ad8c2e48c5391",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/map_kind/bar_test.py",
      "score": 100
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ed97d539c095cf1413af30cc23dea272095b97dd",
      "new_mode": 33188,
      "new_path": "gazelle/python/testdata/remove_invalid_per_file/test.yaml"
    }
  ]
}
