Skip to content

feat(tracing): forward X-Campus-Device; JsonClient.set_default_header (campus#837) - #99

Merged
nycomp merged 1 commit into
mainfrom
feat/837-device-header
Oct 6, 2026
Merged

nycomp merged 1 commit into
mainfrom
feat/837-device-header

Conversation

@nycomp

@nycomp nycomp commented Oct 6, 2026

Copy link
Copy Markdown
Contributor

SDK half of campus#837 (the CLI device lane from the campus#825 design).

What changes

  • propagation_headers() forwards g.device as X-Campus-Device (mirror of campus.config.DEVICE_ID_HEADER, same lockstep convention as the X-Journey-ID pair): a child service's span carries the caller's device identity when the host stashed one via flask_campus's push_context. The receiving middleware (campus#838) reads the header only when it knows nothing better.
  • JsonClient.set_default_header(name, value): lets non-browser clients (campus-cli) present their config-persisted device id on every API call without per-call plumbing. The ABC gains a raising default so callers can detect a transport that cannot carry default headers.
  • Lock bump: campus-suite → a12f023 (middleware header fallback + DEVICE_ID_HEADER constant).

Test plan

  • test_trace_propagation.py: device forwarded inside/outside trace context; absent stash → no header; default header sent on every call; request-time forward wins over the static default; default persists across calls.
  • Full unit suite 246 → 255 OK; ruff clean on changed files (39 pre-existing on main untouched).

Ref nyjc-computing/campus#837

… (#837)

- propagation_headers() forwards a stashed g.device as X-Campus-Device
  (mirror of campus.config.DEVICE_ID_HEADER), so a child service's span
  carries the caller's device identity when the host knows it. The
  receiving middleware reads the header only when it knows nothing
  better (g.device absent, no campus_device cookie).
- JsonClient.set_default_header(): non-browser clients (campus-cli)
  present their config-persisted device id on every API call without
  per-call plumbing. ABC gains a raising default so callers can detect
  a transport that cannot carry default headers.

Lock bump: campus-suite -> a12f023 (DEVICE_ID_HEADER + middleware
header fallback).

Refs nyjc-computing/campus#837
@nycomp
nycomp merged commit f40f8af into main Oct 6, 2026
2 checks passed
@nycomp
nycomp deleted the feat/837-device-header branch October 6, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants