Skip to content

feat(cqrs): 添加CQRS运行时模块和兼容性扩展#225

Merged
GeWuYou merged 12 commits intorefactor/cqrs-architecture-decouplingfrom
refactor/cqrs-architecture-decoupling-todo-6
Apr 15, 2026
Merged

feat(cqrs): 添加CQRS运行时模块和兼容性扩展#225
GeWuYou merged 12 commits intorefactor/cqrs-architecture-decouplingfrom
refactor/cqrs-architecture-decoupling-todo-6

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Apr 15, 2026

  • 新增ContextAwareMediatorCommandExtensions提供命令扩展方法的兼容性别名
  • 新增ContextAwareMediatorExtensions提供CQRS统一接口扩展方法的兼容性别名
  • 新增ContextAwareMediatorQueryExtensions提供查询扩展方法的兼容性别名
  • 添加CqrsRuntimeModule用于注册CQRS运行时和处理器注册器到依赖注入容器
  • 更新IArchitectureContext接口添加新版CQRS请求、命令、查询和通知的统一入口
  • 添加架构上下文的CQRS处理器注册相关单元测试
  • 配置项目文件以支持多目标框架和包引用管理

Summary by CodeRabbit

  • New Features

    • 提供全局可配置的日志工厂访问点与跨组件的 CQRS 运行时/处理注册器工厂。
  • Architecture & Refactor

    • 将 CQRS 按契约/运行时拆分并调整公开命名空间,使用类型转发以保持兼容性;处理器采用新的上下文感知基类。
  • Improvements

    • 增强日志子系统在默认提供者不可用和并发访问场景下的回退与鲁棒性,更新废弃提示指向新扩展命名空间。
  • Tests

    • 新增与扩展多项关于 CQRS 兼容性、运行时与日志行为的测试用例。

GeWuYou added 3 commits April 15, 2026 19:42
- 新增ContextAwareMediatorCommandExtensions提供命令扩展方法的兼容性别名
- 新增ContextAwareMediatorExtensions提供CQRS统一接口扩展方法的兼容性别名
- 新增ContextAwareMediatorQueryExtensions提供查询扩展方法的兼容性别名
- 添加CqrsRuntimeModule用于注册CQRS运行时和处理器注册器到依赖注入容器
- 更新IArchitectureContext接口添加新版CQRS请求、命令、查询和通知的统一入口
- 添加架构上下文的CQRS处理器注册相关单元测试
- 配置项目文件以支持多目标框架和包引用管理
- 引入AbstractCommandHandler、AbstractQueryHandler等各类处理器基类
- 实现CqrsContextAwareHandlerBase提供上下文感知功能
- 添加CqrsTestRuntime为测试项目提供CQRS运行时访问入口
- 创建AbstractCqrsHandlerContextTests验证上下文注入行为
- 支持命令、查询、通知及流式处理的各种抽象基类实现
- 删除 LoggingBehavior 类及其相关实现
- 新增 CqrsRuntimeModule 用于注册CQRS运行时组件
- 添加 ArchitectureComponentRegistryBehaviorTests 测试组件注册行为
- 添加 ArchitectureContextTests 测试架构上下文功能
- 完善CQRS运行时的并发安全性和生命周期管理
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

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: b3e5e7c1-3b03-478e-84aa-97a4d7dde4f5

📥 Commits

Reviewing files that changed from the base of the PR and between 7b63a65 and 922ad43.

📒 Files selected for processing (1)
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.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: Build and Test
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)

📝 Walkthrough

Walkthrough

将 CQRS 相关类型从 Core 程序集中迁移到新的 GFramework.Cqrs 程序集;引入 CqrsRuntimeFactory 与 CqrsContextAwareHandlerBase;在抽象层新增 LoggerFactoryResolver 并从实现层移除旧实现;添加类型转发以保持兼容;更新项目引用、命名空间、源码生成器与相关测试。

Changes

