Skip to content

Feat/Add stream pipeline benchmarks and test coverage#349

Merged
GeWuYou merged 9 commits into
mainfrom
feat/cqrs-optimization
May 12, 2026
Merged

Feat/Add stream pipeline benchmarks and test coverage#349
GeWuYou merged 9 commits into
mainfrom
feat/cqrs-optimization

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented May 12, 2026

Summary by CodeRabbit

发行说明

  • New Features

    • 增加了针对流(stream)稳态调度的性能基准套件,覆盖多条执行路径与观测模式。
  • Tests

    • 添加多项注册器/回退/通知发布器边界单元测试,扩展注册服务的测试覆盖。
    • 新增流处理基准与对比测试(包含不同中间件/管道计数矩阵)。
  • Documentation

    • 更新基准场景覆盖说明与迁移跟踪文档,补充运行与结果解读说明。

Review Change Stack

GeWuYou added 8 commits May 12, 2026 10:32
- 补充空程序集输入时不触发 registrar 的回归测试
- 验证忽略空项后按稳定程序集键排序并去重的注册顺序
- 验证跨调用跳过已注册程序集键时仍继续处理剩余新程序集
- 补充 generated registry 为抽象类型时的回退与抛错覆盖
- 补充 generated registry 缺少无参构造器时的回退与抛错覆盖
- 新增 StreamPipelineBenchmarks,覆盖 0/1/4 个 stream pipeline 行为与 FirstItem/DrainAll 观测矩阵

- 内联 GeneratedStreamPipelineBenchmarkRegistry,保持默认 generated-provider benchmark 宿主接线口径

- 更新 benchmark README,补齐 stream pipeline coverage、运行示例与缺口说明
- 新增默认 notification publisher fallback 与缓存行为的回归测试

- 验证容器无 publisher 时继续使用顺序发布语义且不重复查容器
- 新增 StreamingBenchmarks 中的 Mediator steady-state stream 对照与对应 handler 契约。

- 更新 benchmark README 的 stream coverage 与 gap 描述,使其与当前实现一致。
- 更新 cqrs-rewrite 的 active tracking 与 trace,回填本轮多波 batch 的基线、验证与停点结论

- 修复 StreamPipelineBenchmarks 的 trailing whitespace,确保 git diff --check 通过
- 更新 cqrs-rewrite 的 active tracking 与 trace 指标,确保 branch diff 与下一步建议反映当前提交后状态
- 更新 cqrs-rewrite 的 active tracking 与 trace,确保停止时的 branch diff 指标与当前分支状态一致
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented May 12, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a388b831-eed0-4ec3-8e22-ba52fa969a41

📥 Commits

Reviewing files that changed from the base of the PR and between d85b85c and e746fed.

📒 Files selected for processing (5)
  • GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
