Skip to content

feat(core): 扩展 CQRS 处理器注册 API 并完善文档#223

Merged
GeWuYou merged 7 commits into
refactor/cqrs-architecture-decouplingfrom
refactor/cqrs-architecture-decoupling-todo-4
Apr 15, 2026
Merged

feat(core): 扩展 CQRS 处理器注册 API 并完善文档#223
GeWuYou merged 7 commits into
refactor/cqrs-architecture-decouplingfrom
refactor/cqrs-architecture-decoupling-todo-4

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Apr 15, 2026

Copy link
Copy Markdown
Owner
  • 完整介绍 CQRS 核心概念包括命令、查询、处理器和分发器
  • 提供命令和查询的定义与实现示例代码
  • 详细介绍处理器编写方法和注册流程
  • 说明管道行为(Behaviors)的使用方式
  • 展示通知(Notification)和流式处理功能
  • 提供最佳实践和常见问题解决方案
  • 包含完整的 API 参考和用法示例

Summary by CodeRabbit

发布说明

  • 新功能

    • 可显式从指定程序集注册 CQRS 处理程序(支持单个与多个程序集),并在注册期间自动去重。
  • 文档

    • 更新 CQRS 文档,增加示例并说明显式注册与默认注册流程一致(优先使用生成的注册器,回退到运行时扫描)。
  • 测试

    • 新增单元测试,验证显式注册、去重与清除后可再次注册的行为。
  • 杂项

    • CI/workflow 触发器配置更新(pull_request 触发范围调整等)。

- 完整介绍 CQRS 核心概念包括命令、查询、处理器和分发器
- 提供命令和查询的定义与实现示例代码
- 详细介绍处理器编写方法和注册流程
- 说明管道行为(Behaviors)的使用方式
- 展示通知(Notification)和流式处理功能
- 提供最佳实践和常见问题解决方案
- 包含完整的 API 参考和用法示例
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

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
📝 Walkthrough

Walkthrough

新增显式程序集级 CQRS 处理程序注册 API:RegisterCqrsHandlersFromAssembly(s),将启动时注册委托到容器实现;容器实现增加确定性排序、去重与持久化已注册程序集键;补充测试与文档;保留“优先使用生成注册表、回退到反射扫描”的语义。

Changes

Cohort / File(s) Summary
抽象层与全局 using
GFramework.Core.Abstractions/Architectures/IArchitecture.cs, GFramework.Core.Abstractions/Ioc/IIocContainer.cs, GFramework.Core.Abstractions/GlobalUsings.cs
新增 RegisterCqrsHandlersFromAssembly(Assembly)RegisterCqrsHandlersFromAssemblies(IEnumerable<Assembly>) 方法签名;调整/添加 global usingusing System.Reflection
核心架构与模块委托
GFramework.Core/Architectures/Architecture.cs, GFramework.Core/Architectures/ArchitectureModules.cs, GFramework.Core/Architectures/ArchitectureBootstrapper.cs
Architecture/ArchitectureModules 中新增公开委托方法(参数校验、日志),并将引导层启动时的 CQRS 注册改为调用容器的 RegisterCqrsHandlersFromAssemblies(...)
容器实现(去重与持久状态)
GFramework.Core/Ioc/MicrosoftDiContainer.cs
新增 RegisterCqrsHandlersFromAssembly(s) 实现:输入校验、写锁/冻结检查、确定性排序、按计算注册键去重(长期跟踪 _registeredCqrsHandlerAssemblyKeys)、调用 CqrsHandlerRegistrar.RegisterHandlers(...) 并记录键;Clear() 同步重置去重状态;新增注册键计算辅助方法。
测试
GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs, GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs, GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
新增端到端与单元测试:显式程序集注册、重复注册去重、Clear() 后可重注册;添加测试辅助类型与状态计数器;在部分测试架构类添加方法存根(抛出 NotImplementedException)。
文档与说明
docs/zh-CN/core/cqrs.md, CLAUDE.md
文档更新,示例说明如何通过 RegisterCqrsHandlersFromAssembly(s) 引入外部程序集,并明确仍优先使用生成注册表、回退至运行时反射扫描及自动去重语义。
CI/Workflow
.github/workflows/auto-tag.yml, .github/workflows/ci.yml, .github/workflows/codeql.yml
调整 GitHub Actions 触发条件:修改 push/pull_request 分支过滤与事件条件(工作流触发配置变更)。

Sequence Diagram(s)

sequenceDiagram
    participant Bootstrapper as ArchitectureBootstrapper
    participant Services as IServiceCollection
    participant Container as IServiceContainer (MicrosoftDiContainer)
    participant Registrar as CqrsHandlerRegistrar
    participant Registry as Generated ICqrsHandlerRegistry / Reflection

    Bootstrapper->>Services: ConfigureServices(...)
    Services->>Container: Container.RegisterCqrsHandlersFromAssemblies([archAsm, coreAsm])
    Container->>Container: Validate args, Lock, ThrowIfFrozen
    Container->>Container: Compute registration keys, deterministic sort, deduplicate per-call
    Container->>Container: Check persistent _registeredCqrsHandlerAssemblyKeys
    alt assembly not yet registered
        Container->>Registrar: RegisterHandlers(this, [assembly])
        Registrar->>Registry: Use generated registry OR fallback to reflection
        Registrar-->>Container: handlers registered
        Container->>Container: Record registration key to _registeredCqrsHandlerAssemblyKeys
    else already registered
        Container-->>Container: Log debug and skip
    end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR 标题准确地总结了变更的核心内容:扩展 CQRS 处理器注册 API 并改进文档。
Docstring Coverage ✅ Passed Docstring coverage is 89.74% which is sufficient. The required threshold is 80.00%.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch refactor/cqrs-architecture-decoupling-todo-4

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 8

🧹 Nitpick comments (1)
GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs (1)

46-52: DestroyAsync 放进 finally,保证失败路径也能清理。

当前断言失败会跳过销毁调用,建议用 try/finally 包裹初始化后的测试主体。

♻️ 建议修复
-        await architecture.InitializeAsync();
-        await architecture.Context.PublishAsync(new AdditionalAssemblyNotification());
-
-        Assert.That(AdditionalAssemblyNotificationHandler.InvocationCount, Is.EqualTo(1));
-
-        await architecture.DestroyAsync();
+        await architecture.InitializeAsync();
+        try
+        {
+            await architecture.Context.PublishAsync(new AdditionalAssemblyNotification());
+            Assert.That(AdditionalAssemblyNotificationHandler.InvocationCount, Is.EqualTo(1));
+        }
+        finally
+        {
+            await architecture.DestroyAsync();
+        }

Also applies to: 67-73

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

In
`@GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`
around lines 46 - 52, Wrap the test body that runs after calling
architecture.InitializeAsync() in a try/finally so architecture.DestroyAsync()
is always called on both success and failure; specifically, after calling
architecture.InitializeAsync(), execute the PublishAsync and the Assert inside a
try block and invoke await architecture.DestroyAsync() in the finally block
(apply the same change to the other test that contains the
InitializeAsync/PublishAsync/Assert sequence), ensuring any static state like
AdditionalAssemblyNotificationHandler.InvocationCount is still asserted but
cleanup always runs.
🤖 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/Architectures/IArchitecture.cs`:
- Around line 99-111: Add XML <exception> entries for the two public methods so
the API contract documents null-argument behavior: for
RegisterCqrsHandlersFromAssembly(Assembly assembly) add an <exception> tag
indicating it throws ArgumentNullException when assembly is null; for
RegisterCqrsHandlersFromAssemblies(IEnumerable<Assembly> assemblies) add an
<exception> tag indicating it throws ArgumentNullException when assemblies is
null (and optionally when assemblies contains null entries if implementation
enforces that). Ensure these <exception> tags are added alongside the existing
<summary> and <param> comments for the methods named
RegisterCqrsHandlersFromAssembly and RegisterCqrsHandlersFromAssemblies.

In `@GFramework.Core.Abstractions/Ioc/IIocContainer.cs`:
- Around line 112-125: The XML docs for
IIocContainer.RegisterCqrsHandlersFromAssembly and
RegisterCqrsHandlersFromAssemblies are missing <exception> tags; update the XML
comments for both methods to declare thrown exceptions (e.g., <exception
cref="System.ArgumentNullException">when the assembly or assemblies parameter is
null or contains null entries</exception> and <exception
cref="System.InvalidOperationException">when the container is disposed or not in
a valid state to register handlers</exception> and, if applicable, a specific
registration failure exception such as <exception
cref="YourNamespace.RegistrationException">for failures during
reflection/source-generator registration</exception>), keeping wording
consistent with existing doc style and including the same set of exceptions for
both overloads.

In
`@GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`:
- Around line 19-34: Store the current LoggerFactoryResolver.Provider at test
setup and restore it in TearDown to avoid leaking global logger state: in the
test class add a private field (e.g., originalLoggerProvider), assign it in
SetUp before overriding (LoggerFactoryResolver.Provider = new
ConsoleLoggerFactoryProvider()), and in TearDown set
LoggerFactoryResolver.Provider back to originalLoggerProvider before/after
calling AdditionalAssemblyNotificationHandler.Reset() and GameContext.Clear();
ensure the field is used by the TearDown method to reliably restore the
provider.
- Around line 121-133: Replace the non-atomic increment of InvocationCount with
an Interlocked-backed counter: introduce a private static int _invocationCount,
change the public InvocationCount to return _invocationCount, and update
Handle(AdditionalAssemblyNotification, CancellationToken) to call
Interlocked.Increment(ref _invocationCount); add a public Reset() method that
zeroes the counter with Interlocked.Exchange(ref _invocationCount, 0); finally
add XML doc/comments on the InvocationCount property and Reset method stating
the counter is maintained via System.Threading.Interlocked for thread-safe
access in parallel NUnit runs.

In `@GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs`:
- Around line 189-197: The two newly added public methods
RegisterCqrsHandlersFromAssembly(Assembly assembly) and
RegisterCqrsHandlersFromAssemblies(IEnumerable<Assembly> assemblies) are missing
XML documentation; add triple-slash comments including a <summary> describing
purpose, a <param name="assembly"> (and <param name="assemblies">) describing
the input, and any <exception> tags if the method throws (and <remarks> if
needed) to satisfy the repository C# doc standard; also scan nearby public
methods (the other public methods implemented in the same class) and add similar
XML docs for any missing public/protected/internal members referenced around
these methods.

In `@GFramework.Core/Architectures/ArchitectureModules.cs`:
- Around line 47-62: RegisterCqrsHandlersFromAssembly dereferences assembly
inside the logger interpolation which will produce a NullReferenceException if a
caller passes null; add a guard at the start of RegisterCqrsHandlersFromAssembly
that validates assembly != null and throws
ArgumentNullException(nameof(assembly)) before any logging or use, then call
services.Container.RegisterCqrsHandlersFromAssembly(assembly). Also add a
null-check for the enumerable in RegisterCqrsHandlersFromAssemblies (validate
assemblies != null and throw ArgumentNullException(nameof(assemblies))) to avoid
similar NREs before calling
services.Container.RegisterCqrsHandlersFromAssemblies(assemblies).

In `@GFramework.Core/Ioc/MicrosoftDiContainer.cs`:
- Around line 383-431: Add XML exception documentation to the new public methods
RegisterCqrsHandlersFromAssembly and RegisterCqrsHandlersFromAssemblies: update
their triple-slash comments to include <exception
cref="System.ArgumentNullException"> for null assembly/assemblies and <exception
cref="System.InvalidOperationException"> for the frozen-container case thrown by
ThrowIfFrozen(), and ensure <summary> and <param name="assembly|assemblies"> are
present and accurate; reference the behavior where
RegisterCqrsHandlersFromAssemblies orders and deduplicates assemblies via
GetCqrsAssemblyRegistrationKey and calls CqrsHandlerRegistrar.RegisterHandlers
so callers understand the conditions under which exceptions are thrown.
- Around line 61-65: The Clear() path currently doesn't reset the deduplication
state stored in _registeredCqrsHandlerAssemblyKeys, so subsequent registrations
for the same assembly are skipped; update the Clear() (and any equivalent
Reset/Dispose methods) in MicrosoftDiContainer to also call
_registeredCqrsHandlerAssemblyKeys.Clear() so the CQRS handler assembly-key set
is emptied when the container is cleared, ensuring handlers are re-registered
correctly.

---

Nitpick comments:
In
`@GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`:
- Around line 46-52: Wrap the test body that runs after calling
architecture.InitializeAsync() in a try/finally so architecture.DestroyAsync()
is always called on both success and failure; specifically, after calling
architecture.InitializeAsync(), execute the PublishAsync and the Assert inside a
try block and invoke await architecture.DestroyAsync() in the finally block
(apply the same change to the other test that contains the
InitializeAsync/PublishAsync/Assert sequence), ensuring any static state like
AdditionalAssemblyNotificationHandler.InvocationCount is still asserted but
cleanup always runs.
🪄 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: 89d08417-426b-4ded-bd3c-5bc4687f582f

📥 Commits

Reviewing files that changed from the base of the PR and between f59e8f7 and 4db7923.

📒 Files selected for processing (11)
  • CLAUDE.md
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/GlobalUsings.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureBootstrapper.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • docs/zh-CN/core/cqrs.md
📜 Review details
🧰 Additional context used
📓 Path-based instructions (4)
docs/**/*.md

📄 CodeRabbit inference engine (AGENTS.md)

docs/**/*.md: Update relevant README.md or docs/ page when behavior, setup steps, architecture guidance, or user-facing examples change
Keep code samples, package names, and command examples in documentation aligned with the current repository state
For integration-oriented features such as the AI-First config system, documentation MUST cover project directory layout, file conventions, required project/package wiring, minimal working usage example, and migration/compatibility notes

Files:

  • docs/zh-CN/core/cqrs.md
docs/zh-CN/**/*.md

📄 CodeRabbit inference engine (AGENTS.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

Files:

  • docs/zh-CN/core/cqrs.md
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.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 already uses a different local pattern
Keep a single source file under roughly 800-1000 lines; if a file grows beyond that range, check whether responsibilities should be split before continuing
Keep line length readable, with around 120 characters as the preferred upper bound
Prefer explicit, readable code over clever shorthand in framework internals
Match existing async patterns and naming conventions (Async suffix for asynchronous methods) in C#
Avoid hidden side effects in property getters, constructors, and ...

Files:

  • GFramework.Core/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureBootstrapper.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Abstractions/GlobalUsings.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/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureBootstrapper.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Abstractions/GlobalUsings.cs
🧠 Learnings (20)
📓 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
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Follow all coding rules defined in AGENTS.md strictly
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Core / Game / Ecs.Arch implementations must be platform-agnostic and target net8.0, net9.0, and net10.0
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Godot module code must integrate with Godot engine nodes, scenes, and lifecycle
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: SourceGenerators projects must implement Roslyn incremental source generators targeting netstandard2.1
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: IArchitecture interface must implement lifecycle management, component registration, module installation, and unified service access
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: IContextAware interface must provide SetContext(IArchitectureContext) method for components to access architecture context
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Use four-layer architecture structure: IArchitecture (container), IModel (data/state), ISystem (business logic), IUtility (stateless tools)
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Core lifecycle orchestration must include Init, Ready, and Destroy phases with fine-grained initialization and destruction stages
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Use ArchitectureLifecycle component to manage lifecycle phases, transitions, and hooks
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Use ArchitectureComponentRegistry component to manage Model, System, and Utility registration and resolution
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Use ArchitectureModules component to manage module installation, service module integration, and extension point registration
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: EventBus must support type-safe event publication, subscription, priority handling, filtering, and weak reference subscriptions
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: BindableProperty implementation must support reactive value change notifications to drive UI or business layer updates
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Coroutine system must use IYieldInstruction abstraction and support waiting for time, events, and task completion
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Use MicrosoftDiContainer wrapper around Microsoft.Extensions.DependencyInjection for unified component registration and service resolution
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Use IServiceModule pattern to register built-in services like EventBus, CommandExecutor, and QueryExecutor
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: LoggerGenerator with [Log] attribute must automatically generate log fields and helper methods
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: PriorityGenerator with [Priority] attribute must generate priority comparison implementations
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: EnumExtensionsGenerator with [GenerateEnumExtensions] attribute must generate enum extension capabilities
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: ContextAwareGenerator with [ContextAware] attribute must automatically implement IContextAware boilerplate logic
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: CqrsHandlerRegistryGenerator must generate CQRS handler registrars for consumer assemblies, with runtime fallback to reflection scanning and explicit registration via RegisterCqrsHandlersFromAssembly(s) methods
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Repository structure must separate abstractions (netstandard2.1), platform-agnostic implementations (net8.0+), Godot integration, and source generators into distinct project modules
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T03:50:30.341Z
Learning: Documentation in docs/ must include getting started, installation, module capabilities, source generator usage, tutorials, best practices, and troubleshooting
📚 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:

  • CLAUDE.md
📚 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:

  • CLAUDE.md
📚 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:

  • CLAUDE.md
📚 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 : EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute

Applied to files:

  • CLAUDE.md
📚 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/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureBootstrapper.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Abstractions/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/Architectures/ArchitectureBootstrapper.cs
  • GFramework.Core/Architectures/ArchitectureModules.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/Architectures/ArchitectureModules.cs
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.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.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Core.Abstractions/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 ArchitectureLifecycle, ArchitectureComponentRegistry, and ArchitectureModules as independent components to manage lifecycle, component registration, and module installation respectively

Applied to files:

  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.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: IArchitecture must serve as the top-level container responsible for lifecycle management, component registration, module installation, and unified service access

Applied to files:

  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.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: 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.Abstractions/Ioc/IIocContainer.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/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Ioc/MicrosoftDiContainer.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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.Core.Abstractions/GlobalUsings.cs
🪛 LanguageTool
docs/zh-CN/core/cqrs.md

[uncategorized] ~245-~245: 动词的修饰一般为‘形容词(副词)+地+动词’。您的意思是否是:相同"地"注册
Context: ...andlersFromAssemblies(...)` 会复用与默认启动路径相同的注册逻辑: 优先使用程序集级生成注册器,失败时自动回退到反射扫描;如果同一程序集...

