Skip to content

ci: detect Cargo.lock drift offline + harden java --locked#7425

Open
wjones127 wants to merge 1 commit into
lance-format:mainfrom
wjones127:chore/lockfile-drift-check
Open

ci: detect Cargo.lock drift offline + harden java --locked#7425
wjones127 wants to merge 1 commit into
lance-format:mainfrom
wjones127:chore/lockfile-drift-check

Conversation

@wjones127

Copy link
Copy Markdown
Contributor

The repo keeps three lockfiles — root Cargo.lock, python/Cargo.lock, and java/lance-jni/Cargo.lock (the latter two are excluded from the workspace). A workspace.dependencies change can leave the excluded locks stale. python CI already runs --locked, but java CI did not, so a stale java lock went uncaught until a release build.

Changes:

  • cargo-lock-sync pre-commit hook — verifies all three lockfiles with cargo metadata --frozen (--locked + --offline). No network, no compilation; fails fast with a message naming the stale manifest and the fix.
  • Empty [workspace] tables in python/ and java/lance-jni/ manifests — declares each as its own workspace root so cargo resolves it standalone instead of climbing to an enclosing checkout. Without this, --manifest-path (and the hook) breaks when the checkout is nested inside another cargo project, e.g. a git worktree under the main checkout. The dependency graphs and lockfiles are unchanged.
  • --locked added to the java clippy step (java.yml, runs on PRs) and the release build steps (java-publish.yml).
  • AGENTS.md documents the three-lockfile rule.

Verified: offline check passes in-sync and detects an injected stale lock with exit 1 (no network); [workspace] additions leave all three lockfiles byte-identical; pre-commit validate-config passes and the hook ran green on this commit.

The repo keeps three lockfiles — root, python/, and java/lance-jni/ (the
latter two are excluded from the workspace) — so a workspace dependency
change can leave the excluded locks stale. python CI runs `--locked`, but
java CI did not, so a stale java lock went uncaught.

- Add a `cargo-lock-sync` pre-commit hook that verifies all three lockfiles
  with `cargo metadata --frozen` (= `--locked --offline`): no network, no
  compile, fails fast with a clear fix message.
- Add empty `[workspace]` tables to python/ and java/lance-jni/ manifests so
  cargo resolves them as their own roots instead of climbing to an enclosing
  checkout (which broke `--manifest-path` inside nested git worktrees).
- Add `--locked` to the java clippy (PR CI) and release build steps.
- Document the three-lockfile rule in AGENTS.md.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@github-actions github-actions Bot added ci Github Action or Test issues A-python Python bindings A-java Java bindings + JNI A-ci CI / build workflows labels Jun 23, 2026
@wjones127 wjones127 marked this pull request as ready for review June 23, 2026 17:38
@wjones127 wjones127 requested review from Xuanwo and westonpace June 23, 2026 17:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ci CI / build workflows A-java Java bindings + JNI A-python Python bindings ci Github Action or Test issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant