fix(init): handle setup service auth failures#1076
Merged
Conversation
Contributor
|
Contributor
Codecov Results 📊✅ Patch coverage is 100.00%. Project has 4843 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 81.41% 81.44% +0.03%
==========================================
Files 372 373 +1
Lines 26052 26090 +38
Branches 16994 17015 +21
==========================================
+ Hits 21207 21247 +40
- Misses 4845 4843 -2
- Partials 1774 1770 -4Generated by Codecov Action |
ca9ab91 to
7c6cfd2
Compare
Classify hosted init-service 401s as ApiError(401) so they reuse the CLI's existing token guidance and 4xx telemetry silencing instead of surfacing as generic wizard failures. Block self-hosted credentials before they are sent to the hosted setup service, and cover createRun, startAsync, resumeAsync, env-token, OAuth, and self-hosted-token paths in wizard-runner tests.
7c6cfd2 to
3b35312
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Treat hosted init setup-service 401 responses as expected auth/API state instead of generic wizard failures. The Mastra SDK wrapper is adapted into the same
ApiError(401)path other commands use, so users get existing OAuth/env-token guidance and telemetry silencing stays consistent.The hosted init path also refuses self-hosted credentials before constructing the Mastra client, avoiding forwarding tokens the hosted service cannot validate. The same auth classification now covers create, start, and resume workflow calls.
Related: CLI-17A
Test Plan
pnpm exec biome check src/lib/api/infrastructure.ts src/lib/init/constants.ts src/lib/init/init-service-auth.ts src/lib/init/wizard-runner.ts test/lib/init/wizard-runner.test.tspnpm exec vitest run test/lib/init/wizard-runner.test.ts test/lib/error-reporting.test.ts— 128 passedpnpm exec tsc --noEmit --pretty false