(wb4)

🔇 Additional comments (7)
CLAUDE.md (1)

108-109: 说明补充清晰,和新注册路径语义一致。

这段更新把“默认路径 + 显式程序集接入”关系讲清楚了,能减少使用方误解。

GFramework.Core.Abstractions/GlobalUsings.cs (1)

19-20: 全局 DI using 的补充是合理的。

和 Abstractions 层对 IServiceCollection 的公开契约保持一致。

GFramework.Core/Architectures/Architecture.cs (1)

173-191: 新增 API 的分层委托设计良好。

Architecture -> ArchitectureModules 的职责边界保持一致,便于后续维护。

GFramework.Core/Architectures/ArchitectureBootstrapper.cs (1)

101-105: 启动路径切到容器统一入口是正确方向。

这样默认流程与扩展程序集接入共用同一注册机制,行为更一致。

docs/zh-CN/core/cqrs.md (1)

227-247: 文档补充到位,新增 API 的接入边界讲清楚了。

示例和行为说明(生成器优先、反射回退、重复去重)都很实用。

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

40-73: 新增用例对“显式注册 + 去重”两条关键路径覆盖充分,方向正确。

这组断言聚焦可观察行为(handler 实际执行次数),能有效保护新增 CQRS API 的回归风险。

Based on learnings, "Applies to **/*.cs : Public API changes must be covered by unit or integration tests".

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

