fix(cli): include HTTP status and body in machine user token fetch error - #1615
Conversation
Failures against the OAuth2 token endpoint previously surfaced only a fixed string, making it impossible to distinguish auth rejection, missing endpoints, and gateway failures without adding ad-hoc diagnostics. Claude-Session: https://claude.ai/code/session_01Pc2rqhaP7EUnor5U8BJjzG
🦋 Changeset detectedLatest commit: 5e1023c The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
Code Metrics Report (packages/sdk)
Details | | main (a4fc034) | #1615 (b9560e5) | +/- |
|--------------------|----------------|-----------------|-------|
+ | Coverage | 70.7% | 70.8% | +0.0% |
| Files | 425 | 425 | 0 |
| Lines | 15515 | 15516 | +1 |
+ | Covered | 10983 | 10995 | +12 |
+ | Code to Test Ratio | 1:0.4 | 1:0.4 | +0.0 |
| Code | 106478 | 106522 | +44 |
+ | Test | 48134 | 48175 | +41 |Code coverage of files in pull request scope (85.4% → 91.6%)
SDK Configure Bundle Size
Runtime Performance
Type Performance (instantiations)
Reported by octocov |
There was a problem hiding this comment.
📖 Docs Quality & Consistency Check
✅ Docs are consistent with the implementation and contain no user-facing internal-detail leaks.
Checked areas:
- CLI command documentation (
packages/sdk/docs/cli/auth.md) -machineuser tokencommand interface remains accurate - Auth service documentation (
packages/sdk/docs/services/auth.md) - Machine user concepts and usage examples remain accurate - Testing documentation (
packages/sdk/docs/testing.md) -getMachineUserTokenusage example remains valid - JSDoc for
getMachineUserToken(packages/sdk/src/cli/commands/machineuser/token.ts) - Accurately documents the function's purpose and interface - JSDoc for
fetchMachineUserToken(packages/sdk/src/cli/shared/client.ts) - Accurately documents the internal function's purpose
PR Summary:
This PR improves error messages for machine user token fetch failures by including HTTP status code, status text, and response body. This is purely an internal implementation change that enhances debugging without affecting any documented API contracts or user-facing behavior.
Why no documentation updates are needed:
- Error message formats are implementation details, not part of the documented API contract
- Function signatures remain unchanged
- Command interfaces remain unchanged
- All existing examples and documentation continue to work as documented
Re-run this check by adding the
docs-checklabel to the PR.
Summary
getMachineUserTokennow surfaces the HTTP status, status text, and response body when the token endpoint rejects a request, instead of a fixed generic message.Before / After