28c632ca36
Found by probing the running API; both suites were green and missed it. CalendarService validated only start_year against the cache, never the window end. GET /api/calendar/days?start_year=2035&years=4 returned 200 with end_year=2038, pulling 2036-2038 from the live holidays-library fallback in app/utils/holidays.py. That fallback does not know the de facto free days, so Julafton, Nyarsafton and Midsommarafton were reported as ordinary working days (18 red days per cached year vs 13 per uncached year). Julafton being charged as a working day was fixed once before; it had reappeared past 2035. - clamp end_year to max_year; the response now always reports what it returned - add strict=True to get_swedish_holidays/get_red_days plus UncachedYearError, checked before the memo cache, so a strict caller fails loudly rather than silently degrading. Non-strict default behaviour is unchanged. - RedDaysList derived endYear locally as startYear + years - 1, independent of the response, so a clamped window rendered phantom empty years. It now takes endYear from the backend. Tests: clamping at and before max_year (service + router), Julafton/Nyarsafton/ Midsommarafton red for every cached year, red-day count consistent across the served range, and strict-mode raise/pass-through. Backend 404 -> 414 tests, frontend 704 -> 705. Known, deliberately not fixed here: AllocationInputLoader builds its holiday map the same non-strict way over the planning horizon, so it has the same exposure once the horizon passes 2035. Clamping would silently truncate planning and raising would break real plans, so it needs a product decision first. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RXMhc9nT6sNz1SL4j8dznL
Backend — Föräldraledigplannerare
FastAPI + Python 3.14, packages managed with uv. Layered architecture
(entities → repositories → services → routers) with dependency injection so the
database backend (SQLite now, Postgres later) is swappable.
Setup
uv sync # install deps (incl. dev group)
uv run uvicorn app.main:app --reload # run dev server on :8000
uv run pytest # run tests with coverage
uv run ruff check . # lint
Layout
app/
config.py # pydantic-settings (app config + frozen LeaveRules)
dependencies.py # DI factories (pick repo impl by settings.database_type)
entities/ # plain dataclasses (domain)
models/ # pydantic API schemas
repositories/ # abstract interfaces
repositories_impl/ # concrete impls per backend (sqlite/, postgres/)
services/ # business logic
routers/ # FastAPI routes
db/connection.py # connection + (dev) schema bootstrap
utils/ # errors, logger
Reference vertical slice
VacationDays is implemented end-to-end (entity → schema → repo interface →
SQLite impl → service → router → tests). Copy this slice when adding a new
entity. See JUNIOR_ONBOARDING.md in the repo root for task-by-task guidance.
The inline schema in
db/connection.pyexists only so dev/tests are self-contained. Production schema is owned by Alembic migrations (a senior task).