Repository navigation
dev/v2.1-1 - #222
Merged
Merged
dev/v2.1-1#222
Conversation
- Add client_request_id generation logic and inject it into request headers - Ensure multiple retries of the same logical request share the same client ID - Record client ID in transport-layer errors and logs for issue tracing - Add APIResponseValidationError to handle response body parsing failures - Truncate and format exception output to prevent multi-line text from breaking log structure - Add comprehensive unit tests for request ID generation and response validation exceptions
- Thread RequestOptions through chat, embeddings, files, models, and jobs - Refactor transport header merging to support extra_headers override - Integrate deep_merge for extra_body, merge_query for extra_query - Apply resolve_timeout and resolve_max_retries per call when options present - Export RequestOptions from transport package for public use
…idation config - Add parse_model function for fault-tolerant Pydantic model parsing - Auto-fallback to repair invalid fields and preserve valid data on parse failure - Add strict_validation config option to enable strict validation mode - Raise APIResponseValidationError on response structure mismatch in strict mode - Refactor task and protocol parsing logic to integrate the new fault-tolerant mechanism - Improve boolean config parsing to support multiple environment variable formats
…r resource list interfaces - Add BasePage generic base class to unify offset-based pagination logic - Support sync and async cross-page iteration and next-page fetching - Refactor ModelList, FileList, and JobList to inherit from BasePage - Implement items property for each list resource to unify iteration interface - Inject pagination callbacks into list request methods to support automatic page traversal - Add alias mapping for total and total_count fields in JobList compatibility - Add comprehensive unit tests covering pagination logic and edge cases
…raw responses - Add APIResponse class to wrap HTTP responses with on-demand parsing and error checking - Add request_api method to SyncTransport and AsyncTransport - Add raw parameter and type overloads to models and embeddings resource request methods - Move pagination total_count/total alias logic up to BasePage base class - Remove redundant total_count field in jobs resource and _parse_list in models - Update pre-commit config to suppress E1133 false positives caused by overload resolution - Add unit tests for APIResponse and pagination total alias parsing
- Use AST parsing to compare method sets and parameter signatures between sync and async classes - Verify mechanically copied method bodies remain consistent after stripping async syntax - Maintain exemption list for structural differences like sync vs async generators - Implement auto-discovery mechanism to ensure all new async twins are covered by tests - Add guard tests to verify detectors accurately catch missing methods or parameter drift - Exclude legacy SDK and standalone submodule directories to prevent false positives
- Fix _parse_model to avoid duplicate fields when aliases are involved - Add timeout and max_retries documentation to RequestOptions - Clarify APIResponse.parse() limitations for custom parsers - Update resource methods with improved error handling - Add comprehensive test coverage for new functionality - Update README documentation with latest features
Route wan2.7 image models to the multimodal endpoints and retain non-text content parts so generated media URLs survive typed parsing.
Route the remaining multimodal image models correctly and allow protocol-specific inputs without forcing prompt or messages fields.
…ixes to all resources - Extend fault-tolerant typed response parsing (parse_model) to every resource: apps, audio (asr/tts/customization/phrases), decision, deployments, fine_tunes, images, models, multimodal, reinforcement learning, rerank, tingwu, tokenization, and videos. Streamed frames and websocket results now degrade frame-by-frame instead of raising bare pydantic.ValidationError. - Expose max_retries as a per-request parameter on all resource methods, eliminating the need for a derived client to narrow retries for a single call. - Add raw=True support to all resource methods returning parsed models, allowing callers to obtain the raw APIResponse when needed. - Fix pagination traversal to advance from the request's page_no / page_size rather than the response echo, which may be missing or stale. BasePage.bind_pagination now accepts requested_page_no and requested_page_size. - Update request_options() to accept timeout and max_retries as keyword-only parameters. - Fix docs: correct pagination example (jobs.list → images.jobs.list), clarify streaming retry semantics and strict validation coverage. - Add comprehensive tests: per-request options forwarding for all resources, response drift coverage for every typed-parse surface, and pagination cursor correctness.
Add a local, bilingual rule table that matches (status_code, code, message) to structured fix guidance, surfaced lazily on DashScopeError.diagnosis and the non-raising ResponseBase.diagnosis. No network, no model call; the devkit package is never imported on the success path. Review hardening: - advertise DASHSCOPE_WORKSPACE (the var _config.py actually reads), not the non-existent DASHSCOPE_WORKSPACE_ID - install_excepthook chains to the pre-existing sys.excepthook instead of jumping to sys.__excepthook__, so third-party hooks keep running - every ErrorCode resolves to guidance (adds gateway-timeout and arrears rules); a consistency test guards against registry drift - render as "诊断建议", not "智能诊断": this is a static Tier-0 table, not a model-backed diagnosis; the escalation hint stays in the devkit renderer, so the core error surface carries no CLI coupling
Hook the transport choke point so static/replay/record return raw
httpx.Response wire bytes and the real protocol adapters, SSE parser and
typed models run unchanged. Expose dashscope.enable_dev_mock /
disable_dev_mock / dev_mock_active forwarders. HTTP only; the websocket
transport is not intercepted.
Review hardening:
- record fixtures are written 0600, under a lock with an atomic O_APPEND
write, and record mode emits a one-time data-exposure warning;
set_redactor() scrubs JSON bodies before they land on disk; the
default fixture name is gitignored
- fingerprint now covers base_url/region plus the content/data/files
body channels and a small allowlist of semantic headers, so a
multipart, binary or different-region request cannot collide; volatile
identity headers stay excluded
- response bodies are stored losslessly (base64 for non-UTF-8) instead
of decode(errors="replace"), which corrupted binary responses
- a stream captured before natural EOF is flagged complete=false and
refused on replay (override with DASHSCOPE_DEV_MOCK_ALLOW_PARTIAL)
- re-recording a request now wins: replay resolves to the newest capture
- the transport checks _dev_mock_requested() before building the mock
seam, so a disabled mock adds no per-call allocation ("near-zero
overhead when disabled", not "zero-cost")
ubuntu-latest now resolves to Ubuntu 26.04, which has no CPython 3.9 build in actions/python-versions, so setup-python failed with "version '3.9' ... not found for Ubuntu 26.04". The package still declares python_requires=">=3.9", so keep the 3.9 leg but run it on ubuntu-24.04 (the newest image that ships 3.9); 3.10-3.13 stay on ubuntu-latest.
The layer-decoupling guard flagged errors.py and types/common.py for their lazy `from dashscope.devkit.diagnosis import diagnose` hooks, because `devkit` was absent from _NEUTRAL_PACKAGES and the guard defaults every unknown dashscope.* import to "1.x business surface". devkit is a new 2.0 subsystem, not 1.x, so add it to the neutral set and to the _CURRENT scan roots so the guard also keeps devkit itself free of 1.x imports going forward.
- Introduce resolve_api_key and resolve_fc_api_key functions to fetch current API keys at call time - Refactor usage to avoid relying on import-time environment variable snapshots - Add explicit api_key parameters to relevant functions for better credential passing - Normalize dataset file parameters to avoid [None] issues in uploads - Preserve AgenticRLError classification across upload and HTTP request layers - Harden start.sh generation with shell-safe validation of embedded values - Improve server admission control using asyncio.Semaphore to limit in-flight requests - Enhance request validation error logging with masked request body preview at debug level - Fix async execution in FuncManager and deep-copy RewardProcessorMeta to avoid shared state - Update user guide to warn about DEBUG log level exposing full credentials - Add unit tests to cover dataset upload parameter normalization and error preservation
- Moved client disconnect response to a dedicated function _client_disconnect_response - Simplified handler to return the new function's response on disconnect - Improved logging of client disconnect event with request ID - Applied consistent multi-line formatting for async client call - Cleaned up redundant parentheses in exception handling block - Updated import statements to remove unused OSSUploadError - Corrected pylint disable comment for abstract class instantiation in tests - Minor formatting improvements in test logging string concatenation
- Extend regex to accept local wheel/sdist paths with / and + characters - Document safe characters for SDK_PACKAGE shell word-splitting - Add tests allowing relative and absolute local wheel paths as fc_pypi_lib - Verify multiple space-separated wheel paths round-trip unchanged - Ensure shell injection attempts in SDK_PACKAGE are still rejected with InputError
Preserve FC credential fallback and admission capacity across disconnects, keep package arguments intact, and omit malformed request bodies from debug logs. Move regression coverage to v2 tests while restoring legacy tests to the baseline.
Update Agentic RL expectations for preserved error classifications and safe startup script generation.
This reverts commit de398cf.
Upgrade loongsuite-util-genai to 0.5.0 for explicit Apache-2.0 metadata and refresh the model names used by MaaS region tests.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
[Describe what this PR does and why]
Related Issue: Fixes #[issue_number] or Relates to #[issue_number]
Security Considerations: [Check if API keys or sensitive credentials are exposed in code/logs]
Type of Change
Component(s) Affected
Checklist
Testing
[How to test these changes]
Additional Notes
[Optional: any other context]