2-2: 不存在问题。Microsoft.Extensions.DependencyInjection 命名空间已通过项目的 GlobalUsings.cs 全局提供,该文件在 Line 20 声明 global using Microsoft.Extensions.DependencyInjection;。根据仓库代码约定,核心抽象库采用这一模式统一管理命名空间导入,移除显式 using 指令是符合预期的。

			> Likely an incorrect or invalid review comment.

Comment thread GFramework.Core.Abstractions/Architectures/IArchitecture.cs
Comment thread GFramework.Core.Abstractions/Ioc/IIocContainer.cs
Comment thread GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs Outdated
Comment thread GFramework.Core/Architectures/ArchitectureModules.cs
Comment thread GFramework.Core/Ioc/MicrosoftDiContainer.cs
Comment thread GFramework.Core/Ioc/MicrosoftDiContainer.cs
@GeWuYou GeWuYou changed the title docs(core): 添加 CQRS 架构模式详细文档 feat(core): 扩展 CQRS 处理器注册 API 并完善文档 Apr 15, 2026
- 创建 Architecture 基类提供系统、模型、工具等组件的注册与管理功能
- 实现架构生命周期管理、初始化流程控制和阶段转换功能
- 添加 ArchitectureModules 模块管理器负责 CQRS 行为注册和模块安装
- 实现 MicrosoftDiContainer 依赖注入容器适配器
- 支持单例、瞬态、作用域服务注册和工厂方法注册
- 添加 CQRS 请求管道行为和处理器注册功能
- 实现线程安全的读写锁保护容器操作
- 提供服务获取、排序和优先级管理功能

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`:
- Around line 166-175: The XML doc for the public Register method is missing
<exception> entries for the ArgumentNullException it throws; update the
Register(IServiceCollection services, ILogger logger) documentation to add two
<exception> tags describing that ArgumentNullException is thrown when services
is null and when logger is null, keeping wording consistent with existing
<param> descriptions and coding guidelines so the documentation matches the
implementation.
🪄 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: 40007c29-eeed-4df1-979e-b53644b92cae

📥 Commits

Reviewing files that changed from the base of the PR and between 4db7923 and 27266d0.

📒 Files selected for processing (8)
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
🚧 Files skipped from review as they are similar to previous changes (5)
  • GFramework.Core.Abstractions/Architectures/IArchitecture.cs
  • GFramework.Core/Architectures/Architecture.cs
  • GFramework.Core/Architectures/ArchitectureModules.cs
  • GFramework.Core/Ioc/MicrosoftDiContainer.cs
  • GFramework.Core.Abstractions/Ioc/IIocContainer.cs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.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 already uses a different local pattern
Keep a single source file under roughly 800-1000 lines; if a file grows beyond that range, check whether responsibilities should be split before continuing
Keep line length readable, with around 120 characters as the preferred upper bound
Prefer explicit, readable code over clever shorthand in framework internals
Match existing async patterns and naming conventions (Async suffix for asynchronous methods) in C#
Avoid hidden side effects in property getters, constructors, and ...

Files:

  • GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
🧠 Learnings (18)
📓 Common learnings
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:39:27.946Z
Learning: Follow all coding rules strictly as defined in AGENTS.md
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:39:27.946Z
Learning: Architecture layer must implement four-tier structure: IArchitecture (container/lifecycle), IModel (data/state), ISystem (business logic), IUtility (stateless tools)
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:39:27.946Z
Learning: Module structure must separate abstractions, implementations, engine integrations, and generators as independent, replaceable layers
📚 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.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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
📚 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/Ioc/MicrosoftDiContainerTests.cs
  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/RegistryInitializationHookBaseTests.cs
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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 : Avoid hidden side effects in property getters, constructors, and registration helpers

Applied to files:

  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.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.Tests/Architectures/RegistryInitializationHookBaseTests.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.Tests/Architectures/RegistryInitializationHookBaseTests.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 : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, and edge cases

Applied to files:

  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.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 : Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling

Applied to files:

  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.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/RegistryInitializationHookBaseTests.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.Tests/Architectures/RegistryInitializationHookBaseTests.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/RegistryInitializationHookBaseTests.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: IArchitecture must serve as the top-level container responsible for lifecycle management, component registration, module installation, and unified service access

Applied to files:

  • GFramework.Core.Tests/Architectures/RegistryInitializationHookBaseTests.cs
🔇 Additional comments (5)
GFramework.Core.Tests/Ioc/MicrosoftDiContainerTests.cs (1)

315-337: 回归场景覆盖到位(Clear 后可重新注册同一程序集)。

这个测试把“首次注册 / 清空后移除 / 再注册恢复”三个关键状态都断言到了,能有效保护 CQRS 程序集去重状态重置逻辑。

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

189-207: 测试替身已同步新 API 且文档补齐完整。

这组改动让两个架构替身都覆盖了新的 CQRS 程序集注册入口,并且 XML 注释信息完整,便于后续维护与接口演进。

Also applies to: 340-358

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

19-38: 全局状态清理做得很好,避免了测试间污染。

SetUp/TearDownLoggerFactoryResolver.ProviderGameContext 与共享计数器都做了成对处理,测试隔离性明显提升。


46-89: 新增用例准确覆盖了“显式注册 + 去重”两个关键行为。

这两条用例直接验证了新 API 的核心契约,回归保护价值很高。


132-158: 并发计数器实现是线程安全的,符合并行测试场景。

这里用 Interlocked + Volatile.Read 管理共享计数状态,方向正确且稳定。

GeWuYou added 2 commits April 15, 2026 12:47
- 配置CI构建和测试工作流,支持多.NET版本和并发测试
- 添加CodeQL静态代码分析工作流
- 实现自动版本递增和标签创建工作流
- 定义CQRS命令接口规范,包括响应式和流式命令
- 为架构测试添加空值参数异常文档注释
- 移除push触发器,仅保留pull request触发CI构建测试
- 添加CodeQL静态代码分析工作流,支持安全漏洞检测
- 配置每日凌晨2点定时执行CodeQL分析
- 设置.NET 8.0.x运行时环境支持
- 启用C#语言自动构建模式进行代码扫描

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (3)
.github/workflows/auto-tag.yml (1)

21-21: 可移除 Line 21 的重复分支判断,降低维护成本。

Line 8-9 已限定 workflow_run 仅来自 main,Line 21 再判断 head_branch == 'main' 属于冗余;后续改分支名时需要改两处。

可选精简 diff
       (
         github.event_name == 'workflow_run' &&
         github.event.workflow_run.conclusion == 'success' &&
-        github.event.workflow_run.head_branch == 'main' &&
         contains(github.event.workflow_run.head_commit.message, '[release ci]')
       )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/auto-tag.yml at line 21, Remove the redundant branch check
"github.event.workflow_run.head_branch == 'main' &&" from the conditional
expression; the workflow_run trigger is already restricted to main (the earlier
workflow_run from main guard), so update the conditional used in the job/step to
drop that clause and leave the remaining predicates intact to avoid duplicated
branch checks and future double edits when renaming the main branch.
GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs (2)

111-121: 可评估复用现有架构测试基建,减少本地样板类型。

AdditionalHandlersTestArchitecture 目前只用于在 OnInitialize 注入配置;若现有测试基类能表达同等初始化钩子,建议复用统一基建以降低维护成本。

Based on learnings, **/*.Tests/*.cs should reuse existing architecture test infrastructure when relevant: ArchitectureTestsBase<T>, SyncTestArchitecture, AsyncTestArchitecture.

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

In
`@GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`
around lines 111 - 121, Replace the local AdditionalHandlersTestArchitecture
type with the shared test infrastructure by inheriting from the existing
ArchitectureTestsBase<T> (or one of SyncTestArchitecture/AsyncTestArchitecture)
and moving the configure delegate into the base override; specifically, remove
the sealed AdditionalHandlersTestArchitecture class and instead create the test
fixture using ArchitectureTestsBase<T> (or
SyncTestArchitecture/AsyncTestArchitecture) and implement OnInitialize there to
call the provided configure(Action) so you reuse the common test setup and avoid
a one-off local type.

69-76: 建议加强去重用例:使用“不同实例但相同程序集标识”验证去重键语义。

当前用例重复注册的是同一个 Mock<Assembly> 实例;可再覆盖“两个不同 Assembly 实例但 FullName 相同”的场景,更直接锁定按程序集键去重的行为。

💡 建议补丁
 [Test]
 public async Task RegisterCqrsHandlersFromAssembly_Should_Deduplicate_Repeated_Assembly_Registration()
 {
-    var generatedAssembly = CreateGeneratedHandlerAssembly();
+    var generatedAssemblyA = CreateGeneratedHandlerAssembly();
+    var generatedAssemblyB = CreateGeneratedHandlerAssembly();
     var architecture = new AdditionalHandlersTestArchitecture(target =>
     {
-        target.RegisterCqrsHandlersFromAssembly(generatedAssembly.Object);
-        target.RegisterCqrsHandlersFromAssemblies([generatedAssembly.Object]);
+        target.RegisterCqrsHandlersFromAssembly(generatedAssemblyA.Object);
+        target.RegisterCqrsHandlersFromAssemblies([generatedAssemblyB.Object]);
     });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`
