muse hub user read/update call a non-existent /profile URL suffix
muse hub user read/update call a non-existent /profile URL suffix
Status
✅ Fixed and verified live (2026-07-07). Found while checking whether
aaronrene had a registered MuseHub account before inviting him as a
collaborator (see musehub issue #58, aaronrene onboarding) — muse hub user read aaronrene returned 404 despite his profile page
(https://staging.musehub.ai/aaronrene) loading fine in a browser.
Root cause
muse/cli/commands/hub/users.py's run_user_read/run_user_update called:
data = _hub_api(hub_url, identity, "GET", f"/api/users/{args.username}/profile")
...
data = _hub_api(hub_url, identity, "PATCH", f"/api/users/{args.username}/profile", body=payload)
The real routes (musehub/api/routes/musehub/users.py:72,181) are:
@router.get("/users/{username}", operation_id="getUserProfile", ...)
@router.put("/users/{username}", operation_id="updateUserProfile", ...)
No /profile URL suffix exists — the word "profile" only appears in the
operation_id (describing the data returned), which is almost certainly
where the CLI's incorrect path came from. run_user_update had a second,
independent bug: wrong HTTP verb (PATCH instead of the route's actual
PUT).
Confirmed via direct curl before touching any code:
$ curl -sk -o /dev/null -w "%{http_code}\n" https://staging.musehub.ai/api/users/aaronrene
200
$ curl -sk -o /dev/null -w "%{http_code}\n" https://staging.musehub.ai/api/users/aaronrene/profile
404
Fix
Removed the /profile suffix from both call sites; changed run_user_update
to PUT. Added TestHubUserReadUpdateCommands in tests/test_cli_hub.py
asserting the exact path and HTTP method via a mocked _hub_api — the same
style of test that would have caught this originally (asserting call
arguments, not just that a mocked call succeeded).
Verified live against staging post-fix:
$ muse hub user read aaronrene --hub https://staging.musehub.ai --json
{"username": "aaronrene", "repos": [...3 repos...], "sessionCredits": 757, ...}
Acceptance Criteria
muse hub user read <handle>returns real data for any existing handle.muse hub user updatesendsPUT, notPATCH.TestHubUserReadUpdateCommandspasses; fulltest_cli_hub.pyregression suite green (105/105).
Fix merged to dev/main and pushed to staging as part of tonight's nightly (v0.2.0-nightly.3).