Skip to content

tests: restore MODULE.bazel.lock after bzlmod_lockfile_test failure - #4503

Merged
rickeylev merged 1 commit into
bazel-contrib:mainfrom
rickeylev:fix-bzlmod-lockfile-test-retry
Nov 14, 2026
Merged

rickeylev merged 1 commit into
bazel-contrib:mainfrom
rickeylev:fix-bzlmod-lockfile-test-retry

Conversation

@rickeylev

Copy link
Copy Markdown
Collaborator

bzlmod_lockfile_test runs with no-sandbox and invokes
bazel mod deps --lockfile_mode=update in place when
bazel test //... fails. Leaving MODULE.bazel.lock modified on disk
lets --flaky_test_attempts retries pass on CI, masking stale lockfile
failures, and dirties the local working tree.

Wrap the lockfile update in a context manager that restores the
original bytes and mtime on exit after reading the updated contents
for diff and undeclared-output reporting, and add unit tests covering
retry failure and restoration.

`bzlmod_lockfile_test` runs with `no-sandbox` and invokes
`bazel mod deps --lockfile_mode=update` in place when
`bazel test //...` fails. Leaving `MODULE.bazel.lock` modified on disk
lets `--flaky_test_attempts` retries pass on CI, masking stale lockfile
failures, and dirties the local working tree.

Wrap the lockfile update in a context manager that restores the
original bytes and `mtime` on exit after reading the updated contents
for diff and undeclared-output reporting, and add unit tests covering
retry failure and restoration.
@rickeylev
rickeylev requested a review from aignas as a code owner November 14, 2026 17:13
@rickeylev

Copy link
Copy Markdown
Collaborator Author

This pull request was authored with AI agent assistance. An agent monitors CI
for transient flakes, and @rickeylev handles substantive review comments
directly.

This is an automatically generated agent comment.

@rickeylev
rickeylev enabled auto-merge November 14, 2026 17:15
@rickeylev
rickeylev merged commit bbfb1c7 into bazel-contrib:main Nov 14, 2026
15 checks passed
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.

1 participant