Skip to content

fix(uv): invalidate extension state when lock/annotation files change#798

Closed
mkanat wants to merge 1 commit intoaspect-build:mainfrom
mkanat:fix-797-uv-lockfile-invalidation
Closed

fix(uv): invalidate extension state when lock/annotation files change#798
mkanat wants to merge 1 commit intoaspect-build:mainfrom
mkanat:fix-797-uv-lockfile-invalidation

Conversation

@mkanat
Copy link

@mkanat mkanat commented Feb 13, 2026

Summary

Fixes #797 by explicitly watching uv lock/annotation source files in the module extension so file content changes invalidate cached extension state in normal lockfile modes.

Reproduction

Reproduced from a current head checkout using a minimal bzlmod workspace that depends on published aspect_rules_py@1.8.4:

  1. Run bazelisk mod deps --lockfile_mode=refresh and query an existing dep (@hub//cowsay:all).
  2. Update uv.lock to add a new dep (click) and rerun bazelisk mod deps --lockfile_mode=refresh.
  3. Query @hub//click:all.

Actual on 1.8.4: missing package error (@@aspect_rules_py++uv+hub//click).

Change

  • Add module_ctx.watch(lock.src) before lockfile decode.
  • Add module_ctx.watch(ann.src) before annotations decode.
  • Include comments describing why these watches are required.

Verification

  • Reproduced failure from current head checkout against published 1.8.4.
  • Verified this branch resolves @hub//click:all correctly under --lockfile_mode=refresh.

@aspect-workflows
Copy link

aspect-workflows bot commented Feb 13, 2026

Bazel 8 (Test)

All tests were cache hits

31 tests (100.0%) were fully cached saving 48s.


Bazel 9 (Test)

All tests were cache hits

31 tests (100.0%) were fully cached saving 1m 10s.


Bazel 8 (Test)

e2e

All tests were cache hits

14 tests (100.0%) were fully cached saving 12s.


Bazel 9 (Test)

e2e

All tests were cache hits

12 tests (100.0%) were fully cached saving 7s.


Bazel 8 (Test)

examples/uv_pip_compile

All tests were cache hits

1 test (100.0%) was fully cached saving 335ms.

@mkanat
Copy link
Author

mkanat commented Feb 13, 2026

One thing I don't know about this is whether this is the right place in the codebase to do this, since I'm not intimately familiar with the codebase.

@arrdem
Copy link
Collaborator

arrdem commented Feb 13, 2026

Hey @mkanat, thanks for the fix and excited to see you're playing with the extension!

The correct fix here is that the tomltool driver needs to watch the files that it reads. This and many other fixes is incorporated into #778, which should be landing shortly.

@mkanat
Copy link
Author

mkanat commented Feb 13, 2026

Okay, great, I'll close this!

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.

[Bug]: uv extension: uv.lock changes can leave hub repos stale in normal lockfile mode

2 participants

Comments