Repository navigation
Conversation
- Fix MessageTarget serde tagging to internally tagged with camelCase fields (Closes #316) - Fix Windows integration tests: dynamic dylib discovery and mutex lock for Error 32 - Fix invalid plugin ID (underscore) in manifest unit test
Contributor
Author
|
✅ 实机测试验证完毕 (Real-device Testing Completed) 我已使用此 PR 的 CI 编译产物在 Windows 环境下进行了双 Native 插件的实机联调测试。测试覆盖了 测试结果:
@LanRhyme @ChinsaaWei @ChouChiu 修复已验证完毕,请 Review。 |
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 #316
📝 背景与动机 (Background & Motivation)
在 Issue #316 中,指出
send_messageC ABI 的target_json参数格式与官方文档描述严重不符。文档描述的是 内部标签 (Internally Tagged) 格式(如
{"type":"local","pluginId":"..."}),但host.rs中的MessageTarget枚举使用了 Serde 默认的外部标签格式,且容器级的rename_all = "camelCase"未能级联作用于结构体变体内部的字段(导致plugin_id未被转换为驼峰命名)。此外,在本地验证此修复时,发现现有的集成测试在 Windows 平台上存在严重的并发与路径兼容性问题,导致测试无法稳定运行。
🛠️ 变更内容 (Changes)
1. 修复
MessageTarget序列化逻辑 (Fix MessageTarget Serialization)tauri-app/crates/micyou-plugin/src/host.rs。MessageTarget添加#[serde(tag = "type")],强制采用文档描述的 内部标签 格式。Local和Remote变体上显式添加#[serde(rename_all = "camelCase")],确保内部字段plugin_id正确序列化为pluginId。{"type": "broadcast"}、{"type": "local", "pluginId": "..."})。2. 稳定 Windows 平台下的集成测试 (
native_loader.rs)lib前缀,导致在 Windows 下无法找到.dll文件。重构了fixture_dylib()逻辑,基于cfg!(target_os)动态生成精确文件名并优先进行精确匹配。Os error 32。引入了全局互斥锁COPY_MUTEX序列化复制过程,并增加了重试与短休眠机制,彻底解决了测试偶发崩溃的问题。3. 修复 Manifest 单元测试中的非法 ID (
manifest.rs)entry_path_ignores_wasm_runtime。"dev.micyou.wasm_test"改为"dev.micyou.wasm-test"。原 ID 包含下划线_,违反了 Manifest 校验规则(仅允许小写字母、数字、.和-),导致测试必定失败。由于这只是单字符修正且不影响生产代码,故一并包含在此 PR 中。🧪 测试与验证计划 (Testing & Validation Plan)
cargo test -p micyou-plugin) 在 Windows 环境下已全部通过。send_message的路由在真实宿主环境中完全修复。