fix(release): warm cargo cache before the offline lock sync (VA-144) #154

Closed
David wants to merge 1 commit from fix/VA-144-warm-cargo-cache into main
Owner

Fixes the cold-cache failure in just create-release (#VA-144).

just create-release minor died during the lock sync with "no matching package named anyhow found / location searched: crates.io index". The dependency was never missing: anyhow = "1" is declared in crates/vervain-agent/Cargo.toml and anyhow 1.0.102 is in Cargo.lock. The version bump forces the resolver to run, and inside the dev container cargo resolves against the dev-vervain-agent-cargo-registry volume (compose.yml:13-15), which is created empty on a fresh clone, a new machine, or after a volume prune. --offline then forbids reaching the index, so the first crate needed fails; anyhow was just alphabetically early.

The fix adds cargo fetch --locked in the container immediately before the offline update. It fetches exactly what Cargo.lock pins and fails rather than rewriting it, so the release commit's contents are unaffected, and it costs nothing once the volume is warm.

--offline deliberately stays on the cargo update step. It keeps unrelated dependency movement out of the release commit. Worth recording why the bug existed at all: this recipe inherited that flag from the host-side recipe in common.just, which runs via nushell's ^ operator against a ~/.cargo registry that is warm by construction. vervain-agent vendors no common submodule and has no host Rust toolchain, so it runs the same command in a container and never inherited that guarantee.

Verification status, stated plainly: just pre-commit was NOT run, because docker is not available in the environment this change was authored in. just --dry-run create-release minor confirms the recipe parses and renders both steps in the right order, the diff touches justfile only, and cargo fmt --all --check is clean on the host. The cold-volume acceptance criterion (run with the cargo volumes removed, e.g. after docker compose --file compose.yml down --volumes) still needs a run on a machine with Docker before merge.

Fixes the cold-cache failure in `just create-release` (#VA-144). `just create-release minor` died during the lock sync with "no matching package named `anyhow` found / location searched: crates.io index". The dependency was never missing: `anyhow = "1"` is declared in `crates/vervain-agent/Cargo.toml` and `anyhow 1.0.102` is in `Cargo.lock`. The version bump forces the resolver to run, and inside the dev container cargo resolves against the `dev-vervain-agent-cargo-registry` volume (`compose.yml:13-15`), which is created empty on a fresh clone, a new machine, or after a volume prune. `--offline` then forbids reaching the index, so the first crate needed fails; `anyhow` was just alphabetically early. The fix adds `cargo fetch --locked` in the container immediately before the offline update. It fetches exactly what `Cargo.lock` pins and fails rather than rewriting it, so the release commit's contents are unaffected, and it costs nothing once the volume is warm. `--offline` deliberately stays on the `cargo update` step. It keeps unrelated dependency movement out of the release commit. Worth recording why the bug existed at all: this recipe inherited that flag from the host-side recipe in `common.just`, which runs via nushell's `^` operator against a `~/.cargo` registry that is warm by construction. `vervain-agent` vendors no `common` submodule and has no host Rust toolchain, so it runs the same command in a container and never inherited that guarantee. Verification status, stated plainly: `just pre-commit` was NOT run, because `docker` is not available in the environment this change was authored in. `just --dry-run create-release minor` confirms the recipe parses and renders both steps in the right order, the diff touches `justfile` only, and `cargo fmt --all --check` is clean on the host. The cold-volume acceptance criterion (run with the cargo volumes removed, e.g. after `docker compose --file compose.yml down --volumes`) still needs a run on a machine with Docker before merge.
fix(release): warm cargo cache before the offline lock sync
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 17m21s
Create release / Create release from merged PR (pull_request) Has been skipped
d2b2dc6c01
`just create-release` failed on a cold cache with "no matching package named `anyhow` found / location searched: crates.io index". The dependency was never missing: `anyhow = "1"` is in crates/vervain-agent/Cargo.toml and `anyhow 1.0.102` is in Cargo.lock. The version bump forces the resolver to run, and inside the dev container cargo resolves against the dev-vervain-agent-cargo-registry volume, which is created empty on a fresh clone or after a volume prune. With `--offline` set there is no index to read, so the first crate needed fails and any crate would have failed the same way.

Run `cargo fetch --locked` in the container before the update. It fetches exactly what Cargo.lock pins and never rewrites it, so the release commit's contents are unaffected, and it is a no-op once the volume is warm.

`--offline` stays on the update: it is a deliberate guard that keeps unrelated dependency movement out of the release commit. The recipe inherited that flag from the host-side recipe in common.just, whose cache is warm by construction because it runs against ~/.cargo; this repo has no host Rust toolchain and so does not get that guarantee.

#VA-144
Author
Owner

Superseded by #155 (merged as e300f90) and closed per VA-144 acceptance criterion 10.

This PR's ordering is broken: it inserts cargo fetch --locked AFTER the str replace that bumps [workspace.package] version, so Cargo.toml and Cargo.lock disagree at that point and --locked refuses by design (error: cannot update the lock file /workspace/Cargo.lock because --locked was passed to prevent this). The release still aborts, one step earlier than before. The fetch has to run while the lock is still authoritative, i.e. before the version rewrite, which is what #155 does.

#155 also fixes a second defect this PR does not touch: nothing between the branch creation and the commit was guarded, so any failure in that window left the version bump uncommitted in the working tree on an empty release/<tag> branch.

#VA-144

Superseded by #155 (merged as e300f90) and closed per VA-144 acceptance criterion 10. This PR's ordering is broken: it inserts `cargo fetch --locked` AFTER the `str replace` that bumps `[workspace.package] version`, so `Cargo.toml` and `Cargo.lock` disagree at that point and `--locked` refuses by design (`error: cannot update the lock file /workspace/Cargo.lock because --locked was passed to prevent this`). The release still aborts, one step earlier than before. The fetch has to run while the lock is still authoritative, i.e. before the version rewrite, which is what #155 does. #155 also fixes a second defect this PR does not touch: nothing between the branch creation and the commit was guarded, so any failure in that window left the version bump uncommitted in the working tree on an empty `release/<tag>` branch. #VA-144
David closed this pull request 2026-08-08 02:35:40 +02:00
David deleted branch fix/VA-144-warm-cargo-cache 2026-08-08 02:38:22 +02:00
All checks were successful
Check / fmt + clippy + tests (pull_request) Successful in 17m21s
Required
Details
Create release / Create release from merged PR (pull_request) Has been skipped

Pull request closed

Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
psa-systems/vervain-agent!154
No description provided.