around lines 69 - 76, Update the test
RegisterCqrsHandlersFromAssembly_Should_Deduplicate_Repeated_Assembly_Registration
to exercise deduplication by assembly identity rather than mock instance: create
two distinct Assembly instances/mocks via CreateGeneratedHandlerAssembly (or a
second mock) and set both to return the same FullName, then call
target.RegisterCqrsHandlersFromAssembly(firstAssembly) and
target.RegisterCqrsHandlersFromAssemblies(new[] { secondAssembly }) and assert
handlers are not duplicated; this verifies AdditionalHandlersTestArchitecture’s
RegisterCqrsHandlersFromAssembly/RegisterCqrsHandlersFromAssemblies deduplicates
by assembly identifier (FullName) rather than object reference.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In @.github/workflows/auto-tag.yml:
- Line 21: Remove the redundant branch check
"github.event.workflow_run.head_branch == 'main' &&" from the conditional
expression; the workflow_run trigger is already restricted to main (the earlier
workflow_run from main guard), so update the conditional used in the job/step to
drop that clause and leave the remaining predicates intact to avoid duplicated
branch checks and future double edits when renaming the main branch.

In
`@GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`:
- Around line 111-121: Replace the local AdditionalHandlersTestArchitecture type
with the shared test infrastructure by inheriting from the existing
ArchitectureTestsBase<T> (or one of SyncTestArchitecture/AsyncTestArchitecture)
and moving the configure delegate into the base override; specifically, remove
the sealed AdditionalHandlersTestArchitecture class and instead create the test
fixture using ArchitectureTestsBase<T> (or
SyncTestArchitecture/AsyncTestArchitecture) and implement OnInitialize there to
call the provided configure(Action) so you reuse the common test setup and avoid
a one-off local type.
- Around line 69-76: Update the test
RegisterCqrsHandlersFromAssembly_Should_Deduplicate_Repeated_Assembly_Registration
to exercise deduplication by assembly identity rather than mock instance: create
two distinct Assembly instances/mocks via CreateGeneratedHandlerAssembly (or a
second mock) and set both to return the same FullName, then call
target.RegisterCqrsHandlersFromAssembly(firstAssembly) and
target.RegisterCqrsHandlersFromAssemblies(new[] { secondAssembly }) and assert
handlers are not duplicated; this verifies AdditionalHandlersTestArchitecture’s
RegisterCqrsHandlersFromAssembly/RegisterCqrsHandlersFromAssemblies deduplicates
by assembly identifier (FullName) rather than object reference.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 4b9b25fe-a38c-4cee-b57b-489253395fdd

