Conversation
Signed-off-by: Dargon789 <64915515+Dargon789@users.noreply.github.com>
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Deployment failed with the following error: Learn More: https://vercel.com/dargon789-forge?upgradeToPro=build-rate-limit |
Reviewer's GuideMake the CI install script more portable and POSIX-compliant, harden its temp-dir handling and cleanup, improve dependency checks, and adjust shell integration commands, plus add a changeset for a Rust dependency bump. Sequence diagram for hardened temp directory handling in download_fnmsequenceDiagram
actor CI as CI_or_User
participant Install as install_sh
participant Mktempdir as mktempdir
participant Curl as curl
participant Unzip as unzip
participant FS as Filesystem
CI->>Install: run install.sh
Install->>Mktempdir: DOWNLOAD_DIR=$(mktempdir)
alt mktempdir succeeds
Mktempdir-->>Install: path to temp directory
Install->>Install: trap "rm -rf '$DOWNLOAD_DIR'" EXIT INT HUP TERM
Install->>FS: mkdir -p INSTALL_DIR
Install->>Curl: download archive to DOWNLOAD_DIR/FILENAME.zip
alt curl succeeds
Curl-->>Install: archive file
Install->>Unzip: unzip archive into DOWNLOAD_DIR
Unzip-->>Install: extracted binary
Install->>FS: mv binary to INSTALL_DIR
else curl fails
Curl-->>Install: error
Install->>CI: print download failed message
Install-->>CI: exit 1 (trap removes DOWNLOAD_DIR)
end
else mktempdir fails
Mktempdir-->>Install: error
Install->>CI: print unable to create temp directory
Install-->>CI: exit 1
end
Install-->>CI: script exits (trap removes DOWNLOAD_DIR)
Flow diagram for updated CI install.sh logicflowchart TD
Start([Start]) --> ParseArgs["parse_args: read flags
--use-homebrew, --force-install,
--skip-shell, release, install dir"]
ParseArgs --> DetectOS["Detect OS and architecture"]
DetectOS --> CheckDeps["check_dependencies:
check curl, unzip,
optionally brew"]
CheckDeps -->|missing deps and not FORCE_INSTALL| ExitDeps["Print missing dependency message
and exit"]
CheckDeps -->|deps ok or FORCE_INSTALL| SetFilename["set_filename based on OS and arch"]
SetFilename --> DecideHB{USE_HOMEBREW == true?}
DecideHB -->|yes| InstallHB["brew install fnm"]
DecideHB -->|no| DownloadFnm["download_fnm:
create temp dir via mktempdir,
set trap for cleanup,
mkdir -p INSTALL_DIR,
use curl and unzip,
move binary into INSTALL_DIR"]
InstallHB --> AfterInstall
DownloadFnm --> AfterInstall["fnm binary installed"]
AfterInstall --> SkipShell{SKIP_SHELL == true?}
SkipShell -->|yes| EndNoShell([End: installation only])
SkipShell -->|no| SetupShell["setup_shell:
append integration to shell rc file,
use eval $(fnm env),
print sourcing instructions"]
SetupShell --> End([End: installation + shell integration])
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
✅ Snyk checks have passed. No issues have been found so far.
💻 Catch issues earlier using the plugins for VS Code, JetBrains IDEs, Visual Studio, and Eclipse. |
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- In
ensure_containing_dir_exists, replacing thelocalvariable with a globalcontaining_dirrisks unintended reuse elsewhere in the script; consider using a uniquely prefixed name or a subshell to keep the scope local. - The
mktempdirfallback loop creates predictable directory names under${TMPDIR:-/tmp}; if this script may run in multi-user or shared environments, consider adding a brief comment or extra randomness to clarify/mitigate the security implications of the fallback path.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- In `ensure_containing_dir_exists`, replacing the `local` variable with a global `containing_dir` risks unintended reuse elsewhere in the script; consider using a uniquely prefixed name or a subshell to keep the scope local.
- The `mktempdir` fallback loop creates predictable directory names under `${TMPDIR:-/tmp}`; if this script may run in multi-user or shared environments, consider adding a brief comment or extra randomness to clarify/mitigate the security implications of the fallback path.
## Individual Comments
### Comment 1
<location> `.ci/install.sh:173-174` </location>
<code_context>
- echo -n "Checking availability of unzip... "
- if hash unzip 2>/dev/null; then
+ printf "Checking availability of unzip... "
+ if command -v unzip >/dev/null 2>&1; then
echo "OK!"
else
</code_context>
<issue_to_address>
**question (bug_risk):** Unzip is required even when Homebrew is used, which may be stricter than necessary.
When `USE_HOMEBREW="true"`, the script installs via `brew install fnm` and never uses `unzip`, but still enforces its presence and may set `SHOULD_EXIT="true"`. This can abort the script in valid Homebrew environments without `unzip`. If that’s not intentional, consider skipping the `unzip` check when `USE_HOMEBREW=true` or only requiring it on the non-Homebrew path.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Improve the fnm installation script’s portability and robustness while updating a Rust dependency version.
Bug Fixes:
Enhancements:
Chores: