-
Notifications
You must be signed in to change notification settings - Fork 53
Fix bump-minor-version to treat version as major.minor integers #3222
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -376,7 +376,7 @@ debug-version: | |
|
|
||
| # It's not so hard to do this by hand, but let's save some typing | ||
| bump-minor-version: | ||
| @yq '(((. * 10) + 1) / 10)' -i $(VERSION_FILE) && \ | ||
| @yq '(. | to_string | split(".") | .[0] + "." + (.[1] | to_number + 1 | to_string))' -i $(VERSION_FILE) && \ | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
expr='(. | to_string | split(".") | .[0] + "." + (.[1] | to_number + 1 | to_string))'
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
printf '0.9\n' > "$tmp"
yq "$expr" -i "$tmp"
first="$(cat "$tmp")"
yq "$expr" -i "$tmp"
second="$(cat "$tmp")"
printf 'After first bump: %s\n' "$first"
printf 'After second bump: %s\n' "$second"
# Expected:
# After first bump: 0.10
# After second bump: 0.11Repository: conforma/cli Length of output: 98 🏁 Script executed: # First, examine the Makefile and understand the context
head -n 390 Makefile | tail -n 20Repository: conforma/cli Length of output: 843 🏁 Script executed: # Find and inspect the VERSION file and related version scripts
git ls-files | grep -i version | head -20Repository: conforma/cli Length of output: 346 🏁 Script executed: # Install yq and test the specific YAML behavior
pip install yq > /dev/null 2>&1
# Now run the verification test
#!/bin/bash
set -euo pipefail
expr='(. | to_string | split(".") | .[0] + "." + (.[1] | to_number + 1 | to_string))'
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
printf '0.9\n' > "$tmp"
yq "$expr" -i "$tmp"
first="$(cat "$tmp")"
yq "$expr" -i "$tmp"
second="$(cat "$tmp")"
printf 'After first bump: %s\n' "$first"
printf 'After second bump: %s\n' "$second"Repository: conforma/cli Length of output: 99 🏁 Script executed: # Install yq command-line tool
apt-get update > /dev/null 2>&1 && apt-get install -y yq > /dev/null 2>&1
# Verify yq is available
which yq
# Now run the verification test
#!/bin/bash
set -euo pipefail
expr='(. | to_string | split(".") | .[0] + "." + (.[1] | to_number + 1 | to_string))'
tmp="$(mktemp)"
trap 'rm -f "$tmp"' EXIT
printf '0.9\n' > "$tmp"
echo "Initial content:"
cat "$tmp"
yq "$expr" -i "$tmp"
first="$(cat "$tmp")"
echo "After first bump: $first"
yq "$expr" -i "$tmp"
second="$(cat "$tmp")"
echo "After second bump: $second"
echo ""
echo "Expected: 0.10, then 0.11"
echo "Actual: $first, then $second"
# Test with more iterations to show the pattern
printf '0.9\n' > "$tmp"
for i in {1..5}; do
yq "$expr" -i "$tmp"
echo "Bump $i: $(cat "$tmp")"
doneRepository: conforma/cli Length of output: 181 🏁 Script executed: # Check the VERSION file content
cat VERSIONRepository: conforma/cli Length of output: 59 🏁 Script executed: # Examine the derive-version.sh script referenced in the review
cat hack/derive-version.shRepository: conforma/cli Length of output: 2823 🏁 Script executed: # Examine the version.go file that consumes the VERSION
cat internal/version/version.goRepository: conforma/cli Length of output: 3373 🌐 Web query:
💡 Result: In YAML, How to keep
|
||
| git add $(VERSION_FILE) && \ | ||
| git commit $(VERSION_FILE) \ | ||
| -m "Bump minor version to $$(cat $(VERSION_FILE))" \ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
1. Minor bump breaks at .10
🐞 Bug≡ CorrectnessAgent Prompt
ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation toolsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This concern has been empirically disproven with yq v4.47.1 (the version used by this project). While yq does parse
0.10as!!floatinternally,to_stringpreserves the original scalar representation --to_stringon0.10returns"0.10", not"0.1". The full round-trip0.9 -> 0.10 -> 0.11was verified both via pipe and viayq -ifile writes.