Skip to content

nested_cache: guard nested locks against stale rules_dx extensions (part of #14084) - #14093

Draft
TrapsterDK wants to merge 2 commits into
mainfrom
cloud/14084
Draft

TrapsterDK wants to merge 2 commits into
mainfrom
cloud/14084

Conversation

@TrapsterDK

@TrapsterDK TrapsterDK commented Nov 19, 2026 •

Copy link
Copy Markdown
Collaborator

Part of #14084.

  • //core/modules:consumer_deps_test gets every_nested_lock_matches_the_root_rules_dx_extensions. It checks each nested lock entry that is a rules_dx extension (@@rules_dx+//…), or whose root entry reads a rules_dx file (FILE:@@//…, for example rules_zig reading zig/private/sdk_versions.json). Every FILE:/ENV: input in the nested entry must be in the root entry with the same digest, and every repo it generates must also be generated by the root. On a mismatch it names the set and prints the re-record command.
  • I used subset checks, not the exact equality the issue asks for. The root's dev usages legitimately add inputs and repos: dart pub in the root reads third_party/dart/pubspec.lock and generates 78 repos, while the release consumers generate 46. Exact equality would fail on those.
  • nested_extension_drift_finds_a_stale_sdk is the unit test: a matching pair (zig 0.17.1), a stale pair (zig 0.17.0 with an old sdk_versions.json digest), a dart entry where the root has more, and a python entry that is skipped because it reads no rules_dx file.
  • tools/testing/extensions.bzl now fetches cache entries with a new nested_cache_file rule. It sends ghcr.io the anonymous Bearer QQ== token. The apple set lists a Homebrew swift-format bottle on ghcr.io, which answers 401 without a token, so the macOS nested record and every apple nested run failed to fetch it.

On main the guard flags exactly the six stale sets: adopt_polyglot, apple, indirect, release_bcr, release_candidate and release_quickstart all still have zig_0.17.0_*. I dispatched lock-refresh.yml -f nested=true -f pr=14093 on this branch to re-record them.

Tested:

  • //core/modules:consumer_deps_test was run. The unit test nested_extension_drift_finds_a_stale_sdk and the other 19 tests pass. every_nested_lock_matches_the_root_rules_dx_extensions fails as intended until the re-recorded locks land on this branch.
  • I built @@+nested_repository_cache+nested_cache_a4890bc5…//file (the ghcr.io blob) and @@+nested_repository_cache+nested_cache_7cd0312e…//file (an ordinary entry). Both fetched.

The PR stays draft until the locks land. The offline nested check still needs /evidence on the three hosts.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hxEMUyLEBAfNLUska2

Copy link
Copy Markdown
Collaborator Author

nested record (macos_arm64) failed before it recorded anything. The apple set lists https://ghcr.io/v2/homebrew/core/swift-format/blobs/sha256:a4890bc5…, which main added today in #14007. The cache's http_file sends no token, so ghcr.io answers 401. That breaks every apple nested run on main, not only this PR.

2784cbe fixes it: cache entries now come from nested_cache_file, which sends ghcr.io the anonymous Bearer QQ== token. I checked it by fetching that blob and one ordinary entry through the new rule. Both fetched. I cancelled the old lock-refresh run and dispatched it again (nested=true pr=14093). The PR stays draft until the re-recorded locks land and //core/modules:consumer_deps_test passes.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

The ghcr.io fix works: the second nested record (macos_arm64) got past the apple set. It then failed on GET returned 500 Internal Server Error from github.com/uutils/coreutils/releases/download/0.12.0/coreutils-0.12.0-x86_64-pc-windows-msvc.zip. That URL returns 200 now, so it was a GitHub server error, not this diff. I cancelled that run and dispatched lock-refresh once more as its one re-run.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 4) has four failures:

  • //core/modules:consumer_deps_test is the new guard. It fails as intended until lock-refresh commits the re-recorded locks.
  • //cli/plan:dx_plan_test, //cli/plan:update_registry_gen_test and //config:workspace_policy fail on main too. I ran them locally on a clean origin/main (2c51c0c) and all three fail. The failures are a stale cli/plan/src/plan/registry_gen.rs, go_only_consumer_selects_core_and_go, and missing family.cuda.lint=typos/family.d.lint=typos fields. This PR touches neither cli/plan nor config.

Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 26) fails before any test runs: dx: invalid_scope: unsupported scope "@llvm//tests/stage0_features:stage0_features_test". Changing tools/testing/extensions.bzl, a module extension, widens the plan to //.... The planner query tests(set(...)) in pr-check.yml then expands main's //patches/llvm/tests:stage0_features_test, which is a test_suite around @llvm//tests/stage0_features:stage0_features_test (since #13461). dx test rejects that external label. Any PR whose plan widens hits this, so it isn't this diff. The fix belongs in the planner, which should keep the suite label or drop @ labels after the query. I'm leaving that out of this PR.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 10) failures: //core/quality:policy_profile_analysis, //core/quality:support_unit and //core/quality/tests:core_load_graph_test, plus an analysis error in //core/quality:consumer_policy_case_default_d_test that aborted the rest of the shard. All three tests also fail locally on a clean origin/main (2c51c0c). It is the same core/quality family breakage as //config:workspace_policy (the d/cuda typos lint fields), and this PR doesn't touch it.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 22) fails on //rust/tests:rust_analyzer_acquisition_test, and it fails the same way locally on a clean origin/main (2c51c0c). The pinned rust_analyzer_1.99.1_tools rust-analyzer exits 127: error while loading shared libraries: librustc_driver-7ed0375ae352bd75.so: cannot open shared object file. That comes from the rules_rust toolchain repo, which this PR doesn't touch.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 8) failures: //core/quality/testdata:matrix_rust_typos_fail, matrix_text_typos_fail and matrix_sql_lint_parse_error. All three also fail locally on a clean origin/main (5e9fc64). They are core/quality lint-matrix cases, which this PR doesn't touch.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 15) failures: //gazelle/julia:stdlib_test, //gazelle/ocaml:ocaml_test and //gazelle/csharp:generation_test. All three also fail locally on a clean origin/main (5e9fc64). This PR doesn't touch gazelle/.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 11) failures: //core/tests:pins (julia_src_libllvm/libunwind/libuv/zstd URLs don't name the version) and //csharp/tests/fixtures/xunit:csharp_coverage_test_on. Both also fail locally on a clean origin/main (5e9fc64). This PR touches neither julia pins nor csharp.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 25) failures:

  • //tools/testing:toolchain_gate_test: //core/hermetic_launcher:all lacks the toolchains_on gate.
  • //tools/testing:module_extension_srcs_test: apple/private/tools/ops sources are missing from module_srcs.
  • //tools/testing/consumer:root_module_test and go_consumer_test: go/tests/consumer/consumer.MODULE.bazel has a go = use_extension(...) line.
  • //tools/testing:language_skeleton_test: a known main failure.

The first four also fail locally on a clean origin/main (5e9fc64). None of them involve nested_repository_cache, extensions.bzl or consumer_deps_test.rs, the only files this PR touches.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

The re-record is blocked by main. In lock-refresh run 44619208376, nested record (linux_x86_64) passed //examples/adopt-polyglot:consumer_test and //tools/testing:nested_bazel_harness_test. It failed on //deploy/private/release/tests:release_consumer_smoke_test: no such target '@@rules_dx+//core/modules:dx_versions', referenced from @@rules_dx+//cli/adopt/BUILD.bazel:8 while analysing @@rules_dx+//:dx. dx_versions exists in core/modules/BUILD.bazel on main but not in the shipped release tree. So the release consumer can't build rules_dx's dx, the record job uploads nothing, and lock-refresh won't commit the locks. This PR doesn't touch release packaging. Once main ships dx_versions in the release tree, dispatch lock-refresh.yml -f nested=true -f pr=14093 again.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 13) fails on //deploy/tests/cross:cross_archive_test (no release file ends with /cross_release). It fails the same way locally on a clean origin/main (5e9fc64). This PR doesn't touch deploy/.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 19) aborts on a visibility error: //msix/tests:root_data can't see //msix:BUILD.bazel. On main (5e9fc64), msix/BUILD.bazel line 68 exports that file only to //tools/api:__pkg__ (since #13856), and msix/tests/BUILD.bazel:106 uses it as data. This PR touches neither file. The analysis error aborted the rest of the shard, which is why the other targets show as aborted.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 12) failures: //d/tests:metadata and //deploy/private/offline:bootstrap_test. Both also fail locally on a clean origin/main (5e9fc64). This PR touches neither d/ nor deploy/.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 24) failures: 9 //tools/ci guards (lock_registry, pin_locations, prose_rules, sandbox_escape, starlark_docs, test_budget, unreferenced_files, zero_compat), //tools/docs/ir/ir:site_shard_test, //tools/docs/typescript/extract:dx_docs_typescript_extract_test, //tools/ide:lsp_headless_rust_analyzer_test and //tools/testing/consumer:apple_consumer_test. I ran the eight guards on this branch. No failure names a file this PR touches. pin_locations_test fails on tools/testing/src/exec_log.rs digest-outside-pins and core/pins.bzl no-digest. Its reprinted allowlist keeps tools/testing/extensions.bzl no-digest 1 unchanged from main. The //tools/ci guards are known main failures, and rust-analyzer is the main librustc_driver error noted above.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 23) failures: //tools/api:api_test and six //tools/ci guards (aggregate_gates, config_consistency, bzl_visibility, lock_hub_names, host_env, host_program). I ran all seven on this branch, and none of their logs mention nested_repository_cache, tools/testing/extensions.bzl or consumer_deps_test. bzl_visibility, lock_hub_names, host_env, host_program and api_test also fail locally on a clean origin/main (9284a9f). aggregate_gates and config_consistency are known main failures.


Generated by Claude Code

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Rebased onto main. //core/modules:consumer_deps_test: 20 pass; every_nested_lock_matches_the_root_rules_dx_extensions still fails as intended on the six stale zig_0.17.0 sets. Still waits on a lock-refresh.yml -f nested=true -f pr=14093 re-record, which this session is not allowed to dispatch.

🤖 Generated with Claude Code

https://claude.ai/code/session_01Xut2hvgPbKqbuDgsTasg7K

Copy link
Copy Markdown
Collaborator Author

The re-record has run already (run 44619208376), and all three nested record jobs failed on main, not on this PR. In the shipped release tree, core/modules/BUILD.bazel fails to load at versions_tests.bzl:49 (_ARCHIVES["julia_src"]: key "julia_src" not found), so release_consumer_smoke_test and apple/tests:consumer_build_test can't build @rules_dx//:dx. Nothing on main (54420d8) has touched julia/, core/pins.bzl or core/modules since, so a new dispatch would fail the same way. Once main ships julia_src in the release tree, dispatch lock-refresh.yml -f nested=true -f pr=14093 again.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 0) on 61ff375 fails on //android/tests/conformance:format_error_test (unformatted android/tests/conformance/FormatDirty.java not reported). It fails the same way locally on a clean origin/main (0d79035), and this PR doesn't touch android/. The re-record is still blocked: #14192 says the julia_src archives haven't moved to dx_pins yet, so the shipped tree still fails at versions_tests.bzl:49.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 24) on 61ff375: the new failures are TIMEOUT on //tools/docs/site:serve_test and //tools/docs/site:browser_test. Both pass locally on a clean origin/main (2c23fc1) and on this branch head, and this PR doesn't touch tools/docs. The other failures in the shard (the //tools/ci guards, lsp_headless_rust_analyzer, site_shard_test, the typescript extract test and apple_consumer_test) are the main failures already listed above.


Generated by Claude Code

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (9bf9fb1). //core/modules:consumer_deps_test: 18 pass; every_nested_lock_matches_the_root_rules_dx_extensions still flags the six zig_0.17.0 sets as intended. every_bazel_dep_has_a_floor_comment_and_is_newest and every_nested_lock_has_the_root_registry_deps also fail; this PR does not change them. #14192 (the julia_src blocker for the shipped tree) is merged, so a lock-refresh.yml -f nested=true -f pr=14093 re-record should now get through. This session may only dispatch evidence.yml/ci.yml, so that dispatch is still needed.

Copy link
Copy Markdown
Collaborator Author

I dispatched lock-refresh.yml -f nested=true -f pr=14093 on cloud/14084 (e7f7239). On main (ca636b8), core/modules/versions_tests.bzl no longer reads _ARCHIVES["julia_src"], so the shipped-tree load error that failed every record job should be gone. The re-record should also clear every_nested_lock_has_the_root_registry_deps. every_bazel_dep_has_a_floor_comment_and_is_newest reads only the root MODULE.bazel, which this PR doesn't change.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