📥 Commits

Reviewing files that changed from the base of the PR and between 27266d0 and 0cd1e9e.

📒 Files selected for processing (4)
  • .github/workflows/auto-tag.yml
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
✅ Files skipped from review due to trivial changes (1)
  • .github/workflows/codeql.yml
📜 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). (4)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.cs

📄 CodeRabbit inference engine (AGENTS.md)

**/*.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 already uses a different local pattern
Keep a single source file under roughly 800-1000 lines; if a file grows beyond that range, check whether responsibilities should be split before continuing
Keep line length readable, with around 120 characters as the preferred upper bound
Prefer explicit, readable code over clever shorthand in framework internals
Match existing async patterns and naming conventions (Async suffix for asynchronous methods) in C#
Avoid hidden side effects in property getters, constructors, and ...

Files:

  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
🧠 Learnings (7)
📓 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
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:48:05.671Z
Learning: Follow all coding rules defined in AGENTS.md strictly
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:48:05.671Z
Learning: Core / Game / ECS.Arch implementation projects must be platform-agnostic with target frameworks net8.0, net9.0, net10.0
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:48:05.671Z
Learning: IModel components must be responsible for long-term state and business data modeling, not business logic
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:48:05.671Z
Learning: ISystem components must handle command execution, process orchestration, and rule implementation, not data storage
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:48:05.671Z
Learning: IUtility components must be stateless tools for reuse across other layers
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:48:05.671Z
Learning: Module structure must follow abstraction layer + implementation layer + integration layer + generator layer organization with clear separation of concerns
📚 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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
🔇 Additional comments (4)
.github/workflows/ci.yml (1)

7-9: 触发范围调整与目标一致,配置正确。

push/pull_request 都放开到所有分支,和本次“全分支 CI”目标一致,语义也清晰。

.github/workflows/auto-tag.yml (1)

8-9: auto-tag 的主分支门控逻辑合理。

workflow_run 限制在 main,并叠加“CI 成功 + 提交信息包含 [release ci]”条件,能有效避免误打标签。

Also applies to: 19-28

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

19-38: 全局测试状态的初始化与回收实现稳健。

SetUp/TearDownLoggerFactoryResolver.ProviderGameContext 和计数器的处理完整,能有效降低测试间污染风险。


132-158: 并发计数器实现与说明清晰,符合并行测试场景。

Volatile.Read + Interlocked 的组合保证了可见性与原子性,且注释说明到位。

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.github/workflows/ci.yml:
- Around line 6-7: The TruffleHog step is still using github.event.before (and
possibly github.event.after) which are undefined for pull_request events; update
the workflow to read the PR commit SHAs from github.event.pull_request.base.sha
and github.event.pull_request.head.sha instead. Locate the TruffleHog-related
step/inputs in the ci.yml (e.g., any step that references
github.event.before/github.event.after) and replace those with
github.event.pull_request.base.sha and github.event.pull_request.head.sha so the
scanner receives valid base/head values for PR-triggered runs. Ensure any
variable names or environment inputs passed into the TruffleHog job (step names
like the TruffleHog job or input keys) are updated consistently.
🪄 Autofix (Beta)

❌ Autofix failed (check again to retry)

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: 16e61823-0e36-4375-aff1-b68ca20c4c9e

📥 Commits

Reviewing files that changed from the base of the PR and between 0cd1e9e and 340b6ca.

📒 Files selected for processing (2)
  • .github/workflows/ci.yml
  • .github/workflows/codeql.yml
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/codeql.yml
📜 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
🧠 Learnings (1)
📓 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
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:53:34.002Z
Learning: Module dependency graph must follow the documented structure: GFramework.Core → Core.Abstractions; GFramework.Game → Game.Abstractions + Core + Core.Abstractions; GFramework.Godot → Core + Game + Core.Abstractions + Game.Abstractions; GFramework.Ecs.Arch → Ecs.Arch.Abstractions + Core + Core.Abstractions; GFramework.SourceGenerators → SourceGenerators.Common + SourceGenerators.Abstractions
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:53:34.002Z
Learning: Use Architecture / Model / System / Utility four-layer structure pattern for framework core design
🔇 Additional comments (1)
.github/workflows/ci.yml (1)

2-2: 触发策略注释与配置一致,便于维护。

Line 2 的说明和当前 PR 触发策略匹配,降低了后续维护时的理解成本。

Comment thread .github/workflows/ci.yml
- 移除自定义测试架构类,改用现有的 SyncTestArchitecture
- 将 RegisterCqrsHandlersFromAssembly 测试方法中的架构创建逻辑提取为统一方法
- 更新重复程序集注册去重测试,验证不同 Assembly 实例但相同程序集键的情况
- 简化测试架构初始化逻辑,使用 AddPostRegistrationHook 替代自定义配置
- 调整注释文档以反映新的测试架构创建方式
- 移除 GitHub 工作流中对 main 分支的限制条件
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

An unexpected error occurred while generating fixes: Resource not accessible by integration - https://docs.github.com/rest/git/trees#create-a-tree

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 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/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs`:
- Around line 42-47: The public async test method
RegisterCqrsHandlersFromAssembly_Should_Register_Handlers_From_Explicit_Assembly
(and the other public async test at lines 65-70) are missing the required XML
<returns> documentation; add a <returns> XML comment to each method that
succinctly states it returns a Task and describes the asynchronous test
execution (e.g., "The asynchronous test task."). Ensure the <returns> tag is
placed alongside the existing /// <summary> comment for those methods to satisfy
the project's XML documentation rules.
🪄 Autofix (Beta)

✅ Autofix completed


ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 94dbd028-0d1a-464b-a82d-075860726c70

📥 Commits

Reviewing files that changed from the base of the PR and between 340b6ca and 49df81e.

📒 Files selected for processing (2)
  • .github/workflows/auto-tag.yml
  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/auto-tag.yml
📜 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 (AGENTS.md)

**/*.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 already uses a different local pattern
Keep a single source file under roughly 800-1000 lines; if a file grows beyond that range, check whether responsibilities should be split before continuing
Keep line length readable, with around 120 characters as the preferred upper bound
Prefer explicit, readable code over clever shorthand in framework internals
Match existing async patterns and naming conventions (Async suffix for asynchronous methods) in C#
Avoid hidden side effects in property getters, constructors, and ...

