)]}'
{
  "commit": "5d40f133884051b9a823937884ec62aac3abfe79",
  "tree": "ee710dd5e6885524a43cfb652c7cf11234876cce",
  "parents": [
    "5b2ebd9c765bc0a7d4d773a2b0285ba3b9cf2865"
  ],
  "author": {
    "name": "timothy",
    "email": "387270+timothyklim@users.noreply.github.com",
    "time": "Sat Nov 28 15:14:04 2026"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Sat Nov 28 15:14:04 2026"
  },
  "message": "crate_universe: resolve annotation patches against the current module (#4425)\n\n### Problem\n\n`crate.annotation(patches \u003d ...)` labels are stored in\n`cargo-bazel-lock.json` as canonical strings, so their form depends on\nwhich module was root when the lockfile was pinned (`@@//…` vs\n`@@my_module+//…`). Since #3521 the digest ignores the repo part, so the\nlockfile is reused unchanged when the module is consumed by another\nroot. `_generate_hub_and_spokes` then passes the stored string straight\nto `http_archive`/`git_repository`, and `@@//` resolves to the\n*consumer\u0027s* main repo:\n\n```\nError in patch: Cannot find patch file: /path/to/consumer/bazel/patches/foo.patch\n```\n\nRe-pinning from the consumer only moves the breakage: the module then\nfails as root. No single lockfile works in both setups.\n\n### Fix\n\nBuild an index from the current invocation\u0027s annotation tags, `(crate,\nrepo-stripped label) → label as resolved now`, and use it to rewrite\nlockfile patch labels before creating crate repos. The repo-stripping is\nthe same normalization the digest already uses. Labels with no matching\nannotation keep their lockfile value. There\u0027s no lockfile format change,\nno digest change and no forced re-pin.\n\n### Testing\n\nA module owns a `crate.from_cargo` hub with a patched crate annotation\nand its own lockfile pinned as root. A second root module depends on it\nthrough `local_path_override` and `include()`s its `*.MODULE.bazel`.\n\n- Before: the crate fetch fails because the patch path resolves inside\nthe consumer.\n- After: the patch resolves inside the owning module from both roots.\n\nHappy to add a regression test under `test/` (a nested module with a\nlockfile and a patch annotation, built as root and as a dependency) if\nthat\u0027s the preferred shape.\n\n### Notes\n\nOther label-valued annotation fields (`deps`, `build_script_data`,\n`additive_build_file`, …) may have the same problem when rendered into\nspoke BUILD files. This PR only fixes `patches`, which `extensions.bzl`\nconsumes directly.\n\nAssisted-by: Claude Code:claude-opus-5-5\n\n---------\n\nCo-authored-by: UebelAndre \u003cgithub@uebelandre.com\u003e",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "c4c35598b525d4b7cfb054a687d4543f6601f0f8",
      "old_mode": 33188,
      "old_path": "crate_universe/extensions.bzl",
      "new_id": "1bcacfd7d5b3b0c6cf9f306ba5a8b8d7f2d0d0c0",
      "new_mode": 33188,
      "new_path": "crate_universe/extensions.bzl"
    }
  ]
}
