Support → Linear (FastAPI)
item / server / support
Backend half of support-widget: files each report as a Linear issue through the shared client_credentials OAuth app. Token cache, frozen scope, one 401 re-mint, one transient retry, 503 until configured.
- type
- item
- files
- 2
- registry deps
- https://components.automindz.app/r/http-retry.json
- npm deps
- none
- env vars
- LINEAR_CLIENT_ID, LINEAR_CLIENT_SECRET, LINEAR_TEAM_ID, LINEAR_PROJECT_ID, LINEAR_ASSIGNEE_ID, LINEAR_LABEL_IDS
installs
- ~/backend/support_linear.py
- ~/backend/tests/test_support_linear.py
- Fails closed: 503 with a plain sentence until all LINEAR_* vars are set
- Token cached with 60 s headroom; one re-mint on 401, one retry on 0/429/5xx, never on 4xx
- Scope frozen at issues:create — the shipped test pins it, because the OAuth app is shared by every client
Mount with app.include_router(support_linear.router(topics=MY_TOPICS, source="Acme", reported_by=lambda request: request.headers.get("x-user", "unknown"))) — reported_by defaults to a callable returning "unknown", so filing still works with no session wired in. GET /api/support always answers 200 {configured, topics, message_max}, so the widget can hide itself before anyone submits. POST /api/support takes {topicId, message, pageUrl?} — exactly what support-widget hands to onSubmit, so the wiring is fetch("/api/support", { method: "POST", body: JSON.stringify(values) }) — and answers 200 {ok, identifier, url}, 400 {detail} on an invalid report, 502 {detail} when Linear refuses, is unreachable, or returns no token. It fails closed: 503 {detail} until all four required vars are set — LINEAR_CLIENT_ID, LINEAR_CLIENT_SECRET, LINEAR_TEAM_ID, LINEAR_PROJECT_ID — and an unconfigured POST makes no HTTP call. LINEAR_ASSIGNEE_ID and LINEAR_LABEL_IDS (comma-separated UUIDs) are optional and dropped from the mutation when empty. The OAuth app is shared across every client app that installs this item: LINEAR_PROJECT_ID is the only per-client value, and the scope must stay exactly issues:create — asking Linear for a different scope set revokes every other client's token. The shipped test pins it. The CLI writes these names into .env.local; Python does not read that file, so move them to wherever this host actually reads env before mounting.
Variations
one state per section
No previews for this item yet.