✅ Files skipped from review due to trivial changes (2)
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
📜 Recent review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
  • GitHub Check: Analyze (C#)

📝 Walkthrough

Walkthrough

新增 StreamPipelineBenchmarks(BenchmarkDotNet 矩阵:PipelineCount 0/1/4 与观测 FirstItem/DrainAll),扩展 StreamingBenchmarks 支持生成 Mediator 比较,补充生成注册表激活失败、通知发布者回退缓存与注册服务边界的单元测试,并同步更新 README 与迁移追踪文档。

变更清单

流管道基准测试框架

Layer / File(s) Summary
基准框架、配置和生命周期
GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
定义 StreamPipelineBenchmarks、BenchmarkDotNet Config、矩阵属性(PipelineCountStreamObservation 枚举),实现 Setup/Cleanup 管理日志、构建/拆除 GFramework 与 MediatR/Mediator DI 主机,并管理派发器缓存。
基准入口、管道注册与观测路由
GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
实现三个基准入口(Stream_BaselineStream_GFrameworkCqrsStream_MediatR/Stream_Mediator)、为 GFramework 与 MediatR/Mediator 注册 0/1/4 个无操作流管道行为,提供 ObserveAsync 根据 FirstItem/DrainAll 消费流并调用消费助手。
流消费助手:首项推进与完全耗尽
GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
实现 ConsumeFirstItemAsync(推进一次并释放枚举器)与 DrainAsync(完全迭代)以区分两种观测语义。
流合约、处理器与管道行为
GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
新增 BenchmarkStreamRequest/BenchmarkResponse 记录与 BenchmarkStreamHandler(返回确定性 IAsyncEnumerable),及抽象 BenchmarkStreamPipelineBehaviorBase 与四个具体无操作行为(用于 0/1/4 管道计数矩阵)。
手写生成的流管道基准注册表
GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
实现 GeneratedStreamPipelineBenchmarkRegistry(实现 ICqrsHandlerRegistryICqrsStreamInvokerProviderIEnumeratesCqrsStreamInvokerDescriptors),暴露单一流调用器描述符并提供静态 InvokeBenchmarkStreamHandler

Mediator 支持扩展

Layer / File(s) Summary
Mediator 别名、字段与 DI 构建
GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
添加 GeneratedMediator 别名、新增用于托管生成 Mediator 的 ServiceProvider 与 mediator 字段;在 GlobalSetup/GlobalCleanup 中分别构建与释放 MediatR 与 generated Mediator 主机。
Stream_Mediator 基准与合约扩展
GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
替换原 MediatR 基准为 Stream_Mediator(使用生成 Mediator),并使 BenchmarkStreamRequest/BenchmarkStreamHandler 同时实现 generated Mediator 的流请求/处理器接口(通过显式接口实现委托至现有处理器逻辑)。

生成注册表失败与注册边界测试

Layer / File(s) Summary
生成注册表激活失败回退测试
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
新增两项测试验证当生成注册表类型为抽象或缺失可访问无参构造时,注册器应回退至反射路径并记录警告日志;新增 CreateGeneratedRegistryAssembly 助手并提供触发场景的本地 ICqrsHandlerRegistry 实现。
CqrsHandlerRegistrar 生成注册表验证异常测试
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
新增两项测试断言 RegisterGeneratedRegistry 在抽象或无可访问无参构造注册表时抛 InvalidOperationException 且记录警告,验证容器不含已注册服务,并补充所需 using 与辅助实现。
通知发布者回退缓存与注册服务边界测试
GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs, GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
新增测试验证:当容器未注册 INotificationPublisher 时回退到内置顺序发布者并仅缓存一次解析结果;验证 RegisterHandlers 在空集合、含 null 条目或重复键的场景下的调用语义与稳定顺序。

基准文档与迁移追踪

Layer / File(s) Summary
README 覆盖与过滤示例
GFramework.Cqrs.Benchmarks/README.md
补充/扩展 StreamPipelineBenchmarks 覆盖说明(含管道行为维度与 FirstItem/DrainAll 观测口径),新增 --filter StreamPipelineBenchmarks.Stream_* 示例行并在“当前缺口”中精化 Mediator 两类缺口表述。
迁移待办与追踪记录
ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md, ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
更新恢复点/PR 锚点、活跃事实、验证命令与下一步建议;在追踪文档中新增 2026-05-12 收口与批次记录,列出已补齐测试/基准项与验证命令。

预期代码审核工作量

🎯 3 (中等) | ⏱️ ~20 分钟

可能相关的 PR

  • GeWuYou/GFramework#323:与生成注册表/调用器元数据及测试相关,代码面有交集。
  • GeWuYou/GFramework#340:涉及 CQRS 基准与 generated Mediator 支持,与本 PR 的基准比较与 DI 主机布线有重叠。
  • GeWuYou/GFramework#341:与生成流调用器/注册表和流基准布线存在直接重叠。
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 标题准确总结了主要变更:添加流管道基准测试和测试覆盖,涵盖了 StreamPipelineBenchmarks、相关测试用例和文档更新的核心内容。
Docstring Coverage ✅ Passed Docstring coverage is 97.92% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/cqrs-optimization

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2377    ↑8 2377    ↑8 0 0 0 0 35.0s    ↓2.0s

Test Results

passed 2377 passed ↑8

Details

tests 2377 tests ↑8
clock 35.0s ↓2.0s
tool nunit
build CI - Build & Test arrow-right build-and-test link #1109
pull-request Feat/cqrs optimization link #349

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2258 0 3 4.8s

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
CreateStream_Should_Throw_When_Stream_Pipeline_Behavior_Context_Does_Not_Implement_IArchitectureContext 18 17 1 5.56    ↓0.32
PublishAsync_Should_Stop_After_First_Handler_Exception_When_Using_Default_Publisher 36 35 1 2.78    ↓0.08
PublishAsync_Should_Throw_When_Context_Does_Not_Implement_IArchitectureContext 40 39 1 2.50    ↓0.06

build-and-test: Run #1109

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
2377 2377 0 0 0 0 0 35.0s

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
CreateStream_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 36 4.2s 4.8s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 51 1.2s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 51 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 51 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 51 1.1s 1.1s
Append_ShouldNotBlock 51 1.0s 1.0s
Context_Caching_Should_Improve_Performance 51 782ms 794ms
PendingCount_ShouldReflectQueuedEntries 51 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 51 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 51 401ms 402ms

± Comparison with run #1108 at c4a1999 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 51 runs.

Github Test Reporter by CTRF 💚

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 12, 2026

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ CSHARP dotnet-format yes 1 no 5.3s
✅ REPOSITORY gitleaks yes no no 8.6s
✅ REPOSITORY trufflehog yes no no 6.38s

Detailed Issues

⚠️ CSHARP / dotnet-format - 1 error
Welcome to .NET 9.0!
---------------------
SDK Version: 9.0.114

----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, run 'dotnet dev-certs https --trust'
Learn about HTTPS: https://aka.ms/dotnet-https

----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Unhandled exception: System.Exception: Restore operation failed.
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.OpenMSBuildWorkspaceAsync(String solutionOrProjectPath, WorkspaceType workspaceType, Boolean noRestore, Boolean requiresSemantics, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
   at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
   at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
   at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)

See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security
Show us your support by starring ⭐ the repository

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 12, 2026

Greptile Summary

This PR adds a new StreamPipelineBenchmarks suite that covers 0/1/4 stream pipeline behaviors against FirstItem and DrainAll observation modes, and expands unit test coverage across four CQRS areas. The existing StreamingBenchmarks is also updated to include the same two-mode observation pattern and a Mediator variant.

  • New benchmark: StreamPipelineBenchmarks.cs (527 lines) with a 6-scenario matrix (3 pipeline counts × 2 observation modes) comparing direct call, GFramework.CQRS runtime, and MediatR.
  • New test fixtures: CqrsHandlerRegistrarTests, CqrsHandlerRegistrarFallbackFailureTests, CqrsNotificationPublisherTests, and CqrsRegistrationServiceTests add 30+ test cases covering handler registration ordering, cache coherence, fallback-failure paths, publisher strategy selection, and assembly-key deduplication.

Confidence Score: 5/5

Safe to merge; all changes are additive benchmarks and tests with no modifications to production code paths.

The only finding is a missing [NonParallelizable] attribute on CqrsHandlerRegistrarTests, which poses a latent risk if the project enables parallel test execution but does not affect current behaviour. All production-facing code is unchanged.

GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs — missing the isolation attribute that its structurally identical sibling fixture carries.

Important Files Changed

Filename Overview
GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs New 527-line benchmark file comparing stream pipeline dispatch (0/1/4 behaviors, FirstItem/DrainAll observation) across direct call, GFramework.CQRS, and MediatR; structure mirrors the existing StreamingBenchmarks pattern cleanly.
GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs Refactored to add FirstItem/DrainAll observation modes and a Mediator benchmark variant; ConsumeFirstItemAsync and DrainAsync helpers replace the old single-mode loop.
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs New fixture (correctly marked [NonParallelizable]) covering three fallback-failure paths: unresolvable named fallback, throwing named fallback, and cross-assembly direct fallback; also covers abstract/no-parameterless-ctor registry fallback to reflection.
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs New fixture with 11 test cases covering deterministic handler order, partial assembly load, generated registry, cache-hit behaviour, and duplicate type filtering; lacks [NonParallelizable] despite mutating the same process-wide statics as the sibling fallback-failure fixture.
GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs New tests for custom publisher injection, pre-registered publisher, ambiguous publisher rejection, publisher caching, sequential fallback caching, TaskWhenAll parallel dispatch, zero-handler no-op, and fail-fast sequential semantics.
GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs New fixture covering assembly-key deduplication (within call, across calls, null filtering, stable sort order, FullName/SimpleName/ToString fallback chain) for the registration service coordinator.
Prompt To Fix All With AI
Fix the following 1 code review issue. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 1
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs:17-18
**Missing `[NonParallelizable]` on a fixture that mutates process-wide statics**

`CqrsHandlerRegistrarFallbackFailureTests` carries `[NonParallelizable]` with an explicit comment explaining that it modifies `LoggerFactoryResolver.Provider` and the registrar's static caches. `CqrsHandlerRegistrarTests` modifies the exact same four static caches (`AssemblyMetadataCache`, `RegistryActivationMetadataCache`, `LoadableTypesCache`, `SupportedHandlerInterfacesCache`) in `SetUp`/`TearDown`, and two of its individual test methods also temporarily replace `LoggerFactoryResolver.Provider` inline. If the project ever enables assembly-level or fixture-level parallelism, the competing cache clears and logger-provider swaps will cause intermittent failures that are hard to reproduce. The attribute should be added to match the sibling fixture's explicit isolation guarantee.

Reviews (2): Last reviewed commit: "chore(cqrs-rewrite): 修复PR349评审遗留问题" | Re-trigger Greptile

Comment thread GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md`:
- Around line 78-80: Update the PR anchor text in the numbered list from "PR
`#348`" to "PR `#349`" so the next-step pointer matches the current branch; locate
the occurrence of the string "PR `#348`" in the numbered list block (around the
instruction starting with "再次运行 `$gframework-pr-review`") and replace it with
"PR `#349`", keeping the surrounding wording/formatting intact.

In `@ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md`:
- Around line 42-45: The "当前下一步:" block still references "PR `#348`"; update that
occurrence to "PR `#349`" so the trace's immediate next step matches the current
PR, i.e., replace the text token "PR `#348`" in the "当前下一步:" section with "PR
`#349`" (verify the line containing "先按需要运行 `$gframework-pr-review`,确认 `PR `#348``
latest-head open thread ..." is updated).

In `@GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs`:
- Around line 167-174: The XML doc for the public method Stream_Mediator is
missing a <returns> element; add a <returns> tag to the existing triple-slash
comment for Stream_Mediator describing that the method returns a ValueTask which
completes when the stream observation finishes (i.e., a ValueTask representing
the asynchronous observation of the mediator-created stream returned by
_mediator.CreateStream(_request, CancellationToken.None) and consumed via
ObserveAsync/Observation).

In `@GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs`:
- Around line 146-176: Add missing <returns> XML documentation to the three
public benchmark methods Stream_Baseline, Stream_GFrameworkCqrs, and
Stream_MediatR: each should document that the method returns a ValueTask
representing the asynchronous observation of the response stream produced by the
handler/runtime/mediatr (the task returned from ObserveAsync wrapping the
stream), e.g. mention it returns a ValueTask that completes when the observation
of the response sequence finishes; place the <returns> tag directly above each
method alongside the existing summary.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: e95b62f0-53cb-4f0f-8c1e-c4e70f739563

📥 Commits

Reviewing files that changed from the base of the PR and between ef4d3d5 and d85b85c.

📒 Files selected for processing (9)
  • GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
  • GFramework.Cqrs.Benchmarks/README.md
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (8)
ai-plan/public/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/public/**: Contributors MUST keep committed ai-plan/public/** content safe to publish in Git history
Active tracking and trace files are recovery entrypoints, not append-only changelogs. They MUST stay concise enough for boot to locate the current recovery point quickly
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change. Keep only the current recovery point, active facts, active risks, immediate next step, and pointers to the relevant archive files in the default boot path
When a topic is fully complete, move the entire topic directory under ai-plan/public/archive/<topic>/ and remove it from ai-plan/public/README.md in the same change
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
ai-plan/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/**: Never write secrets, tokens, credentials, private keys, machine usernames, home-directory paths, hostnames, IP addresses, proprietary URLs, or other sensitive environment details into any ai-plan/** file
Never record absolute file-system paths in ai-plan/**; use repository-relative paths, branch names, PR numbers, or stable document identifiers instead

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
ai-plan/public/**/traces/**

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST maintain a matching execution trace under ai-plan/public/<topic>/traces/ for complex work. The trace should record the current date, key decisions, validation milestones, and the immediate next step

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
ai-plan/public/**/todos/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/public/**/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery document under ai-plan/public/<topic>/todos/ before making substantive code changes
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely

Files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: Apply [Log] attribute for automatic logging field and logging helper method generation
Apply [Priority] attribute for automatic priority comparison implementation generation
Apply [GenerateEnumExtensions] attribute to generate enumeration extension capabilities
Apply [ContextAware] attribute to automatically implement IContextAware boilerplate logic

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///)
XML documentation comments MUST use <summary>, <param>, <returns>, <exception>, and <remarks> where applicable, explaining intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML documentation
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds and compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Avoid obvious comments such as // increment i
Methods with non-trivial logic MUST document: The core idea, Key decisions, and Edge case handling, if any
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what. Code should remain understandable without requiring external context. Prefer slightly more explanation over too little for framework code
Do not rely on implicit imports. Declare every required using explicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments
Follow standard C# naming: Types, methods, properties, events, and constants use PascalCase; Interfaces use I prefix; Parameters and locals use camelCase; Private fields use _camelCase
Use 4 spaces for indentation. Do not use tabs
Use Allman braces
Keep using directives at the top...

Files:

  • GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
**/README.md

📄 CodeRabbit inference engine (AGENTS.md)

**/README.md: Use the canonical filename README.md. Do not introduce new ReadMe.md or other filename variants
A module README MUST describe: the module's purpose, the relationship to adjacent runtime, abstractions, or generator packages, the major subdirectories or subsystems the reader is expected to use, the minimum adoption path, and the corresponding docs/zh-CN/ entry points
If a module's responsibilities, setup, public API surface, generator inputs, or adoption path change, update that module's README.md in the same change

Files:

  • GFramework.Cqrs.Benchmarks/README.md
**/Cqrs/**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias

Files:

  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
**/*.Tests/**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.Tests/**/*.cs: Mirror the source structure in test projects whenever practical
Reuse existing architecture test infrastructure when relevant: ArchitectureTestsBase<T>, SyncTestArchitecture, AsyncTestArchitecture

Files:

  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
🧠 Learnings (2)
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
📚 Learning: 2026-05-11T06:15:15.057Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 348
File: GFramework.Cqrs.Benchmarks/Messaging/NotificationLifetimeBenchmarks.cs:52-68
Timestamp: 2026-05-11T06:15:15.057Z
Learning: In the GeWuYou/GFramework repo, do not treat a missing [GenerateEnumExtensions] attribute as a code review issue for every enum. Skip the check for:
1) local/private benchmark enums (e.g., enums defined for benchmarks such as HandlerLifetime in GFramework.Cqrs.Benchmarks),
2) enums located in projects that do NOT reference the source-generator abstractions package (the generator won’t apply there), and
3) core framework/runtime-style code paths that AGENTS.md explicitly restricts from using generator-attribute usage.
If an enum falls into any of these cases, do not flag the missing [GenerateEnumExtensions] (it has been triaged as a generalized false positive for these scenarios).

