Skip to content

feat(pulse): Bearer PAT auth for pulse-emit hook#27

Merged
masonwyatt23 merged 2 commits intomainfrom
feat/pulse-emit-bearer-pat
Apr 29, 2026
Merged

feat(pulse): Bearer PAT auth for pulse-emit hook#27
masonwyatt23 merged 2 commits intomainfrom
feat/pulse-emit-bearer-pat

Conversation

@masonwyatt23
Copy link
Copy Markdown
Collaborator

Summary

  • Adds opt-in ASHLR_PULSE_PAT env var so hooks/pulse-emit.ts can authenticate against production Pulse servers (today the hook only sends x-ashlr-user, which production rejects via NODE_ENV gate)
  • When the PAT is set, sends Authorization: Bearer <pat> and drops x-ashlr-user so the server's auth path stays unambiguous
  • Zero behavior change when the PAT is unset — x-ashlr-user fallback preserved

Why

The Pulse server (ashlrai/ashlr-pulse) gates x-ashlr-user to non-production environments. Without Bearer support here, the plugin can only talk to a local dev Pulse, not a hosted instance — which blocks the v0.4 cloud rollout the Pulse roadmap commits to.

Test plan

  • 2 new cases in __tests__/pulse-emit.test.ts:
    • PAT set → Authorization: Bearer … header present, x-ashlr-user absent
    • PAT unset → x-ashlr-user fallback works as before
  • bun test __tests__/pulse-emit.test.ts → 7 pass / 0 fail
  • bun run typecheck clean
  • Manual: point at a real Pulse server with a minted PAT and confirm spans land via curl + bearer

🤖 Generated with Claude Code

masonwyatt23 and others added 2 commits April 25, 2026 00:22
The OTel emitter currently sends only the `x-ashlr-user` header, which
the Pulse server (ashlrai/ashlr-pulse) accepts only when
NODE_ENV !==

Assisted-By: ashlr-plugin <https://plugin.ashlr.ai>"production". Production Pulse servers reject it — so the
plugin can't talk to a hosted Pulse instance today.

Adds opt-in Bearer auth via a new `ASHLR_PULSE_PAT` env var. PATs are
minted on the Pulse server with `bun run src/cli/mint-pat.ts`. When set,
the hook sends `Authorization: Bearer <pat>` and OMITS `x-ashlr-user` so
the server's auth path stays unambiguous. When unset, behavior is
identical to today.

Tests
- 2 new cases in __tests__/pulse-emit.test.ts:
  - PAT set → Bearer header present, x-ashlr-user absent
  - PAT unset → x-ashlr-user falls back as before
- All 7 pulse-emit tests pass; typecheck clean.

Docs
- env list in the file header now documents ASHLR_PULSE_PAT and notes
  that production Pulse servers require it.

No behavior change for users who don't set the PAT.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 29, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
ashlr-plugin-site Ready Ready Preview, Comment Apr 29, 2026 6:49pm

Request Review

@masonwyatt23 masonwyatt23 merged commit ff49083 into main Apr 29, 2026
27 of 28 checks passed
@masonwyatt23 masonwyatt23 deleted the feat/pulse-emit-bearer-pat branch April 29, 2026 18:59
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.

1 participant