Skip to content

Use the frozen uv lock for Cloud Run images - #3859

Merged
anth-volk merged 2 commits into
masterfrom
fix/cloud-run-frozen-uv-install
Sep 30, 2026
Merged

anth-volk merged 2 commits into
masterfrom
fix/cloud-run-frozen-uv-install

Conversation

@anth-volk

@anth-volk anth-volk commented Sep 30, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes #3858

Summary

  • install the API v1 Cloud Run environment with uv sync --frozen --no-dev --no-editable
  • include uv.lock in the image build context and install the runtime environment into /opt/venv
  • pin the uv container image used during image construction
  • refresh uv.lock after CI increments the project version and before it commits the release changelog
  • add a focused regression test that prevents the Cloud Run image from returning to pip resolution

Why

The Cloud Run image previously ran pip install -e . against dependency ranges and ignored uv.lock. The latest failed staging image therefore installed FastAPI 0.142.0 while the repository lock selected 0.138.2. FastAPI 0.142.0 attempted automatic OpenTelemetry configuration during startup and the application process exited.

Using the same frozen uv installation command as the simulation entry Cloud Run service makes the reviewed lock file determine the production dependency set.

Testing

  • uv run --frozen pytest tests/unit/test_cloud_run_deploy_scripts.py tests/unit/test_asgi_factory.py -q (150 passed)
  • uv run --frozen pytest tests/unit/test_alembic_workflows.py tests/unit/test_cloud_run_deploy_scripts.py -q (125 passed)
  • uv run --frozen ruff check tests/unit/test_cloud_run_deploy_scripts.py
  • uv lock --check
  • docker build --platform linux/amd64 -f gcp/cloud_run/Dockerfile -t policyengine-api-cloud-run:uv-lock-test .
  • verified /opt/venv/bin/python, Gunicorn, Uvicorn, policyengine-api 4.2.4, FastAPI 0.138.2, and policyengine-observability 3.0.1 inside the built image

@codecov

codecov Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.65%. Comparing base (8468a86) to head (21d8790).

Additional details and impacted files
@@             Coverage Diff             @@
##           master    #3859       +/-   ##
===========================================
+ Coverage   45.76%   87.65%   +41.89%     
===========================================
  Files         182      197       +15     
  Lines       10812    11952     +1140     
  Branches     1837     2092      +255     
===========================================
+ Hits         4948    10477     +5529     
+ Misses       5456      901     -4555     
- Partials      408      574      +166     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@anth-volk
anth-volk marked this pull request as ready for review September 30, 2026 16:37
@anth-volk
anth-volk merged commit c1b737e into master Sep 30, 2026
14 checks passed

This branch was successfully deployed

1 active deployment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Install the Cloud Run API from the frozen uv lock

1 participant