Skip to content

Commit 36ff52c

Browse files
cognectclaude
andcommitted
chore(xtask): bump rewrites per-crate inline path-dep version pins
xtask bump previously only touched [workspace.dependencies] in the root Cargo.toml. Per-crate inline pins like 'rakka-accel-cuda = { path = "../rakka-accel-cuda", version = "0.2.7" }' in patterns/train/agents/realtime/py drifted on every bump and broke 'cargo publish' with "no matching package" errors (this caused the v0.2.6 release attempt to fail). Walk crates/*/Cargo.toml and rewrite any sibling rakka-accel-* path dep pinned at the previous workspace version. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent e658c0a commit 36ff52c

1 file changed

Lines changed: 45 additions & 2 deletions

File tree

xtask/src/main.rs

Lines changed: 45 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@
33
//! Subcommands:
44
//! * `bump <patch|minor|major>` — bump the workspace version, refresh
55
//! `Cargo.lock`, mirror to `crates/rakka-accel-py/pyproject.toml`,
6-
//! and rewrite internal-path-dep version pins inside
7-
//! `[workspace.dependencies]`.
6+
//! rewrite internal-path-dep version pins inside
7+
//! `[workspace.dependencies]`, and rewrite per-crate inline
8+
//! `path = "../rakka-accel-*"`-with-`version = "..."` pins so
9+
//! sibling-crate deps don't drift.
810
//! * `bump --pre <id>` / `bump --set <ver>` — variants for
911
//! pre-release tags and exact-version overrides.
1012
//! * `verify` — local mirror of the release-pipeline gate:
@@ -78,6 +80,7 @@ fn bump(args: Vec<String>) -> Result<()> {
7880
println!("{} -> {}", current, next);
7981
write_workspace_version(cargo_toml, &next)?;
8082
write_workspace_deps_versions(cargo_toml, &current, &next)?;
83+
write_member_inline_deps_versions(&current, &next)?;
8184
if pyproject.exists() {
8285
write_pyproject_version(pyproject, &next)?;
8386
}
@@ -214,6 +217,46 @@ fn write_workspace_deps_versions(path: &Path, prev: &str, next: &str) -> Result<
214217
Ok(())
215218
}
216219

220+
/// Bump every per-crate inline `path = "../rakka-accel-*"`-with-`version = "<prev>"`
221+
/// pin in member Cargo.tomls. xtask's workspace-deps rewrite covers
222+
/// `[workspace.dependencies]` only; sibling-crate deps that the
223+
/// member crates declare directly (e.g. patterns/train/agents/realtime/py
224+
/// → rakka-accel-cuda) drift on every bump otherwise, breaking
225+
/// `cargo publish` with "no matching package" errors.
226+
fn write_member_inline_deps_versions(prev: &str, next: &str) -> Result<()> {
227+
let crates_dir = Path::new("crates");
228+
if !crates_dir.exists() {
229+
return Ok(());
230+
}
231+
let needle = format!("version = \"{prev}\"");
232+
let replacement = format!("version = \"{next}\"");
233+
for entry in std::fs::read_dir(crates_dir)? {
234+
let entry = entry?;
235+
let manifest = entry.path().join("Cargo.toml");
236+
if !manifest.exists() {
237+
continue;
238+
}
239+
let text = std::fs::read_to_string(&manifest)?;
240+
let mut out = String::with_capacity(text.len());
241+
let mut changed = false;
242+
for line in text.split_inclusive('\n') {
243+
// Only rewrite lines that pin a sibling rakka-accel-* path
244+
// dep at the previous workspace version.
245+
let is_sibling_path = line.contains("path = \"../rakka-accel");
246+
if is_sibling_path && line.contains(&needle) {
247+
out.push_str(&line.replace(&needle, &replacement));
248+
changed = true;
249+
} else {
250+
out.push_str(line);
251+
}
252+
}
253+
if changed {
254+
std::fs::write(&manifest, out)?;
255+
}
256+
}
257+
Ok(())
258+
}
259+
217260
fn write_pyproject_version(path: &Path, version: &str) -> Result<()> {
218261
// pyproject.toml in maturin mode declares `dynamic = ["version"]`
219262
// — the wheel version comes from Cargo.toml. We still update the

0 commit comments

Comments
 (0)