-
Notifications
You must be signed in to change notification settings - Fork 10
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
Fix foundry version check #534
Conversation
WalkthroughThe pull request updates the version verification for the Foundry tool within a shell script. The conditional check that previously looked for the string Changes
Possibly related PRs
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
This stack of pull requests is managed by Graphite. Learn more about stacking. |
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.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
dev/up
(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (2)
- GitHub Check: Test (Node)
- GitHub Check: Build pre-baked anvil-xmtpd
@@ -2,7 +2,7 @@ | |||
set -e | |||
|
|||
if ! which forge &>/dev/null; then echo "ERROR: Missing foundry binaries. Run 'curl -L https://foundry.paradigm.xyz | bash' and follow the instructions to install foundry 1.0.0" && exit 1; fi | |||
if ! forge --version | grep -q "v1.0.0"; then echo "ERROR: Foundry version is not 1.0.0. Please install the correct version." && exit 1; fi | |||
if ! forge --version | grep -q "1.0.0"; then echo "ERROR: Foundry version is not 1.0.0. Please install the correct version." && exit 1; fi |
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.
💡 Verification agent
🧩 Analysis chain
Verify Foundry version output format and improve version check precision.
While removing the "v" prefix aligns with Foundry's version output, the current grep check could be too permissive. It might match "1.0.0" within other version strings (e.g., "11.0.0" or "1.0.01").
Let's verify the Foundry version output format and check for potential version mismatches:
Consider using a more precise version check:
-if ! forge --version | grep -q "1.0.0"; then
+if ! forge --version | grep -q "^forge 1\.0\.0\b"; then
This ensures:
- The version string starts with "forge "
- Exactly matches "1.0.0"
- Prevents partial matches within other version numbers
🏁 Script executed:
#!/bin/bash
# Description: Check Foundry version output format and test version string matching
# Get Foundry version output format
forge --version
# Test if the current grep would incorrectly match these versions
echo "forge 11.0.0" | grep -q "1.0.0" && echo "WARNING: Would incorrectly match 11.0.0"
echo "forge 1.0.01" | grep -q "1.0.0" && echo "WARNING: Would incorrectly match 1.0.01"
Length of output: 367
Action Required: Refine the Foundry version check for precise matching.
- The current grep check with
"1.0.0"
is too permissive and incorrectly matches version strings such as11.0.0
and1.0.01
. - Verification via test commands confirms that these false positives occur.
- It is recommended to use a regex that anchors to the start of the version string and enforces exact matching.
Consider updating the version check in dev/up
as follows:
-if ! forge --version | grep -q "1.0.0"; then echo "ERROR: Foundry version is not 1.0.0. Please install the correct version." && exit 1; fi
+if ! forge --version | grep -q "^forge 1\.0\.0\b"; then echo "ERROR: Foundry version is not 1.0.0. Please install the correct version." && exit 1; fi
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
if ! forge --version | grep -q "1.0.0"; then echo "ERROR: Foundry version is not 1.0.0. Please install the correct version." && exit 1; fi | |
if ! forge --version | grep -q "^forge 1\.0\.0\b"; then echo "ERROR: Foundry version is not 1.0.0. Please install the correct version." && exit 1; fi |
tl;dr
Foundry seems to have updated the way they display versions from
v1.0.0
to1.0.0-stable
, which breaks our Foundry checkSummary by CodeRabbit