HIGH: export/json calls get_saved_recipes(1000, 0) with wrong argument types #92

Closed
opened 2026-04-18 09:02:10 -07:00 by pyr0ball · 0 comments
Owner

Summary

GET /api/v1/export/json always exports an empty saved recipes list because it passes the wrong arguments to get_saved_recipes.

Root Cause

app/api/endpoints/export.py:

asyncio.to_thread(store.get_saved_recipes, 1000, 0)

But Store.get_saved_recipes signature is:

def get_saved_recipes(self, sort_by: str = "saved_at", collection_id: int | None = None)

So 1000 is passed as sort_by (an invalid sort key, silently falls through to the default saved_at DESC) and 0 is passed as collection_id. Because 0 is not None, the function enters the collection-filtered branch and returns only saved recipes in collection ID 0, which is always empty.

Fix

asyncio.to_thread(store.get_saved_recipes)

Or be explicit:

asyncio.to_thread(store.get_saved_recipes, sort_by="saved_at")

The limit/offset parameters do not exist in get_saved_recipes — they belong to the old list_receipts API. The export route should just return all saved recipes.

## Summary `GET /api/v1/export/json` always exports an empty saved recipes list because it passes the wrong arguments to `get_saved_recipes`. ## Root Cause `app/api/endpoints/export.py`: ```python asyncio.to_thread(store.get_saved_recipes, 1000, 0) ``` But `Store.get_saved_recipes` signature is: ```python def get_saved_recipes(self, sort_by: str = "saved_at", collection_id: int | None = None) ``` So `1000` is passed as `sort_by` (an invalid sort key, silently falls through to the default `saved_at DESC`) and `0` is passed as `collection_id`. Because `0 is not None`, the function enters the collection-filtered branch and returns only saved recipes in collection ID 0, which is always empty. ## Fix ```python asyncio.to_thread(store.get_saved_recipes) ``` Or be explicit: ```python asyncio.to_thread(store.get_saved_recipes, sort_by="saved_at") ``` The limit/offset parameters do not exist in `get_saved_recipes` — they belong to the old `list_receipts` API. The export route should just return all saved recipes.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Circuit-Forge/kiwi#92
No description provided.