Applied to files:

  • GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
🔇 Additional comments (4)
GFramework.Cqrs.Tests/Cqrs/CqrsNotificationPublisherTests.cs (1)

158-196: LGTM!

GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs (1)

9-9: LGTM!

Also applies to: 174-240, 768-817

GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarFallbackFailureTests.cs (1)

141-201: LGTM!

Also applies to: 226-242, 343-392

GFramework.Cqrs.Tests/Cqrs/CqrsRegistrationServiceTests.cs (1)

16-33: LGTM!

Also applies to: 108-140, 142-182

Comment thread ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md Outdated
Comment thread ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
Comment thread GFramework.Cqrs.Benchmarks/Messaging/StreamingBenchmarks.cs
Comment thread GFramework.Cqrs.Benchmarks/Messaging/StreamPipelineBenchmarks.cs
@GeWuYou GeWuYou changed the title Feat/cqrs optimization Feat/Add stream pipeline benchmarks and test coverage May 12, 2026
- 更新 stream benchmark 的 XML 返回值契约

- 修复通知发布器缓存回归测试的误导性安全网

- 同步 ai-plan 中的当前 PR 锚点与验证结果
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2377 2377 0 0 0 0 37.6s    ↑2.6s

Test Results

passed 2377 passed

Details

tests 2377 tests
clock 37.6s ↑2.6s
tool nunit
build CI - Build & Test arrow-right build-and-test link #1110
pull-request Feat/Add stream pipeline benchmarks and test coverage link #349

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2261 0 3 4.8s

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
CreateStream_Should_Throw_When_Stream_Pipeline_Behavior_Context_Does_Not_Implement_IArchitectureContext 19 18 1 5.26    ↓0.30
PublishAsync_Should_Stop_After_First_Handler_Exception_When_Using_Default_Publisher 37 36 1 2.70    ↓0.08
PublishAsync_Should_Throw_When_Context_Does_Not_Implement_IArchitectureContext 41 40 1 2.44    ↓0.06

build-and-test: Run #1110

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
2377 2377 0 0 0 0 0 37.6s

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
CreateStream_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 37 4.2s 4.8s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 52 1.2s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 52 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 52 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 52 1.1s 1.1s
Append_ShouldNotBlock 52 1.0s 1.0s
Context_Caching_Should_Improve_Performance 52 781ms 794ms
PendingCount_ShouldReflectQueuedEntries 52 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 52 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 52 401ms 402ms

± Comparison with run #1109 at 3744e3e | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 52 runs.

Github Test Reporter by CTRF 💚

@GeWuYou GeWuYou merged commit 2b2bec6 into main May 12, 2026
7 checks passed
@GeWuYou GeWuYou deleted the feat/cqrs-optimization branch May 12, 2026 03:49
pull Bot pushed a commit to Mu-L/GFramework that referenced this pull request May 12, 2026
- 更新 StreamingBenchmarks 的 XML 返回值注释并收口 README 中的 stream startup/gap 描述。

- 补充 cqrs-rewrite tracking 与 trace,记录 PR GeWuYou#349 合并后的新基线、startup parity 进展与下一恢复点。
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