analysis (PR-time checks on linux_x86_64) on e7f7239 fails on //tools/ci:workflow_pins_test: .github/workflows/reusable-release.yml no longer matches tools/ci/starter_pin.sha256. This PR changes only core/modules/consumer_deps_test.rs, tools/testing/extensions.bzl and tools/testing/nested_repository_cache.bzl. The workflow last changed on main in #14337 (7b09a47), so main needs to update starter_pin.sha256.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 4) on e7f7239 has one new failure, //core/modules/tests:loaders_test. It fails the same way locally on a clean origin/main (0ef271f), and this PR doesn't touch it. //config:workspace_policy is the main failure noted earlier. //core/modules:consumer_deps_test waits on the lock-refresh re-record that is running now.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 19) on e7f7239 aborted because //patches:update_readme_test failed to build: the genrule //patches:readme_generated exits 1. That build fails the same way locally on a clean origin/main (976c47a), and this PR doesn't touch patches/. The aborted targets after it are fallout from that build error.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

The julia_src blocker is gone, but nested record (linux_x86_64) in lock-refresh run 44887187938 hit a new main failure. The record passed //examples/adopt-polyglot:consumer_test and //tools/testing:nested_bazel_harness_test. release_consumer_smoke_test then failed in quickstart_consumer_test::the_readme_quickstart_runs_as_written (quickstart_consumer_test.rs:403) on the consumer footprint budget: external_repos: 312 is above the budget 230 (core) and 321 is above the budget 244 (python). Those budgets live in core/modules/core_budget.json and core/modules/python_consumer_budget.json on main, which this PR doesn't change. So the record uploads nothing and the locks can't land yet. Once main's footprint or budget is fixed, dispatch lock-refresh.yml -f nested=true -f pr=14093 again.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 24) on e7f7239 aborted on a build error. The link check for //tools/docs/site:user_api reports docs_site: dangling link '../deploy/README.md#pypi_deploy', and the same build fails locally on a clean origin/main (976c47a). This PR doesn't touch tools/docs or deploy/. The other failures in the shard are aggregate_gates, config_consistency and workflow_pins, already noted as main failures above.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 13) on e7f7239 fails on //deploy/private:pub_config_content and //elixir/tests/conformance:coverage_test. Both also fail locally on a clean origin/main (493dd39). This PR touches neither deploy/ nor elixir/.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 15) on e7f7239 has one new failure, //gazelle/dispatch:dispatch_test (TestLanguageConformance/dart/metadata). It fails the same way locally on a clean origin/main (2261255), and this PR doesn't touch gazelle/. The other three failures, //gazelle/ocaml:ocaml_test, //gazelle/csharp:generation_test and //gazelle/julia:stdlib_test, are the main failures noted earlier.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 18) on e7f7239 produced no test result. After about 11 minutes the runner logged The runner has received a shutdown signal and exited 143, with no test reported as failed before that. That's a GitHub runner shutdown, not this diff. I'm not re-running it separately: a run-level re-run would also repeat the shards that fail on main, and the PR stays draft until the nested re-record lands.


Generated by Claude Code

…art of #14084)

