refactor: remove personal_rating, DRY get_or_404, fix ty errors

- Drop Product.personal_rating from model, API schemas, and all frontend
  views (list table, detail view, quick-edit form, new-product form)
- Extract get_or_404 into backend/innercontext/api/utils.py; remove five
  duplicate copies from individual API modules
- Fix all ty type errors: generic get_or_404 with TypeVar, cast() in
  coerce_effect_profile validator, col() for ilike on SQLModel column,
  dict[str, Any] annotation in test helper, ty: ignore for CORSMiddleware

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Piotr Oleszczyk 2026-02-27 11:20:13 +01:00
parent 5e3c0c97e5
commit 6333c6678a
15 changed files with 30 additions and 81 deletions

View file

@ -1,6 +1,8 @@
"""Unit tests for Product.to_llm_context() — no database required."""
from uuid import uuid4
from typing import Any
import pytest
from innercontext.models import Product
@ -18,8 +20,8 @@ from innercontext.models.product import (
)
def _make(**kwargs):
defaults = dict(
def _make(**kwargs: Any) -> Product:
defaults: dict[str, Any] = dict(
id=uuid4(),
name="Test",
brand="B",