Files:

  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
🧠 Learnings (7)
📓 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
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Follow all coding rules defined in AGENTS.md
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Abstractions projects should only contain interfaces and contract definitions, not carry runtime implementation logic
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Core / Game / Ecs.Arch projects should contain platform-independent core implementation
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Godot integration layer should handle integration with Godot nodes, scenes, and engine lifecycle
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: SourceGenerators projects should provide Roslyn incremental source code generators and common infrastructure
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Architecture implementations must manage lifecycle phases (Init, Ready, Destroy) and ensure ordering consistency across Utility, Model, System, service modules, and hooks
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Source Generator [Log] attribute should automatically generate log fields and logging helper methods
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Source Generator [Priority] attribute should generate priority comparison implementations
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Source Generator [GenerateEnumExtensions] attribute should generate enumeration extension capabilities
Learnt from: CR
URL: 
File: CLAUDE.md:undefined-undefined
Timestamp: 2026-04-15T04:59:46.594Z
Learning: Source Generator [ContextAware] attribute should automatically implement IContextAware boilerplate logic
📚 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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.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/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs
🔇 Additional comments (2)
GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs (2)

114-118: 测试基建复用做得很好。

这里复用了 SyncTestArchitecture 并通过 AddPostRegistrationHook 注入注册逻辑,测试关注点清晰,避免了重复搭建架构样板代码。

