Repository navigation
test: port the upstream DeepSeek tests - #299
Merged
Merged
Conversation
75 of the 93 tests in deepseek_chat_test.rs port an upstream case of @ai-sdk/deepseek@3.0.56 and now carry an RFC-0045 marker, in one mod per upstream describe. The other 18 are aimux's own or check only part of a snapshot case and stay unmarked. Bodies and fn names are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
13 cases of convert-to-deepseek-chat-messages, deepseek-prepare-tools, convert-to-deepseek-usage and is-deepseek-v4-model in foo/tests.rs next to each source file. One prepare-tools case needs an unset strict-tools capability that only a directly built model has; it is ts-only in layout.toml. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
10 cases under tests/it/deepseek/, built as the single tests/it/main.rs program, with the upstream fixtures and snapshots beside them. The three structured-outputs cases need a model the provider never builds and are ts-only. 'continues validating known usage field %s' fails: aimux reads a string usage count as 0. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
tokenUsageSchema (deepseek-chat-api-types.ts:95-113) keeps usage as a loose object but requires its known counts to be numbers or null, so a response with "prompt_tokens": "100" is rejected. aimux kept usage as a raw Value and read such a count as 0. The response and chunk types now validate the seven counts when they deserialize; the generate path reads usage from the parsed response. Test: raw_usage::continues_validating_known_usage_field. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
Maps each upstream source file of @ai-sdk/deepseek@3.0.56 to its Rust file (RFC-0046 §4.4) with the RFC-0045 tests table. The Files API is missing in aimux (#275), so its upstream tests are not ported. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
This was referenced Oct 20, 2026
All DeepSeek tests of this port now live in one directory that keeps the upstream src/chat/ subdirectory, one file per upstream test file: chat/chat_language_model, convert_to_chat_messages, convert_to_usage, is_v4_model, prepare_tools and raw_usage, with their fixtures/ and snapshots/. The src/deepseek/*/tests.rs files and the tests/it/ binary are gone; the shared mock fetch is reached through src/test_support/. The boundary script skips files under tests/ dirs as it skips #[cfg(test)] blocks. Test bodies and markers are unchanged. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
This was referenced Oct 20, 2026
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
cunninghamcard-bit
changed the base branch from
master
to
fix/deepseek-usage-counts-must-be-numbers
October 20, 2026 07:11
This was referenced Oct 20, 2026
Merged
…stream-deepseek-tests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5
cunninghamcard-bit
marked this pull request as ready for review
October 24, 2026 10:55
6 of 12 tasks
…e-numbers' into test/port-the-upstream-deepseek-tests
eric8810
approved these changes
Oct 25, 2026
eric8810
left a comment
Contributor
There was a problem hiding this comment.
DeepSeek test port:98 个 marker 覆盖 122 个 in-scope case,7 个 fixtures 逐字节一致,无生产代码变化。Approve。
…rt-the-upstream-deepseek-tests # Conflicts: # aimux-providers/layout.toml
…rt-the-upstream-deepseek-tests # Conflicts: # aimux-providers/layout.toml
…rt-the-upstream-deepseek-tests # Conflicts: # aimux-providers/layout.toml
…rt-the-upstream-deepseek-tests # Conflicts: # aimux-providers/layout.toml
…rt-the-upstream-deepseek-tests
eric8810
changed the base branch from
fix/deepseek-usage-counts-must-be-numbers
to
master
October 27, 2026 01:21
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.
Summary
按 RFC-0045(#281)把
@ai-sdk/deepseek@3.0.56的上游测试迁完,按厂商分批的第三个(Mistral #295、Cohere #296)。上游 7 个测试文件共 122 个用例:
ts-only:只有绕过 provider、直接构造模型时才走得到。uploadFile)的用例,aimux 没实现这个接口,layout.toml记为missing、挂 Provider 构造与配置:迁移后遗留缺口 #275,测试由实现它的 PR 带进来。迁移中发现一处行为差异,单独开了 fix PR #309(上游会拒绝 usage 计数不是数字的响应,aimux 把
"prompt_tokens": "100"读成 0),本 PR 叠在它上面。这个修复最早在本分支上提交过,拆出去之后用一个合并提交把 #309 合进来,所以提交列表里还看得到它,但相对 #309 的 diff 只有测试和layout.toml。位置按新定的布局:DeepSeek 的新测试全放
src/deepseek/tests/,保留上游的chat/子目录,一个上游测试文件对应一个 Rust 文件。原有的tests/deepseek_chat_test.rs留在原地,由包拆分线程的搬移 PR 合进来。一、体系概览:DeepSeek 的测试现在怎么跑(master
5743a40a)上游
packages/deepseek/src/对应:改动前 93 个测试和上游用例对不上号:函数名多数不是
it文本,没有一处写完整出处,看不出覆盖了哪些用例。二、本 PR 的改动(细节)
1. 原有 93 个测试补标记(
tests/deepseek_chat_test.rs)逐个对照场景和断言:75 个和上游用例一一对应,加标记、按
describe包mod;另外 18 个放在文件末尾不标,其中 11 个是 aimux 自己的测试,7 个用内联数据只断言了快照的一部分,对应的上游用例在第 2 步按快照完整迁。函数名、函数体不变。#309 加的 2 个 aimux 测试也在文件末尾。2. 剩下的上游用例(新目录,
deepseek/mod.rs:196加#[cfg(test)] mod tests;)3.
aimux-providers/layout.toml(只有[deepseek])harness 上的差别(期望值都没改):快照里值为
undefined的键在 JSON 里省略;TS 测试服务器的requestHeaders不含user-agent,比较时去掉;Uint8Array输入用FileBytes::Binary构造。Type of change
Checklist
cargo +1.99 fmt --all -- --checkpassescargo +1.99 clippy -p aimux-providers --lib --tests -- -D warningspassescargo +1.99 test -p aimux-providers:lib 158(其中 deepseek 23)、deepseek_chat 95、deepseek 4,以及用到 DeepSeek 的 cassette_full、conformance、non_object_tool_input、openai_compatible、package_user_agent、runtime_decision、list_models,全过scripts/check_provider_boundaries.shpassesNotes for reviewers
src/test_support/mod.rs、aimux-providers/layout.toml,并改了边界脚本的同两行;这几处在各 PR 里内容相同,后合入的只需合并layout.toml的厂商表。layout.toml里(4 个 ts-only,20 个属于 missing 的 Files 文件)。🤖 Generated with Claude Code
https://claude.ai/code/session_01RoxcKU4zBD64Lri3e4Lrq5