Cohort / File(s) Summary
核心抽象 - 文档
GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
修正 XML 注释中对 CQRS 的命名空间引用(文档更正,无 API 变更)。
日志工厂解析器(抽象新增 / 实现移除)
GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs, GFramework.Core/Logging/LoggerFactoryResolver.cs
在 Abstractions 新增静态 LoggerFactoryResolver(懒加载默认 provider、静默回退、MinLevel 代理);从实现程序集删除原实现类。
类型转发
GFramework.Core/Properties/TypeForwarders.cs
新增 assembly-level TypeForwardedTo 条目,将若干旧类型(LoggerFactoryResolver、CommandBase/QueryBase/RequestBase/NotificationBase)转发到运行时程序集。
CQRS 运行时工厂与模块
GFramework.Cqrs/CqrsRuntimeFactory.cs, GFramework.Core/Services/Modules/CqrsRuntimeModule.cs, GFramework.Tests.Common/CqrsTestRuntime.cs
新增 CqrsRuntimeFactory(CreateRuntime/CreateHandlerRegistrar);模块与测试运行时改为使用工厂创建 runtime/registrar(替代反射/直接 new),并调整日志类别命名。
CQRS 命名空间与基类迁移
GFramework.Cqrs/...(示例:GFramework.Cqrs/Command/CommandBase.cs, GFramework.Cqrs/Query/QueryBase.cs, GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
将消息基类与处理程序从 GFramework.Core.Cqrs.* 移至 GFramework.Cqrs.*;新增 CqrsContextAwareHandlerBase 并将多个抽象处理器从 ContextAwareBase 改为继承该新基类。
扩展方法与兼容性包装
GFramework.Core/Extensions/..., GFramework.Cqrs/Extensions/*, GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
扩展方法命名空间迁移到 GFramework.Cqrs.Extensions;Core 保留兼容包装并更新 Obsolete 提示指向新命名空间。
源码生成器与常量
GFramework.SourceGenerators.Common/Constants/PathContests.cs, GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs, GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
新增 CQRS 命名空间常量(contracts/runtime 分离);生成器改为分别引用 contracts(抽象接口)与 runtime(注册器/属性);更新测试期望。
项目引用调整
GFramework.Core/GFramework.Core.csproj, GFramework.Cqrs/GFramework.Cqrs.csproj, GFramework.Tests.Common/GFramework.Tests.Common.csproj
添加跨项目 ProjectReference,使各项目与新的 GFramework.Cqrs / Abstractions 依赖对齐。
测试 - 导入与新增测试
多个 GFramework.Core.Tests/*, GFramework.Cqrs.Tests/*, GFramework.Core.Tests/Cqrs/*, GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
大量测试添加/更新:新增 CQRS 兼容性与处理器上下文测试,扩展 LoggerFactoryResolver 的并发/回退测试;并统一/新增对 GFramework.Core.Abstractions.Logging 的 using。
全局 using 与小改动
GFramework.Cqrs/GlobalUsings.cs, 若干测试文件行尾与 using 调整
新增项目级 global using 文件,若干文件调整 using 与行尾 newline。

Sequence Diagram(s)

sequenceDiagram
    participant Caller as Caller
    participant Factory as CqrsRuntimeFactory
    participant Container as IIocContainer
    participant Logger as ILogger
    participant Runtime as ICqrsRuntime (CqrsDispatcher)
    participant Registrar as ICqrsHandlerRegistrar (DefaultCqrsHandlerRegistrar)

    Caller->>Factory: CreateRuntime(container, logger)
    Factory->>Container: 验证 container 非空
    Factory->>Logger: 验证 logger 非空
    Factory->>Runtime: new CqrsDispatcher(container, logger)
    Factory-->>Caller: 返回 ICqrsRuntime

    Caller->>Factory: CreateHandlerRegistrar(container, logger)
    Factory->>Container: 验证 container 非空
    Factory->>Logger: 验证 logger 非空
    Factory->>Registrar: new DefaultCqrsHandlerRegistrar(container, logger)
    Factory-->>Caller: 返回 ICqrsHandlerRegistrar
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 分钟

Possibly related PRs

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 42.86% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题准确概括了主要变更内容:CQRS运行时模块的添加和兼容性扩展,与代码改动高度相关。

✏️ 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 refactor/cqrs-architecture-decoupling-todo-6

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

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: 7

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs (1)

4-15: ⚠️ Potential issue | 🟡 Minor

Obsolete 提示中的目标类型命名空间不正确。

当前字符串提示 GFramework.Core.Extensions.ContextAwareCqrsQueryExtensions,但真实位置是 GFramework.Cqrs.Extensions,会导致兼容迁移提示错误。

🔧 建议修复
 [Obsolete(
-    "Use GFramework.Core.Extensions.ContextAwareCqrsQueryExtensions instead. This compatibility alias will be removed in a future major version.")]
+    "Use GFramework.Cqrs.Extensions.ContextAwareCqrsQueryExtensions instead. This compatibility alias will be removed in a future major version.")]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs` around
lines 4 - 15, Update the Obsolete message on the
ContextAwareMediatorQueryExtensions compatibility type so it points to the
correct namespace/type: change the string "Use
GFramework.Core.Extensions.ContextAwareCqrsQueryExtensions instead..." to
reference "Use GFramework.Cqrs.Extensions.ContextAwareCqrsQueryExtensions
instead..."; locate the Obsolete attribute applied to the
ContextAwareMediatorQueryExtensions class and correct the fully-qualified type
name in that attribute text to match the actual location in
GFramework.Cqrs.Extensions.
GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs (1)

4-15: ⚠️ Potential issue | 🟡 Minor

Obsolete 迁移指引命名空间写错了。

当前提示指向 GFramework.Core.Extensions.ContextAwareCqrsCommandExtensions,但实际类型在 GFramework.Cqrs.Extensions。这会误导调用方迁移路径和 IDE 快速修复。

🔧 建议修复
 [Obsolete(
-    "Use GFramework.Core.Extensions.ContextAwareCqrsCommandExtensions instead. This compatibility alias will be removed in a future major version.")]
+    "Use GFramework.Cqrs.Extensions.ContextAwareCqrsCommandExtensions instead. This compatibility alias will be removed in a future major version.")]
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs` around
lines 4 - 15, Update the Obsolete message and any XML references to point to the
correct namespace where the replacement type lives:
GFramework.Cqrs.Extensions.ContextAwareCqrsCommandExtensions (the current
message incorrectly references GFramework.Core.Extensions). Locate the
attributes and <see cref="..."/> XML in ContextAwareMediatorCommandExtensions
(and the Obsolete attribute text) and change the namespace portion to
GFramework.Cqrs.Extensions so IDE quick-fixes and migration guidance direct
callers to the real type.
GFramework.Tests.Common/CqrsTestRuntime.cs (1)

51-51: ⚠️ Potential issue | 🟡 Minor

RegisterInfrastructure 的异常文档已过期,建议移除。

当前实现已不再通过反射调用构造函数,这里的 TargetInvocationException 说明会造成误导。

建议修复
-    /// <exception cref="TargetInvocationException">反射调用底层 CQRS runtime 或注册器构造函数失败时抛出。</exception>

As per coding guidelines: "Any change to public API, lifecycle semantics, module behavior, or extension points MUST update the related XML docs".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Tests.Common/CqrsTestRuntime.cs` at line 51, The XML doc on
RegisterInfrastructure incorrectly documents a TargetInvocationException from
reflection; remove that <exception> element and update the
RegisterInfrastructure XML comments to reflect current behavior (remove any
mention of reflection or TargetInvocationException and, if needed, add the
correct exceptions actually thrown by RegisterInfrastructure or leave no
exception tags). Ensure the summary/remarks remain accurate for the
RegisterInfrastructure method and that public API docs no longer reference
TargetInvocationException.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs`:
- Around line 40-49: CreateDefaultProvider currently uses Type.GetType and
Activator.CreateInstance without catching exceptions, so if the provider's
constructor throws (e.g., missing dependencies) the call will bubble up instead
of falling back; wrap the reflection and Activator.CreateInstance call inside a
try/catch, attempt to instantiate the providerType and set provider.MinLevel =
LogLevel.Info only on success, and on any exception (or if the cast fails)
return a new SilentLoggerFactoryProvider(); reference CreateDefaultProvider,
DefaultProviderTypeName, ILoggerFactoryProvider, Activator.CreateInstance,
provider.MinLevel and SilentLoggerFactoryProvider when locating code to modify.
- Around line 22-26: The Provider property uses lazy initialization and
assignment on a shared static field (field) without synchronization, causing
race conditions; make access thread-safe by serializing get/set operations
(e.g., introduce a private static readonly lock object or use
Interlocked.CompareExchange) so CreateDefaultProvider() is invoked at most once
and assignments via the set accessor cannot race with initialization; update the
Provider getter to perform a thread-safe double-checked initialization calling
CreateDefaultProvider() and update the setter to acquire the same lock (or use
atomic compare-exchange) and validate non-null (keeping the
ArgumentNullException behavior) to preserve deterministic global logger provider
semantics.

In `@GFramework.Cqrs.Tests/GlobalUsings.cs`:
- Line 23: 在 GlobalUsings.cs 中存在重复的全局导入声明 `global using System.Diagnostics`(第17
行与第23 行重复),请删除重复的那一行,只保留一个 `global using System.Diagnostics` 条目以消除编译警告并保持导入唯一性。

In `@GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs`:
- Around line 25-27: 更新类文档中错误的命名空间描述:在 LoggingBehavior.cs 的 <remarks>
注释中将“GFramework.Core.Cqrs.Behaviors”更正为当前实际命名空间“GFramework.Cqrs.Cqrs.Behaviors”(或使用
typeof(LoggingBehavior).Namespace 风格的表述以避免硬编码),以确保 XML 文档与类型所在命名空间一致并遵循公共 API
文档更新的要求;检查并同步任何同文件头部或总结处涉及旧命名空间的描述(例如类 LoggingBehavior 的注释)以完成修复。

In `@GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs`:
- Around line 21-27: The XML class summary incorrectly mentions
IStreamQueryHandler while the class implements IStreamRequestHandler<TQuery,
TResponse>; update the class documentation to reference the actual implemented
interface name (IStreamRequestHandler<TQuery, TResponse>) so documentation and
code match for AbstractStreamQueryHandler<TQuery, TResponse>, or alternatively
change the implemented interface to IStreamQueryHandler if the public API should
be that type—ensure the class XML comment, <summary>, and any <typeparam>
remarks reflect the chosen interface name consistently.

In `@GFramework.Cqrs/CqrsRuntimeFactory.cs`:
- Around line 24-43: Add <exception> XML documentation to both public factory
methods CreateRuntime and CreateHandlerRegistrar indicating they throw
ArgumentNullException when container or logger is null; update the existing
triple-slash comments above CreateRuntime (returning ICqrsRuntime) and
CreateHandlerRegistrar (returning ICqrsHandlerRegistrar) to include <exception
cref="System.ArgumentNullException"> for the container (IIocContainer) and
logger (ILogger) parameters so the XML docs meet the project's documentation
guideline.

In `@GFramework.Cqrs/Request/RequestBase.cs`:
- Line 17: Add a backward-compatibility shim for the renamed RequestBase<TInput,
TResponse> so external code targeting GFramework.Core.Cqrs.Request continues to
work: either add a TypeForwarder entry for
GFramework.Core.Cqrs.Request.RequestBase or create a small wrapper class in the
old namespace that inherits the new
GFramework.Cqrs.Request.RequestBase<TInput,TResponse> and mark it [Obsolete]
with migration guidance; add unit tests in GFramework.Cqrs.Tests (similar
approach to MediatorCompatibilityDeprecationTests) that assert code can still
reference/derive from the old RequestBase type, and update the XML docs to note
the namespace change and deprecation/migration steps.

---

Outside diff comments:
In `@GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs`:
- Around line 4-15: Update the Obsolete message and any XML references to point
to the correct namespace where the replacement type lives:
GFramework.Cqrs.Extensions.ContextAwareCqrsCommandExtensions (the current
message incorrectly references GFramework.Core.Extensions). Locate the
attributes and <see cref="..."/> XML in ContextAwareMediatorCommandExtensions
(and the Obsolete attribute text) and change the namespace portion to
GFramework.Cqrs.Extensions so IDE quick-fixes and migration guidance direct
callers to the real type.

In `@GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs`:
- Around line 4-15: Update the Obsolete message on the
ContextAwareMediatorQueryExtensions compatibility type so it points to the
correct namespace/type: change the string "Use
GFramework.Core.Extensions.ContextAwareCqrsQueryExtensions instead..." to
reference "Use GFramework.Cqrs.Extensions.ContextAwareCqrsQueryExtensions
instead..."; locate the Obsolete attribute applied to the
ContextAwareMediatorQueryExtensions class and correct the fully-qualified type
name in that attribute text to match the actual location in
GFramework.Cqrs.Extensions.

In `@GFramework.Tests.Common/CqrsTestRuntime.cs`:
- Line 51: The XML doc on RegisterInfrastructure incorrectly documents a
TargetInvocationException from reflection; remove that <exception> element and
update the RegisterInfrastructure XML comments to reflect current behavior
(remove any mention of reflection or TargetInvocationException and, if needed,
add the correct exceptions actually thrown by RegisterInfrastructure or leave no
exception tags). Ensure the summary/remarks remain accurate for the
RegisterInfrastructure method and that public API docs no longer reference
TargetInvocationException.
🪄 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: fb683993-0bef-40d6-bc3e-545376ea3d10

📥 Commits

Reviewing files that changed from the base of the PR and between f7b4ae9 and 1c7558a.

📒 Files selected for processing (55)
  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
  • GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Core/GFramework.Core.csproj
  • GFramework.Core/Logging/LoggerFactoryResolver.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.Cqrs.Tests/Cqrs/AbstractCqrsHandlerContextTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
  • GFramework.Cqrs/Command/CommandBase.cs
  • GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs
  • GFramework.Cqrs/Cqrs/Behaviors/PerformanceBehavior.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractCommandHandler.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractStreamCommandHandler.cs
  • GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
  • GFramework.Cqrs/Cqrs/Notification/AbstractNotificationHandler.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractQueryHandler.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractRequestHandler.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractStreamRequestHandler.cs
  • GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs
  • GFramework.Cqrs/CqrsRuntimeFactory.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsCommandExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs
  • GFramework.Cqrs/GFramework.Cqrs.csproj
  • GFramework.Cqrs/GlobalUsings.cs
  • GFramework.Cqrs/ICqrsHandlerRegistry.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs/Internal/DefaultCqrsHandlerRegistrar.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
  • GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
💤 Files with no reviewable changes (2)
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Core/Logging/LoggerFactoryResolver.cs
📜 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). (2)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
🧰 Additional context used
📓 Path-based instructions (5)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, and edge cases
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions, and design rationale
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostic or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly in C# files
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, constants use PascalCase; interfaces use I prefix; parameters and locals use camelCase; private fields use _camelCase
Use 4 spaces for indentation (not tabs), use Allman braces, and keep using directives at the top of the file sorted consistently
Prefer one primary type per file unless the surrounding project alread...

Files:

  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs/Internal/DefaultCqrsHandlerRegistrar.cs
  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Cqrs/Command/CommandBase.cs
  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
  • GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsCommandExtensions.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs/Request/RequestBase.cs
  • GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractStreamRequestHandler.cs
  • GFramework.Cqrs/Cqrs/Notification/AbstractNotificationHandler.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs
  • GFramework.Cqrs/ICqrsHandlerRegistry.cs
  • GFramework.Cqrs/GlobalUsings.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractQueryHandler.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/AbstractCqrsHandlerContextTests.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractCommandHandler.cs
  • GFramework.Cqrs/CqrsRuntimeFactory.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
  • GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractRequestHandler.cs
  • GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
  • GFramework.Cqrs/Cqrs/Behaviors/PerformanceBehavior.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractStreamCommandHandler.cs
**/*.{cs,csproj}

📄 CodeRabbit inference engine (AGENTS.md)

Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Files:

  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs/Internal/DefaultCqrsHandlerRegistrar.cs
  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Core/GFramework.Core.csproj
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Cqrs/Command/CommandBase.cs
  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
  • GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsCommandExtensions.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs/Request/RequestBase.cs
  • GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractStreamRequestHandler.cs
  • GFramework.Cqrs/Cqrs/Notification/AbstractNotificationHandler.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs
  • GFramework.Cqrs/ICqrsHandlerRegistry.cs
  • GFramework.Cqrs/GlobalUsings.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractQueryHandler.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/AbstractCqrsHandlerContextTests.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractCommandHandler.cs
  • GFramework.Cqrs/CqrsRuntimeFactory.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
  • GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractRequestHandler.cs
  • GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
  • GFramework.Cqrs/Cqrs/Behaviors/PerformanceBehavior.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
  • GFramework.Cqrs/GFramework.Cqrs.csproj
  • GFramework.Cqrs/Cqrs/Command/AbstractStreamCommandHandler.cs
**/*.Tests/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.Tests/*.cs: When a public API defines multiple contract branches, tests MUST cover meaningful variants including null, empty, default, and filtered inputs when those branches change behavior
Regression fixes should include a test that fails before the fix and passes after it
Mirror the source structure in test projects whenever practical
Reuse existing architecture test infrastructure when relevant: ArchitectureTestsBase<T>, SyncTestArchitecture, AsyncTestArchitecture
Keep tests focused on observable behavior, not implementation trivia
Source generator changes MUST be covered by generator tests; preserve snapshot-based verification patterns already used in the repository
When generator behavior changes intentionally, update snapshots together with the implementation

Files:

  • GFramework.Cqrs.Tests/GlobalUsings.cs
**/*.csproj

📄 CodeRabbit inference engine (AGENTS.md)

Follow repository defaults: ImplicitUsings disabled, Nullable enabled, GenerateDocumentationFile enabled for shipped libraries, LangVersion generally preview

Files:

  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Core/GFramework.Core.csproj
  • GFramework.Cqrs/GFramework.Cqrs.csproj
**/*SourceGenerators/**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

Keep source generators deterministic and free of hidden environment or network dependencies

Files:

  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
🧠 Learnings (24)
📚 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/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs/Internal/DefaultCqrsHandlerRegistrar.cs
  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Cqrs/Command/CommandBase.cs
  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
  • GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsCommandExtensions.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs/Request/RequestBase.cs
  • GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractStreamRequestHandler.cs
  • GFramework.Cqrs/Cqrs/Notification/AbstractNotificationHandler.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs
  • GFramework.Cqrs/ICqrsHandlerRegistry.cs
  • GFramework.Cqrs/GlobalUsings.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractQueryHandler.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/AbstractCqrsHandlerContextTests.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractCommandHandler.cs
  • GFramework.Cqrs/CqrsRuntimeFactory.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
  • GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractRequestHandler.cs
  • GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
  • GFramework.Cqrs/Cqrs/Behaviors/PerformanceBehavior.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
  • GFramework.Cqrs/Cqrs/Command/AbstractStreamCommandHandler.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Use MicrosoftDiContainer wrapping Microsoft.Extensions.DependencyInjection for unified component registration and service resolution

Applied to files:

  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Cqrs/GlobalUsings.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/AbstractCqrsHandlerContextTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Source generator changes MUST be covered by generator tests; preserve snapshot-based verification patterns already used in the repository

Applied to files:

  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/State/StateMachineSystemTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Core/GFramework.Core.csproj
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Command/CommandBase.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs/Request/RequestBase.cs
  • GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs
  • GFramework.Cqrs/ICqrsHandlerRegistry.cs
  • GFramework.Cqrs/GlobalUsings.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.SourceGenerators.Common/Constants/PathContests.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
  • GFramework.Cqrs/GFramework.Cqrs.csproj
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Do not rely on implicit imports; declare every required `using` explicitly in C# files

Applied to files:

  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Cqrs/GlobalUsings.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`

Applied to files:

  • GFramework.Cqrs.Tests/GlobalUsings.cs
  • GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs
  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
  • GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Applies to **/*.cs : PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute

Applied to files:

  • GFramework.Core.Tests/Architectures/PriorityServiceTests.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Applies to **/*.cs : ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

Applied to files:

  • GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsCommandExtensions.cs
  • GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs
  • GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
  • GFramework.Cqrs/Cqrs/Request/AbstractRequestHandler.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions, and design rationale

Applied to files:

  • GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
📚 Learning: 2026-04-06T12:45:47.739Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:47.739Z
Learning: In the GFramework repository (GeWuYou/GFramework), even though `ImplicitUsings` is disabled in the `.csproj` files, the project uses a manual `GlobalUsings.cs` file with `global using` directives to provide common System namespaces (e.g., System, System.Threading, System.Threading.Tasks) project-wide. Do not flag missing System-level `using` imports in C# files within this repository, as they are covered by GlobalUsings.cs.

Applied to files:

  • GFramework.Tests.Common/GFramework.Tests.Common.csproj
  • GFramework.Core/GFramework.Core.csproj
  • GFramework.Cqrs/GFramework.Cqrs.csproj
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Implement CQRS pattern (Command Query Responsibility Segregation) with support for both synchronous and asynchronous execution, using Mediator pattern integrated via source code generators

Applied to files:

  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Use ArchitectureLifecycle, ArchitectureComponentRegistry, and ArchitectureModules as independent components to manage lifecycle, component registration, and module installation respectively

Applied to files:

  • GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Any change to public API, lifecycle semantics, module behavior, or extension points MUST update the related XML docs

Applied to files:

  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : All public, protected, and internal types and members MUST include XML documentation comments (`///`) with `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` where applicable

Applied to files:

  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : If a framework abstraction changes meaning or intended usage, update the explanatory comments in code as part of the same change

Applied to files:

  • GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.csproj : Follow repository defaults: `ImplicitUsings` disabled, `Nullable` enabled, `GenerateDocumentationFile` enabled for shipped libraries, `LangVersion` generally `preview`

Applied to files:

  • GFramework.Cqrs/GlobalUsings.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Use IServiceModule pattern to register built-in services (EventBus, CommandExecutor, QueryExecutor) with Architecture

Applied to files:

  • GFramework.Core/Services/Modules/CqrsRuntimeModule.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs

Applied to files:

  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*SourceGenerators/**/*.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: IContextAware must provide unified context access through SetContext(IArchitectureContext) method for components to obtain architecture context

Applied to files:

  • GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs
📚 Learning: 2026-04-05T15:30:46.211Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Applies to **/Abstractions/**/*.cs : Abstractions projects must only contain interface and contract definitions, not runtime implementation logic

Applied to files:

  • GFramework.Cqrs/GFramework.Cqrs.csproj
🪛 GitHub Check: Build and Test
GFramework.Cqrs.Tests/GlobalUsings.cs

[warning] 23-23:
The using directive for 'System.Diagnostics' appeared previously in this namespace


[warning] 23-23:
The using directive for 'System.Diagnostics' appeared previously in this namespace

🔇 Additional comments (51)
GFramework.Cqrs/Notification/NotificationBase.cs (1)

17-17: 命名空间迁移方向正确。

NotificationBase 迁移到 GFramework.Cqrs.Notification 与本次 CQRS 运行时拆分目标一致,改动清晰且风险可控。

GFramework.Cqrs/Query/QueryBase.cs (1)

16-16: 查询基类命名空间调整合理。

该迁移与 PR 的 CQRS 命名空间收敛保持一致,不涉及语义或执行路径变化。

GFramework.Cqrs/Command/CommandBase.cs (1)

16-16: 命令基类迁移一致性良好。

命名空间调整与 CQRS 契约/运行时统一方向一致,改动本身无额外风险。

GFramework.Cqrs/Extensions/ContextAwareCqrsCommandExtensions.cs (1)

4-4: 扩展方法命名空间归位正确。

迁移到 GFramework.Cqrs.Extensions 后,CQRS 扩展入口边界更清晰,兼容层调用路径也更直观。

GFramework.Cqrs/GFramework.Cqrs.csproj (1)

14-14: 新增项目引用有明确必要性。

GFramework.Cqrs 引用 GFramework.Core.Abstractions 与运行时工厂对核心抽象契约的依赖一致,符合当前模块装配需求。

GFramework.Core/GFramework.Core.csproj (1)

13-13: Core 引用 CQRS 运行时模块合理。

这条依赖与本 PR 的“Core 接入新版 CQRS 运行时”目标一致,属于必要装配变更。

GFramework.Tests.Common/GFramework.Tests.Common.csproj (1)

13-13: 测试基础设施依赖补齐到位。

GFramework.Tests.Common 增加对 GFramework.Cqrs 的引用有助于统一测试运行时装配,与本次 CQRS 迁移相匹配。

GFramework.Core.Abstractions/Architectures/IArchitectureContext.cs (1)

18-18: 接口迁移说明文档更新准确。

两处注释均已对齐新 GFramework.Cqrs.Abstractions.Cqrs 契约语义,能有效降低迁移期误用风险。

As per coding guidelines “Any change to public API, lifecycle semantics, module behavior, or extension points MUST update the related XML docs”.

Also applies to: 178-178

GFramework.Cqrs/GlobalUsings.cs (1)

1-7: 全局依赖导入设计清晰,可接受。

这一组 global using 与 CQRS 运行时模块的共享依赖匹配,改动合理。

GFramework.Cqrs/Internal/DefaultCqrsHandlerRegistrar.cs (1)

6-6: 命名空间迁移一致性良好。

GFramework.Cqrs.Internal 与当前模块分层保持一致。

GFramework.Cqrs/CqrsHandlerRegistryAttribute.cs (1)

1-1: 特性命名空间迁移正确。

该调整与生成器对 CqrsHandlerRegistryAttribute 的新元数据定位保持一致。

GFramework.Cqrs/ICqrsHandlerRegistry.cs (1)

3-3: 接口命名空间调整合理。

ICqrsHandlerRegistry 归位到 GFramework.Cqrs 后,runtime/生成器引用路径更统一。

GFramework.SourceGenerators.Common/Constants/PathContests.cs (1)

18-22: 新增命名空间常量设计合理。

将 CQRS runtime 与 abstractions 的命名空间集中为常量,有助于后续生成器维护。

Also applies to: 54-57

GFramework.Core/Properties/TypeForwarders.cs (1)

4-4: 类型转发变更方向正确。

该转发能降低日志解析器迁移后的程序集边界摩擦,兼容性考虑到位。

GFramework.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs (2)

11-20: 命名空间拆分(Contracts/Runtime)处理正确。

这里将处理器接口元数据与运行时注册器元数据分离,和当前 CQRS 分层结构一致,能降低后续命名空间迁移时的耦合风险。


279-295: 生成代码对 runtime 命名空间的引用一致且完整。

assembly 级特性与生成注册器接口实现都指向 runtime 命名空间,和上面的元数据解析策略保持一致。

GFramework.Cqrs/Cqrs/CqrsContextAwareHandlerBase.cs (1)

6-57: 上下文注入基类实现清晰,失败语义明确。

SetContext/GetContext 显式实现配合 Context 的 fail-fast 访问约束,能很好约束处理器必须走 CQRS runtime 分发路径。

GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs (1)

2-2: 日志抽象命名空间引入合理。

与测试中的日志工厂初始化链路一致,方向正确。

GFramework.Core.Tests/State/StateMachineSystemTests.cs (1)

3-3: 日志抽象引用补齐正确。

该变更不会改变测试行为,仅完善日志抽象依赖声明。

GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs (1)

3-3: 该日志抽象 using 添加是正确的。

与测试中的 logger provider 初始化保持一致。

GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs (1)

4-4: 日志抽象依赖声明补充到位。

该导入与当前测试中的日志注入路径匹配。

GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs (1)

1-1: 日志抽象命名空间引入正确。

与测试初始化的日志工厂使用方式保持一致。

GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs (1)

6-6: 命名空间声明保持规范。

该处改动未引入行为变化,符合模块命名结构。

GFramework.Core.Tests/Architectures/PriorityServiceTests.cs (2)

248-248: 文件结尾换行调整无问题。

这是非功能性改动,不影响可读性与执行行为。


3-3: 导入迁移与当前测试场景一致,保持这样即可。

新增 GFramework.Core.Abstractions.Logging 与测试内日志提供器初始化路径匹配,未见行为风险。

GFramework.Core.Tests/Architectures/ArchitectureComponentRegistryBehaviorTests.cs (2)

717-717: 末尾换行改动可忽略。

该行不涉及逻辑或契约变化。


3-3: 日志抽象命名空间接入合理。

该导入与本文件对日志相关类型的使用方向一致,兼容当前重构目标。

GFramework.Core.Tests/Architectures/ArchitectureInitializationPipelineTests.cs (2)

188-188: 结尾换行改动无需额外处理。

该改动不涉及行为层面。


3-3: 日志抽象导入更新没有问题。

改动与测试文件整体依赖方向一致,保持即可。

GFramework.Core.Tests/Architectures/ArchitectureContextTests.cs (1)

8-8: 导入调整正确,且与测试初始化流程兼容。

未发现该变更对 ArchitectureContext 相关测试行为造成副作用。

GFramework.Core.Tests/Architectures/ArchitectureModulesBehaviorTests.cs (1)

2-2: 命名空间迁移与当前模块行为测试保持一致。

这是清晰且低风险的导入更新。

GFramework.Core/Extensions/ContextAwareMediatorExtensions.cs (1)

4-4: 兼容层转发依赖补齐到位。

新增 GFramework.Cqrs.Extensions 使兼容别名可稳定委托到新扩展入口,方向正确。

GFramework.Godot/Coroutine/ContextAwareCoroutineExtensions.cs (1)

7-7: CQRS 扩展命名空间切换正确。

当前协程封装调用的新扩展入口与该导入一致,改动合理。

GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs (1)

5-5: CQRS 根命名空间更新与测试语义保持一致。

该导入变更与 CqrsHandlerRegistryAttribute 的新归属对齐,风险可控。

GFramework.Core.Tests/Architectures/ArchitectureLifecycleBehaviorTests.cs (1)

5-5: 变更方向正确,测试依赖保持清晰。

这里改为引入日志抽象层命名空间,与 SetUp 中的日志工厂配置保持一致,没有引入额外行为风险。

GFramework.Cqrs/Internal/CqrsDispatcher.cs (1)

10-10: 命名空间迁移与模块边界一致。

CqrsDispatcher 迁移到 GFramework.Cqrs.Internal 后,归属更清晰,且未改变运行时行为。

GFramework.Cqrs/Extensions/ContextAwareCqrsExtensions.cs (1)

4-4: 命名空间调整合理。

仅迁移到 GFramework.Cqrs.Extensions,且未引入行为变化,和本次 CQRS 运行时拆分目标一致。

GFramework.Cqrs/Extensions/ContextAwareCqrsQueryExtensions.cs (1)

4-4: 命名空间迁移一致性良好。

该调整与 Core 侧兼容扩展的委托关系匹配,查询扩展行为保持稳定。

GFramework.Cqrs/Cqrs/Request/AbstractStreamRequestHandler.cs (1)

16-26: 基类迁移方向正确。

AbstractStreamRequestHandler 改为继承 CqrsContextAwareHandlerBase 与 CQRS 运行时拆分保持一致,接口契约也未被破坏。

GFramework.Core/Services/Modules/CqrsRuntimeModule.cs (1)

40-45: 运行时注册路径统一,改动合理。

通过 CqrsRuntimeFactory 统一创建并注册 ICqrsRuntime / ICqrsHandlerRegistrar,与测试基础设施保持一致,维护性更好。

GFramework.Cqrs/Cqrs/Notification/AbstractNotificationHandler.cs (1)

16-26: 变更方向正确,基类切换与命名空间迁移一致。

该抽象通知处理器切到 CqrsContextAwareHandlerBase 后,和本次 CQRS runtime 迁移目标保持一致,接口契约也保持稳定。

GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs (1)

49-69: 请求日志路径覆盖完整(开始/成功/取消/失败),实现清晰。

当前异常分支和耗时输出逻辑完整,便于定位请求处理状态。

GFramework.Cqrs/Cqrs/Query/AbstractQueryHandler.cs (1)

21-27: 基类迁移与文档说明一致,语义清晰。

这里对上下文注入时机和处理器职责的说明到位,和新的 CqrsContextAwareHandlerBase 行为一致。

GFramework.Cqrs/Cqrs/Command/AbstractStreamCommandHandler.cs (1)

21-35: 流式处理的生命周期与并发约束说明写得很好。

这段注释把上下文有效期、实例复用风险、取消令牌语义都交代清楚了,能有效降低派生类误用。

GFramework.Tests.Common/CqrsTestRuntime.cs (1)

63-72: 测试基建改为复用 CqrsRuntimeFactory 是正确方向。

这让测试与生产注册路径保持一致,减少了测试层的实现漂移。

GFramework.Cqrs/CqrsRuntimeFactory.cs (1)

16-44: 工厂抽象边界设计合理。

通过返回 ICqrsRuntime/ICqrsHandlerRegistrar 抽象而不暴露内部实现,模块解耦做得很好。

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

19-47: 测试覆盖点准确,验证了关键可观察行为。

未初始化失败路径与注入后 OnContextReady/Context 可用性的断言都很到位,能有效守住这次基类语义变更。

GFramework.Cqrs/Cqrs/Behaviors/PerformanceBehavior.cs (1)

17-26: 命名空间迁移与慢请求阈值常量化实现清晰且稳定。

本次调整保持了原有行为语义不变,同时提升了可维护性;兼容性说明也已通过注释明确表达。

Also applies to: 30-31, 57-60

GFramework.Cqrs/Cqrs/Command/AbstractCommandHandler.cs (1)

17-26: 命令处理器基类迁移到新上下文基类的改动一致且接口契约保持稳定。

两种泛型变体都同步完成了继承迁移,且 IRequestHandler 约束未引入破坏性偏差。

Also applies to: 40-47

GFramework.Cqrs/Cqrs/Request/AbstractRequestHandler.cs (1)

16-24: 请求处理器基类迁移实现完整,语义与泛型契约保持一致。

这组改动与命令处理器侧的迁移策略一致,整体可读性和一致性都很好。

Also applies to: 37-42

GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs (1)

41-53: 生成器测试中的命名空间迁移同步到位,断言目标与生成器实现一致。

sourceexpected 中的 GFramework.Cqrs / GFramework.Cqrs.Abstractions.Cqrs 映射更新完整,且回退场景测试也保持了覆盖。

Based on learnings: Applies to **/.Tests/.cs : Source generator changes MUST be covered by generator tests; preserve snapshot-based verification patterns already used in the repository.

Also applies to: 68-68, 84-111, 149-161, 176-176

Comment thread GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
Comment thread GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
Comment thread GFramework.Cqrs.Tests/GlobalUsings.cs Outdated
Comment thread GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs Outdated
Comment thread GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs Outdated
Comment thread GFramework.Cqrs/CqrsRuntimeFactory.cs
Comment thread GFramework.Cqrs/Request/RequestBase.cs
GeWuYou added 3 commits April 15, 2026 21:54
- 从 GlobalUsings.cs 中删除未使用的 System.Diagnostics 全局引用
- 保持测试项目的全局引用列表整洁
- 减少不必要的命名空间导入
- 新增ContextAwareMediatorCommandExtensions提供命令扩展方法兼容性支持
- 新增ContextAwareMediatorQueryExtensions提供查询扩展方法兼容性支持
- 添加LoggerFactoryResolver实现全局日志工厂访问入口
- 实现TypeForwarders将核心类型转发到正确程序集
- 添加MediatorCompatibilityDeprecationTests验证弃用策略
- 扩展LoggerFactoryTests覆盖并发初始化和回退逻辑
- 迁移CommandBase到Core.Cqrs.Command命名空间
- 移动LoggingBehavior到GFramework.Cqrs.Cqrs.Behaviors
- 添加AbstractStreamQueryHandler支持流式查询处理
- 创建NotificationBase提供通知基类实现
- 将CommandBase、QueryBase、RequestBase、NotificationBase类型从Core模块迁移到独立Cqrs模块
- 在GFramework.Core中添加TypeForwarder维持向后兼容性
- 创建CqrsPublicNamespaceCompatibilityTests验证运行时程序集转发功能
- 更新CqrsTestRuntime移除对已迁移类型的直接引用
- 为所有基础类型添加统一输入模型支持和命名空间兼容性注释
- 实现完整的CQRS抽象基类重构以支持模块化架构
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

🧹 Nitpick comments (1)
GFramework.Core.Tests/Logging/LoggerFactoryTests.cs (1)

436-440: ManualResetEventSlim 实例未被释放。

Reset() 方法在创建新的 ManualResetEventSlim 实例前未释放旧实例。虽然在测试上下文中这不是严重问题,但可以通过调用现有实例的 Reset() 方法来避免创建新对象。

♻️ 建议的修复方案
         public static void Reset()
         {
-            _constructionGate = new ManualResetEventSlim(false);
+            _constructionGate.Reset();
             Interlocked.Exchange(ref _constructionCount, 0);
         }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.Tests/Logging/LoggerFactoryTests.cs` around lines 436 - 440,
The Reset() method currently creates a new ManualResetEventSlim which leaks the
previous instance; instead, update Reset() to reuse the existing
_constructionGate by checking if _constructionGate is non-null and calling
_constructionGate.Reset(), only creating a new ManualResetEventSlim if
_constructionGate is null, and continue to set _constructionCount to 0 via
Interlocked.Exchange; reference the Reset() method and the _constructionGate and
_constructionCount fields when making this change.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@GFramework.Core/Properties/TypeForwarders.cs`:
- Around line 1-8: The TypeForwardedTo attributes reference CQRS base types
(CommandBase<,>, QueryBase<,>, RequestBase<,>, NotificationBase<>) but the file
lacks the using that declares those types; add the missing using(s) that contain
these CQRS base classes (the namespace where CommandBase, QueryBase, RequestBase
and NotificationBase are defined) so the compiler can resolve them while keeping
the existing using System.Runtime.CompilerServices and
GFramework.Core.Abstractions.Logging.

In `@GFramework.Cqrs/Notification/NotificationBase.cs`:
- Line 22: The XML doc for the type parameter TInput contains an invalid cref
("input"); update the `<typeparam name="TInput">` comment to reference the
actual interface constraint by replacing `<see cref="input" />` with `<see
cref="INotificationInput" />` so the cref points to a real type (TInput is
constrained to INotificationInput in NotificationBase's generic constraint).

In `@GFramework.Cqrs/Query/QueryBase.cs`:
- Line 21: The XML doc for the type parameter TInput in QueryBase.cs incorrectly
references TResponse; update the <typeparam name="TInput"> comment to reference
the correct interface IQueryInput (matching the generic constraint "where TInput
: IQueryInput") and adjust the descriptive text accordingly so it states that
TInput must implement IQueryInput.

In `@GFramework.Cqrs/Request/RequestBase.cs`:
- Line 22: 修复 RequestBase 泛型参数文档:将类 RequestBase 上的 <typeparam name="TInput"> 的
XML 注释中错误指向的 <see cref="TResponse" /> 改为正确的接口引用 <see cref="IRequestInput"
/>,以匹配泛型约束 where TInput : IRequestInput 并确保文档与类型约束一致。

---

Nitpick comments:
In `@GFramework.Core.Tests/Logging/LoggerFactoryTests.cs`:
- Around line 436-440: The Reset() method currently creates a new
ManualResetEventSlim which leaks the previous instance; instead, update Reset()
to reuse the existing _constructionGate by checking if _constructionGate is
non-null and calling _constructionGate.Reset(), only creating a new
ManualResetEventSlim if _constructionGate is null, and continue to set
_constructionCount to 0 via Interlocked.Exchange; reference the Reset() method
and the _constructionGate and _constructionCount fields when making this change.
🪄 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: 9d0939f9-50c5-447f-b9ce-9d60be861c65

📥 Commits

Reviewing files that changed from the base of the PR and between 1c7558a and 12c9c8a.

📒 Files selected for processing (15)
  • GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Cqrs/Command/CommandBase.cs
  • GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs
  • GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs
  • GFramework.Cqrs/CqrsRuntimeFactory.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
✅ Files skipped from review due to trivial changes (1)
  • GFramework.Core/Extensions/ContextAwareMediatorQueryExtensions.cs
🚧 Files skipped from review as they are similar to previous changes (7)
  • GFramework.Cqrs/Cqrs/Query/AbstractStreamQueryHandler.cs
  • GFramework.Core/Extensions/ContextAwareMediatorCommandExtensions.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
  • GFramework.Cqrs/CqrsRuntimeFactory.cs
  • GFramework.Cqrs/Cqrs/Behaviors/LoggingBehavior.cs
  • GFramework.Core.Abstractions/Logging/LoggerFactoryResolver.cs
  • GFramework.Cqrs/Command/CommandBase.cs
📜 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). (2)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, and edge cases
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions, and design rationale
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostic or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly in C# files
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, constants use PascalCase; interfaces use I prefix; parameters and locals use camelCase; private fields use _camelCase
Use 4 spaces for indentation (not tabs), use Allman braces, and keep using directives at the top of the file sorted consistently
Prefer one primary type per file unless the surrounding project alread...

Files:

  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
**/*.{cs,csproj}

📄 CodeRabbit inference engine (AGENTS.md)

Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Files:

  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Implement CQRS pattern (Command Query Responsibility Segregation) with support for both synchronous and asynchronous execution, using Mediator pattern integrated via source code generators
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Cqrs/Request/RequestBase.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Source generator changes MUST be covered by generator tests; preserve snapshot-based verification patterns already used in the repository

Applied to files:

  • GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 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.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs
  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Core.Tests/Logging/LoggerFactoryTests.cs
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When a public API defines multiple contract branches, tests MUST cover meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
🪛 GitHub Check: Build and Test
GFramework.Core/Properties/TypeForwarders.cs

[failure] 6-6:
The type or namespace name 'QueryBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 5-5:
The type or namespace name 'CommandBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 8-8:
The type or namespace name 'NotificationBase<>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 7-7:
The type or namespace name 'RequestBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 6-6:
The type or namespace name 'QueryBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 5-5:
The type or namespace name 'CommandBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 8-8:
The type or namespace name 'NotificationBase<>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 7-7:
The type or namespace name 'RequestBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 6-6:
The type or namespace name 'QueryBase<,>' could not be found (are you missing a using directive or an assembly reference?)


[failure] 5-5:
The type or namespace name 'CommandBase<,>' could not be found (are you missing a using directive or an assembly reference?)

GFramework.Cqrs/Notification/NotificationBase.cs

[warning] 22-22:
XML comment has cref attribute 'input' that could not be resolved


[warning] 22-22:
XML comment has cref attribute 'input' that could not be resolved


[warning] 22-22:
XML comment has cref attribute 'input' that could not be resolved


[warning] 22-22:
XML comment has cref attribute 'input' that could not be resolved

GFramework.Cqrs/Query/QueryBase.cs

[warning] 21-21:
XML comment has cref attribute 'TResponse' that refers to a type parameter


[warning] 21-21:
XML comment has cref attribute 'TResponse' that refers to a type parameter


[warning] 21-21:
XML comment has cref attribute 'TResponse' that refers to a type parameter

GFramework.Cqrs/Request/RequestBase.cs

[warning] 22-22:
XML comment has cref attribute 'TResponse' that refers to a type parameter


[warning] 22-22:
XML comment has cref attribute 'TResponse' that refers to a type parameter


[warning] 22-22:
XML comment has cref attribute 'TResponse' that refers to a type parameter

🔇 Additional comments (7)
GFramework.Core.Tests/Logging/LoggerFactoryTests.cs (5)

11-13: LGTM!

[NonParallelizable] 属性是必要的,因为测试会修改全局静态状态 LoggerFactoryResolver.Provider 和内部字段。根据相关代码片段,其他测试文件(如 ArchitectureContextTestsMicrosoftDiContainerTests)也会在 SetUp 中修改这个全局状态,因此串行执行可以避免竞态条件。


221-251: LGTM!

测试正确验证了当默认 provider 激活失败时的回退行为。try/finally 结构确保测试状态被正确恢复,Assert.Multiple 合理地验证了回退 provider 的类型、MinLevel 设置以及 SilentLogger 的行为。


253-305: LGTM!

并发测试设计良好,使用 ManualResetEventSlim 同步多个并发任务,验证了 LoggerFactoryResolver 的线程安全初始化行为。finally 块中正确地释放了阻塞的构造过程并重置状态。


341-363: LGTM!

反射辅助方法封装良好,错误处理提供了清晰的诊断信息。


365-394: LGTM!

测试桩实现简洁明了,XML 文档完整说明了其用途。

GFramework.Core.Tests/Cqrs/MediatorCompatibilityDeprecationTests.cs (1)

34-48: 弃用迁移提示的断言更新正确

这里把兼容扩展的迁移目标对齐到 GFramework.Cqrs.Extensions.*,与当前兼容层设计一致,测试价值明确。

GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs (1)

19-43: 兼容性测试覆盖面到位,断言粒度合理

这组测试同时锁定了“旧命名空间可见性”和“GFramework.Core 到 runtime 程序集转发”两个核心行为,对本次 CQRS 拆分回归防护很有价值。

Comment thread GFramework.Core/Properties/TypeForwarders.cs
Comment thread GFramework.Cqrs/Notification/NotificationBase.cs Outdated
Comment thread GFramework.Cqrs/Query/QueryBase.cs Outdated
Comment thread GFramework.Cqrs/Request/RequestBase.cs Outdated
- 在 TypeForwarders.cs 中添加 Cqrs 相关命名空间引用
- 在 CqrsPublicNamespaceCompatibilityTests.cs 中同步更新命名空间导入
- 在 CqrsTestRuntime.cs 中补充 Command 命名空间引用
- 确保所有测试运行时环境的命名空间一致性
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: 2

🧹 Nitpick comments (1)
GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs (1)

49-56: 建议重命名辅助方法以反映实际验证逻辑。

如果按照上述修复更新测试期望值,方法名 AssertLegacyType 将不再准确描述其行为(验证的是新命名空间,而非"遗留"命名空间)。

♻️ 建议重命名
-    private static void AssertLegacyType(Type type, string expectedNamespace)
+    private static void AssertTypeNamespaceAndAssembly(Type type, string expectedNamespace)
     {
         Assert.Multiple(() =>
         {
             Assert.That(type.Namespace, Is.EqualTo(expectedNamespace));
             Assert.That(type.Assembly.GetName().Name, Is.EqualTo("GFramework.Cqrs"));
         });
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs` around
lines 49 - 56, The helper method AssertLegacyType no longer reflects its
behavior (it asserts the type's namespace equals the expected/new namespace and
assembly name), so rename the method (e.g., to AssertExpectedNamespace or
AssertPublicCqrsType) and update all callers in
CqrsPublicNamespaceCompatibilityTests to use the new name; ensure the method
signature (AssertLegacyType(Type type, string expectedNamespace)) and its
assertions remain unchanged except for the identifier rename so tests keep the
same logic but a clearer name.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs`:
- Around line 22-32: Update the test to expect the actual namespaces and make
the method name reflect that: change the AssertLegacyType expected namespace
strings from
"GFramework.Core.Cqrs.Command"/"GFramework.Core.Cqrs.Query"/"GFramework.Core.Cqrs.Request"/"GFramework.Core.Cqrs.Notification"
to
"GFramework.Cqrs.Command"/"GFramework.Cqrs.Query"/"GFramework.Cqrs.Request"/"GFramework.Cqrs.Notification"
for the assertions on CommandBase<TestCommandInput, Unit>,
QueryBase<TestQueryInput, string>, RequestBase<TestRequestInput, string>, and
NotificationBase<TestNotificationInput>, and rename the test method
Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly
to Base_Message_Types_Should_Live_In_Cqrs_Namespaces_And_Runtime_Assembly to
match the updated expectations.
- Around line 37-47: The test is asserting assembly-qualified names using a
non-existent namespace ("GFramework.Core.Cqrs...") causing TypeLoadException;
update the strings passed to AssertForwardedType in
GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly to
match the actual forwarded types (e.g. use
"GFramework.Cqrs.Command.CommandBase`2" / "GFramework.Cqrs.Query.QueryBase`2" /
"GFramework.Cqrs.Request.RequestBase`2" /
"GFramework.Cqrs.Notification.NotificationBase`1" with the correct assembly
part), or alternatively modify the TypeForwarders.cs entries to forward the
legacy "GFramework.Core.Cqrs.*" names to the runtime types—ensure the namespace
in the asserted assembly-qualified names exactly matches the targets in
TypeForwarders.cs and update the four AssertForwardedType calls accordingly.

---

Nitpick comments:
In `@GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs`:
- Around line 49-56: The helper method AssertLegacyType no longer reflects its
behavior (it asserts the type's namespace equals the expected/new namespace and
assembly name), so rename the method (e.g., to AssertExpectedNamespace or
AssertPublicCqrsType) and update all callers in
CqrsPublicNamespaceCompatibilityTests to use the new name; ensure the method
signature (AssertLegacyType(Type type, string expectedNamespace)) and its
assertions remain unchanged except for the identifier rename so tests keep the
same logic but a clearer name.
🪄 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: 217e4091-4048-4aac-a5ee-344217f13261

📥 Commits

Reviewing files that changed from the base of the PR and between 12c9c8a and b747787.

📒 Files selected for processing (3)
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Core/Properties/TypeForwarders.cs
  • GFramework.Tests.Common/CqrsTestRuntime.cs
✅ Files skipped from review due to trivial changes (1)
  • GFramework.Core/Properties/TypeForwarders.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Tests.Common/CqrsTestRuntime.cs
📜 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). (2)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, and edge cases
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions, and design rationale
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostic or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly in C# files
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, constants use PascalCase; interfaces use I prefix; parameters and locals use camelCase; private fields use _camelCase
Use 4 spaces for indentation (not tabs), use Allman braces, and keep using directives at the top of the file sorted consistently
Prefer one primary type per file unless the surrounding project alread...

Files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
**/*.{cs,csproj}

📄 CodeRabbit inference engine (AGENTS.md)

Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
🧠 Learnings (9)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Implement CQRS pattern (Command Query Responsibility Segregation) with support for both synchronous and asynchronous execution, using Mediator pattern integrated via source code generators
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Source generator changes MUST be covered by generator tests; preserve snapshot-based verification patterns already used in the repository

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When a public API defines multiple contract branches, tests MUST cover meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 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.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
🪛 GitHub Check: Build and Test
GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs

[failure] 60-60: Failed Test: GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly
GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly: System.TypeLoadException : Could not resolve type 'GFramework.Core.Cqrs.Command.CommandBase2' in assembly 'GFramework.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'. - at System.Reflection.TypeNameResolver.GetType(String escapedTypeName, ReadOnlySpan1 nestedTypeNames, TypeName parsedName)
at System.Reflection.TypeNameResolver.GetType(String typeName, Func2 assemblyResolver, Func4 typeResolver, Assembly requestingAssembly, Boolean throwOnError, Boolean ignoreCase, Boolean extensibleParser)
at System.Type.GetType(String typeName, Boolean throwOnError)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.AssertForwardedType(String assemblyQualifiedTypeName) in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 60
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c.<GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly>b__1_0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 42
at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 40
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

  1. at System.Reflection.TypeNameResolver.GetType(String escapedTypeName, ReadOnlySpan1 nestedTypeNames, TypeName parsedName) at System.Reflection.TypeNameResolver.GetType(String typeName, Func2 assemblyResolver, Func`4 typeResolver, Assembly requestingAssembly, Boolean throwOnError, Boolean ignoreCase, Boolean extensibleParser)
    at System.Type.GetType(String typeName, Boolean throwOnError)
    at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.AssertForwardedType(String assemblyQualifiedTypeName) in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 60
    at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c.<GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly>b__1_0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 42
    at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
    at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 40
    at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
    at System.RuntimeMethodHandle.InvokeMethod(ObjectHandleOnStack target, Void** arguments, ObjectHandleOnStack sig, BOOL isConstructor, ObjectHandleOnStack result)
    at System.Reflection.MethodBaseInvoker.InterpretedInvoke_Method(Object obj, IntPtr* args)
    at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)

[failure] 25-25: Failed Test: Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly
Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly: Multiple failures or warnings in test:

  1. Assert.That(type.Namespace, Is.EqualTo(expectedNamespace))
    Expected string length 28 but was 23. Strings differ at index 12.
    Expected: "GFramework.Core.Cqrs.Command"
    But was: "GFramework.Cqrs.Command"
    -----------------------^
 at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c__DisplayClass2_0.<AssertLegacyType>b__0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 53

at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.AssertLegacyType(Type type, String expectedNamespace) in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 51
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c.<Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly>b__0_0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 27
at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 25

  1. Assert.That(type.Namespace, Is.EqualTo(expectedNamespace))
    Expected string length 26 but was 21. Strings differ at index 12.
    Expected: "GFramework.Core.Cqrs.Query"
    But was: "GFramework.Cqrs.Query"
    -----------------------^
 at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c__DisplayClass2_0.<AssertLegacyType>b__0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 53

at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.AssertLegacyType(Type type, String expectedNamespace) in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 51
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c.<Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly>b__0_0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 28
at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 25

  1. Assert.That(type.Namespace, Is.EqualTo(expectedNamespace))
    Expected string length 28 but was 23. Strings differ at index 12.
    Expected: "GFramework.Core.Cqrs.Request"
    But was: "GFramework.Cqrs.Request"
    -----------------------^
 at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c__DisplayClass2_0.<AssertLegacyType>b__0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 53

at NUnit.Framework.Assert.Multiple(TestDelegate testDelegate)
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.AssertLegacyType(Type type, String expectedNamespace) in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 51
at GFramework.Core.Tests.Cqrs.CqrsPublicNamespaceCompatibilityTests.<>c.<Base_Message_Types_Should_Remain_In_Legacy_Namespaces_While_Living_In_Runtime_Assembly>b__0_0() in /home/runner/work/GFramework/GFramework/GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs:line 29
at NUnit.Framework.Assert.Multiple(Te

🔇 Additional comments (1)
GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs (1)

58-76: 辅助方法和测试输入类型实现正确。

AssertForwardedType 的逻辑正确验证了类型转发机制。私有测试输入类型(TestCommandInput 等)简洁且符合测试需求。

Comment thread GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
Comment thread GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
GeWuYou added 4 commits April 15, 2026 22:50
- 修正NotificationBase中TInput类型的XML文档注释,将input更正为INotificationInput
- 修正QueryBase中TInput类型的XML文档注释,将TResponse更正为IQueryInput
- 修正RequestBase中TInput类型的XML文档注释,将TResponse更正为IRequestInput
- 将GFramework.Core.Cqrs.Command更改为GFramework.Cqrs.Command
- 将GFramework.Core.Cqrs.Query更改为GFramework.Cqrs.Query
- 将GFramework.Core.Cqrs.Request更改为GFramework.Cqrs.Request
- 将GFramework.Core.Cqrs.Notification更改为GFramework.Cqrs.Notification
- 将基础消息类型从遗留的Core.Cqrs命名空间迁移到新的Cqrs命名空间
- 保持运行时程序集承载实现的架构设计
- 更新测试方法名称以反映新的命名空间结构
- 确保公共API兼容性的同时优化组件组织结构
- 更新测试方法名称从 GFramework_Core_Assembly_Should_Forward_Legacy_Base_Types_To_Runtime_Assembly
  为 Type_Forwarding_Should_Resolve_Cqrs_Types_From_Core_Assembly
- 将断言中的程序集限定名从 GFramework.Core.Cqrs.* 更新为 GFramework.Cqrs.*
- 保持对命令、查询、请求和通知基类型的验证逻辑不变
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.

🧹 Nitpick comments (2)
GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs (2)

58-66: 建议避免 throwOnError: true 以提升批量断言的诊断信息。

当前一旦首个类型解析失败会抛异常并中断后续检查,Assert.Multiple 的聚合失败价值会降低。可改为 throwOnError: false,让四个类型一次性给出完整失败清单。

🧪 建议修改
     private static void AssertForwardedType(string assemblyQualifiedTypeName)
     {
-        var resolvedType = Type.GetType(assemblyQualifiedTypeName, throwOnError: true);
+        var resolvedType = Type.GetType(assemblyQualifiedTypeName, throwOnError: false);
 
         Assert.Multiple(() =>
         {
             Assert.That(resolvedType, Is.Not.Null);
             Assert.That(resolvedType!.Assembly.GetName().Name, Is.EqualTo("GFramework.Cqrs"));
         });
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs` around
lines 58 - 66, In AssertForwardedType change Type.GetType(..., throwOnError:
true) to throwOnError: false so resolution failures don't throw; keep the local
resolvedType variable and inside Assert.Multiple assert that resolvedType is not
null before accessing its Assembly (remove the null-forgiving operator on
resolvedType and use Assert.That(resolvedType, Is.Not.Null) prior to
Assert.That(resolvedType.Assembly.GetName().Name,
Is.EqualTo("GFramework.Cqrs"))) so all type resolution/assertion failures are
reported together.

19-21: 修正文档注释中的命名空间描述,避免与测试语义不一致。

Line 20 写的是“历史 Core.Cqrs 命名空间”,但本测试实际断言的是 GFramework.Cqrs.*。建议同步修正文案,避免后续维护误解测试意图。

✏️ 建议修改
     /// <summary>
-    ///     验证基础消息类型继续暴露在历史 Core.Cqrs 命名空间,同时由独立 runtime 程序集承载实现。
+    ///     验证基础消息类型继续暴露在历史公开 CQRS 命名空间(GFramework.Cqrs.*),同时由独立 runtime 程序集承载实现。
     /// </summary>

As per coding guidelines: If a framework abstraction changes meaning or intended usage, update the explanatory comments in code as part of the same change.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs` around
lines 19 - 21, Update the XML documentation on the
CqrsPublicNamespaceCompatibilityTests class so the summary accurately describes
the namespace asserted by the test: replace the incorrect reference to "历史
Core.Cqrs 命名空间" with "历史 GFramework.Cqrs 命名空间" (or phrase indicating
GFramework.Cqrs.*) to match the test assertions in
CqrsPublicNamespaceCompatibilityTests; ensure the summary text mentions that the
legacy GFramework.Cqrs types remain exposed while runtime implementations are in
a separate assembly, and keep the comment language consistent with the test
intent.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs`:
- Around line 58-66: In AssertForwardedType change Type.GetType(...,
throwOnError: true) to throwOnError: false so resolution failures don't throw;
keep the local resolvedType variable and inside Assert.Multiple assert that
resolvedType is not null before accessing its Assembly (remove the
null-forgiving operator on resolvedType and use Assert.That(resolvedType,
Is.Not.Null) prior to Assert.That(resolvedType.Assembly.GetName().Name,
Is.EqualTo("GFramework.Cqrs"))) so all type resolution/assertion failures are
reported together.
- Around line 19-21: Update the XML documentation on the
CqrsPublicNamespaceCompatibilityTests class so the summary accurately describes
the namespace asserted by the test: replace the incorrect reference to "历史
Core.Cqrs 命名空间" with "历史 GFramework.Cqrs 命名空间" (or phrase indicating
GFramework.Cqrs.*) to match the test assertions in
CqrsPublicNamespaceCompatibilityTests; ensure the summary text mentions that the
legacy GFramework.Cqrs types remain exposed while runtime implementations are in
a separate assembly, and keep the comment language consistent with the test
intent.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 32ae7b89-7d72-4d9a-8028-5d28ee33c767

📥 Commits

Reviewing files that changed from the base of the PR and between b747787 and 7b63a65.

📒 Files selected for processing (4)
  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Query/QueryBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
✅ Files skipped from review due to trivial changes (1)
  • GFramework.Cqrs/Query/QueryBase.cs
🚧 Files skipped from review as they are similar to previous changes (2)
  • GFramework.Cqrs/Notification/NotificationBase.cs
  • GFramework.Cqrs/Request/RequestBase.cs
📜 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: Build and Test
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, and edge cases
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions, and design rationale
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostic or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every required using explicitly in C# files
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, constants use PascalCase; interfaces use I prefix; parameters and locals use camelCase; private fields use _camelCase
Use 4 spaces for indentation (not tabs), use Allman braces, and keep using directives at the top of the file sorted consistently
Prefer one primary type per file unless the surrounding project alread...

Files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
**/*.{cs,csproj}

📄 CodeRabbit inference engine (AGENTS.md)

Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
🧠 Learnings (10)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to docs/zh-CN/**/*.md : When a feature is added, removed, renamed, or substantially refactored, contributors MUST update or create the corresponding user-facing integration documentation in `docs/zh-CN/` in the same change
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-05T15:30:46.211Z
Learning: Implement CQRS pattern (Command Query Responsibility Segregation) with support for both synchronous and asynchronous execution, using Mediator pattern integrated via source code generators
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Source generator changes MUST be covered by generator tests; preserve snapshot-based verification patterns already used in the repository

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.Tests/*.cs : When a public API defines multiple contract branches, tests MUST cover meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 Learning: 2026-04-14T01:59:40.041Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-14T01:59:40.041Z
Learning: Applies to **/*.cs : Use the namespace pattern `GFramework.{Module}.{Feature}` with PascalCase segments

Applied to files:

  • GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
📚 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.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs
🔇 Additional comments (2)
GFramework.Core.Tests/Cqrs/CqrsPublicNamespaceCompatibilityTests.cs (2)

23-32: 基础类型命名空间与运行时程序集断言设计合理。

这组断言直接覆盖了迁移后最关键的对外可见行为(命名空间 + 所在程序集),回归价值高。


38-47: Type Forwarding 兼容性用例覆盖到位。

通过 GFramework.Core 程序集限定名解析并校验最终落到 GFramework.Cqrs,与转发目标一致,能有效防止兼容性回归。

- 更新注释以更准确描述基础消息类型的命名空间暴露方式
- 将Type.GetType的throwOnError参数从true改为false以避免异常抛出
- 调整测试逻辑以更好地处理类型解析场景
@GeWuYou GeWuYou merged commit 385893c into refactor/cqrs-architecture-decoupling Apr 15, 2026
5 checks passed
@GeWuYou GeWuYou deleted the refactor/cqrs-architecture-decoupling-todo-6 branch April 15, 2026 15:02
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