Skip to content

[FSTORE-2036] PR 4a/4 — Python SDK support for Unity Catalog OAuth M2M#966

Draft
jimdowling wants to merge 1 commit into
logicalclocks:mainfrom
jimdowling:fstore-2036-uc-oauth-m2m-sdk
Draft

[FSTORE-2036] PR 4a/4 — Python SDK support for Unity Catalog OAuth M2M#966
jimdowling wants to merge 1 commit into
logicalclocks:mainfrom
jimdowling:fstore-2036-uc-oauth-m2m-sdk

Conversation

@jimdowling
Copy link
Copy Markdown
Contributor

Summary

PR 4 of 4 for FSTORE-2099, hopsworks-api half. Extends UnityCatalogConnector so the Python SDK round-trips the new OAuth fields the backend (#3032 / #3033) and frontend (logicalclocks/hopsworks-front#1919) added. Legacy PAT-only construction keeps working unchanged.

Companion loadtest PR: logicalclocks/loadtest (link in this thread once the loadtest PR is opened).

Spec: uc-oauth2/uc-oauth2.md in the per-feature workspace. Ticket: https://hopsworks.atlassian.net/browse/FSTORE-2099

What changes

  • Constructor gains auth_method, client_id, client_secret, oauth_endpoint, account_id, account_host, has_access_token, has_client_secret. auth_method defaults to "PAT" when absent so existing code paths (and downstream fixtures) keep producing PAT connectors. OAUTH_M2M without an explicit oauth_endpoint defaults to "WORKSPACE", matching the frontend default.
  • Write-only-friendly booleans: has_access_token and has_client_secret come from the server (hasAccessToken / hasClientSecret in camelCase). When a caller builds a connector locally with a secret in hand, the booleans fall back to "is the secret non-None" so client code that constructs in-process still reports correct state.
  • from_response_json is unchanged — it already uses humps.decamelize + **kwargs splat, which picks up the new fields by name once they're declared on the constructor.
  • Existing get_unity_catalog fixture updated to match the post-PR-1 backend wire format (hasAccessToken: true; no decrypted access_token in GET responses). Two new fixtures (get_unity_catalog_oauth_workspace, get_unity_catalog_oauth_account) cover the OAuth modes.
  • Tests extended from 4 to 8 in TestUnityCatalogConnector — round-trip for both OAuth modes; legacy construction defaulting to PAT; OAuth construction defaulting oauth_endpoint to WORKSPACE.

Test plan

  • uv run pytest python/tests/test_storage_connector.py::TestUnityCatalogConnector8/8 passing.
  • uv run ruff check — clean.
  • uv run docsig python/hsfs/storage_connector.py — clean.

🤖 Generated with Claude Code

https://hopsworks.atlassian.net/browse/FSTORE-2036

PR 4 of 4 for FSTORE-2036, hopsworks-api half. Extend
UnityCatalogConnector so the Python SDK round-trips the new OAuth
fields the backend (PR 1 / PR 2) and frontend (PR 3) added. Legacy
PAT-only construction keeps working unchanged.

Constructor gains auth_method, client_id, client_secret,
oauth_endpoint, account_id, account_host, has_access_token, and
has_client_secret. auth_method defaults to "PAT" when absent so
existing code paths and fixtures that construct connectors with
just access_token keep producing PAT connectors. When the caller
asks for OAUTH_M2M without specifying oauth_endpoint, it defaults
to "WORKSPACE", matching the frontend default.

has_access_token and has_client_secret are write-only-friendly
booleans: the server emits them on read so a caller can tell whether
a secret is on file without ever seeing it. When constructed locally
with a secret in hand, has_* falls back to "is the secret non-None"
so client code that builds a connector in-process still reports the
correct state.

from_response_json keeps using humps.decamelize + **kwargs splat;
the new fields are picked up by name. The existing get_unity_catalog
fixture is updated to match the post-PR-1 backend wire format
(hasAccessToken: true on read; no decrypted access_token in the
response). Two new fixtures (get_unity_catalog_oauth_workspace,
get_unity_catalog_oauth_account) cover the OAuth modes.

Tests extended from 4 to 8 in TestUnityCatalogConnector. New cases:
from_response_json for OAuth workspace and OAuth account modes;
legacy construction defaulting to PAT (no auth_method supplied);
OAUTH_M2M construction defaulting oauth_endpoint to WORKSPACE.

uv run pytest TestUnityCatalogConnector — 8/8 passing.
uv run ruff check / docsig — clean.

Signed-off-by: Jim Dowling <jim@hopsworks.ai>
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@github-actions
Copy link
Copy Markdown

Coverage report

Click to see where and how coverage changed

FileStatementsMissingCoverageCoverage
(new stmts)
Lines missing
  python/hsfs
  storage_connector.py
Project Total  

This report was generated by python-coverage-comment-action

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.

1 participant