Skip to content

fix(legacy_1x): restore 1.19-era internals contract for pinned integrations - #257

Merged
lzsweb merged 2 commits into
mainfrom
fix/legacy-upstream-symbol-contract
Dec 3, 2026
Merged

lzsweb merged 2 commits into
mainfrom
fix/legacy-upstream-symbol-contract

Conversation

@lzsweb

@lzsweb lzsweb commented Dec 2, 2026

Copy link
Copy Markdown
Collaborator

Summary

Downstream integrations pinned to older 1.x internals cannot run on the 2.x package even though legacy_1x vendors the 1.x surface. Probing the actual import/construct surface of LlamaIndex, Dify, LangChain and MetaGPT against 2.1.4 found exactly two gaps, both hit by MetaGPT (dashscope~=1.19.3):

  • _get_protocol_params was removed within 1.x itself by 1.27.8, so the vendored surface lacks it. MetaGPT unpacks its 13-element tuple (the 1.19.3 contract; 1.22.2 had 14). Restored verbatim from the 1.19.3 wheel.
  • ApiRequestData only accepted input_data=; 1.19.3 (and MetaGPT) use input=. Added a keyword-only input= alias (input_data wins when both are given), so existing callers are unaffected.

This promotes the legacy surface from "implementation detail" to a tested public contract: tests/legacy_1x/unit/test_upstream_symbol_contract.py (33 cases) pins the four integrations' import lists, the 13-tuple defaults/pop semantics/ws-NONE downgrade, the input= alias equivalence, MetaGPT's offline request build (AGeneration(Generation, BaseAioApi) MRO included), and 1.x kwargs. Future legacy_1x renames now fail CI before breaking a downstream release.

No change to the 2.x native API — it has zero references to these symbols.

Verification

  • New contract tests: 33/33 pass; full tests/legacy_1x/unit regression: 737 pass (3 environmental failures from missing optional dashscope_agenticx, unrelated).
  • Real-API smoke on this branch (dashscope 2.1.4, qwen-plus): all five integrations, 13/13 paths green — LlamaIndex 0.5.2 (sync/stream/async/async-stream), LangChain ChatTongyi 1.2.15 (completion/stream), Qwen-Agent 0.0.34 (raw-api stream + direct Generation.call), Dify tongyi plugin (stream/non-stream), MetaGPT git main (AGeneration.acall completion/stream — exercising exactly the restored _get_protocol_params + ApiRequestData(input=) path).

Test plan

  • pytest tests/legacy_1x/unit/test_upstream_symbol_contract.py
  • pytest tests/legacy_1x/unit regression
  • Five-integration real-call smoke (completion + streaming; LlamaIndex also async)

zhansheng.lzs added 2 commits December 2, 2026 17:13
…ations

MetaGPT (dashscope~=1.19.3) unpacks the 13-element _get_protocol_params
tuple and constructs ApiRequestData(input=...); both were missing from
the vendored 1.27.8-era surface. Restore the helper verbatim from 1.19.3
and add a keyword-only input= alias to ApiRequestData.

Add tests/legacy_1x/unit/test_upstream_symbol_contract.py pinning the
import/construct surface of LlamaIndex, Dify, LangChain and MetaGPT so
future legacy_1x renames fail CI before breaking a downstream release.
…ontract tests

CI pylint (tests) flagged dict() call and unused ws_stream_mode unpack;
switch to a dict literal and underscore-prefixed dummy. No behavior change.
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