Repository navigation
test: port the upstream Azure tests - #324
Conversation
@ai-sdk/openai 4.0.83 takes `maxNumResults` as a JS number and sends it as is (openai-responses-prepare-tools.ts:219), so `5` reaches the API's integer field as `5`. aimux typed the field `Option<f64>`, so the typed factory sent `5.0`. It is an `Option<u32>` now; the other number fields of the tool arguments that count things (`partial_images`, `output_compression`) are integers already. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
… never started @ai-sdk/openai 4.0.83 starts the stream's `responseId` at `null` (openai-responses-language-model.ts:1587) and only `response.created` sets it, so a stream without that event finishes with `responseId: null`. aimux wrote an empty string. The generate path already writes `null`. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
@ai-sdk/openai 4.0.83 puts the reasoning item's id on every `reasoning-delta` as `providerMetadata.<key>.itemId` (openai-responses-language-model.ts:2735-2749). aimux sent the deltas without provider metadata, while its reasoning start and end parts already carried it. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Ports the 97 cases of @ai-sdk/azure 4.0.84 (azure-openai-provider.test.ts, azure-transcription-model.test.ts) into src/azure/tests/, one Rust file per upstream test file, each case under a `/// upstream:` marker. 88 are ported and pass on the three OpenAI fixes below this commit; 9 are listed in layout.toml (8 sub-feature, 1 ts-only). Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
The `/// TS: "…"` lines in azure_upstream_e2e_test.rs named upstream cases these tests only check in part. They now say `partial:` and point at the full ports in src/azure/tests/. Test bodies are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
|
说明里提到的「测试文件没有同名源文件」, Generated by Claude Code |
…m-id Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
…st/port-the-upstream-azure-tests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
eric8810
left a comment
There was a problem hiding this comment.
Azure test port:88 tests + 9 exclusions = 97,16 个 snapshots/18 个 fixtures 全部被引用且精确比较,无生产变化。Approve。
…eam-azure-tests # Conflicts: # CHANGELOG.md # aimux-providers/layout.toml # aimux-providers/tests/azure_upstream_e2e_test.rs # aimux-providers/tests/openai_upstream_e2e_test.rs
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase is content-preserving: only master/parent merges and CHANGELOG/layout conflict resolution; tests and CI unchanged. Re-approving current head.
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master/parent merges and CHANGELOG/layout conflict resolution; CI 16/16. Re-approving current head.
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master/parent merges and conflict resolution; CI 16/16. Re-approving current head.
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master/parent merges and conflict resolution; CI 16/16. Re-approving current head.
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master merges and conflict resolution; CI 16/16. Re-approving current head.
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master merges and conflict resolution; CI 16/16. Re-approving current head.
…eam-azure-tests # Conflicts: # aimux-providers/layout.toml
eric8810
left a comment
There was a problem hiding this comment.
Rebase verified content-preserving: only master merges and layout.toml conflict resolution; CI 16/16. Re-approving current head.
Summary
按 RFC-0045(#281)把
@ai-sdk/azure@4.0.84的上游测试迁完,按厂商分批的第八个(Mistral #295、Cohere #296、DeepSeek #299、Groq #301、Hugging Face #303、xAI #312、Anthropic AWS #319)。上游 2 个测试文件共 97 个用例:
tests/azure_upstream_e2e_test.rs12 个测试里有 9 个带/// TS: "…"出处,但只比部分字段,出处改成/// partial: …注释,指向完整用例所在的文件(单独一个提交,函数体不变)。layout.toml的手写排除:sub-feature(Provider 构造与配置:迁移后遗留缺口 #275):Azure 上的 DeepSeek 模型 4 个、completion()2 个,aimux 都没移植;embedding 的单次输入字节上限 1 个,aimux 的EmbeddingModel只有max_embeddings_per_call();转写的 workflow 序列化往返 1 个,aimux 的模型不能序列化。ts-only:用vi.spyOn替换OpenAITranscriptionModel.prototype.doStream,Rust 模型没有可替换的接缝。Azure 复用 OpenAI 的模型代码,迁移中发现的 3 处差异都在 OpenAI 共用代码里,原先各自单独一个 fix PR(#323 合并了三处),现在三处都已随 OpenAI 的 fix PR #368 合入 master,#323 已关闭:
max_num_results是f64,请求体里发成5.0,上游发5。response.created时,结束时的responseId是"",上游是null。{ azure: { itemId } }。位置按新定的布局:新测试全放
src/azure/tests/,一个上游测试文件对应一个 Rust 文件。一、体系概览:Azure 的测试现在怎么跑(master
b91829af)上游
packages/azure/src/对应:改动前 aimux 没有一个测试带上游的完整 describe 链。
二、本 PR 的改动(细节)
1. 新测试目录(
azure/mod.rs末尾#[cfg(test)] mod tests;)2.
aimux-providers/layout.toml(只有[azure])3.
tests/azure_upstream_e2e_test.rs:9 个测试上的 11 行/// TS: "…"改成/// partial: …; full port in src/azure/tests/<file>.rs。harness 上的差别(期望值都没改):
createModel自己拼 URL 和 headers 建OpenAIResponsesLanguageModel,这里用provider.responses(..),差别只在这些用例不比的 URL 和鉴权头。ai-sdk-azure/4.0.84(钉住的版本),不比上游 mock 的0.0.0-test;比对发出的 headers 时去掉 user-agent,单独比。InvalidArgument只带 message,argument: 'resourceName'改比变体和 message,并确认没有发请求。AiMuxError::Aborted,不比同一个错误对象;AbortSignal 的同一性改为取消调用方的 signal、看 transport 收到的那份是否跟着取消。undefined的键在 JSON 里省略,Date 写成 ISO 字符串。Type of change
Checklist
cargo +1.99 fmt -p aimux-providers -- --checkpassescargo +1.99 clippy -p aimux-providers --lib --tests -- -D warningspassescargo +1.99 test -p aimux-providers:lib 223(其中 azure 88),129 个测试二进制全过scripts/check_provider_boundaries.shpassesNotes for reviewers
src/test_support/mod.rs、aimux-providers/layout.toml,并改了边界脚本的同两行;这几处在各 PR 里内容相同,后合入的只需合并layout.toml的厂商表。layout.toml的手写排除里。foo.test.ts测foo.ts;azure-transcription-model.test.ts是第一个没有同名源文件的,这里把它的排除挂在定义AzureTranscriptionModel的azure-openai-provider.ts上,并在layout.toml里注明。f6279139,master 209be26)。合并时openai_upstream_e2e_test.rs和 CHANGELOG 取 master 的版本(fix: OpenAI Responses reasoning deltas carry the item id #323 的改动 master 都有);azure_upstream_e2e_test.rs保留了 fix: OpenAI Responses, chat, transcription and image behaviour match the AI SDK #368 新加的image_input_capabilities_are_unknown_for_deployments,注释改成和其他用例一样的 partial 写法;layout.toml是 master 的原文后接 azure 表。Generated by Claude Code