Based on learnings, "Applies to **/.Tests/.cs : Reuse existing architecture test infrastructure when relevant: ArchitectureTestsBase<T>, SyncTestArchitecture, AsyncTestArchitecture".


69-90: 去重场景覆盖有效,断言粒度正确。

通过两个不同 Assembly 实例但相同程序集键来验证去重,并以可观察行为(只触发一次 handler)断言,测试设计扎实。

@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

Fixes Applied Successfully

Fixed 1 file(s) based on 1 unresolved review comment.

Files modified:

  • GFramework.Core.Tests/Architectures/ArchitectureAdditionalCqrsHandlersTests.cs

Commit: 2329cba3a604f2d3340b3b53d6dc570359b2f972

The changes have been pushed to the refactor/cqrs-architecture-decoupling-todo-4 branch.

Time taken: 2m 12s

Fixed 1 file(s) based on 1 unresolved review comment.

Co-authored-by: CodeRabbit <noreply@coderabbit.ai>
@coderabbitai

coderabbitai Bot commented Apr 15, 2026

Copy link
Copy Markdown
Contributor

Note

Autofix is a beta feature. Expect some limitations and changes as we gather feedback and continue to improve it.

An unexpected error occurred while generating fixes: Resource not accessible by integration - https://docs.github.com/rest/git/trees#create-a-tree

- 将基础提交哈希从 github.event.before 更新为 github.event.pull_request.base.sha
- 将当前提交哈希从 github.sha 更新为 github.event.pull_request.head.sha
- 确保PR工作流正确比较基线和目标分支的差异
@GeWuYou GeWuYou merged commit 3dbe105 into refactor/cqrs-architecture-decoupling Apr 15, 2026
5 checks passed
@GeWuYou GeWuYou deleted the refactor/cqrs-architecture-decoupling-todo-4 branch April 15, 2026 05:21
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