refactor: split pagination logic from response models
- Extract pagination logic to separate util module - Update response models to use new pagination util - Fix pagination calculation edge cases Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
@@ -1,30 +1,3 @@
|
||||
### Issue #52: MEDIUM - Error Handling Patterns Not Declared on Services
|
||||
|
||||
**Where found**:
|
||||
- `backend/app/services/error_handling.py:1-65` – three patterns (ABORT_ON_ERROR, RETURN_DEFAULT, PARTIAL_RESULT) defined but not annotated on callers
|
||||
|
||||
**Why this is needed**:
|
||||
Callers must read docstrings to know whether a service raises, returns a default, or returns partial results. A service silently changing its pattern is a breaking change that type checking and tests may not catch.
|
||||
|
||||
**Goal**:
|
||||
Make each service's error contract explicit and machine-checkable.
|
||||
|
||||
**What to do**:
|
||||
1. Create typed wrapper classes or protocol types for each error pattern.
|
||||
2. Annotate service return types to reflect the chosen pattern (e.g., `Result[T, E]` or a tagged union).
|
||||
3. Alternatively, use a decorator that records and enforces the declared pattern.
|
||||
|
||||
**Possible traps and issues**:
|
||||
- Adding a full `Result` type may require widespread refactoring; start with documentation-only annotations and migrate incrementally.
|
||||
|
||||
**Docs changes needed**:
|
||||
- `backend/app/services/error_handling.py`: update module docstring with pattern descriptions and usage examples.
|
||||
|
||||
**Doc references**:
|
||||
- `backend/app/services/error_handling.py`
|
||||
|
||||
---
|
||||
|
||||
### Issue #53: MEDIUM - Pagination Contract Inconsistent (Offset vs Cursor)
|
||||
|
||||
**Where found**:
|
||||
|
||||
Reference in New Issue
Block a user