Skip to content

feat(studio): support OAuth app config and secret/variable descriptions per modelscope_service 20261027 contract - #83

Open
J-z202408 wants to merge 3 commits into
modelscope:mainfrom
J-z202408:main
Open

J-z202408 wants to merge 3 commits into
modelscope:mainfrom
J-z202408:main

Conversation

@J-z202408

@J-z202408 J-z202408 commented Nov 13, 2026 •

Copy link
Copy Markdown

Release Notes — modelscope_hub

Features

Studio OAuth app configuration

  • ms create <repo_id> --repo-type studio and ms studio settings now support configuring a Studio's OAuth app:
    --oauth-enabled/--no-oauth-enabled, --oauth-scope, --oauth-token-expire-time (1=15min … 6=30days), --oauth-callback-url (repeatable), --oauth-homepage-url.
  • --oauth-callback-url omitted on create defaults to the studio subdomain; on update the existing callbacks are kept.
  • Invalid combinations fail fast client-side (mirroring the server's 400 gate): OAuth details require an explicit --oauth-enabled; the flags are studio-only.

Secret & variable descriptions

  • ms secret add/update, ms studio secret|variable add/update accept --description (max 512 chars).
  • On update the flag is tri-state: omit it to keep the stored description, pass "" to clear.
  • ms secret list, ms studio secret|variable list now render the description column.
  • Python API: add_secret/update_secret/add_variable/update_variable accept description=; the OpenAPI client's studio secret/variable methods likewise.

Fixes

  • Legacy add_studio_secret/add_studio_variable/update_* no longer silently drop a description= kwarg; unknown kwargs still ignored as before (no TypeError).
  • ms secret list / ms studio secret list: keys up to the contract's 128 bytes now render untruncated and stay copyable — previously the default truncation made copied keys fail with 404 on update/delete.
  • ms studio secret list: removed the always-empty updated_at column (not part of the server contract).
  • ms studio variable list: long values (up to 4096 chars) are now capped so a single value can no longer destroy the table layout; keys remain untruncated.

Compatibility

  • No breaking changes: all new flags/parameters default to "not sent"; existing commands and call sites behave identically.

jz02070540 added 3 commits November 12, 2026 14:16
…ption)

Re-implements the 20261027 OpenAPI adaptation on top of current main
(post-modelscope#77 rewrite), replacing the pre-modelscope#77 implementation previously
carried on this branch:

- CLI: studio settings/create expose the OAuth app configuration flags
  (--oauth-enabled/--no-oauth-enabled, --oauth-scope,
  --oauth-token-expire-time, --oauth-callback-url, --oauth-homepage-url);
  lone oauth_* settings without an explicit oauth_enabled are rejected
  client-side, mirroring the server's HTTP 400 gate
- CLI/API: --description on studio secret/variable add/update (and the
  top-level secret family); description is tri-state on update — None
  omits the field (server keeps the stored one), empty string clears it
- CLI: secret/variable list now renders the description column the
  server returns
- compat: legacy add/update_studio_secret/variable forward passthrough
  kwargs (description) instead of silently dropping them
- fixture: openapi.json gains the oauth_* fields on
  CreateStudioRequest / UpdateStudioSettingsRequest / GetStudioResponse
  with service-master-aligned descriptions

Verified: full cli subset 868 passed / 37 skipped; ruff + mypy clean;
modelscope SDK tests/studios/test_studio_cli.py against this build:
19 passed / 19 skipped (gates active).
…erance

Three review findings on modelscope#83 plus a help-text clarification:

- create: reject OAuth flag combinations the server would silently drop.
  The create contract decodes oauth_enabled as a plain bool, so detail
  fields without an explicit flag never reach the OAuth app creation —
  the studio deploys without its login runtime variables. Lone details
  and non-studio misuse now fail fast before any request
  (openapi/backend/studio.go:634, service/space.go:3899).
- secret/variable list: keep keys (and variable values) untruncated —
  server-legal keys run to 128 bytes and must stay copyable; only the
  description column is capped via the new per-column max_widths
  (openapi/types/studio.go:216).
- compat: forward only description on add/update_studio_secret/variable;
  unknown kwargs keep the legacy silent-ignore behaviour instead of
  raising TypeError from the fixed-signature modern API.
- CLI help: --oauth-callback-url now distinguishes create (defaults to
  the studio subdomain) from update (keeps existing callbacks).

Verified: full non-remote suite 1775 passed / 1 skipped; ruff + mypy
clean; modelscope tests/studios with this build: 23 passed / 19 skipped.
… cap variable values

- ms secret list did not forward max_widths to render_table, so the
  default 80-char truncation hit the key column: server-legal keys
  (contract maxLength 128) rendered with an ellipsis, and copying them
  from the screen made update/delete 404. This is the exact failure
  mode utils/format.py's max_widths was introduced to prevent and that
  ms studio secret list already guards against. The key column is now
  untruncated and the description capped at 80.
- Removed the updated_at column: StudioSecretItem (service contract,
  modelscope_service openapi/types/studio.go) has only key/description,
  so the column always rendered "-". The mock fixture carried a
  fictional updated_at that masked this.
- ms studio variable list left the value column untruncated
  (max_widths=(None, None, 80)) on the theory that values are copyable
  identifiers; they are not — the key is the identifier, the value is
  data, and a contract-legal 4096-char value rendered as one giant
  cell that hard-wrapped and destroyed the table. The value column is
  now capped at 120 (keys stay untruncated).
@J-z202408 J-z202408 changed the title Adapt Studio surface to modelscope_service master (OAuth + env descri… feat(studio): support OAuth app config and secret/variable descriptions per modelscope_service 20261027 contract Nov 23, 2026
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