Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions test-flask/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[project]
name = "test-flask"
version = "0"
requires-python = ">=3.12"

dependencies = [
"blinker>=1.9.0",
"click>=8.1.8",
"flask>=3.1.1",
"ipdb>=0.13.13",
"markupsafe>=3.0.2",
"sentry-sdk[flask]",
"sqlalchemy>=2.0.38",
]

[tool.uv.sources]
sentry-sdk = { path = "../../sentry-python", editable = true }
11 changes: 0 additions & 11 deletions test-flask/requirements.txt

This file was deleted.

19 changes: 5 additions & 14 deletions test-flask/run.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
#!/usr/bin/env bash
set -euo pipefail

# exit on first error
set -xe
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

# create and activate virtual environment
python -m venv .venv
source .venv/bin/activate

# Install (or update) requirements
python -m pip install -r requirements.txt

# Initialize database
# flask --app flaskr init-db

# Run Flask application on localhost:5000
flask --app flaskr run
uv run flask --app flaskr run
Comment on lines +4 to +8

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bug: The script installs uv but doesn't update the current shell's $PATH, causing the subsequent uv run command to fail with 'command not found' in clean environments.
Severity: HIGH

Suggested Fix

After the curl | sh installation line, add export PATH="$HOME/.local/bin:$PATH" to update the current shell's PATH variable. This ensures the uv command is found and executed correctly within the same script session. Alternatively, source the profile file, e.g., source "$HOME/.cargo/env", if the installer provides a consistent environment file.

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: test-flask/run.sh#L4-L8

Potential issue: When `uv` is not pre-installed, the script attempts to install it using
`curl -LsSf https://astral.sh/uv/install.sh | sh`. However, this installer only modifies
shell profile files (e.g., `.bashrc`) and does not update the `$PATH` of the current,
non-interactive shell session. As a result, the immediately following `uv run` command
on line 8 fails because the `uv` executable cannot be found. Since `set -euo pipefail`
is active, the script exits immediately upon this failure, preventing the test from
running in any environment without a pre-existing `uv` installation, such as a clean CI
runner.

Did we get this right? 👍 / 👎 to inform future reviews.

Loading