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
16 changes: 16 additions & 0 deletions test-fastapi-root-path/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[project]
name = "test-fastapi-root-path"
version = "0"
requires-python = ">=3.12"

dependencies = [
"black>=25.1.0",
"fastapi>=0.115.11",
"ipdb>=0.13.13",
"requests>=2.32.3",
"sentry-sdk[fastapi]",
"uvicorn>=0.34.0",
]

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

This file was deleted.

14 changes: 4 additions & 10 deletions test-fastapi-root-path/run.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,9 @@
#!/usr/bin/env bash

set -euo pipefail

reset

python -m venv .venv
source .venv/bin/activate

pip install -r requirements.txt

# uvicorn main:app --port 5000 --reload --root-path /api/v1 &
uvicorn main:app --port 5000 --reload
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi

#nginx -c "$(pwd)/nginx.conf"
uv run uvicorn main:app --port 5000 --reload
Comment on lines +5 to +9

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 in a subshell, which doesn't update the parent shell's PATH. The subsequent uv command fails with "command not found".
Severity: MEDIUM

Suggested Fix

Source the installer script instead of piping it to a new shell, for example: source <(curl -LsSf https://astral.sh/uv/install.sh). This will run the installer in the current shell process, allowing it to modify the PATH environment variable. Alternatively, explicitly add the installation directory (e.g., $HOME/.cargo/bin) to the PATH after the installation step.

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-fastapi-root-path/run.sh#L5-L9

Potential issue: The `run.sh` script attempts to install `uv` using `curl -LsSf
https://astral.sh/uv/install.sh | sh`. This command runs the installer in a subshell,
which prevents it from modifying the `PATH` environment variable of the main script's
process. Consequently, the next command, `uv run ...`, fails because the shell cannot
find the `uv` executable. Since the script is configured with `set -euo pipefail`, this
"command not found" error will cause the script to terminate, failing the test for any
environment where `uv` is not pre-installed.

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

Loading