test(cqrs): 补齐 PR304 测试 XML 注释

- 补齐上下文校验 handler 的 Handle 参数与返回 XML 注释

- 更新带 DispatchId 的测试请求与通知 XML 参数注释

- 记录 cqrs-rewrite 主题的本轮 PR review 跟进
This commit is contained in:
gewuyou 2026-04-30 09:00:24 +08:00
parent 255a6a152e
commit 98021f59e7
4 changed files with 12 additions and 0 deletions

View File

@ -122,6 +122,9 @@ internal sealed class CqrsDispatcherContextValidationTests
/// <summary> /// <summary>
/// 返回固定结果;当前测试只关心调用前的上下文校验。 /// 返回固定结果;当前测试只关心调用前的上下文校验。
/// </summary> /// </summary>
/// <param name="request">当前请求。</param>
/// <param name="cancellationToken">取消令牌。</param>
/// <returns>固定整型结果。</returns>
public ValueTask<int> Handle(ContextAwareRequest request, CancellationToken cancellationToken) public ValueTask<int> Handle(ContextAwareRequest request, CancellationToken cancellationToken)
{ {
return ValueTask.FromResult(1); return ValueTask.FromResult(1);
@ -138,6 +141,9 @@ internal sealed class CqrsDispatcherContextValidationTests
/// <summary> /// <summary>
/// 返回已完成任务;当前测试只关心调用前的上下文校验。 /// 返回已完成任务;当前测试只关心调用前的上下文校验。
/// </summary> /// </summary>
/// <param name="notification">当前通知。</param>
/// <param name="cancellationToken">取消令牌。</param>
/// <returns>已完成任务。</returns>
public ValueTask Handle(ContextAwareNotification notification, CancellationToken cancellationToken) public ValueTask Handle(ContextAwareNotification notification, CancellationToken cancellationToken)
{ {
return ValueTask.CompletedTask; return ValueTask.CompletedTask;
@ -154,6 +160,9 @@ internal sealed class CqrsDispatcherContextValidationTests
/// <summary> /// <summary>
/// 返回一个最小流;当前测试只关心建流前的上下文校验。 /// 返回一个最小流;当前测试只关心建流前的上下文校验。
/// </summary> /// </summary>
/// <param name="request">当前流请求。</param>
/// <param name="cancellationToken">取消枚举时使用的取消令牌。</param>
/// <returns>包含单个固定元素的异步流。</returns>
public async IAsyncEnumerable<int> Handle( public async IAsyncEnumerable<int> Handle(
ContextAwareStreamRequest request, ContextAwareStreamRequest request,
[EnumeratorCancellation] CancellationToken cancellationToken) [EnumeratorCancellation] CancellationToken cancellationToken)

View File

@ -5,4 +5,5 @@ namespace GFramework.Cqrs.Tests.Cqrs;
/// <summary> /// <summary>
/// 为 notification dispatch binding 上下文刷新回归提供带分发标识的最小通知。 /// 为 notification dispatch binding 上下文刷新回归提供带分发标识的最小通知。
/// </summary> /// </summary>
/// <param name="DispatchId">当前分发的稳定标识,便于断言缓存 binding 复用时观察到的是同一次通知。</param>
internal sealed record DispatcherNotificationContextRefreshNotification(string DispatchId) : INotification; internal sealed record DispatcherNotificationContextRefreshNotification(string DispatchId) : INotification;

View File

@ -5,4 +5,5 @@ namespace GFramework.Cqrs.Tests.Cqrs;
/// <summary> /// <summary>
/// 为 stream dispatch binding 上下文刷新回归提供带分发标识的最小流请求。 /// 为 stream dispatch binding 上下文刷新回归提供带分发标识的最小流请求。
/// </summary> /// </summary>
/// <param name="DispatchId">当前分发的稳定标识,便于断言缓存 binding 复用时观察到的是同一次建流。</param>
internal sealed record DispatcherStreamContextRefreshRequest(string DispatchId) : IStreamRequest<int>; internal sealed record DispatcherStreamContextRefreshRequest(string DispatchId) : IStreamRequest<int>;

View File

@ -30,6 +30,7 @@ CQRS 迁移与收敛。
- 已完成一轮 `static lambda + state` 微收敛:`CqrsDispatcher``CqrsHandlerRegistrar` 现会在弱缓存 / 并发缓存入口优先使用无捕获工厂,继续压低热路径上的额外闭包分配 - 已完成一轮 `static lambda + state` 微收敛:`CqrsDispatcher``CqrsHandlerRegistrar` 现会在弱缓存 / 并发缓存入口优先使用无捕获工厂,继续压低热路径上的额外闭包分配
- 已补充 `CqrsReflectionFallbackAttribute` 叶子级合同测试,锁定空 marker、字符串 fallback 名称归一化、直接 `Type` fallback 归一化与空参数防御语义 - 已补充 `CqrsReflectionFallbackAttribute` 叶子级合同测试,锁定空 marker、字符串 fallback 名称归一化、直接 `Type` fallback 归一化与空参数防御语义
- 已完成 `PR #304` review follow-up 收敛:`CqrsDispatcher` 现补齐 pipeline executor / continuation 缓存的线程模型文档,并把 request pipeline invoker 从按 `behaviorCount` 重复创建收敛为 binding 内复用 - 已完成 `PR #304` review follow-up 收敛:`CqrsDispatcher` 现补齐 pipeline executor / continuation 缓存的线程模型文档,并把 request pipeline invoker 从按 `behaviorCount` 重复创建收敛为 binding 内复用
- 已补齐 `CqrsDispatcherContextValidationTests` 三个上下文校验 handler 的 XML `param` / `returns` 注释,以及 `DispatcherNotificationContextRefreshNotification``DispatcherStreamContextRefreshRequest``DispatchId` XML 参数注释,收敛上一轮 PR review 遗留的文档类 minor feedback
- 已收紧 CQRS / generator 回归测试的脆弱断言日志断言改为语义匹配precise runtime type lookup 回归改为锁定数组秩、外部类型查找与“未发射 fallback metadata”这些稳定语义 - 已收紧 CQRS / generator 回归测试的脆弱断言日志断言改为语义匹配precise runtime type lookup 回归改为锁定数组秩、外部类型查找与“未发射 fallback metadata”这些稳定语义
- 已为 dispatcher cache / context refresh / pipeline order 三组测试状态容器补齐并发保护,并将 `CqrsDispatcherCacheTests` 标记为 `NonParallelizable`,避免静态缓存与共享快照在并行测试中相互污染 - 已为 dispatcher cache / context refresh / pipeline order 三组测试状态容器补齐并发保护,并将 `CqrsDispatcherCacheTests` 标记为 `NonParallelizable`,避免静态缓存与共享快照在并行测试中相互污染
- 中期上继续 `Phase 8` 主线:参考 `ai-libs/Mediator`,继续扩大 generator 覆盖,并选择下一个收益明确的 dispatch / invoker 反射收敛点 - 中期上继续 `Phase 8` 主线:参考 `ai-libs/Mediator`,继续扩大 generator 覆盖,并选择下一个收益明确的 dispatch / invoker 反射收敛点