Skip to content

fix(client): 为动态注册与替换提供远端合同可见性屏障 (#760) - #768

Merged
SunSi12138 merged 2 commits into
devfrom
fix/760-remote-contract-readiness
Oct 3, 2026
Merged

SunSi12138 merged 2 commits into
devfrom
fix/760-remote-contract-readiness

Conversation

@SunSi12138

Copy link
Copy Markdown
Owner

独立控制连接的动态注册/替换返回成功后,已经 Ready 的数据连接可能尚未收到新的 ContractManifest,合法 Get 因而被拒绝。本 PR 提供显式、可取消的 wire identity 可见性屏障;Get 保持同步并继续原有校验。

  • 单客户端和指定 multi-cluster slot 按 ContractId + 精确 RpcAssemblyHash 等待所有当前 Ready 连接,至少需要一条。缺失合同等待传播,真实 hash mismatch 立即 fail closed。
  • 明确声明 previous hash 的替换重载只允许该旧值继续等待;任何第三种 hash 仍立即拒绝。相同 ID/hash 已可见时立即完成,不冒充 implementation/Artifact generation 确认或 lease。
  • 清单与拓扑事件唤醒等待;重连观察新连接独立 generation,取消只影响调用方,Stop/cluster removal 结束旧 lifetime。等待入口只使用数值 identity,不获取代理或保留 collectible Type/Assembly。
  • 将动态程序集测试的私有清单反射轮询改为公开屏障。新增真实 TCP 两连接测试,受控延迟广播,分别证明 Register 和实际生成程序集不同 wire hash 的 Replace 在控制回复之后仍需等待数据可见性。

验证(Linux x64,SDK 10.0.102 / runtime 10.0.2):Release 全 solution 构建零 warning/error;新增 21 条确定性 Unit 测试通过;完整 Unit 1,875、Generator 269、Integration 453、LoadTest component Unit 60 全部通过,无 failure/skip。动态模块分组 44 条全部通过。Whitespace、maintainability、project-reference boundary、generated Runtime dependency guard 和八包完整 public API 检查通过;实际打包 API 仅新增四个有默认实现的接口方法,原签名和 wire/Generated ABI 不变。默认接口实现对旧自定义客户端明确 NotSupported。

首次测试发现的夹具缺项已修正:空路由集群声明 AllowDynamicContracts,控制连接显式选请求超时策略,cluster removal 使用有界 drain 等待而非零时限要求异步清理瞬时完成。

此 PR 是上游源码修复,不宣称已发布正式 NuGet。Kan#518/#730 仍需消费正式修复版本并完成原失败三平台验收;Windows 的 ContractMismatch 必须保留原始 bind-handler 异常证据,不假定与 Linux 同因。

Fixes #760
关联 SunSi12138/Kan#518、SunSi12138/Kan#730。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant