Muawiya-contact opened a new pull request, #325:
URL: https://github.com/apache/hugegraph-ai/pull/325
## What does this PR do?
Auth endpoints in the Python client were using absolute paths
(`/auth/users`, etc.) that only worked because of a temporary `PathFilter`
compatibility layer in HugeGraph 1.7.0. Once `PathFilter` is removed, those
endpoints would break.
This PR implements the same dual-path strategy as the Java client's
`AuthAPI.java` — graphspace-scoped paths when a graphspace is available,
server-level fallback when it isn't.
## Changes
**`src/pyhugegraph/utils/huge_router.py`**
Path resolution moved to runtime — prefers explicit graphspace arg, then
`session.cfg.graphspace` when `gs_supported` is true, falls back to
server-level `/auth/...` otherwise.
**`src/pyhugegraph/api/auth.py`**
- `users`, `accesses`, `belongs`, `targets` →
`graphspaces/{graphspace}/auth/...`
- `groups` → `/auth/groups` (server-level, unchanged)
**`src/tests/api/test_auth_routing.py`** (new)
Unit tests mocking `HGraphSession` — asserts correct URL resolution for both
graphspace and fallback cases. 9 tests, all passing.
**`src/tests/api/test_auth.py`**
Integration tests now skip gracefully when no live server is reachable —
local runs won't fail without a HugeGraph instance.
## Backward Compatibility
Public method signatures are unchanged. Behavior only differs when a
graphspace is configured — requests use the scoped path automatically. No user
action required.
## Related
Closes #322
Reference: `AuthAPI.java` (Java client dual-path strategy)
/cc @imbajin
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]