kiwi/app/api/endpoints
pyr0ball ed4595d960 feat(recipes): async L3/L4 recipe job queue with poll endpoint
Adds the recipe_jobs table and background task pipeline for level 3/4
recipe generation. POST ?async=true returns 202 with job_id; clients
poll GET /recipes/jobs/{job_id} until status=done.

Key fix: _enqueue_recipe_job now calls scheduler.enqueue() after
insert_task() to wake the in-memory work queue immediately. Without
this, tasks sat in 'queued' until the scheduler's 30s idle cycle or
an API restart triggered _load_queued_tasks().

- Migration 034: recipe_jobs table (job_id, user_id, status, request,
  result, error) with indexes on job_id and user_id/created_at
- Store: create/get/update_running/complete/fail recipe job methods
- runner.py: recipe_llm task type + _run_recipe_llm handler; MUST
  call fail_recipe_job() before re-raising so status stays consistent
- CLOUD_MODE guard: falls back to sync generation (scheduler only
  polls shared settings DB, not per-user DBs)
- L4 wildcard is covered by the same req.level in (3, 4) dispatch
2026-04-19 21:44:27 -07:00
..
__init__.py chore: initial commit — kiwi Phase 2 complete 2026-03-30 22:20:48 -07:00
community.py fix: recipe enrichment backfill, main_ingredient browser domain, bug batch 2026-04-18 15:38:56 -07:00
export.py fix: recipe enrichment backfill, main_ingredient browser domain, bug batch 2026-04-18 15:38:56 -07:00
feedback.py refactor: use shorter circuitforge_core.api import for feedback router 2026-04-05 21:21:50 -07:00
feedback_attach.py feat: screenshot attachment in feedback form (#82) 2026-04-15 23:08:02 -07:00
health.py chore: initial commit — kiwi Phase 2 complete 2026-03-30 22:20:48 -07:00
household.py fix: recipe enrichment backfill, main_ingredient browser domain, bug batch 2026-04-18 15:38:56 -07:00
imitate.py chore: commit in-progress work -- tag inferrer, imitate endpoint, hall-of-chaos easter egg, migration files, Dockerfile .env defense 2026-04-14 13:23:15 -07:00
inventory.py fix: re-fetch inventory item after insert to populate product_name (#99) 2026-04-18 16:02:35 -07:00
meal_plans.py feat: wire meal planner slot editor and meal type picker 2026-04-16 14:23:38 -07:00
ocr.py fix: wire recipe corpus to cloud per-user DBs via SQLite ATTACH (#102) 2026-04-18 14:21:56 -07:00
orch_usage.py feat(kiwi): add /orch-usage proxy endpoint for frontend budget display 2026-04-14 15:42:58 -07:00
receipts.py fix: recipe enrichment backfill, main_ingredient browser domain, bug batch 2026-04-18 15:38:56 -07:00
recipes.py feat(recipes): async L3/L4 recipe job queue with poll endpoint 2026-04-19 21:44:27 -07:00
saved_recipes.py fix: recipe enrichment backfill, main_ingredient browser domain, bug batch 2026-04-18 15:38:56 -07:00
session.py fix: suppress E2E test sessions from log-based analytics 2026-04-18 19:06:37 -07:00
settings.py feat: metric/imperial unit preference (#81) 2026-04-15 23:04:29 -07:00
shopping.py fix: wire recipe corpus to cloud per-user DBs via SQLite ATTACH (#102) 2026-04-18 14:21:56 -07:00
staples.py feat: recipe + staple API endpoints with tier gating 2026-03-31 12:49:38 -07:00