Feat/cqrs optimization#340
Conversation
- 优化 dispatcher 在零 pipeline 场景下跳过空行为解析,减少请求热路径分配 - 修复 MicrosoftDiContainer 热路径的无效 debug 字符串构造,并新增非激活注册检测回归测试 - 新增基于 NuGet 的 Mediator 对照基准并更新 CQRS 重写跟踪文档
- 更新 BenchmarkDotNet 生成目录忽略规则,避免本地基准产物污染工作树 - 补充 CQRS benchmark 回归要求与性能目标,要求相关改动后复跑 request 基准 - 更新 cqrs-rewrite 跟踪文档并记录最新 request 基准结果
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (9)
📝 Walkthrough总体概述此 PR 优化了 CQRS Request 的热路径性能,通过在 DI 容器引入 变更概览Request 热路径优化与 Mediator 基准对标
相关 PR
预估代码审查工作量🎯 3 (中等复杂度) | ⏱️ ~25 分钟 ✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
Summary
Test ResultsDetails
Failed TestsCqrsDispatcherContextValidationTests Insights
Fail Rate
build-and-test: Run #1089
❌ Some tests failed!
Slowest Tests
± Comparison with run #1088 at 01054a9 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 36 runs. Github Test Reporter by CTRF 💚 |
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| dotnet-format | yes | 1 | no | 5.28s | ||
| ✅ REPOSITORY | gitleaks | yes | no | no | 8.81s | |
| ✅ REPOSITORY | trufflehog | yes | no | no | 7.37s |
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

Show us your support by starring ⭐ the repository
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (2)
GFramework.Core.Abstractions/Ioc/IIocContainer.cs (1)
255-265: ⚡ Quick win补全
HasRegistration(Type)的异常契约文档。当前注释缺少
<exception>,但该入口在常见实现中会对空参数和容器释放状态抛异常。建议在接口层显式声明异常契约,避免调用方误判行为边界。As per coding guidelines "All public, protected, and internal types and members MUST include XML documentation comments (
///) in C#; XML documentation MUST use<summary>,<param>,<returns>,<exception>, and<remarks>where applicable".🤖 Prompt for 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. In `@GFramework.Core.Abstractions/Ioc/IIocContainer.cs` around lines 255 - 265, Update the XML docs for the HasRegistration(Type) interface method to declare its exception contract: add <exception> entries for ArgumentNullException (thrown when the type parameter is null) and ObjectDisposedException (thrown when the container has been disposed and cannot be queried). Reference the method name HasRegistration(Type) so implementers and callers know to document/handle these cases consistently.GFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs (1)
151-173: 💤 Low valueMediator 与 GFramework 接口隐式共享实现,存在未来契约漂移的编译诊断盲点。
BenchmarkRequestHandler通过单个公有Handle(BenchmarkRequest, CancellationToken) : ValueTask<BenchmarkResponse>同时隐式实现GFramework.Cqrs.Abstractions.Cqrs.IRequestHandler<,>与Mediator.IRequestHandler<,>。两个接口的方法签名(包括ValueTask<TResponse>返回类型)当前完全一致。当 Mediator 在主版本升级时若调整
IRequestHandler签名(例如改为IRequestHandler<TRequest>或引入streaming区分),单一隐式实现会导致编译错误,且需逐一追踪具体是哪个接口不满足。建议为
Mediator.IRequestHandler<,>.Handle添加显式实现仅=> Handle(request, cancellationToken);,使两条契约在源码上分别可见,未来升级时 diff 与诊断更直观。🤖 Prompt for 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. In `@GFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs` around lines 151 - 173, The public Handle(BenchmarkRequest, CancellationToken): ValueTask<BenchmarkResponse> currently implicitly satisfies both GFramework.Cqrs.Abstractions.Cqrs.IRequestHandler and Mediator.IRequestHandler causing a fragile shared implementation; add an explicit implementation for Mediator.IRequestHandler<BenchmarkRequest, BenchmarkResponse>.Handle that delegates to the existing public Handle (i.e. implement Task<BenchmarkResponse> Mediator.IRequestHandler<BenchmarkRequest, BenchmarkResponse>.Handle(...) => Handle(request, cancellationToken); or equivalent delegation) so the Mediator contract is visibly separated while preserving behavior and easing future diagnostics.
🤖 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 39-42: 当前文档段落中重复使用了“RP-101”且仍引用旧的 PR 锚点“PR
`#339`”,在当前语境应为“RP-102”且锚点应指向当前 PR;请统一修正恢复点编号并更新活跃入口的 PR 锚点(检查并替换所有出现的
RP-101/RP-102 与 PR `#339/PR` `#340` 引用),删除或替换任何已失效或推测性的示例说明以保持示例准确一致,确保段落开头的 active
入口明确指向最新恢复锚点(例如将 active 入口更新为 RP-102 并把 PR 链接改为 PR `#340`)。
In `@GFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.cs`:
- Around line 79-87: The XML doc comment for the method in BenchmarkHostFactory
(the summary/remarks that currently mention "ai-libs/Mediator") is stale and
should reference the actual NuGet package used; update the summary/param/remarks
to say the project uses the NuGet "Mediator" package (or remove the repo path)
so the documentation matches the implementation that resolves the generated
Mediator.Mediator singleton, e.g., edit the XML doc above the factory method in
class BenchmarkHostFactory to replace "ai-libs/Mediator" with "Mediator (NuGet)"
and keep the rest of the lifetime explanation intact.
---
Nitpick comments:
In `@GFramework.Core.Abstractions/Ioc/IIocContainer.cs`:
- Around line 255-265: Update the XML docs for the HasRegistration(Type)
interface method to declare its exception contract: add <exception> entries for
ArgumentNullException (thrown when the type parameter is null) and
ObjectDisposedException (thrown when the container has been disposed and cannot
be queried). Reference the method name HasRegistration(Type) so implementers and
callers know to document/handle these cases consistently.
In `@GFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs`:
- Around line 151-173: The public Handle(BenchmarkRequest, CancellationToken):
ValueTask<BenchmarkResponse> currently implicitly satisfies both
GFramework.Cqrs.Abstractions.Cqrs.IRequestHandler and Mediator.IRequestHandler
causing a fragile shared implementation; add an explicit implementation for
Mediator.IRequestHandler<BenchmarkRequest, BenchmarkResponse>.Handle that
delegates to the existing public Handle (i.e. implement Task<BenchmarkResponse>
Mediator.IRequestHandler<BenchmarkRequest, BenchmarkResponse>.Handle(...) =>
Handle(request, cancellationToken); or equivalent delegation) so the Mediator
contract is visibly separated while preserving behavior and easing future
diagnostics.
🪄 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: 2d7bf93f-eee2-4b68-b0f5-dc8340a4ed05
📒 Files selected for processing (11)
.gitignoreGFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csprojGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.csGFramework.Cqrs.Benchmarks/README.mdGFramework.Cqrs/Internal/CqrsDispatcher.csai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.mdai-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 (11)
**/*Abstractions/**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
Abstractions projects should only contain interfaces and contract definitions without any runtime implementation logic
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.cs
**/*.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 (///) in C#
XML documentation MUST use<summary>,<param>,<returns>,<exception>, and<remarks>where applicable, and explain intent, contract, and usage constraints instead of restating syntax
If a C# member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why abstraction exists, and when to use instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Do not rely on implicit imports. Declare every requiredusingexplicitly in C#
Write null-safe code that respects nullable annotations instead of suppressing warnings by default in C#
Use namespace patternGFramework.{Module}.{Feature}with PascalCase segments in C#
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, Interfaces useIprefix, Parameters and locals use camelCase, Private fields use_camelCase
Use Allman braces style for C#
Keepusingdirectives at the top of the file and sort them consistently in C#
Prefer one primary type per file unless surrounding project already uses different local pattern
Prefer explicit, readable code over clever shorthand in framework internals
M...
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
**/*[!.]*
📄 CodeRabbit inference engine (AGENTS.md)
For files with shebang lines, keep shebang as first line and place license header immediately after it
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csprojGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.mdGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.csGFramework.Cqrs.Benchmarks/README.mdai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
**/*.{cs,ts,tsx,js,jsx,py,sh}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{cs,ts,tsx,js,jsx,py,sh}: All generated or modified code MUST include clear and meaningful comments where required by documentation rules
Comments MUST NOT be trivial, redundant, or misleading. Prefer explainingwhyandwhen, not justwhat. Code should remain understandable without requiring external context
Avoid obvious comments such as// increment i
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
**/*.{cs,ts,tsx,js,jsx,py}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{cs,ts,tsx,js,jsx,py}: Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds/compatibility constraints/edge cases, and registration order/lifecycle sequencing/generated code assumptions
Methods with non-trivial logic MUST document core idea, key decisions, and edge case handling
Separate logical blocks with blank lines when it improves readability
Unless there is clear and documented reason to keep file large, keep single source file under roughly 800-1000 lines
Validate external or user-controlled input before it reaches file system, serialization, reflection, code generation, or process boundaries
Do not build command strings, file paths, type names, or generated code from untrusted input without strict validation or allow-listing
Avoid logging secrets, tokens, credentials, or machine-specific sensitive data
Prefer least-privilege behavior for file, process, and environment access
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
**/*.{csproj,cs}
📄 CodeRabbit inference engine (AGENTS.md)
Framework runtime, abstractions, and meta-package projects MUST NOT reference
*.SourceGenerators*projects or packages, and MUST NOT use source-generator attributes
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csprojGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
**/*.{cs,ts,tsx,js,jsx,py,sh,xml,csproj,props,targets}
📄 CodeRabbit inference engine (AGENTS.md)
Use 4 spaces for indentation. Do not use tabs
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csprojGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
**/*.{cs,ts,tsx,js,jsx,py,sh,xml}
📄 CodeRabbit inference engine (AGENTS.md)
Keep line length readable. Around 120 characters is preferred upper bound
Files:
GFramework.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
**/*.{xml,csproj,props,targets}
📄 CodeRabbit inference engine (AGENTS.md)
For XML/MSBuild files with XML declaration, keep XML declaration as first node and place license header immediately after it
Files:
GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj
**/*.csproj
📄 CodeRabbit inference engine (AGENTS.md)
**/*.csproj: Follow repository defaults:ImplicitUsingsdisabled,Nullableenabled,GenerateDocumentationFileenabled for shipped libraries,LangVersiongenerallypreviewin main libraries and abstractions
Minimize new package dependencies. Add them only when necessary and keep scope narrow
Files:
GFramework.Cqrs.Benchmarks/GFramework.Cqrs.Benchmarks.csproj
**/*.{md,mdx}
📄 CodeRabbit inference engine (AGENTS.md)
**/*.{md,mdx}: Keep code samples, package names, and command examples aligned with current repository state in documentation
When public page references XML docs or API coverage, convert evidence into reader-facing guidance: explain which types/namespaces/entry points readers should inspect and why
For integration-oriented features such as AI-First config system, documentation MUST cover: project directory layout/file conventions, required project/package wiring, minimal working example, migration/compatibility notes
When examples are rewritten, preserve only parts that remain true. Delete or replace speculative examples instead of lightly editing into another inaccurate form
Files:
ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.mdGFramework.Cqrs.Benchmarks/README.mdai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
🧠 Learnings (1)
📚 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.Core.Abstractions/Ioc/IIocContainer.csGFramework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.csGFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.csGFramework.Core/Ioc/MicrosoftDiContainer.csGFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs
🔇 Additional comments (3)
GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs (2)
422-446: 测试覆盖到位,闭合泛型 + 开放泛型注册分支语义清晰。两条用例分别锁定了「无匹配 service 返回 false」与「开放泛型
IPipelineBehavior<,>注册可被闭合查询命中」两个关键分支,同时验证了Freeze()前后HasRegistration(Type)的稳定性,恰好对应 PR 在CqrsDispatcher里引入的0 pipelinefast-path 假设。
944-958: 💤 Low value约束声明一致,
OpenGenericHasRegistrationBehavior<TRequest,TResponse>实现正确。已确认
IPipelineBehavior<TRequest, TResponse>的真实声明为:public interface IPipelineBehavior<TRequest, TResponse> where TRequest : IRequest<TResponse>约束
where TRequest : IRequest<TResponse>与 surrogate 类完全一致,因此该实现作为 open-generic registration 的最小代理是恰当的,不存在约束窄化的问题。GFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs (1)
91-95: ⚡ Quick win
BenchmarkCleanupHelper.DisposeAll(...)已正确引入并支持可空参数列表。验证确认:
BenchmarkCleanupHelper.DisposeAll的签名为public static void DisposeAll(params IDisposable?[] disposables),支持可空的IDisposable?[]参数- 新增的
_mediatorServiceProvider已正确纳入 cleanup 调用(第 94 行)- 该方法设计用于处理多个
IDisposable对象,包括MicrosoftDiContainer等- 异常处理机制文档明确:单个失败回抛原始异常,多个失败聚合为
AggregateException- 可空参数类型确保不会因字段未赋值而产生 NRE,避免掩盖真正的失败原因
|
| Filename | Overview |
|---|---|
| GFramework.Cqrs/Internal/CqrsDispatcher.cs | Adds HasRegistration fast-path guard before GetAll on both SendAsync and CreateStream hot paths, correctly skipping the empty-collection allocation when no pipeline behaviors are registered. |
| GFramework.Core/Ioc/MicrosoftDiContainer.cs | Implements HasRegistration(Type) via descriptor-only scan (CanSatisfyServiceType), correctly matching exact service keys and open-generic definitions without activating instances; also adds IsDebugEnabled guards to eliminate log-string allocations on hot paths. |
| GFramework.Core.Abstractions/Ioc/IIocContainer.cs | Adds HasRegistration(Type) to the public IIocContainer interface with full XML doc including exception contracts and semantic remarks; companion docs/zh-CN update is included in this PR. |
| GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs | Adds three regression tests for HasRegistration: no-match returns false, open-generic registration is visible, and concrete-only self-registration does not masquerade as its interface keys. |
| GFramework.Cqrs.Tests/Cqrs/CqrsDispatcherContextValidationTests.cs | Adds HasRegistration stub configuration to strict mocks for both request and stream context-validation tests, preventing MockException short-circuits before the intended assertion fires. |
| GFramework.Cqrs.Benchmarks/Messaging/RequestBenchmarks.cs | Adds source-generated Mediator as a fourth comparison group alongside baseline, GFramework.Cqrs, and MediatR; BenchmarkRequest and BenchmarkRequestHandler now explicitly implement Mediator contracts to surface any future API drift at compile time. |
| GFramework.Cqrs.Benchmarks/Messaging/BenchmarkHostFactory.cs | Adds CreateMediatorServiceProvider factory for the Mediator NuGet reference; XML doc comment has one line with an extra leading space (harmless formatting noise). |
Sequence Diagram
sequenceDiagram
participant Caller
participant CqrsDispatcher
participant IIocContainer
participant RequestInvoker
participant PipelineExecutor
Caller->>CqrsDispatcher: SendAsync(context, request)
CqrsDispatcher->>IIocContainer: Get(HandlerType)
IIocContainer-->>CqrsDispatcher: handler
CqrsDispatcher->>IIocContainer: HasRegistration(BehaviorType)
alt No behaviors registered (fast path)
IIocContainer-->>CqrsDispatcher: false
CqrsDispatcher->>RequestInvoker: Invoke(handler, request, ct)
RequestInvoker-->>Caller: TResponse (0 behavior allocations)
else Behaviors registered
IIocContainer-->>CqrsDispatcher: true
CqrsDispatcher->>IIocContainer: GetAll(BehaviorType)
IIocContainer-->>CqrsDispatcher: behaviors[]
CqrsDispatcher->>PipelineExecutor: GetPipelineExecutor(n).Invoke(...)
PipelineExecutor-->>Caller: TResponse (pipeline path)
end
Reviews (2): Last reviewed commit: "fix(cqrs): 修复 HasRegistration 评审回归" | Re-trigger Greptile
Summary
Test ResultsDetails
Insights
Fail Rate
build-and-test: Run #1090
🎉 All tests passed!Slowest Tests
± Comparison with run #1089 at 55b5e87 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 37 runs. Github Test Reporter by CTRF 💚 |
Summary by CodeRabbit
发布说明
新功能
性能优化
文档