feat: install script to check for hard stops - #4489
Conversation
The idea came from Discord, and Alex (stayalive) lay out a very good approach on this: https://discord.com/channels/621778831602221064/796028405833007104/1541789134006259814
|
@aminvakil apparently, EDIT; nevermind I just read this #4489 (comment), sorry about that |
|
Just dropping this here: #3878 (review) Overall, I think this is pretty good but we need a shared place and format to have the hard-stops so docs and the repo does not diverge. I'd propose JSON in a well-known location like the docs repo or this repo, and reading it with |
@BYK Yeah I remember about your comment. I don't know where the "shared place" should be. I don't want to have it on And yes, there will always be a maintenance burden for this one. |
Not sure we are on the same page. My proposal is having this information in a separate, dedicated JSON file in this repo and then the docs repo fetching it at build time. |
Aaaaaahhhhhh, that makes sense. I dunno how to do it on the docs repo, but making a JSON file here would be doable. |
| if [[ -n "$current_version" ]]; then | ||
| # We iterate over the list of hard stops, and check whether the current | ||
| # version is below any of them. | ||
| local _wrote_version=0 |
There was a problem hiding this comment.
Bug: The installation script will fail because local is used outside a function in install/check-hard-stop.sh. The script runs with set -e, causing it to exit on this error.
Severity: CRITICAL
Suggested Fix
Remove the local keyword from the declaration of _wrote_version on line 149. The line should be changed from local _wrote_version=0 to _wrote_version=0 to correctly declare it as a script-level variable.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent. Verify if this is a real issue. If it is, propose a fix; if not, explain why it's
not valid.
Location: install/check-hard-stop.sh#L149
Potential issue: In `install/check-hard-stop.sh`, the `local` keyword is used to declare
the `_wrote_version` variable at the top level, outside of any function. In bash,
`local` is only valid inside a function and will return a non-zero exit code when used
in the global scope. Because the parent `install.sh` script executes with `set -e`, this
error will cause the entire installation/upgrade process to abort prematurely. This bug
is triggered during a standard upgrade for any existing user who has a
`.sentry-hard-stop` file from a previous installation, which is a common scenario.
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 2b942d2. Configure here.
| if [[ -n "$current_version" ]]; then | ||
| # We iterate over the list of hard stops, and check whether the current | ||
| # version is below any of them. | ||
| local _wrote_version=0 |
There was a problem hiding this comment.
Top-level local crashes upgrade installs
High Severity
local _wrote_version=0 runs at script scope in a sourced file, which bash rejects. Combined with set -e in install.sh, any upgrade that already has a tracking file aborts immediately, so the hard-stop check never runs and the install cleanup trap can stop a live stack.
Reviewed by Cursor Bugbot for commit 2b942d2. Configure here.


The idea came from Discord, and Alex (stayalive) lay out a very good approach on this: https://discord.com/channels/621778831602221064/796028405833007104/1541789134006259814