Skip to content

fix(extensions): W3 add tests for auth-jwt and sqlalchemy, prep incompatibleWith - #185

Merged
ulises-jeremias merged 1 commit into
mainfrom
fix/w3-extensions
Aug 23, 2026
Merged

fix(extensions): W3 add tests for auth-jwt and sqlalchemy, prep incompatibleWith#185
ulises-jeremias merged 1 commit into
mainfrom
fix/w3-extensions

Conversation

@ulises-jeremias

Copy link
Copy Markdown
Member

Summary

W3 extension hardening for cpa-templates (fix/w3-extensions branched from origin/main @ b6d108b).

Adds missing extension tests for the two previously untested overlays and preps incompatibleWith for the upcoming flower-docker (PR #178).

Added

  • extensions/fastapi-auth-jwt/template/tests/test_auth.py (16 tests): Argon2 hash_password/verify_password (including salt uniqueness), create_access_token/decode_access_token round-trip, extra claims, JWT_ALGORITHM header check, secret rotation (InvalidSignatureError), expiry future-window, LoginRequest/TokenResponse/UserPublic schema validation, and router wiring via TestClient for /auth/login (success 200 + token decode, 401 on bad password/email, 422 on bad payload) and /auth/me.
  • extensions/fastapi-sqlalchemy/template/tests/test_sqlalchemy.py (9 tests): Base declarative sanity, model registration + cleanup, engine/session_factory smoke (SELECT 1), get_db single-yield generator contract, isolated in-memory sqlite round-trip with throwaway model, Alembic env.py static wiring check (Base import, target_metadata, DATABASE_URL), DATABASE_URL env-override SELECT 1, and session.py sqlite check_same_thread style guard. Ruff/mypy/pyright green (was fixed for FromClause/Table typing and import sorting).

Changed

  • docs/AUTHORING.md — document incompatibleWith prep: celery-docker vs upcoming flower-docker (PR feat: add flower-docker extension for Celery monitoring #178) both target celery-worker and must declare symmetric incompatibleWith when flower-docker lands. Points to scripts/ci/validate-registry.py + templates.schema.json (validation already hardened in W1).
  • extensions/all-postgres/template/.env.example.append — style consistency: remove duplicate # PostgreSQL (optional overlay) header and leading blank line to match other extensions (# Auth JWT …, # SQLAlchemy …).

Validation

  • python scripts/ci/validate-registry.py✅ registry ok (6 templates, 18 extensions) on fix/w3-extensions.
  • Scaffold smoke (local file:// URLs via uvx create-awesome-python-app@latest):
    • fastapi-starter + fastapi-auth-jwt + fastapi-sqlalchemyuv syncruff check ✅, mypy ✅, pyright ✅, pytest -q 34 passed.
    • fastapi-starter + fastapi-auth-jwt alone → 25 passed, lint/type green.
    • fastapi-starter + fastapi-sqlalchemy alone → 17 passed, lint/type green.

Notes

  • incompatibleWith for flower-docker not yet added to templates.json — symmetric validation would fail without the flower-docker extension present (it doesn't exist on main yet). This PR only documents the intent and ensures validation is ready (W1 already added incompatibleWith + compatibleWith handling). PR feat: add flower-docker extension for Celery monitoring #178 will add the symmetric entries.
  • No templates.json entry changes; no new extension slugs.
  • fix/w3-extensions pushes 4 files changed (+335/-3), commit 075069b.

…patibleWith

- extensions/fastapi-auth-jwt: add tests/test_auth.py (16 tests) covering
  password hashing (salted Argon2), JWT create/decode round-trip, extra
  claims, algorithm, secret rotation, expiry, Pydantic schemas, and
  router wire-up via TestClient ($auth endpoints).
- extensions/fastapi-sqlalchemy: add tests/test_sqlalchemy.py (9 tests)
  covering DeclarativeBase registration, engine/session factory smoke,
  get_db generator contract, isolated in-memory round-trip, Alembic
  env wiring via static content check, DATABASE_URL override, and
  sqlite connect_args style guard.
- docs/AUTHORING.md: document upcoming celery-docker vs flower-docker
  incompatibleWith prep for PR #178 (symmetric validation via
  scripts/ci/validate-registry.py / templates.schema.json).
- extensions/all-postgres: fix .env.example.append style consistency
  (remove duplicate header and leading blank line).

Co-authored-by: cpa-templates W3 task
@ulises-jeremias
ulises-jeremias marked this pull request as ready for review August 23, 2026 17:30
@coderabbitai

coderabbitai Bot commented Aug 23, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@ulises-jeremias, you've reached your PR review limit, so we couldn't start this review.

Next review available in: 22 minutes

Limit details: You’ve used the included review currently available.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

Wait for the limit to reset, then comment @coderabbitai review or push new commits to the PR.

An organization admin can change what happens after included review limits in Billing.

How do review limits work?

CodeRabbit enforces per-developer PR review limits within each organization.

For paid Pro and Pro+ reviews, CodeRabbit uses a developer's included PR review attempts over the past 7 days to set the current hourly allowance. At typical activity levels, the full plan allowance applies. Higher sustained activity can lower the allowance until earlier attempts leave the 7-day window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 7cfce224-4b77-45e0-a04e-1061d8fd5f2d

📥 Commits

Reviewing files that changed from the base of the PR and between b6d108b and 075069b.

📒 Files selected for processing (4)
  • docs/AUTHORING.md
  • extensions/all-postgres/template/.env.example.append
  • extensions/fastapi-auth-jwt/template/tests/test_auth.py
  • extensions/fastapi-sqlalchemy/template/tests/test_sqlalchemy.py

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@ulises-jeremias
ulises-jeremias merged commit 2a18e35 into main Aug 23, 2026
18 checks passed
@ulises-jeremias
ulises-jeremias deleted the fix/w3-extensions branch August 23, 2026 17:56
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