Skip to content

bazel: enforce MODULE.bazel.lock sync with Cargo.lock - #11790

Merged
joshka-oai merged 3 commits into
mainfrom
joshka/bazel-lockfile-sync-check
Feb 14, 2026
Merged

joshka-oai merged 3 commits into
mainfrom
joshka/bazel-lockfile-sync-check

Conversation

@joshka-oai

@joshka-oai joshka-oai commented Feb 13, 2026 •

Copy link
Copy Markdown
Contributor

Why this change

When Cargo dependencies change, it is easy to end up with an unexpected local diff in
MODULE.bazel.lock after running Bazel. That creates noisy working copies and pushes lockfile fixes
later in the cycle. This change addresses that pain point directly.

What this change enforces

The expected invariant is: after dependency updates, MODULE.bazel.lock is already in sync with
Cargo resolution. In practice, running bazel mod deps should not mutate the lockfile in a clean
state. If it does, the dependency update is incomplete.

How this is enforced

This change adds a single lockfile check script that snapshots MODULE.bazel.lock, runs
bazel mod deps, and fails if the file changes. The same check is wired into local workflow
commands (just bazel-lock-update and just bazel-lock-check) and into Bazel CI (Linux x86_64 job)
so drift is caught early and consistently. The developer documentation is updated in
codex-rs/docs/bazel.md and AGENTS.md to make the expected flow explicit.

MODULE.bazel.lock is also refreshed in this PR to match the current Cargo dependency resolution.

Expected developer workflow

After changing Cargo.toml or Cargo.lock, run just bazel-lock-update, then run
just bazel-lock-check, and include any resulting MODULE.bazel.lock update in the same change.

Testing

Ran just bazel-lock-check locally.

@joshka-oai
joshka-oai requested review from bolinfest and zbarsky-openai and removed request for zbarsky-openai February 13, 2026 23:01
@joshka-oai
joshka-oai force-pushed the joshka/bazel-lockfile-sync-check branch from f5eb56e to 148e25d Compare February 13, 2026 23:01
Add a shared lockfile check script that verifies lockfile freshness with
`bazel mod deps --lockfile_mode=error` so stale `MODULE.bazel.lock`
fails fast without mutating files.

Wire local commands for explicit lockfile workflows:
- `just bazel-lock-update` uses `--lockfile_mode=update`
- `just bazel-lock-check` runs the non-mutating verify script

Run the same check in Bazel CI on one Linux job so lockfile drift is
caught consistently. Document the expected dependency-update flow in
`codex-rs/docs/bazel.md` and add matching guidance in `AGENTS.md`.

Refresh `MODULE.bazel.lock` to match current Cargo resolution.
@joshka-oai
joshka-oai force-pushed the joshka/bazel-lockfile-sync-check branch from 148e25d to 011b070 Compare February 13, 2026 23:21
@joshka-oai
joshka-oai enabled auto-merge (squash) February 13, 2026 23:45
@joshka-oai

Copy link
Copy Markdown
Contributor Author

Bazel failures here look unrelated to this lockfile change.

//codex-rs/protocol:protocol-unit-tests fails to compile under Bazel due to a test using include_bytes!("../../core/src/skills/.../skill-creator.png"), which is outside the Bazel sandbox inputs (works under Cargo).

I opened #11799 to make that test hermetic by inlining a tiny valid PNG. Regression appears to come from #10590 (cc: @charley-oai).

@joshka-oai
joshka-oai merged commit de93cef into main Feb 14, 2026
53 of 55 checks passed
@joshka-oai
joshka-oai deleted the joshka/bazel-lockfile-sync-check branch February 14, 2026 02:11
@github-actions github-actions Bot locked and limited conversation to collaborators Feb 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants