test(providers): 建立五协议 wire payload 与传输装配 golden 快照基线 - #590
Open
AlphaCatMeow wants to merge 1 commit into
Open
Conversation
为 LLM seam 改造提供行为等价判定基准: - wire-payload-golden:anthropic-messages / openai-completions / openai-responses / google-generative-ai / deepseek-responses 五协议 固定输入下的完整请求体逐字段锁定(thinking 档位、工具、缓存断点、 text-only 双形态),走真实 pi-ai stream() 与全部 payload 中间件, onPayload 链尾截获后中断,零网络。 - transport-golden:prepareProviderRequest 完整输出快照(反代 URL、 全量头集、base64 覆盖包解码断言、鉴权头排除、full URL 模式、 useSystemProxy 开关),并锁定 failover 逐候选传输配置独立性 (主选走代理+备选直连互不泄漏,双向拓扑)。 零生产代码改动。
StackCairn
marked this pull request as draft
August 22, 2026 03:45
Contributor
|
PR governance checks passed. Awaiting human review. |
AlphaCatMeow
marked this pull request as ready for review
August 22, 2026 03:50
This was referenced Aug 22, 2026
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.
Closes #591
改动说明
为「LLM seam 改造 Stack」建立 PR-0 golden 快照基线:在动任何生产代码之前,把五条协议链路"固定输入 → 完整请求"的装配行为逐字段锁定,作为后续 seam 重构(适配器包装、payload 拦截器注册化、重试策略反转)"行为等价"的判定基准。
零生产代码改动——diff 仅含两个新测试文件(+750 行)。
新增测试
test/providers/wire-payload-golden.test.mjs(6 条):五协议最终 wire 请求体整体快照,走真实 pi-aistream()与全部 payload 中间件(finalizeProviderStreamOptions),onPayload链尾截获后中断,零网络:output_config.effort+ 缓存断点 + metadata + tool_choicereasoning_effort/strict)与 text-only 形态(不带 tools 也不带 tool_choice,锁定严格网关 400 回避行为)store+prompt_cache_key+reasoning.encrypted_contentthinkingConfig.thinkingLevel+functionCallingConfigtest/providers/transport-golden.test.mjs(7 条):prepareProviderRequest传输装配完整输出快照(真实实现,仅 mock tauri invoke):x-liveagent-use-system-proxy头与凭据互不泄漏——供应商级代理语义是"网络可达性属于每个目标"的载体,seam 重构不得破坏快照有意写成显式对象字面量而非 .snapshot 文件:diff 直接可读,且杜绝无意 re-record。非确定字段(session id)注入固定值。
验证结果
node --test test/providers/wire-payload-golden.test.mjs test/providers/transport-golden.test.mjs)pnpm --dir crates/agent-gui buildpnpm --dir crates/agent-gui test:frontendupstream/main@29c9f1b5裸基线复测得到完全相同的 5 个失败,属既有问题,与本改动无关pnpm --dir crates/agent-gui lintupstream/main裸基线同样失败;lint 范围为src/,不含本 PR 的test/文件git diff --check未运行项
cargo check(未触碰任何 Rust 代码)人工验收结果
用户已在 Tauri 调试客户端(
start-tauri-dev.bat,当前分支 HEAD 构建)完成冒烟验收并明确反馈通过。验收期间发现两个与本 PR 无关的上游既有兼容问题(agnes 中转的 Responses shim 对web_search工具类型与多轮 assistant 历史的校验失败),已核验涉事生产文件与upstream/main逐字节一致,将另行立项。Stack 信息
Depends-On: none
Stack-Root: 本 PR(LLM seam 改造 Stack 根)