feat: shared feedback router factory (closes #23) #28

Merged
pyr0ball merged 2 commits from feature/api-feedback into main 2026-04-05 20:50:24 -07:00
Owner

Summary

  • Adds circuitforge_core.api.feedback.make_feedback_router(repo, product, demo_mode_fn) — a reusable FastAPI APIRouter that products include in one line
  • Routes: GET /status{"enabled": bool}, POST / → creates a Forgejo issue
  • Demo mode support via callable or DEMO_MODE env var
  • Label upsert via Forgejo API with 502 on creation failure
  • 13 tests, all passing

Consumer migrations

kiwi, snipe, and peregrine will replace their hand-rolled feedback endpoints in follow-up commits (tracked in this issue).

Test plan

  • pytest tests/test_api/ -v — 13/13 passing
  • Consumer products import from circuitforge_core.api.feedback after merge
## Summary - Adds `circuitforge_core.api.feedback.make_feedback_router(repo, product, demo_mode_fn)` — a reusable FastAPI `APIRouter` that products include in one line - Routes: `GET /status` → `{"enabled": bool}`, `POST /` → creates a Forgejo issue - Demo mode support via callable or `DEMO_MODE` env var - Label upsert via Forgejo API with 502 on creation failure - 13 tests, all passing ## Consumer migrations kiwi, snipe, and peregrine will replace their hand-rolled feedback endpoints in follow-up commits (tracked in this issue). ## Test plan - [x] `pytest tests/test_api/ -v` — 13/13 passing - [ ] Consumer products import from `circuitforge_core.api.feedback` after merge
pyr0ball added 2 commits 2026-04-05 17:55:19 -07:00
Adds make_feedback_router(repo, product, demo_mode_fn) which returns a
FastAPI APIRouter with GET /status and POST / endpoints. Handles Forgejo
label creation/reuse, issue body assembly (including repro steps for bugs),
demo mode gating, and FORGEJO_API_TOKEN presence checks. 12 tests covering
all status/submit paths, mock Forgejo interaction, and body content assertions.
Also adds fastapi>=0.110 and httpx>=0.27 to [dev] optional deps.
pyr0ball merged commit 1cbea29817 into main 2026-04-05 20:50:24 -07:00
pyr0ball deleted branch feature/api-feedback 2026-04-05 20:50:25 -07:00
Sign in to join this conversation.
No reviewers
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/circuitforge-core#28
No description provided.