feat(api,desktop,trpc): client version header + per-procedure telemetry
Desktop cloud tRPC clients now send x-superset-client: desktop/<appVersion>; the API parses it into ctx.client, tags Sentry, and a sampled (1%) middleware on the shared procedure builders emits api_procedure_called with procedure + client product + version.
This is PR A of the API compatibility plan: it starts accumulating the per-procedure, per-client-version usage evidence that the CI contract gate and min-version floor (follow-up PRs) consume, and that the electric-proxy teardown will use as its adoption-drain signal.
Notes:
- Absent/unparseable header = web or pre-header build, treated as always-current;
ctx.clientis null and nothing changes. x-superset-clientadded to the API's CORS allow-list (renderer preflights).- Mobile/CLI headers intentionally deferred (mobile not in use; CLI needs version-embedding survey) — the parser already accepts
mobile/…andcli/…. - No behavior branches on version anywhere; this PR is purely observational.
https://claude.ai/code/session_01Rq18Ske93pkaTqTHByebtq
Summary by cubic
Desktop tRPC calls now include x-superset-client: desktop/<version>. The API parses it into ctx.client, tags Sentry, and samples per-procedure telemetry to track usage by client version.
- New Features
- Desktop renderer sends
x-superset-client: desktop/<appVersion>on API requests. - API: CORS allows
x-superset-client; parse intoctx.client; set@sentry/nextjstagclient=<product>/<version>. packages/trpc: middleware (1% sample) emitsapi_procedure_calledtoposthogwithprocedure,client_product,client_version.- Parser accepts
desktop|mobile|cli; missing/unparseable treated as web/pre-header (ctx.clientnull). No behavior changes.
- Desktop renderer sends
Summary by CodeRabbit
- Improvements
- Improved API request compatibility for desktop clients by supporting client identification headers during browser security checks.
- Desktop requests now consistently include authentication and app version information when available.
- Added more complete client and version context to support troubleshooting and service performance monitoring.
- Improved consistency for API calls from command-line integrations and other clients.