Skip to content

Conversation

@ludfjig
Copy link
Contributor

@ludfjig ludfjig commented Jan 28, 2026

Avoid stale Cargo.lock being checked in. This is annoying because rust-analyzer will rebuild them locally and update Cargo.lock, resulting in locally modified Cargo.lock files, which can interfere with git operations (like git checkout).

Most complications come from the fact that dependabot will update dependencies (like hyperlight-common dependencies) without rebuilding guests resulting in the guest's Cargo.lock being outdated after a dependabot PR.f

I'm not 100% this will work after merging, so might require a future fix. Worst case is dependabot PRs won't get merged for a while, which is not the end of the world

Note: most of the scripting in this PR is made by copilot.

Prior art:

Note: since this will modify dependabot PRs, commands like @dependabot rebase won't work. Would need to do @dependabot recreate isntead, since dependabot won't rebase if somebody else touched the PR. This might make it a little more cumbersome to merge dependabot PRs...

- name: Update simpleguest Cargo.lock
if: steps.check-ecosystem.outputs.is_cargo == 'true'
working-directory: src/tests/rust_guests/simpleguest
run: cargo update
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is cargo update more aggressive than we want here? IIUC cargo update would update all deps to the latest compatible version, whereas I wonder if cargo update simpleguest to do only the updates that are necessary to make the lockfiles consistent would be useful to make the PRs a bit more granular and isolate the effect of a dependency with a failing update?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps building the guest would do the minimal necessary updates. I'm not sure cargo update simpleguest would work

Copy link
Contributor Author

@ludfjig ludfjig Feb 11, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually cargo fetch should probably do it! (without the --locked)

@syntactically
Copy link
Member

@ludfjig Absolutely no pressure if you have higher-priority things, but is there anything we should do to progress this? It's only a tiny papercut, but I am constantly running into the out-of-date guest lock files because I now use Nix-vendored dependencies, which makes them a bit annoying (have to get a cargo executable not configured for vendoring, fix the lock file, wait for the dev environment to rebuild, etc).

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR aims to prevent stale, checked-in Cargo.lock files (especially for Rust test guests) by enforcing lockfile freshness in CI and adding automation to update guest lockfiles on Dependabot PRs.

Changes:

  • Enforce --locked cargo fetch for each Rust guest crate (simpleguest/dummyguest/witguest) in local just CI-like checks.
  • Enforce the same guest lockfile checks in the reusable CI workflow (dep_code_checks.yml).
  • Add a new workflow to auto-update and push guest Cargo.lock files on Dependabot cargo PRs.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
Justfile Adds cargo fetch --manifest-path … --locked checks for each Rust guest crate.
.github/workflows/dep_code_checks.yml Extends the existing lockfile freshness check to include each Rust guest crate.
.github/workflows/dependabot-update-guest-locks.yml New workflow to regenerate guest lockfiles and push them back to Dependabot PR branches.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

@ludfjig ludfjig marked this pull request as ready for review February 12, 2026 00:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bugfix For PRs that fix bugs

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants