Skip to content

chore: clean up test infrastructure and tooling#83

Merged
rushilsrivastava merged 1 commit into
masterfrom
chore/cleanup
Feb 17, 2026
Merged

chore: clean up test infrastructure and tooling#83
rushilsrivastava merged 1 commit into
masterfrom
chore/cleanup

Conversation

@rushilsrivastava
Copy link
Copy Markdown
Member

@rushilsrivastava rushilsrivastava commented Feb 17, 2026

Summary

  • Migrate from Poetry to uv for dependency management
  • Add Makefile with lint, format, and test targets
  • Rewrite test suite: extract fixtures into conftest.py with pydantic-settings, split monolithic test into focused test functions
  • Fix CI workflow to reference correct docker-compose.yaml

Test Plan

  • All 3 smoke tests pass locally against Cloud Tasks emulator
  • Linter and formatter pass (ruff check, ruff format --check)
  • CI passes on this PR

🤖 Generated with Claude Code


Summary by cubic

Migrate from Poetry to uv and rebuild tests/CI around the Cloud Tasks emulator for reliable local and CI runs. Add readiness checks, fix queue parent construction, default region to us-central1, guard Scheduler locally, and prevent uvicorn deadlocks.

  • Refactors

    • Switch deps/build to uv + Hatchling; add uv.lock; use uv build/publish with tag/version validation.
    • Add Makefile (lint, format, test) and Development docs; add docker-compose for the emulator.
    • Restructure tests: shared fixtures via pydantic-settings, split smoke tests, run example app on port 1738.
    • CI: new emulator-backed test workflow using docker-compose and Makefile; show emulator logs on failure; lint uses uv.
  • Bug Fixes

    • Fix ensure_queue: build parent via location_path(project, location).
    • Stabilize server tests: wait for emulator and app readiness; write uvicorn output to a temp file to avoid pipe deadlocks; fail fast with server logs.
    • Local/CI safety: bind emulator to 0.0.0.0, default region to us-central1, inject an AnonymousCredentials-based Cloud Scheduler client when IS_LOCAL.

Written for commit 6018a01. Summary will update on new commits.


Note

Medium Risk
Moderate risk due to broad tooling/packaging workflow changes (build/publish/CI dependency management) plus new subprocess- and Docker-based test infrastructure that can be flaky if environment assumptions differ.

Overview
This PR migrates packaging and automation from Poetry to uv (and hatchling), replacing poetry.lock with uv.lock, updating PyPI publishing to uv build/uv publish, and standardizing local commands via a new Makefile (make lint, make format, make test).

CI is reworked to run tests against a Docker Compose Cloud Tasks emulator (new docker-compose.yaml and new CI workflow with log capture on failure), while the lint workflow also moves to uv sync + make lint. It also adds emulator-backed smoke tests that boot the example app under uvicorn with readiness checks, updates examples/docs defaults (region -> us-central1), and includes small reliability fixes (e.g., queue creation parent path construction and avoiding local Cloud Scheduler credentials via an anonymous client).

Written by Cursor Bugbot for commit 6018a01. This will update automatically on new commits. Configure here.

Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

1 issue found across 14 files

Prompt for AI agents (all issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="tests/conftest.py">

<violation number="1" location="tests/conftest.py:70">
P2: `subprocess.Popen` pipes stdout without any reader, which can deadlock the uvicorn process once its output buffer fills. Redirect stdout to `DEVNULL` or inherit stdout instead of piping it.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

Comment thread tests/conftest.py Outdated
Comment thread tests/conftest.py Outdated
Comment thread tests/test_smoke.py Outdated
- Migrate from Poetry to uv
- Add Makefile with lint, format, and test targets
- Rewrite test suite: extract fixtures into conftest.py with
  pydantic-settings, split monolithic test into focused test functions
- Wait for Cloud Tasks emulator before starting uvicorn in tests
- Fix ScheduledRouteBuilder crash without GCP credentials by passing
  a dummy client in local mode
- Use temp file for subprocess output to avoid pipe deadlocks
- Remove no-op test_trigger_endpoint (route doesn't exist on test server)
- Switch CI workflows to use Makefile targets

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Comment thread tests/conftest.py
try:
proc.wait(timeout=10)
except subprocess.TimeoutExpired:
proc.kill()
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing proc.wait() after proc.kill() leaves zombie

Low Severity

After proc.kill() in the subprocess.TimeoutExpired handler, there is no proc.wait() call to reap the child process. This leaves a zombie process entry in the process table until the proc object is garbage collected. On Python 3.12+, this also emits a ResourceWarning. The standard pattern is to always call proc.wait() immediately after proc.kill().

Fix in Cursor Fix in Web

Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

run: |
TAG_VERSION=${GITHUB_REF#refs/tags/v}
PYPROJECT_VERSION=$(poetry version -s)
PYPROJECT_VERSION=$(uv version)
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 version output includes project name, breaking comparison

High Severity

The uv version command outputs the version in the format project-name version-number (e.g., fastapi-gcp-tasks 0.1.1), whereas the old poetry version -s outputted just the bare version string (e.g., 0.1.1). Since TAG_VERSION is extracted as a bare version like 0.1.1, comparing it against PYPROJECT_VERSION from uv version will always fail, blocking every PyPI publish.

Fix in Cursor Fix in Web

@rushilsrivastava rushilsrivastava merged commit 88c38b2 into master Feb 17, 2026
3 checks passed
@rushilsrivastava rushilsrivastava deleted the chore/cleanup branch February 17, 2026 12:13
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.

1 participant