Skip to content
Closed
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
13 changes: 11 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ on:
pull_request:
branches: [main]

permissions:
contents: read

jobs:
lint:
name: Lint (Ruff)
Expand All @@ -17,6 +20,7 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true

- name: Set up Python
run: uv python install 3.12
Expand All @@ -40,6 +44,7 @@ jobs:
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true

- name: Set up Python
run: uv python install 3.12
Expand All @@ -51,18 +56,22 @@ jobs:
run: uv run mypy src/

test:
name: Test (Pytest)
name: Test (Pytest) - Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4

- name: Install uv
uses: astral-sh/setup-uv@v4
with:
version: "latest"
enable-cache: true

- name: Set up Python
run: uv python install 3.12
run: uv python install ${{ matrix.python-version }}

- name: Install dependencies
run: uv sync --group dev --all-extras
Comment on lines 76 to 77
Copy link

Choose a reason for hiding this comment

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

Bug: Concurrent CI matrix jobs using setup-uv with enable-cache: true will experience cache key collisions and upload failures.
Severity: MEDIUM | Confidence: High

🔍 Detailed Analysis

When multiple matrix jobs (e.g., Python 3.12 and 3.13) run concurrently, both use enable-cache: true with astral-sh/setup-uv@v4 and attempt to install dependencies. Because the setup-uv action is not provided with python-version input and no cache-suffix is specified, both jobs generate the same cache key. This leads to a race condition where both jobs try to upload to the same cache simultaneously, resulting in cache upload failures for at least one job, wasted CI time, and potentially inconsistent cache states.

💡 Suggested Fix

Either pass python-version: ${{ matrix.python-version }} directly to astral-sh/setup-uv@v4 or add cache-suffix: ${{ matrix.python-version }} to the action configuration to differentiate cache keys for matrix jobs.

🤖 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: .github/workflows/ci.yml#L56-L77

Potential issue: When multiple matrix jobs (e.g., Python 3.12 and 3.13) run
concurrently, both use `enable-cache: true` with `astral-sh/setup-uv@v4` and attempt to
install dependencies. Because the `setup-uv` action is not provided with
`python-version` input and no `cache-suffix` is specified, both jobs generate the same
cache key. This leads to a race condition where both jobs try to upload to the same
cache simultaneously, resulting in cache upload failures for at least one job, wasted CI
time, and potentially inconsistent cache states.

Did we get this right? 👍 / 👎 to inform future reviews.
Reference ID: 3596559

Expand Down