Repository navigation
fix(crates/panache-mcp): 稳定工具目录中的随机种子描述 - #29
Merged
Merged
Conversation
背景:Style 默认会生成随机 seed。schemars 把生成 schema 时的随机取样作为固定 default 暴露,导致重复工具发现的目录可不同。 解决手段:仅对 Style.seed 的 schema 删除该 default,并用专项回归固定类型、可选性和显式种子的反序列化。运行时仍按原逻辑给省略 seed 的稿件随机分配。 收益:8 个本地真实 MCP 会话各 3 次查询,候选 24 份目录稳定一致,显式和省略三类保存行为保持。便于对照实验与一致地描述客户端能力。
Reviewer's GuideAPIRemove the random seed default from Style's generated schema while preserving the field's runtime behavior and public shape.
TestsAdd regression coverage for stable schema output, seed optionality, unchanged defaults, and explicit seed deserialization and serialization.
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
Owner
Author
重复查询与实际保存的核对
|
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.
问题
Style::default()为新稿生成随机 seed。生成工具 schema 时也执行了该默认逻辑,导致任意一个取样值被写成save_section.style.seed.default。它并不代表下一次省略 seed 的实际值;甚至同一 MCP 会话反复查询也可能不同。改动
只用 schemars 的字段 transform 移除
Style.seed输出 schema 的default。不改变类型、可选性、字段语义和运行时随机生成;显式 seed 仍可用于复现。新增同一结构的专项单元测试。没有编辑 #27 对Tune的保护条件;两份补丁的适用检查通过。本地验证
基线
e1e2546a与独立候选分别构建,Rust 1.94.1、真实 Markdown worker、Python MCP SDK 1.29.0,协商协议均为2025-11-25。每臂 8 个独立进程,每进程查询三次完整工具目录并写三份合成新稿:仅在基线目录忽略该随机字段后,与候选所有目录的规范化摘要完全相同。通过
cargo test --locked -p panache-mcp seed_schema_tests;使用当前二进制真实调用save_section并以 SQLitedrafts.style验证。以上是可复现性修复,不把它描述成已证实的客户端缓存故障或 MCP 规范違例。草稿,不加标签,不手动触发 Actions。
Summary by Sourcery
Remove the random Style seed default from generated schemas while preserving existing runtime and serialization behavior.
Bug Fixes:
Tests: