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

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Python 3.12 requirement mismatch

High Severity

The pyproject.toml now requires Python 3.12+, but the .python-version file still pins 3.11.6. This mismatch can cause uv run to fail, preventing the project from starting or running scripts like run.sh and run-celery.sh.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7824e3e. Configure here.

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 pyproject.toml requires Python >=3.12, but .python-version pins 3.11.6. This conflict will cause uv run commands to fail.
Severity: HIGH

Suggested Fix

Align the Python versions. Either change requires-python in pyproject.toml to ">=3.11.6" or update the version in .python-version to 3.12 or a compatible newer version.

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-celery-accumulating-baggage/pyproject.toml#L4

Potential issue: The `pyproject.toml` file specifies `requires-python = ">=3.12"`, while
the `.python-version` file in the same directory pins the version to `3.11.6`. When `uv
run` is executed, it reads both files and detects that the pinned interpreter version
does not satisfy the project's requirement. This will cause commands like `uv run celery
...` and `uv run python main.py` to fail with an incompatibility error on every
invocation in both `run.sh` and `run-celery.sh`.

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


dependencies = [
"celery>=5.4.0",
"ipdb>=0.13.13",
"redis>=5.2.1",
"sentry-sdk[celery]",
]

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

This file was deleted.

23 changes: 6 additions & 17 deletions test-celery-accumulating-baggage/run-celery.sh
Original file line number Diff line number Diff line change
@@ -1,26 +1,15 @@
#!/usr/bin/env bash

# exit on first error
set -euo pipefail

# Delete Celery beat schedule because because when switching versions
# a wrong schedule will cause strange errors
rm -f celerybeat-schedule
if ! command -v uv &> /dev/null; then
curl -LsSf https://astral.sh/uv/install.sh | sh
fi
Comment on lines +4 to +6

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 uv command will not be found immediately after installation because the script does not update the current shell's PATH.
Severity: HIGH

Suggested Fix

After the installation command, add a line to update the PATH for the current session, such as export PATH="$HOME/.local/bin:$PATH", before calling uv run.

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-celery-accumulating-baggage/run-celery.sh#L4-L6

Potential issue: The `run-celery.sh` and `run.sh` scripts attempt to install `uv` if
it's missing, but the installer does not update the `PATH` for the current shell
session. Consequently, the subsequent `uv run` command will fail with a "command not
found" error on any system where `uv` is not already installed and in the `PATH`. This
makes the scripts unreliable for first-time users.

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


# Delete redis database (empty the queue)
rm -f celerybeat-schedule
rm -rf dump.rdb

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

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

redis-server --daemonize yes

# Run Celery and beat in the same process
celery -A main.app worker \
uv run celery -A main.app worker \
--loglevel=DEBUG \
--concurrency=1
# --max-tasks-per-child=2
--concurrency=1
15 changes: 5 additions & 10 deletions test-celery-accumulating-baggage/run.sh
Original file line number Diff line number Diff line change
@@ -1,13 +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

python main.py
uv run python main.py

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

uv install lacks PATH refresh

Medium Severity

The uv installer doesn't update the PATH for the current shell, causing uv run to fail with "command not found" immediately after installation. This is particularly an issue if ~/.local/bin isn't already on PATH, and set -euo pipefail ensures the script exits.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 7824e3e. Configure here.

Loading