Skip to content

fix: fall back to hub endpoints on 401 for public bundles#23

Merged
justinmerrell merged 1 commit intomainfrom
fix/hub-fallback-on-401
Apr 3, 2026
Merged

fix: fall back to hub endpoints on 401 for public bundles#23
justinmerrell merged 1 commit intomainfrom
fix/hub-fallback-on-401

Conversation

@justinmerrell
Copy link
Copy Markdown
Contributor

Summary

  • When pulling public bundles without MUSHER_API_KEY, the SDK raised AuthenticationError instead of falling back to hub endpoints
  • Root cause: _pull_version only caught APIError (403), but 401 raises AuthenticationError which is not a subclass of APIError
  • Now both resolve() and _pull_version() catch AuthenticationError (401) and APIError (403), falling back to /v1/hub/... endpoints matching the CLI's behavior

Closes #22

Test plan

  • Added test_pull_hub_fallback_401 — verifies pull falls back to hub on 401
  • Added test_resolve_hub_fallback_401 — verifies resolve falls back to hub on 401
  • Added test_resolve_hub_fallback_403 — verifies resolve falls back to hub on 403
  • All 231 tests pass, linting/types clean
  • Manually verified pulling musher-examples/demo-starter:1.0.0 from hub.musher.dev without API key

🤖 Generated with Claude Code

When pulling a public bundle without MUSHER_API_KEY set, the SDK raised
AuthenticationError instead of falling back to the hub endpoint. The hub
fallback only caught APIError with status 403, but 401 raises
AuthenticationError which is not a subclass of APIError.

Now both resolve() and _pull_version() catch AuthenticationError (401)
and APIError with status 403, falling back to /v1/hub/... endpoints for
public bundle access without credentials.

Closes #22

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@justinmerrell justinmerrell merged commit 4371deb into main Apr 3, 2026
6 checks passed
@justinmerrell justinmerrell deleted the fix/hub-fallback-on-401 branch April 3, 2026 00:13
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.

Hub fallback for public bundles doesn't trigger on 401 (only 403)

1 participant