Enhance exception handling, caching, and CORS in QuoteService#5
Merged
WillianSilva51 merged 7 commits intomainfrom Apr 3, 2026
Merged
Enhance exception handling, caching, and CORS in QuoteService#5WillianSilva51 merged 7 commits intomainfrom
WillianSilva51 merged 7 commits intomainfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR updates the Quotes API/service layer to improve domain validation and exception handling, adjusts Redis cache key generation behavior, adds global CORS middleware configuration, and moves test/lint tooling into a dev optional dependency group.
Changes:
- Add duplicate-quote validation in
QuoteService.create_quote()backed by a new repository lookup method and corresponding tests. - Restructure exception modules/handlers under
api/core/*and improve unexpected exception logging. - Split dev tools into
project.optional-dependencies.devand update CI to install them viauv sync --extra dev.
Reviewed changes
Copilot reviewed 13 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
uv.lock |
Moves pytest/ruff into an optional dev extra in the lock metadata. |
pyproject.toml |
Defines [project.optional-dependencies].dev for test/lint dependencies. |
api/tests/test_quote_service.py |
Adds tests/fixtures for duplicate detection; introduces a placeholder get_all test. |
api/services/quote_service.py |
Adds duplicate check + fixes tags filter construction for get_all. |
api/routers/quotes.py |
Tightens API key dependency typing. |
api/repositories/quote_repository.py |
Uses model_validate on create; adds get_quote_by_content_and_author. |
api/main.py |
Switches exception imports to core.* and adds global CORS middleware. |
api/exceptions/__init__.py |
Removes old exceptions package exports. |
api/core/handlers/exception_handlers.py |
Updates imports and logs unexpected exceptions with stack traces via Loguru. |
api/core/handlers/__init__.py |
Adds package export for handlers. |
api/core/exceptions/custom_exceptions.py |
Ensures exceptions call super().__init__ for proper message behavior. |
api/core/exceptions/__init__.py |
Adds package export for exceptions. |
api/core/cache.py |
Filters cache key kwargs and caches falsy-but-not-None results. |
.github/workflows/python-tests.yml |
Installs dev extras in CI with uv. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Copilot is generating a summary...]