Skip to content

Commit 77be91b

Browse files
joaoh82claude
andauthored
fix(release): bump-version.sh rewrites inter-workspace dep pins (SQLR-9) (#88)
* fix(release): bump-version.sh rewrites inter-workspace dep pins (SQLR-9) The release-pr.yml dispatch for v0.3.0 failed at `cargo build` with `failed to select a version for the requirement sqlrite-ask = "^0.2"` because bump-version.sh updated the package-level `version = "X.Y.Z"` field in 11 manifests but ignored the three `version = "..."` pins that workspace crates declare on each other (engine→sqlrite-ask, sqlrite-mcp→engine, wasm SDK→sqlrite-ask). PR #87 patched those by hand; this change makes the script handle them automatically. Approach: detect any TOML line containing both `version = "..."` and `path = "..."`, rewrite the version to the full bumped semver. This is unambiguous in the repo (no false positives) and handles both inline-table orderings. Future workspace crates added with the same path+version shape get rewritten with no script changes. The rewrite uses the full X.Y.Z[-pre][+build] form (e.g. "0.3.0", not "0.3"), which catches drift inside a minor and works with the prerelease-dispatch path. Visible effect on the next release PR: the three pins flip from "0.3" to "0.3.0". Also extends the verify loop to flag any surviving same-line `path = ... version = ...` pin not at the bumped version, so a future refactor that changes pin shape (e.g. multi-line deps) fails loudly instead of silently producing a broken release branch. Verification: - bump-version.sh 9.9.9-test rewrites all three pins (both inline-table orderings). - Re-running with the same arg is byte-exact idempotent. - `cargo build --workspace --exclude sqlrite-desktop ...` resolves cleanly — the original SQLR-9 failure mode no longer reproduces. - Verify-loop logic confirmed against a staled-pin fixture. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> * docs(release): fix off-by-one file counts in bump-version.sh banner The header docstring said "eight Cargo.toml / pyproject.toml files, plus three JSON manifests — eleven files total" and the footer said "the ten-file bump". TOML_FILES has nine entries (root engine, ffi, ask, mcp, python ×2, nodejs, wasm, desktop) plus three JSON manifests = twelve total. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent be871bc commit 77be91b

1 file changed

Lines changed: 38 additions & 3 deletions

File tree

scripts/bump-version.sh

Lines changed: 38 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
# scripts/bump-version.sh 0.2.0
77
#
88
# Rewrites the version field in every manifest that carries one
9-
# (eight Cargo.toml / pyproject.toml files, plus three JSON manifests
10-
#eleven files total). Then you run `cargo build` yourself to
9+
# (nine Cargo.toml / pyproject.toml files, plus three JSON manifests
10+
#twelve files total). Then you run `cargo build` yourself to
1111
# refresh Cargo.lock. Idempotent: running twice with the same version
1212
# is a no-op; running twice with different versions lands on the
1313
# second.
@@ -84,6 +84,25 @@ for file in "${TOML_FILES[@]}"; do
8484
fi
8585
sed "s/^version = \"[^\"]*\"/version = \"${VERSION}\"/" "$file" > "$file.tmp"
8686
mv "$file.tmp" "$file"
87+
88+
# Inter-workspace dep pins — lines like:
89+
# sqlrite-ask = { version = "0.3", path = "sqlrite-ask", ... }
90+
# sqlrite = { package = "sqlrite-engine", path = "..", version = "0.3", ... }
91+
#
92+
# These carry BOTH version and path because crates.io publishing
93+
# rejects path-only deps (see PR #58 retrospective). The version
94+
# field has to track the workspace bump or `cargo build` fails to
95+
# resolve a candidate (SQLR-9; failed run for v0.3.0 hit exactly
96+
# this — `failed to select a version for the requirement
97+
# sqlrite-ask = "^0.2"`).
98+
#
99+
# Detection: any line containing both `version = "..."` and
100+
# `path = "..."`. The package-level `^version = "..."` line at
101+
# the top of each manifest has no `path` on it and can't match.
102+
# Both inline-table orderings (version-first and path-first) work
103+
# because sed acts per-line, not per-token-order.
104+
sed -E '/path *= *"[^"]*"/ s/version *= *"[^"]*"/version = "'"${VERSION}"'"/' "$file" > "$file.tmp"
105+
mv "$file.tmp" "$file"
87106
done
88107

89108
# ---------------------------------------------------------------------------
@@ -147,6 +166,22 @@ for file in "${JSON_FILES[@]}"; do
147166
fi
148167
done
149168

169+
# Inter-workspace pin sweep — any surviving `version = "X"` on a TOML
170+
# line that also has `path = "..."` and isn't already at $VERSION is a
171+
# pin we missed. Catches future refactors that change pin shape (e.g.
172+
# someone splits a long dep line across multiple TOML lines, where the
173+
# single-line address would no longer match).
174+
for file in "${TOML_FILES[@]}"; do
175+
bad="$(grep -nE 'path *= *"[^"]*"' "$file" \
176+
| grep -E 'version *= *"[^"]*"' \
177+
| grep -vE "version *= *\"${VERSION}\"" || true)"
178+
if [[ -n "$bad" ]]; then
179+
echo "$file — inter-workspace pin not at ${VERSION}:" >&2
180+
echo "$bad" | sed 's/^/ /' >&2
181+
FAILURES=$((FAILURES + 1))
182+
fi
183+
done
184+
150185
if [[ $FAILURES -gt 0 ]]; then
151186
echo
152187
echo "error: $FAILURES file(s) did not update as expected." >&2
@@ -157,5 +192,5 @@ fi
157192
echo
158193
echo "Done. Next steps:"
159194
echo " cargo build # refresh Cargo.lock with the new versions"
160-
echo " git diff # inspect the ten-file bump"
195+
echo " git diff # inspect the twelve-file bump"
161196
echo " git checkout . # or back out if it looks wrong"

0 commit comments

Comments
 (0)