Skip to content

feat: scaffold worker package with FastAPI app and health endpoints#33

Merged
sjlangley merged 5 commits intomainfrom
apps/worker/scaffold
Apr 13, 2026
Merged

feat: scaffold worker package with FastAPI app and health endpoints#33
sjlangley merged 5 commits intomainfrom
apps/worker/scaffold

Conversation

@sjlangley
Copy link
Copy Markdown
Owner

@sjlangley sjlangley commented Apr 13, 2026

Initial worker package structure for PR6 import job processing.

Package structure:

  • FastAPI application (app.py) with health endpoints
  • Health routes (/health/live, /health/ready) for Kubernetes probes
  • Settings management via Pydantic (environment-based config)
  • Structured logging with JSON formatter
  • Pydantic models for health responses
  • Type checking configuration (pyrefly.toml)
  • Dependency management (pyproject.toml)

Testing infrastructure:

  • Pytest with async support (pytest-asyncio)
  • HTTP client fixtures (AsyncClient via httpx)
  • 100% coverage for health endpoints (test_health.py)
  • CI workflows: lint (ruff), test (pytest), docker build

Docker support:

  • Lightweight Dockerfile (Python 3.12-slim)
  • Entrypoint script for graceful startup
  • Health check endpoints for container orchestration
  • Added worker service to docker-compose.yml (port 8081)

Documentation:

  • Comprehensive README.md with:
    • Architecture overview (lease-based job claiming)
    • Job processing pipeline (6 stages)
    • Running instructions (local + production)
    • Environment variables reference
    • Scaling guidelines
    • Troubleshooting guide

Ready for implementation of job processing loop and stage runners in next commits.

Related to PR6 implementation plan (pr6-import-job-plan.md).

Documentation

Updated project documentation to reflect the new worker package:

  • README.md: Updated Planned Stack to show apps/worker/ as actual package (not "planned"), added PR feat: scaffold worker package with FastAPI app and health endpoints #33 worker scaffold entry to Completed section with implementation details
  • CLAUDE.md: Added Worker section to Tech Stack with Python 3.12/FastAPI/pytest details, added apps/worker/ file organization tree to Backend Development Guidelines
  • implementation-plan.md: Updated Repo Shape to include apps/worker/ with architectural decision note explaining upfront extraction (originally planned to keep inside apps/api/), updated PR1 note about worker service, updated PR6 files list to reflect worker package structure

The documentation now accurately reflects the decision to extract the worker to a separate package from the start, providing clearer boundaries and simpler deployment patterns.

Initial worker package structure for PR6 import job processing.

Package structure:
- FastAPI application (app.py) with health endpoints
- Health routes (/health/live, /health/ready) for Kubernetes probes
- Settings management via Pydantic (environment-based config)
- Structured logging with JSON formatter
- Pydantic models for health responses
- Type checking configuration (pyrefly.toml)
- Dependency management (pyproject.toml)

Testing infrastructure:
- Pytest with async support (pytest-asyncio)
- HTTP client fixtures (AsyncClient via httpx)
- 100% coverage for health endpoints (test_health.py)
- CI workflows: lint (ruff), test (pytest), docker build

Docker support:
- Lightweight Dockerfile (Python 3.12-slim)
- Entrypoint script for graceful startup
- Health check endpoints for container orchestration
- Added worker service to docker-compose.yml (port 8081)

Documentation:
- Comprehensive README.md with:
  - Architecture overview (lease-based job claiming)
  - Job processing pipeline (6 stages)
  - Running instructions (local + production)
  - Environment variables reference
  - Scaling guidelines
  - Troubleshooting guide

Ready for implementation of job processing loop and stage runners in next commits.

Related to PR6 implementation plan (pr6-import-job-plan.md).
@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

Flag Coverage Δ
api ?
worker 100.00% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
apps/worker/src/worker/app.py 100.00% <100.00%> (ø)
apps/worker/src/worker/enums.py 100.00% <100.00%> (ø)
apps/worker/src/worker/logging.py 100.00% <100.00%> (ø)
apps/worker/src/worker/models/health.py 100.00% <100.00%> (ø)
apps/worker/src/worker/routes/health.py 100.00% <100.00%> (ø)
apps/worker/src/worker/settings.py 100.00% <100.00%> (ø)

... and 18 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

sjlangley and others added 4 commits April 13, 2026 12:16
- README.md: add apps/worker/ to stack, document PR #33 worker scaffold
- CLAUDE.md: add Worker tech stack section, include worker file organization
- implementation-plan.md: document architectural decision to extract worker upfront

Co-Authored-By: OpenAI Codex <noreply@openai.com>
@sjlangley sjlangley merged commit 1ee23c4 into main Apr 13, 2026
5 checks passed
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