Skip to content

fix(cli): include HTTP status and body in machine user token fetch error - #1615

Merged
toiroakr merged 2 commits into
mainfrom
fix/machine-user-token-error-detail
Jul 1, 2026
Merged

fix(cli): include HTTP status and body in machine user token fetch error#1615
toiroakr merged 2 commits into
mainfrom
fix/machine-user-token-error-detail

Conversation

@dqn

@dqn dqn commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Summary

getMachineUserToken now surfaces the HTTP status, status text, and response body when the token endpoint rejects a request, instead of a fixed generic message.

Before / After

// Before
Error: Failed to fetch machine user token

// After
Error: Failed to fetch machine user token: 403 Forbidden {"error":"access_denied"}

dqn added 2 commits July 1, 2026 21:55
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-bot

changeset-bot Bot commented Jul 1, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5e1023c

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@tailor-platform/sdk Patch
@tailor-platform/create-sdk Patch

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

@pkg-pr-new

pkg-pr-new Bot commented Jul 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

pnpm add https://pkg.pr.new/@tailor-platform/create-sdk@5e1023c
pnpm add https://pkg.pr.new/@tailor-platform/sdk@5e1023c

commit: 5e1023c

@github-actions

github-actions Bot commented Jul 1, 2026

Copy link
Copy Markdown

Code Metrics Report (packages/sdk)

main (a4fc034) #1615 (b9560e5) +/-
Coverage 70.7% 70.8% +0.0%
Code to Test Ratio 1:0.4 1:0.4 +0.0
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%)

Files Coverage +/- Status
packages/sdk/src/cli/shared/client.ts 91.6% +6.1% modified

SDK Configure Bundle Size

main (a4fc034) #1615 (b9560e5) +/-
configure-index-size 20.32KB 20.32KB 0KB
dependency-chunks-size 47.13KB 47.13KB 0KB
total-bundle-size 67.45KB 67.45KB 0KB

Runtime Performance

main (a4fc034) #1615 (b9560e5) +/-
Generate Median 3,055ms 2,961ms -94ms
Generate Max 3,108ms 3,165ms 57ms
Apply Build Median 3,119ms 3,025ms -94ms
Apply Build Max 3,145ms 3,059ms -86ms

Type Performance (instantiations)

main (a4fc034) #1615 (b9560e5) +/-
tailordb-basic 39,476 39,476 0
tailordb-optional 4,385 4,385 0
tailordb-relation 5,103 5,103 0
tailordb-validate 742 742 0
tailordb-hooks 5,222 5,222 0
tailordb-object 12,510 12,510 0
tailordb-enum 1,450 1,450 0
resolver-basic 9,272 9,272 0
resolver-nested 26,139 26,139 0
resolver-array 18,078 18,078 0
executor-schedule 4,310 4,310 0
executor-webhook 949 949 0
executor-record 5,664 5,664 0
executor-resolver 4,108 4,108 0
executor-operation-function 937 937 0
executor-operation-gql 945 945 0
executor-operation-webhook 956 956 0
executor-operation-workflow 1,785 1,785 0

Reported by octocov

@dqn
dqn marked this pull request as ready for review July 1, 2026 13:11
@dqn
dqn requested a review from a team as a code owner July 1, 2026 13:11
@dqn
dqn requested a review from toiroakr July 1, 2026 13:11

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📖 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 token command 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) - getMachineUserToken usage 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-check label to the PR.


@toiroakr toiroakr left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@toiroakr
toiroakr merged commit a58efe9 into main Jul 1, 2026
43 checks passed
@toiroakr
toiroakr deleted the fix/machine-user-token-error-detail branch July 1, 2026 14:30
This was referenced Jul 1, 2026
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