consumer_deps_test now compares each nested lock's rules_dx extension
entries, and the entries whose root reads a rules_dx file, with the root
MODULE.bazel.lock: every FILE:/ENV: input must match and every generated
repo must exist in the root. It names the stale set and the re-record
command.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hxEMUyLEBAfNLUska2
…oken (part of #14084)

The apple set lists a Homebrew swift-format bottle on ghcr.io, which
answers 401 without a token, so every apple nested test and the macOS
nested record failed to fetch it. Cache entries now come from a small
repository rule that sends `Bearer QQ==` to ghcr.io URLs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Xut2hxEMUyLEBAfNLUska2
@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Rebased onto main (5bf6454). //core/modules:consumer_deps_test: 18 pass; every_nested_lock_matches_the_root_rules_dx_extensions flags adopt_polyglot, apple, indirect (still zig_0.17.0; the release sets were re-recorded by #14606). every_nested_lock_has_the_root_registry_deps wants the same re-record. every_bazel_dep_has_a_floor_comment_and_is_newest fails on rules_cuda in bcr_newest.json, a main failure.

/lock-refresh nested=true

🤖 Generated with Claude Code

Copy link
Copy Markdown
Collaborator Author

I dispatched lock-refresh.yml -f nested=true -f pr=14093 on cloud/14084 (982de39), since no run had started for this branch. One overlap: #14719 (cloud/14718) also changes tools/testing/extensions.bzl so the nested cache sends ghcr.io an anonymous token, the same fix as this PR's second commit. Whichever lands second has to drop its copy.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

nested record (windows_x86_64) in lock-refresh run 45171035108 passed //tools/testing:nested_bazel_harness_test and //examples/adopt-polyglot:consumer_test. It failed release_consumer_smoke_test in quickstart_consumer_test::the_readme_quickstart_runs_as_written. The step dx check //app/... on a Rust-only package exits 1 on app/lib.rs:4:8: clippy::must_use_candidate (-D clippy::must-use-candidate implied by -D warnings). That's the README quickstart's Rust sample against the strict clippy set on main, and this PR doesn't touch either. The footprint-budget error from Saturday no longer appears. I'm waiting for the Linux and macOS record jobs. The lock-refresh merge needs every host, so the locks can't land until main fixes the quickstart sample or its lint config.


Generated by Claude Code

@TrapsterDK

Copy link
Copy Markdown
Collaborator Author

Lock refresh 45171035108: the linux_x86_64 and windows_x86_64 nested record jobs fail in quickstart_consumer_test::the_readme_quickstart_runs_as_written at dx check //app/... (clippy::must_use_candidate on the fixture's answer()). This PR does not touch that file. The fixture fix is 3b96a67 on #14188. The re-record waits for that fix to reach main. #14719 also carries the ghcr.io anonymous-token change, so drop e7f7239 here when #14719 merges.

🤖 Generated with Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 24) on 982de39 has four failures that aren't listed above. I ran them on this branch head, and none comes from this PR:

  • //tools/ci:repo_rule_refetch_test wants a line for scala/private/toolchain/config_extension.bzl not-reproducible 1. That file came in with scala: let the root module choose Scala versions with scala_config.settings #14441. The tools/testing/nested_repository_cache.bzl not-reproducible 1 line is unchanged from main, because the new nested_cache_file rule returns repo_metadata(reproducible = True).
  • //tools/ci:hub_literals_test flags a bare maven at cli/adopt/src/lock_hubs.rs:206.
  • //tools/ci:lint_attributes_test flags drop(...) calls in cli/codegen_shard/src/writer.rs and deploy/private/src/crates.rs, plus the panic-family allowlist.
  • //tools/docs/languages:languages_test reports that docs/languages/{android,apple,cc,java,scala,zig}.md are out of date.

The rest of the shard repeats the main failures listed above.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

Shards 3, 25 and 26 on 982de39 have new failures. I ran them on this branch head. None of their logs mention a file this PR touches:

  • //cli/adopt:dx_adopt_test: scaffold::tests::go_files_get_the_gopls_tier_view (cli/adopt/src/scaffold.rs:1912).
  • //tools/testing/consumer:dart_consumer_test: dx init --apply writes a dart/tests/consumer/BUILD.bazel that doesn't match the checked-in file.
  • //tools/testing/nested:dx_nested_test: rules_flutter_pin_matches_the_root_module. The root MODULE.bazel now adds deterministic_web_compile.patch to the rules_flutter override, and tools/testing/nested/src/compose.rs doesn't list it.
  • //tools/testing:module_extension_srcs_test now fails on lua/private/lua_LICENSE.txt, which is missing from module_srcs.

The other failures in these shards (root_module_test, apple_consumer_test, the typescript extract test, language_skeleton_test) are the main failures already listed above.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

affected tests (linux_x86_64, shard 5) on 982de39 fails only on //core/modules:versions_contract: file //cuda:pins.json is missing substring. I ran it on this branch head, and it fails the same way. This PR doesn't touch cuda/ or core/modules/versions_tests.bzl.


Generated by Claude Code

Copy link
Copy Markdown
Collaborator Author

nested record (macos_arm64) in lock-refresh run 45171035108 passed //apple/tests:consumer_build_test, //examples/adopt-polyglot:consumer_test and //tools/testing:nested_bazel_harness_test. That means the ghcr.io anonymous-token fetch works on macOS. It failed only on release_consumer_smoke_test, at the same quickstart clippy::must_use_candidate on app/lib.rs:4 as Linux and Windows. That leaves the whole run waiting on the quickstart fixture fix from #14188 reaching main. After that, dispatch lock-refresh.yml -f nested=true -f pr=14093 again.


Generated by Claude Code

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants