Skip to content

feat(management): read-only RAM ManagementClient (G1/G2/G5) - #240

Open
lzsweb wants to merge 5 commits into
mainfrom
dev/v2.2-1
Open

lzsweb wants to merge 5 commits into
mainfrom
dev/v2.2-1

Conversation

@lzsweb

@lzsweb lzsweb commented Nov 19, 2026

Copy link
Copy Markdown
Collaborator

Summary

Adds dashscope.management as an optional [management] extra — a ToB
self-service backend SDK integration layer over the ModelStudio/2026-02-10
RAM OpenAPI (ROA style). Read-only first release; no reference backend.

  • G1 atomic layer — 14 read ops only: workspaces / models / model limits /
    model permissions, API keys (list/get), billing (overview/trend), token plan
    (account / members / seats / subscription / shared-packages). The other 24 ops
    (21 writes + 3 out-of-scope reads) are deferred and catalogued as high-risk
    in the design md; no code shipped for them.
  • G2 resources: ManagementClient / AsyncManagementClient, full sync+async
    symmetry, raw=True overloads, region binding + with_options(region=...)
    (independent connection pool, shared credential resolver).
  • G5 cross-cutting:
    • V3 ACS3-HMAC-SHA256 signing via official alibabacloud_openapi_util;
      signed header set == sent header set; canonical query used verbatim on wire.
    • Credential chain via official alibabacloud_credentials (ak/sk, STS, ECS RAM
      role, OIDC, default chain), sync + async.
    • Dual-envelope success gate (modelstudio lowercase vs tokenplan PascalCase) +
      RAM error crosswalk to dashscope error classes.
    • SecretStr redaction for apiKeyValue (repr / log / exception / model_dump).
    • Dual pagination: TokenPage (nextToken) and BasePage (PageNo/PageNum).
  • Every request carries x-dashscope-sdk-client: python-sdk/<ver>/management2
    • session id + client-request-id, folded into the signed header set
      (DASHSCOPE_DISABLE_SDK_HEADERS kill switch honored).
  • New deps isolated behind the extra: alibabacloud_credentials>=1.0.0,
    alibabacloud_openapi_util>=0.2.0. Core dashscope import does not require them.

Test plan

  • 120 mock tests: signer (independent gateway oracle + openapi_util oracle),
    credentials, errors (success gate / crosswalk), transport (wire form / retry /
    region), resources, pagination — sync + async.
  • 5 env-gated read-only e2e (tests/protocols/test_management_e2e.py), skip
    without creds, no write ops.
  • Full suite: 6498 passed / 51 skipped / 0 failed.
  • pre-commit green and stable (mypy / black / flake8 / pylint / add-trailing-comma).
  • L3 deep security review on the committed change set: no issues found.

zhansheng.lzs and others added 5 commits November 18, 2026 17:57
Trim the `current` job matrix to the odd CPython legs (drop 3.10/3.12);
the archived `legacy` job stays on 3.11.
…1/G2/G5)

Add dashscope.management as an optional [management] extra: a ToB
self-service backend integration layer over the ModelStudio/2026-02-10
RAM OpenAPI (ROA). Read-only first release.

- G1 atomic layer: 14 read ops only (workspaces/models/limits/permissions,
  api keys, billing overview/trend, token plan account/members/seats/
  subscription/shared-packages). 24 write/out-of-scope ops deferred and
  catalogued as high-risk in md; no code.
- G2 resources: ManagementClient/AsyncManagementClient with sync+async
  symmetry, raw=True overloads, region binding + with_options(region).
- G5 cross-cutting: V3 ACS3-HMAC-SHA256 signing via official
  alibabacloud_openapi_util; credential chain via alibabacloud_credentials;
  dual-envelope success gate + RAM error crosswalk; SecretStr redaction;
  dual pagination (TokenPage nextToken / BasePage PageNo).
- Every request carries x-dashscope-sdk-client=python-sdk/<ver>/management2
  + session id + client-request-id, folded into the signed header set.

Tests: 120 mock tests (signer gateway oracle, credentials, errors,
transport, resources, pagination) + 5 env-gated read-only e2e. Full suite
6498 passed / 51 skipped / 0 failed. pre-commit green.
…identity swap

- Raise error if partial access_key_id or access_key_secret is provided alone
- Prevent fallback to ambient host credentials when partial AK is detected
- Convert numeric error codes to string to avoid AttributeError in error mapping
- Improve secret redaction by matching sk- tokens with regex and applying filter on management loggers
- Introduce get_management_logger to attach secret redaction filter to all management loggers
- Limit transparent retries to safe HTTP methods to avoid duplicate side effects on write ops
- Support per-call timeout overrides and preserve injected client timeout settings in transport
- Add tests for partial explicit credential rejection, management logger redaction,
  retry behavior on write methods, and timeout handling with client and per-call overrides
- Removed unnecessary newlines in assertion statements
- Improved readability by simplifying multiline assertions
- Ensured consistent assert formatting in test_management_logger_carries_redaction_filter

This branch has not been deployed

No deployments
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