Skip to content

Feat/Add stream invoker provider support to CQRS handler registry generator#307

Merged
GeWuYou merged 14 commits into
mainfrom
feat/cqrs-optimization
May 1, 2026
Merged

Feat/Add stream invoker provider support to CQRS handler registry generator#307
GeWuYou merged 14 commits into
mainfrom
feat/cqrs-optimization

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Apr 30, 2026

Summary by CodeRabbit

发布说明

  • 新功能

    • 支持流式请求的编译期描述符与生成的流调用器提供者,运行时优先使用生成的请求/流描述符以加速分发并保留反射回退
    • 新增面向流处理的描述符与提供者契约以便注册与枚举生成元数据
  • 修复与改进

    • 强化描述符构造与运行时绑定的校验与错误处理,减少不兼容元数据导致的隐性故障
  • 文档

    • 更新 README 与文档,说明生成器/运行时的请求与流调用器优先级与回退行为
  • 测试

    • 扩展单元测试,覆盖生成器发射、隐藏实现场景、回退与错误路径验证

GeWuYou added 11 commits April 30, 2026 13:14
- 更新 CQRS runtime 与生成器文档,补充 generated stream invoker provider / descriptor 的并列表述。

- 说明 runtime 优先消费 generated request / stream invoker 元数据,未命中时回退到既有反射 binding。

- 调整 request-only 措辞,使 reader-facing 文案与现有 generated request invoker 语义保持一致。
- 新增 stream invoker provider runtime fixture,复用 request provider 测试风格锁定 descriptor 和静态 invoker 形状

- 补充 Phase 8 stream invoker provider 回归测试骨架,并暂时以 Ignore 挂起等待主线程生成实现落地
- 新增 stream invoker provider、descriptor 与 dispatcher/registrar 接线

- 更新 source generator 与回归测试,覆盖 generated stream invoker 发射和消费语义

- 更新 CQRS 文档与 ai-plan 恢复点,补充 stream invoker 的接入与验证记录
- 新增 hidden implementation 但 visible handler interface 的 request provider 生成断言

- 新增 hidden implementation 但 visible handler interface 的 stream provider 生成断言
- 扩大 request 与 stream invoker 发射范围到 reflected-implementation 注册场景

- 补充 hidden implementation 回归测试并更新 CQRS ai-plan 恢复点
- 新增 hidden implementation request provider runtime 集成回归,验证 registrar 与 dispatcher 会继续消费 generated metadata

- 新增 hidden implementation stream provider runtime 集成回归,覆盖可见 handler interface 下的流式 dispatch 路径

- 补充对应测试替身 registry 与隐藏 handler 容器,保持现有 generated invoker 测试风格
- 更新 CQRS 重写跟踪到 RP-070,补充 hidden-implementation generated invoker runtime 回归说明

- 补充本轮定向验证结果与当前相对 origin/main 的 branch diff 指标
- 新增 request 与 stream generator 回归,明确 precise reflected 注册不会发射 invoker provider 元数据

- 更新 CQRS 重写恢复点到 RP-071,并记录本轮验证与边界结论
- 新增 request 与 stream gate 回归,锁定 runtime 合同不完整时不会发射 invoker provider 元数据

- 更新 CQRS 重写恢复点到 RP-072,并记录定向验证与 helper 收敛
- 修复 request 与 stream generated invoker 签名不兼容时冒出 ArgumentException 的行为,统一包装为 InvalidOperationException

- 补充对应 runtime 回归测试并更新 CQRS 重写恢复点到 RP-073
- 新增 non-enumerating request 与 stream provider 回归,锁定 dispatcher 会继续回退到反射路径

- 更新 CQRS 重写恢复点到 RP-074,并记录定向验证结果
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a7c5af52-b12a-4e26-93f7-e7db907dcb89

📥 Commits

Reviewing files that changed from the base of the PR and between 9296def and 26314db.

📒 Files selected for processing (3)
  • ai-plan/public/cqrs-rewrite/archive/traces/cqrs-rewrite-history-rp062-through-rp076.md
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
✅ Files skipped from review due to trivial changes (1)
  • ai-plan/public/cqrs-rewrite/archive/traces/cqrs-rewrite-history-rp062-through-rp076.md
📜 Recent review details
🧰 Additional context used
📓 Path-based instructions (2)
ai-plan/public/*/todos/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/public/*/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for boot to locate the current recovery point quickly
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
🧠 Learnings (11)
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for `boot` to locate the current recovery point quickly

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery document under `ai-plan/public/<topic>/todos/` before making substantive code changes

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under `ai-plan/public/<topic>/todos/` in the same change

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active `todos/` and `traces/` entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/README.md : When a worktree-to-topic mapping changes, or when a topic becomes active/inactive, contributors MUST update `ai-plan/public/README.md` in the same change

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/traces/** : Contributors MUST maintain a matching execution trace under `ai-plan/public/<topic>/traces/` for complex work, recording the current date, key decisions, validation milestones, and the immediate next step

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/Cqrs/**/*.cs : Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias

Applied to files:

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

[uncategorized] ~15-~15: 您的意思是“"不"齐”?
Context: ...前移已扩展到 request / stream 路径,当前 RP-076 已补齐 stream invoker provider gate 的四项 runti...

(BU)


[uncategorized] ~44-~44: 您的意思是“"不"同”?
Context: ...quest 侧是否存在与 stream gate 对称的生成合同遗漏,再决定是否补同批 generator 回归 3. 在进入下一批 runtime / gene...

(BU)

🔇 Additional comments (2)
ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md (1)

10-60: LGTM - 恢复文档已正确收敛为单一入口!

该跟踪文档现在完全符合编码规范的要求:

  • ✅ 单一恢复锚点(RP-076PR Feat/Add stream invoker provider support to CQRS handler registry generator #307``)清晰明确
  • ✅ 当前活跃事实聚焦于本轮验证结果,不再堆叠历史阶段
  • ✅ 活跃风险、权威验证与下一步骤简洁可执行
  • ✅ 归档指针(L51-52)正确指向历史细节,保持可追溯性
  • ✅ 说明区(L57-60)明确了 active 文档定位

文档结构现在能够让 boot 快速定位当前恢复点,而不会陷入历史流水账,完美符合"recovery entrypoint"的设计意图。

基于编码规范:"Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for boot to locate the current recovery point quickly" 以及 "When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files"。

ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md (1)

5-32: LGTM - trace 文档与 tracking 保持同步且符合规范!

该执行追踪文档正确维护了复杂工作的关键信息:

  • ✅ 记录当前日期(2026-04-30)与阶段(RP-076)
  • ✅ 捕获关键决策(收敛为单一 active 入口、归档历史细节)
  • ✅ 记录验证里程碑(PR review 脚本、Release 构建、targeted stream invoker 测试)
  • ✅ 明确下一步骤(3 项具体行动)
  • ✅ 与 tracking 文档保持一致(恢复点、验证命令、下一步均对齐)

trace 现在作为与 tracking 配对的恢复入口,同时提供了执行历程的当前快照而非完整流水账,符合"matching execution trace for complex work"的要求。

基于编码规范:"Contributors MUST maintain a matching execution trace under ai-plan/public/<topic>/traces/ for complex work, recording the current date, key decisions, validation milestones, and the immediate next step" 以及 "Active tracking and trace files are recovery entrypoints, not append-only changelogs"。


📝 Walkthrough

Walkthrough

在源生成器与运行时中并行引入“流式调用程序”支持:新增流描述符/条目与提供者/枚举契约,生成器可发射静态桥接方法与描述符数组;注册器/调度器在激活阶段预热并优先使用这些生成的流调用程序元数据;测试与文档同步更新。

Changes

Cohort / File(s) Summary
源生成器:模型
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
新增 StreamInvokerRegistrationSpec / StreamInvokerEmissionSpec;在注册规格与生成形状中加入可选流调用程序数据与能力标志(Supports/HasStreamInvokerProvider)。
源生成器:发射
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
新增流发射路径(CreateStreamInvokerEmissions);条件实现 ICqrsStreamInvokerProvider/IEnumeratesCqrsStreamInvokerDescriptors;生成流描述符数组、TryGetDescriptor、静态桥接方法(InvokeStreamHandler{n});调整请求调用程序相关泛型限定与 GetDescriptors 实现。
源生成器:核心检测/环境
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
检测流提供者运行时契约;在构建注册规范时提取并携带流处理器签名信息;GenerationEnvironment 新增流提供能力标志以驱动条件发射。
源生成器测试 & 辅助
GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
扩展测试以覆盖流/隐藏实现/精确反射边界;新增辅助生成器输入修改器;验证在缺少运行时契约时跳过发射。
运行时:流描述符与契约(公共 API)
GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs, GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs, GFramework.Cqrs/ICqrsStreamInvokerProvider.cs, GFramework.Cqrs/IEnumeratesCqrsStreamInvokerDescriptors.cs
新增流描述符类型与条目,以及流调用程序提供者与描述符枚举接口,用于注册与查找生成的流元数据。
运行时:调度器与描述符处理
GFramework.Cqrs/Internal/CqrsDispatcher.cs
新增卸载安全的生成流调用程序缓存与内部流调用程序记录;CreateStreamDispatchBinding 优先使用生成描述符,缺失时回退反射;为委托创建增加异常包装与更明确的错误传播。
运行时:注册器
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
激活生成注册表时检测并注册 ICqrsStreamInvokerProvider,枚举并预写入流描述符到 Dispatcher 缓存,条件性将提供者注册为 DI 单例。
请求调用程序描述符微更改
GFramework.Cqrs/CqrsRequestInvokerDescriptor.cs, GFramework.Cqrs/CqrsRequestInvokerDescriptorEntry.cs
将 invoker 方法验证提前到描述符构造(ValidateInvokerMethod);请求描述符条目改为显式构造并做空检查。
测试:运行时行为与示例
GFramework.Cqrs.Tests/...
(CqrsGeneratedRequestInvokerProviderTests.cs, GeneratedStreamInvokerProviderRegistry.cs, GeneratedStreamInvokerRequest*.cs, HiddenImplementation*.cs, 等)
新增/扩展大量测试工件以覆盖生成的流描述符注册、隐藏实现场景、失败边界(非静态/签名不兼容)、以及调度器优先使用生成描述符的消费路径。
文档与迁移记录
GFramework.Cqrs.SourceGenerators/README.md, GFramework.Cqrs/README.md, docs/zh-CN/core/cqrs.md, docs/zh-CN/source-generators/cqrs-handler-registry-generator.md, ai-plan/...
更新生成器与运行时文档以记录生成请求/流调用程序提供者行为、优先级与回退语义;更新迁移跟踪与验证记录。

Sequence Diagram(s)

sequenceDiagram
    participant Generator as 源代码生成器
    participant GeneratedRegistry as 生成的注册表
    participant Registrar as CqrsHandlerRegistrar
    participant DI as 容器/服务
    participant Dispatcher as CqrsDispatcher
    participant Consumer as 调用端

    Generator->>GeneratedRegistry: 生成注册表类并注入流描述符数组\n与静态 InvokeStreamHandler 方法
    Registrar->>GeneratedRegistry: 激活并调用 Register(services, logger)
    GeneratedRegistry->>DI: 注册处理程序服务
    GeneratedRegistry-->>Registrar: 返回流描述符枚举 (GetDescriptors)
    Registrar->>Dispatcher: 预热并注册生成的流描述符
    Consumer->>Dispatcher: CreateStream(requestType, responseType)
    alt 生成描述符命中
        Dispatcher->>Dispatcher: TryGetGeneratedStreamInvokerDescriptor -> 构建 StreamInvoker 委托
        Dispatcher-->>Consumer: 返回由生成静态方法驱动的 IAsyncEnumerable<T>
    else 未命中
        Dispatcher->>Dispatcher: 使用反射创建流调用程序描述符
        Dispatcher-->>Consumer: 返回反射路径生成的 IAsyncEnumerable<T>
    end
Loading

代码审查工作量估计

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

可能相关的 PR

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed PR标题清晰准确地概括了主要变更:向CQRS处理器注册表生成器添加流调用程序提供程序支持。标题与整个变更集的核心目标完全相关。
Docstring Coverage ✅ Passed Docstring coverage is 94.02% which is sufficient. The required threshold is 80.00%.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

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

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

❤️ Share
Review rate limit: 0/1 reviews remaining, refill in 60 minutes.

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

@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2235    ↑21 2235    ↑21 0 0 0 0 35.5s    ↓2.9s

Test Results

passed 2235 passed ↑21

Details

tests 2235 tests ↑21
clock 35.5s ↓2.9s
tool nunit
build CI - Build & Test arrow-right build-and-test link #1021
pull-request Feat/cqrs optimization link #307

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2157 0 0 30.0s

build-and-test: Run #1021

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
Flush_ShouldWaitForAllEntriesToBeProcessed 18 1.7s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 18 3.4s 4.7s
CreateStream_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 3 4.5s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 18 2.1s 2.2s
Generates_Scene_Behavior_Boilerplate 18 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 18 1.1s 1.1s
Append_ShouldNotBlock 18 1.0s 1.0s
Context_Caching_Should_Improve_Performance 18 785ms 799ms
PendingCount_ShouldReflectQueuedEntries 18 501ms 502ms
Cleanup_Should_NotRemoveActiveLocks 18 404ms 405ms

± Comparison with run #1018 at 7437bda | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 18 runs.

Github Test Reporter by CTRF 💚

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 30, 2026

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ CSHARP dotnet-format yes 1 no 5.45s
✅ REPOSITORY gitleaks yes no no 7.7s
✅ REPOSITORY trufflehog yes no no 6.21s

Detailed Issues

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

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

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

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

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

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented Apr 30, 2026

Greptile Summary

This PR extends the CQRS handler registry source generator and runtime dispatcher to support compile-time stream invoker provider metadata, mirroring the existing request invoker provider pattern. The source generator emits InvokeStreamHandlerN bridge methods and a StreamInvokerDescriptors array; the registrar pre-warms the static GeneratedStreamInvokers cache at startup so CreateStreamDispatchBinding can bypass reflection on the hot path.

  • P1: NonStaticRequestInvokerProviderRegistry.GetDescriptors() and NonStaticStreamInvokerProviderRegistry.GetDescriptors() both construct descriptors with non-static methods. The new ValidateInvokerMethod guard throws ArgumentException at construction time, propagating through RegisterHandlers with no try-catch, causing two fallback tests to crash during setup rather than demonstrating graceful fallback.

Confidence Score: 4/5

Core runtime and source generator logic is sound; two test fixtures for the non-static fallback scenario are broken by the new descriptor constructor validation and will cause test failures.

The production code path is implemented correctly and mirrors the proven request invoker pattern. The P1 finding is confined to the test layer: two GetDescriptors() implementations construct descriptors with non-static methods, which the new constructor guard rejects at registration time rather than dispatch time, breaking two fallback tests.

GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs – NonStaticRequestInvokerProviderRegistry.GetDescriptors and NonStaticStreamInvokerProviderRegistry.GetDescriptors need to either return empty lists or not construct descriptors with non-static methods.

Important Files Changed

Filename Overview
GFramework.Cqrs/Internal/CqrsDispatcher.cs Adds static GeneratedStreamInvokers cache and CreateStreamDispatchBinding fast-path that consumes pre-registered stream invoker metadata; mirrors the existing request invoker pattern cleanly with proper fallback logic.
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs Adds RegisterGeneratedStreamInvokerProvider and RegisterGeneratedStreamInvokerDescriptors following the established request invoker provider pattern.
GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs New descriptor type mirroring CqrsRequestInvokerDescriptor; validates non-null and static constraint on invokerMethod at construction time.
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs Adds CreateStreamInvokerEmissions and AppendStreamInvokerProviderMembers emitting InvokeStreamHandlerN methods matching the StreamInvoker delegate signature.
GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs Two test fixtures construct descriptor objects with non-static methods, which the new constructor validation throws on, causing RegisterHandlers to fail before fallback is attempted.
GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerProviderRegistry.cs Well-structured test registry; InvokeGenerated is correctly static and matches the StreamInvoker delegate.

Sequence Diagram

sequenceDiagram
    participant App
    participant Registrar as CqrsHandlerRegistrar
    participant Registry as GeneratedRegistry
    participant Dispatcher as CqrsDispatcher
    participant Cache as GeneratedStreamInvokers
    participant StreamCache as StreamDispatchBindings

    Note over App,StreamCache: Registration phase
    App->>Registrar: RegisterHandlers(services, assembly)
    Registrar->>Registry: registry.Register(services, logger)
    Registrar->>Registry: GetDescriptors()
    Registry-->>Registrar: [CqrsStreamInvokerDescriptorEntry]
    loop each descriptor entry
        Registrar->>Dispatcher: RegisterGeneratedStreamInvokerDescriptor
        Dispatcher->>Cache: GetOrAdd(reqType, respType, metadata)
    end
    Note over App,StreamCache: Dispatch phase
    App->>Dispatcher: CreateStream(context, request)
    Dispatcher->>StreamCache: GetOrAdd(reqType, respType, factory)
    StreamCache-->>Dispatcher: miss
    Dispatcher->>Cache: TryGetValue(reqType, respType)
    alt Generated metadata found
        Cache-->>Dispatcher: GeneratedStreamInvokerMetadata
        Dispatcher-->>StreamCache: StreamDispatchBinding(generatedInvoker)
    else Not found
        Dispatcher->>Dispatcher: CreateStreamInvoker (reflection)
        Dispatcher-->>StreamCache: StreamDispatchBinding(reflectionInvoker)
    end
    Dispatcher->>App: IAsyncEnumerable
Loading
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs:394-414
**Non-static invoker test fixture will throw during `RegisterHandlers`**

`NonStaticRequestInvokerProviderRegistry.GetDescriptors()` constructs `new CqrsRequestInvokerDescriptor(…, instanceMethod)`. The new `ValidateInvokerMethod` guard added to `CqrsRequestInvokerDescriptor` in this PR throws `ArgumentException` when `!invokerMethod.IsStatic`. This exception propagates from `GetDescriptors()``RegisterGeneratedRequestInvokerDescriptors``RegisterHandlers` with no surrounding try-catch, so the test `SendAsync_Should_Fall_Back_To_Runtime_Path_When_Generated_Request_Invoker_Is_Not_Static` crashes at `CqrsTestRuntime.RegisterHandlers(...)` before the dispatch even runs, rather than falling back gracefully to the runtime path. The same problem exists for `NonStaticStreamInvokerProviderRegistry.GetDescriptors()` and the corresponding stream test.

### Issue 2 of 2
GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs:518-537
**Same non-static constructor throw for stream non-static fixture**

`NonStaticStreamInvokerProviderRegistry.GetDescriptors()` creates `new CqrsStreamInvokerDescriptor(…, instanceMethod)`. `CqrsStreamInvokerDescriptor.ValidateInvokerMethod` throws `ArgumentException` for non-static methods, propagating through `RegisterHandlers`. The test `CreateStream_Should_Fall_Back_To_Runtime_Path_When_Generated_Stream_Invoker_Is_Not_Static` would fail at the `RegisterHandlers` call with an unhandled exception instead of demonstrating the expected fallback.

Reviews (4): Last reviewed commit: "docs(cqrs-rewrite): 收敛恢复入口文档" | Re-trigger Greptile

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

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

Inline comments:
In `@ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md`:
- Line 10: Update the migration tracking so the active facts and recovery anchor
reflect the new PR state: add a concise entry noting PR `#307`’s current status,
validation conclusions, any newly discovered issues, completed work, and the
next recommended recovery point (replacing the outdated PR `#305` reference);
specifically edit the section that mentions "恢复点编号:`CQRS-REWRITE-RP-074`" and
the "active 事实区" to include PR `#307` verification results and recommended next
steps so the tracking follows the rule to record completed work, discovered
issues, validation results, and next recovery point.
- Around line 271-318: The active migration-tracking document currently contains
an extended sequence of per-command validation logs (e.g. the repeated "dotnet
build GFramework.Cqrs.SourceGenerators..." and many "dotnet test
GFramework.SourceGenerators.Tests..." / "dotnet test GFramework.Cqrs.Tests..."
entries); trim this active section down to a single concise "latest
authoritative validation batch" entry plus a short conclusion sentence, then
move the full command-level history into a separate archive file (or an
"Archive" subsection) and replace the removed content with a clear archive
pointer (one-line path or link) and a one-line summary of overall results;
preserve the final pass/fail counts and any critical notes (e.g. MSB3026 noise)
in the archive so the active document remains a compact recovery entrypoint.

In `@docs/zh-CN/core/cqrs.md`:
- Around line 168-170: Update the doc text to reflect actual behavior: explain
that CqrsDispatcher.CreateRequestInvokerDescriptor and
CreateStreamInvokerDescriptor will throw InvalidOperationException on
incompatible generated metadata rather than silently falling back, so change the
phrase “生成注册器不可用或元数据异常时记录告警并回退到反射路径” to indicate that only when a generated
descriptor is not found (未命中 generated descriptor) will the runtime fall back to
reflection, and note that incompatible metadata causes an exception
(InvalidOperationException) instead of a silent downgrade.
- Line 239: Replace the table's first-column text that currently exposes the raw
path "GFramework.Cqrs 根入口与 Internal/" with a semantic label such as
"运行时入口与内部协作层" (or similar reader-facing phrase), leaving the second column
unchanged so it still lists the concrete types CqrsRuntimeFactory,
ICqrsHandlerRegistry, CqrsHandlerRegistryAttribute,
CqrsReflectionFallbackAttribute, ICqrsRequestInvokerProvider, and
ICqrsStreamInvokerProvider; update the table row that mentions GFramework.Cqrs
and Internal/ so the first cell is the semantic navigation label and the second
cell retains the type names (ensuring the reader sees friendly navigation text
while concrete types remain in the details column).

In `@GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs`:
- Around line 188-226: Add two negative-regression tests that cover the case
where the enumerating provider interfaces exist but return an empty collection
from GetDescriptors(): create tests
SendAsync_Should_Fall_Back_To_Runtime_Path_When_Request_Provider_Returns_Empty_Descriptors
and
CreateStream_Should_Fall_Back_To_Runtime_Path_When_Stream_Provider_Returns_Empty_Descriptors
that mirror the existing NonEnumerating* tests but use generated registries
whose GetDescriptors() returns an empty enumerable (i.e., implements
IEnumeratesCqrsRequestInvokerDescriptors /
IEnumeratesCqrsStreamInvokerDescriptors and yields no descriptors), then
register handlers via CqrsTestRuntime.RegisterHandlers, Freeze the container,
send the GeneratedRequestInvokerRequest and drain the
GeneratedStreamInvokerRequest and assert the responses are the runtime fallbacks
("runtime:payload" and [3,4]) to ensure dispatcher falls back to the
runtime/reflective path when descriptors are present but empty.

In
`@GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs`:
- Around line 35-67: Register and TryGetDescriptor are public and can throw on
null inputs but lack <exception> XML comments; add <exception> tags to both
method XML docs: for Register(...) document ArgumentNullException thrown when
services or logger is null (matching the ArgumentNullException.ThrowIfNull
calls), and for TryGetDescriptor(...) document ArgumentNullException for null
requestType/responseType (or explicitly state no exceptions if you choose not to
validate), and include any other runtime exceptions that may be observable so
the XML docs for Register and TryGetDescriptor accurately reflect thrown
exceptions.

In `@GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs`:
- Around line 18-30: The constructor of CqrsStreamInvokerDescriptor currently
only null-checks invokerMethod; update the descriptor to validate that the
provided MethodInfo (InvokerMethod) is a static method and fail fast if it is
not by throwing an ArgumentException (or similar) with a clear message;
specifically, inside the CqrsStreamInvokerDescriptor(...) constructor check
invokerMethod.IsStatic and throw when false so invalid instance methods cannot
enter the registration pipeline.

In `@GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs`:
- Around line 9-12: The public record CqrsStreamInvokerDescriptorEntry currently
allows nulls to be passed and defers failures; add immediate null checks in the
record's primary constructor so callers get ArgumentNullException at
construction time. In the record CqrsStreamInvokerDescriptorEntry (parameters
RequestType, ResponseType, Descriptor) validate RequestType, ResponseType and
Descriptor and throw ArgumentNullException for any that are null (use nameof for
parameter names) to make the type null-safe and respect nullable annotations.

In `@GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`:
- Around line 3109-3157: The generator gating (supportsStreamInvokerProvider in
CqrsHandlerRegistryGenerator.cs) also depends on CqrsStreamInvokerDescriptor and
CqrsStreamInvokerDescriptorEntry, so add two more unit tests in
GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs that
mirror the existing tests but RemoveBlock the descriptor types: one RemoveBlock
that deletes the "public sealed class CqrsStreamInvokerDescriptor" block and
another that deletes the "public sealed class CqrsStreamInvokerDescriptorEntry"
block; ensure each new test asserts the generatedSource still contains the
generated registry class and does NOT contain ICqrsStreamInvokerProvider,
IEnumeratesCqrsStreamInvokerDescriptors, CqrsStreamInvokerDescriptorEntry(, or
InvokeStreamHandler0 (use the same Assert.Multiple pattern and naming consistent
with the existing tests).
🪄 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: 34fca0dc-2689-4739-a724-4c59b18e7d43

📥 Commits

Reviewing files that changed from the base of the PR and between 8d6fc74 and 8b36626.

📒 Files selected for processing (24)
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs.SourceGenerators/README.md
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequest.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequestHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedRequestInvokerProviderRegistry.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationRequestInvokerContainer.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationStreamInvokerContainer.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs
  • GFramework.Cqrs/ICqrsStreamInvokerProvider.cs
  • GFramework.Cqrs/IEnumeratesCqrsStreamInvokerDescriptors.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs/README.md
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • docs/zh-CN/core/cqrs.md
  • docs/zh-CN/source-generators/cqrs-handler-registry-generator.md
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and Test
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (9)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

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

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interactions, why the abstraction exists, and when to use it
Generated logic and generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostics 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 in C# files
Follow standard C# naming: types/methods/properties/events/constants in PascalCase, interfaces with I prefix, parameters and locals in camelCase, private fields in _camelCase
Use 4 spaces for indentation in C# files; do not use tabs
Use Allman braces in C# files
Keep using directives at the top of C# files and sort them consistently
Prefer one primary type per C# file unless the surrounding project already uses a different local pattern
Keep...

Files:

  • GFramework.Cqrs/IEnumeratesCqrsStreamInvokerDescriptors.cs
  • GFramework.Cqrs/ICqrsStreamInvokerProvider.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedRequestInvokerProviderRegistry.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequest.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationStreamInvokerContainer.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequestHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationRequestInvokerContainer.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
**/Cqrs/**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedRequestInvokerProviderRegistry.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequest.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationStreamInvokerContainer.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequestHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationRequestInvokerContainer.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
**/README.md

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • GFramework.Cqrs/README.md
  • GFramework.Cqrs.SourceGenerators/README.md
docs/**/*.md

📄 CodeRabbit inference engine (CLAUDE.md)

Documentation should be organized with Chinese content in docs/zh-CN/ and structured to include getting started, module-specific capabilities (Core, Game, Godot, ECS), source generator usage, tutorials, best practices, and troubleshooting

Files:

  • docs/zh-CN/source-generators/cqrs-handler-registry-generator.md
  • docs/zh-CN/core/cqrs.md
{README.md,docs/**}

📄 CodeRabbit inference engine (AGENTS.md)

{README.md,docs/**}: Update the relevant README.md or docs/ page when behavior, setup steps, architecture guidance, or user-facing examples change
Public documentation MUST NOT include governance-only content such as inventory tables, coverage baselines, review queues, batch metrics, recovery points, trace summaries, or 'this still needs a later audit wave' notes
Public documentation MUST use semantic section titles and link labels; do not surface raw filenames or paths as reader-facing navigation text when a meaningful destination label is available
Public documentation MUST avoid rhetorical, self-referential, or AI-sounding headings and prompts; prefer neutral labels like '公开入口'、'模块与包关系'、'栏目覆盖范围' and '相关主题'
Public documentation MUST present limitations, suitability, and migration boundaries as adoption guidance; do not publish internal-governance or product-roadmap wording
Keep code samples, package names, and command examples aligned with the current repository state in documentation
Prefer documenting behavior and design intent, not only API surface in user documentation
When a public page references XML docs or API coverage, convert that evidence into reader-facing guidance by explaining which types/namespaces/entry points readers should inspect and why, instead of exposing audit counts or governance terminology
If an existing documentation page no longer reflects the current implementation, fixing the code without fixing the documentation is considered incomplete work
Do not rely on 'the code is self-explanatory' for framework features that consumers need to adopt; write the adoption path down so future users do not need to rediscover it from source
When examples are rewritten, preserve only the parts that remain true; delete or replace speculative examples instead of lightly editing them into another inaccurate form

Files:

  • docs/zh-CN/source-generators/cqrs-handler-registry-generator.md
  • docs/zh-CN/core/cqrs.md
docs/zh-CN/**

📄 CodeRabbit inference engine (AGENTS.md)

docs/zh-CN/**: 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
For integration-oriented features such as the AI-First config system, documentation MUST cover: project directory layout and file conventions, required project or package wiring, minimal working usage example, and migration or compatibility notes

Files:

  • docs/zh-CN/source-generators/cqrs-handler-registry-generator.md
  • docs/zh-CN/core/cqrs.md
docs/**

📄 CodeRabbit inference engine (AGENTS.md)

If a docs category appears in VitePress navigation or sidebar, it MUST have a real landing page or be removed from navigation in the same change

Files:

  • docs/zh-CN/source-generators/cqrs-handler-registry-generator.md
  • docs/zh-CN/core/cqrs.md
ai-plan/public/*/todos/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/public/*/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for boot to locate the current recovery point quickly
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
🧠 Learnings (23)
📚 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/IEnumeratesCqrsStreamInvokerDescriptors.cs
  • GFramework.Cqrs/ICqrsStreamInvokerProvider.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedRequestInvokerProviderRegistry.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequest.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationStreamInvokerContainer.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequestHandler.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationRequestInvokerContainer.cs
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/*{Startup,Init,Register,Setup,Configure}*.cs : CQRS handler registration should use generated products from CqrsHandlerRegistryGenerator at runtime, falling back to reflection scanning when generation cannot cover cases; explicitly register handlers from non-default assemblies using RegisterCqrsHandlersFromAssembly(...) or RegisterCqrsHandlersFromAssemblies(...)

Applied to files:

  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedRequestInvokerProviderRegistry.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs/README.md
  • docs/zh-CN/source-generators/cqrs-handler-registry-generator.md
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • docs/zh-CN/core/cqrs.md
  • GFramework.Cqrs/Internal/CqrsDispatcher.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs.SourceGenerators/README.md
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Service modules should use IServiceModule pattern to register built-in services (EventBus, CommandExecutor, QueryExecutor, etc.) and handle infrastructure capability assembly

Applied to files:

  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/Cqrs/**/*.cs : Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias

Applied to files:

  • GFramework.Cqrs/README.md
  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • GFramework.Cqrs.SourceGenerators/README.md
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.SourceGenerators/README.md
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery document under `ai-plan/public/<topic>/todos/` before making substantive code changes

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for `boot` to locate the current recovery point quickly

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under `ai-plan/public/<topic>/todos/` in the same change

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/README.md : If a module's responsibilities, setup, public API surface, generator inputs, or adoption path change, update that module's `README.md` in the same change

Applied to files:

  • GFramework.Cqrs.SourceGenerators/README.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostics or fallback behavior

Applied to files:

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

Applied to files:

  • GFramework.Cqrs.SourceGenerators/README.md
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : When a public C# API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests in C#

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-16T13:25:59.124Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 235
File: GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs:1-3
Timestamp: 2026-04-16T13:25:59.124Z
Learning: In the GeWuYou/GFramework repo, treat `global using NUnit.Framework;` as provided project-wide by `GFramework.SourceGenerators.Tests/GlobalUsings.cs` (via GlobalUsings.cs). Do not require or flag missing per-file `using NUnit.Framework;` directives in test `.cs` files under `GFramework.SourceGenerators.Tests/`, since the project-wide global usings already include NUnit (along with other common namespaces).

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/traces/** : Contributors MUST maintain a matching execution trace under `ai-plan/public/<topic>/traces/` for complex work, recording the current date, key decisions, validation milestones, and the immediate next step

Applied to files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
🪛 LanguageTool
GFramework.Cqrs/README.md

[uncategorized] ~23-~23: 您的意思是“"不"齐”?
Context: ...;运行时会优先消费这些编译期元数据,只有缺失、不适用,或 fallback 仍需补齐剩余 handler 时,才继续进入反射路径。 - `GFramework.C...

(BU)

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

[grammar] ~55-~55: Ensure spelling is correct
Context: ...erRegistrar` 现会在激活 registry 后把 provider 注册进容器, 并把 provider 枚举出的 stream invoker 描述符写入 disp...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~61-~61: Ensure spelling is correct
Context: ...er 方法 - GFramework.Cqrs/README.mdGFramework.Cqrs.SourceGenerators/README.md、`docs/zh-CN...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~309-~309: Ensure spelling is correct
Context: ...26 输出文件竞争噪音;当前已确认没有新增 analyzer warning,GFramework.Cqrs.Tests仍能完成 Release 构建 -dotnet test G...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

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

[style] ~142-~142: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...mework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs`、 ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[grammar] ~143-~143: Ensure spelling is correct
Context: ...mework.Cqrs/.cs 新增 stream provider 契约、GFramework.Cqrs.SourceGenerators/Cqrs/GFramewo...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (14)
GFramework.Cqrs.Tests/Cqrs/GeneratedStreamInvokerRequest.cs (1)

5-9: 实现清晰,测试意图明确。

该请求模型足够精简,且文档注释与用途一致,便于后续生成流式 invoker 用例阅读与维护。

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

16-33: 流式处理实现符合契约且可测试性好。

Handle 与私有异步迭代器的拆分、取消令牌传递和固定输出序列都很稳,适合做 generated/runtime 路径区分验证。

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

16-50: 隐藏实现场景建模到位。

“可见请求 + 私有处理器类型 + 类型暴露入口”的组合设计清晰,能有效覆盖 hidden implementation 的注册与分发路径。

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

243-355: stream invoker 接线扩展与现有 request 路径保持一致。

新增注册流程(provider 注册 + 描述符灌入 dispatcher 缓存)结构清晰,且与现有 generated registry 激活流程衔接自然。

GFramework.Cqrs/IEnumeratesCqrsStreamInvokerDescriptors.cs (1)

11-18: 接口边界简洁且职责单一。

GetDescriptors() 的契约定义足够直接,便于 registrar 在激活阶段统一消费生成描述符。

GFramework.Cqrs.SourceGenerators/README.md (1)

18-19: 文档更新及时,覆盖了新增生成路径与运行时语义。

新增的 request/stream invoker provider 描述、命中优先级与回退语义都已补齐,和本次能力扩展保持一致。

Also applies to: 38-39, 61-62

GFramework.Cqrs/ICqrsStreamInvokerProvider.cs (1)

5-33: 接口契约与回退语义表达清晰,适合作为 stream invoker provider 的稳定扩展点。

这段改动把 provider 的职责边界、默认 runtime 的接线方式和反射回退路径都说明得很完整,可维护性很好。

docs/zh-CN/source-generators/cqrs-handler-registry-generator.md (1)

31-42: 文档已与本次 request/stream invoker provider 能力同步,接入与回退边界描述到位。

尤其是 registrar/dispatcher 的消费顺序和“未命中即回退反射”的行为,读者能直接据此判断是否需要安装生成器。

Also applies to: 84-93, 103-104, 140-142

GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs (1)

12-53: 模型层扩展保持了 request/stream 对称性,gate 信号也收敛得很干净。

SupportsStreamInvokerProviderHasStreamInvokerProvider 的拆分让后续发射阶段判断更直接。

Also applies to: 61-66, 343-349

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

12-93: 这个测试 registry 设计合理,能有效锁定“隐藏实现 + 可见接口”下的 generated invoker 行为。

TryGetDescriptorGetDescriptors() 和静态桥接方法三者配合完整,覆盖目标场景充分。

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

5-38: 测试容器抽象清晰,能稳定支撑 hidden implementation 回归场景。

VisibleRequestHiddenHandlerType 的暴露粒度恰当,没有额外泄漏测试细节。

GFramework.Cqrs/README.md (1)

23-23: README 已同步本次 provider 元数据优先级与 fallback 语义,信息更新及时。

对 request/stream 两条路径的描述保持一致,便于使用方快速建立正确预期。

Also applies to: 123-124, 131-131, 145-145

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

25-31: stream invoker 的生成门控与规格提取实现完整,且与 request 路径保持良好对称。

这能显著降低后续两条路径语义漂移的概率。

Also applies to: 88-114, 243-267, 306-332

ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md (1)

3-217: 迁移追踪记录完整,已覆盖日期、关键决策、验证结果和下一步动作。

这份 trace 能作为后续批次恢复点直接使用。

Comment thread ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md Outdated
Comment thread ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md Outdated
Comment thread docs/zh-CN/core/cqrs.md Outdated
Comment thread docs/zh-CN/core/cqrs.md Outdated
Comment thread GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs Outdated
Comment thread GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs Outdated
- 修复 request 与 stream generated invoker 描述符的静态方法与空值防御,提前拒绝非法元数据

- 补充 provider 空描述符枚举与非静态 invoker 回退回归,更新相关 XML 注释与中文文档语义

- 更新 cqrs-rewrite 活跃跟踪、执行 trace 与验证归档,记录 PR #307 的当前验证结论
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2245    ↑10 2245    ↑10 0 0 0 0 36.7s    ↑1.2s

Test Results

passed 2245 passed ↑10

Details

tests 2245 tests ↑10
clock 36.7s ↑1.2s
tool nunit
build CI - Build & Test arrow-right build-and-test link #1023
pull-request Feat/cqrs optimization link #307

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2161 0 0 30.0s

build-and-test: Run #1023

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
Flush_ShouldWaitForAllEntriesToBeProcessed 19 1.6s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 19 3.3s 4.7s
CreateStream_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 4 4.6s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 19 2.1s 2.2s
Generates_Scene_Behavior_Boilerplate 19 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 19 1.1s 1.1s
Append_ShouldNotBlock 19 1.0s 1.0s
Context_Caching_Should_Improve_Performance 19 784ms 799ms
PendingCount_ShouldReflectQueuedEntries 19 501ms 502ms
Cleanup_Should_NotRemoveActiveLocks 19 404ms 405ms

± Comparison with run #1021 at f62cf5c | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 19 runs.

Github Test Reporter by CTRF 💚

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: 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 `@ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md`:
- Around line 52-90: The active tracking entry in
cqrs-rewrite-migration-tracking.md is too verbose and should be trimmed: move
the step-by-step implementation/test details currently listed (each bullet under
the "已完成" sections) into an archive file (e.g.,
archive/todos/cqrs-rewrite-validation-history-...md) and in this active file
leave only the current recovery point summary, active risks, immediate next
step, and a short pointer/link to the archive; update the lead paragraph and any
sections that reference detailed items so they instead reference the archive
file and remove per-change bullets (retain only the high-level conclusion,
"活跃风险", "下一步", and the archive pointer).
🪄 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: 5506ab2d-54ef-4b6a-8215-7bb01a8b6859

📥 Commits

Reviewing files that changed from the base of the PR and between 8b36626 and 8352874.

📒 Files selected for processing (10)
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
  • GFramework.Cqrs/CqrsRequestInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsRequestInvokerDescriptorEntry.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.cs
  • ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • docs/zh-CN/core/cqrs.md
✅ Files skipped from review due to trivial changes (1)
  • GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Cqrs/CqrsStreamInvokerDescriptorEntry.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). (1)
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (8)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

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

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interactions, why the abstraction exists, and when to use it
Generated logic and generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostics 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 in C# files
Follow standard C# naming: types/methods/properties/events/constants in PascalCase, interfaces with I prefix, parameters and locals in camelCase, private fields in _camelCase
Use 4 spaces for indentation in C# files; do not use tabs
Use Allman braces in C# files
Keep using directives at the top of C# files and sort them consistently
Prefer one primary type per C# file unless the surrounding project already uses a different local pattern
Keep...

Files:

  • GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsRequestInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsRequestInvokerDescriptorEntry.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
ai-plan/public/*/traces/**

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

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

📄 CodeRabbit inference engine (CLAUDE.md)

Documentation should be organized with Chinese content in docs/zh-CN/ and structured to include getting started, module-specific capabilities (Core, Game, Godot, ECS), source generator usage, tutorials, best practices, and troubleshooting

Files:

  • docs/zh-CN/core/cqrs.md
{README.md,docs/**}

📄 CodeRabbit inference engine (AGENTS.md)

{README.md,docs/**}: Update the relevant README.md or docs/ page when behavior, setup steps, architecture guidance, or user-facing examples change
Public documentation MUST NOT include governance-only content such as inventory tables, coverage baselines, review queues, batch metrics, recovery points, trace summaries, or 'this still needs a later audit wave' notes
Public documentation MUST use semantic section titles and link labels; do not surface raw filenames or paths as reader-facing navigation text when a meaningful destination label is available
Public documentation MUST avoid rhetorical, self-referential, or AI-sounding headings and prompts; prefer neutral labels like '公开入口'、'模块与包关系'、'栏目覆盖范围' and '相关主题'
Public documentation MUST present limitations, suitability, and migration boundaries as adoption guidance; do not publish internal-governance or product-roadmap wording
Keep code samples, package names, and command examples aligned with the current repository state in documentation
Prefer documenting behavior and design intent, not only API surface in user documentation
When a public page references XML docs or API coverage, convert that evidence into reader-facing guidance by explaining which types/namespaces/entry points readers should inspect and why, instead of exposing audit counts or governance terminology
If an existing documentation page no longer reflects the current implementation, fixing the code without fixing the documentation is considered incomplete work
Do not rely on 'the code is self-explanatory' for framework features that consumers need to adopt; write the adoption path down so future users do not need to rediscover it from source
When examples are rewritten, preserve only the parts that remain true; delete or replace speculative examples instead of lightly editing them into another inaccurate form

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

docs/zh-CN/**: 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
For integration-oriented features such as the AI-First config system, documentation MUST cover: project directory layout and file conventions, required project or package wiring, minimal working usage example, and migration or compatibility notes

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

If a docs category appears in VitePress navigation or sidebar, it MUST have a real landing page or be removed from navigation in the same change

Files:

  • docs/zh-CN/core/cqrs.md
ai-plan/public/*/todos/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/public/*/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for boot to locate the current recovery point quickly
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Files:

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

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
🧠 Learnings (22)
📚 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/CqrsStreamInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsRequestInvokerDescriptor.cs
  • GFramework.Cqrs/CqrsRequestInvokerDescriptorEntry.cs
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/traces/** : Contributors MUST maintain a matching execution trace under `ai-plan/public/<topic>/traces/` for complex work, recording the current date, key decisions, validation milestones, and the immediate next step

Applied to files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/*{Startup,Init,Register,Setup,Configure}*.cs : CQRS handler registration should use generated products from CqrsHandlerRegistryGenerator at runtime, falling back to reflection scanning when generation cannot cover cases; explicitly register handlers from non-default assemblies using RegisterCqrsHandlersFromAssembly(...) or RegisterCqrsHandlersFromAssemblies(...)

Applied to files:

  • docs/zh-CN/core/cqrs.md
  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to {README.md,docs/**} : Public documentation MUST avoid rhetorical, self-referential, or AI-sounding headings and prompts; prefer neutral labels like '公开入口'、'模块与包关系'、'栏目覆盖范围' and '相关主题'

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to docs/zh-CN/** : For integration-oriented features such as the AI-First config system, documentation MUST cover: project directory layout and file conventions, required project or package wiring, minimal working usage example, and migration or compatibility notes

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to {README.md,docs/**} : Public documentation MUST use semantic section titles and link labels; do not surface raw filenames or paths as reader-facing navigation text when a meaningful destination label is available

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to {README.md,docs/**} : When a public page references XML docs or API coverage, convert that evidence into reader-facing guidance by explaining which types/namespaces/entry points readers should inspect and why, instead of exposing audit counts or governance terminology

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to docs/zh-CN/** : 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

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/README.md : A module README MUST describe: the module's purpose, relationship to adjacent runtime/abstractions/generator packages, major subdirectories or subsystems, minimum adoption path, and corresponding `docs/zh-CN/` entry points

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to docs/**/*.md : Documentation should be organized with Chinese content in docs/zh-CN/ and structured to include getting started, module-specific capabilities (Core, Game, Godot, ECS), source generator usage, tutorials, best practices, and troubleshooting

Applied to files:

  • docs/zh-CN/core/cqrs.md
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/Cqrs/**/*.cs : Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias

Applied to files:

  • docs/zh-CN/core/cqrs.md
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for `boot` to locate the current recovery point quickly

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active `todos/` and `traces/` entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery document under `ai-plan/public/<topic>/todos/` before making substantive code changes

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
  • ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under `ai-plan/public/<topic>/todos/` in the same change

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions

Applied to files:

  • GFramework.Cqrs.Tests/Cqrs/HiddenImplementationGeneratedStreamInvokerProviderRegistry.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Governance-only material such as XML audit snapshots, documentation remediation baselines, backlog status, and recovery metadata belongs in `ai-plan/**`, not in public docs

Applied to files:

  • ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
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:

  • ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md
🪛 LanguageTool
ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md

[style] ~171-~171: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...mework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs`、 ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[grammar] ~172-~172: Ensure spelling is correct
Context: ...mework.Cqrs/.cs 新增 stream provider 契约、GFramework.Cqrs.SourceGenerators/Cqrs/GFramewo...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

docs/zh-CN/core/cqrs.md

[grammar] ~170-~170: Ensure spelling is correct
Context: ... 生成注册器不可用时记录告警并回退到反射路径;只有“未命中 generated descriptor”才会走反射绑定,已命中的不兼容元数据会直接抛出异常 6. 当生成注册器携带 `CqrsReflectionFallbackAttr...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

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

[grammar] ~55-~55: Ensure spelling is correct
Context: ...erRegistrar` 现会在激活 registry 后把 provider 注册进容器, 并把 provider 枚举出的 stream invoker 描述符写入 disp...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~61-~61: Ensure spelling is correct
Context: ...er 方法 - GFramework.Cqrs/README.mdGFramework.Cqrs.SourceGenerators/README.md、`docs/zh-CN...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md

[grammar] ~72-~72: Ensure spelling is correct
Context: ...26 输出文件竞争噪音;当前已确认没有新增 analyzer warning,GFramework.Cqrs.Tests仍能完成 Release 构建 -dotnet test G...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (7)
ai-plan/public/cqrs-rewrite/archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md (1)

5-7: 归档定位清晰,符合恢复入口收敛目标。

这段说明把“active 仅保留权威批次、明细进 archive”的边界写得很明确,便于后续接手。

ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md (1)

5-33: RP-075 追踪信息完整,可直接作为交接入口。

本段已覆盖关键决策、验证里程碑与“当前下一步”,可恢复性很好。

GFramework.Cqrs/CqrsRequestInvokerDescriptor.cs (1)

22-50: 构造阶段前移 invoker 合约校验的实现很稳妥。

这里把 null 与“非静态方法”拦截提前到描述符创建时,能更早暴露无效元数据并减少运行时分发阶段的不确定性,方向正确。

GFramework.Cqrs/CqrsRequestInvokerDescriptorEntry.cs (1)

6-41: 显式构造器改造后的一致性和防御性都不错。

对三个入参的空值校验明确,属性保持只读,整体契约表达比之前更直观。

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

168-186: 文档更新准确描述了双轨调度模型。

这几段变更清晰地说明了:

  1. Request invoker provider 和 stream invoker provider 的预接线机制
  2. 生成元数据优先、未命中时反射兜底的两阶段查找
  3. 不兼容元数据时的异常抛出行为(而非静默降级)

技术描述与提供的代码片段(CreateRequestDispatchBindingCreateStreamDispatchBindingRegisterGeneratedRequestInvokerDescriptors 等)一致,且已修正此前评审中指出的回退语义问题。


239-239: 表格首列改用语义标签,符合文档规范。

这里已经把原先暴露的 "GFramework.Cqrs 根入口与 Internal/" 路径替换成面向读者的导航文案"运行时入口与内部协作层",具体类型保留在第二列,满足"Public documentation MUST use semantic section titles and link labels"的要求。

As per coding guidelines: Public documentation MUST use semantic section titles and link labels; do not surface raw filenames or paths as reader-facing navigation text when a meaningful destination label is available.

GFramework.Cqrs/CqrsStreamInvokerDescriptor.cs (1)

18-50: 实现方向正确:描述符在构造期做了前置校验,能有效减少运行时延迟失败。

handlerTypeinvokerMethod 的校验边界清晰,且异常语义与用途匹配,整体可维护性不错。

Comment thread ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md Outdated
- 补充 stream invoker descriptor 与 descriptor entry 缺失时整体跳过 provider 元数据的生成器回归

- 优化测试辅助重命名逻辑,精确模拟 metadata name 缺失而不破坏其余合同编译

- 更新 cqrs-rewrite 跟踪与追踪,记录 PR #307 follow-up 的恢复点和验证结果
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2247    ↑2 2247    ↑2 0 0 0 0 33.6s    ↓3.1s

Test Results

passed 2247 passed ↑2

Details

tests 2247 tests ↑2
clock 33.6s ↓3.1s
tool nunit
build CI - Build & Test arrow-right build-and-test link #1024
pull-request Feat/cqrs optimization link #307

Insights

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

build-and-test: Run #1024

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
CreateStream_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 5 4.6s 4.8s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 20 3.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 20 2.1s 2.2s
Generates_Scene_Behavior_Boilerplate 20 1.8s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 20 1.1s 1.1s
Append_ShouldNotBlock 20 1.0s 1.0s
Context_Caching_Should_Improve_Performance 20 784ms 795ms
PendingCount_ShouldReflectQueuedEntries 20 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 20 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 20 401ms 402ms

± Comparison with run #1023 at 72b7e2e | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 20 runs.

Github Test Reporter by CTRF 💚

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.

♻️ Duplicate comments (2)
ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md (2)

52-93: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

active 跟踪段仍偏历史堆叠,建议继续归档瘦身为“恢复入口视图”。

这段仍包含大量实现/测试明细,建议仅保留:当前恢复点结论、活跃风险、最近权威验证、下一步,以及归档指针;其余命令级与阶段级细节继续下沉 archive。

As per coding guidelines "Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for boot to locate the current recovery point quickly" and "When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files".

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

In `@ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md` around
lines 52 - 93, The active-tracking section is too detailed and must be slimmed
to a recovery-entry view: edit the "active 跟踪段" content in
cqrs-rewrite-migration-tracking.md to remove the long implementation/test bullet
list and retain only (1) a concise current recovery-point conclusion, (2) active
risks, (3) the most recent authoritative validation(s), (4) the immediate next
step, and (5) a pointer to the archived detailed history (e.g.
archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md); move all
command-/stage-level details and test-by-test items into that archive file and
update any in-document references (RP-063..RP-074,
CqrsHandlerRegistryGeneratorTests, CqrsDispatcher,
CqrsGeneratedRequestInvokerProviderTests, etc.) to point readers to the archive.

10-10: ⚠️ Potential issue | 🟠 Major | ⚡ Quick win

恢复点已更新,但活跃事实区仍保留旧 PR 锚点,建议同步收敛。

RP-076 已是当前恢复点,但文档后文仍并列 PR #261/#302/#305 的“当前活跃事实”表述,和本轮 PR #307`` 权威验证容易形成双锚点。建议把旧 PR 状态下沉到 archive,只在 active 区保留当前 PR 锚点与恢复结论。

As per coding guidelines "Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point" and "Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely".

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

In `@ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md` at line
10, Update the migration-tracking doc so the active facts section only
references the current recovery point and authoritative PR: replace the parallel
anchors `PR `#261/`#302/#305` with the single active anchor `PR `#307`` and ensure
the recovery point identifier `CQRS-REWRITE-RP-076` is shown as the current RP;
move the older PR entries into an "archive" or "historical" subsection with
their status and any outstanding risks, and ensure the document records the
current phase, known risks, validation result, and next recommended resume step
per the tracking guidelines.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md`:
- Around line 52-93: The active-tracking section is too detailed and must be
slimmed to a recovery-entry view: edit the "active 跟踪段" content in
cqrs-rewrite-migration-tracking.md to remove the long implementation/test bullet
list and retain only (1) a concise current recovery-point conclusion, (2) active
risks, (3) the most recent authoritative validation(s), (4) the immediate next
step, and (5) a pointer to the archived detailed history (e.g.
archive/todos/cqrs-rewrite-validation-history-rp063-through-rp074.md); move all
command-/stage-level details and test-by-test items into that archive file and
update any in-document references (RP-063..RP-074,
CqrsHandlerRegistryGeneratorTests, CqrsDispatcher,
CqrsGeneratedRequestInvokerProviderTests, etc.) to point readers to the archive.
- Line 10: Update the migration-tracking doc so the active facts section only
references the current recovery point and authoritative PR: replace the parallel
anchors `PR `#261/`#302/#305` with the single active anchor `PR `#307`` and ensure
the recovery point identifier `CQRS-REWRITE-RP-076` is shown as the current RP;
move the older PR entries into an "archive" or "historical" subsection with
their status and any outstanding risks, and ensure the document records the
current phase, known risks, validation result, and next recommended resume step
per the tracking guidelines.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 813a49c7-8c2f-403b-a3ff-246b7c9db937

📥 Commits

Reviewing files that changed from the base of the PR and between 8352874 and 9296def.

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

📄 CodeRabbit inference engine (CLAUDE.md)

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

Files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

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

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interactions, why the abstraction exists, and when to use it
Generated logic and generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostics 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 in C# files
Follow standard C# naming: types/methods/properties/events/constants in PascalCase, interfaces with I prefix, parameters and locals in camelCase, private fields in _camelCase
Use 4 spaces for indentation in C# files; do not use tabs
Use Allman braces in C# files
Keep using directives at the top of C# files and sort them consistently
Prefer one primary type per C# file unless the surrounding project already uses a different local pattern
Keep...

Files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
ai-plan/public/*/todos/**

📄 CodeRabbit inference engine (AGENTS.md)

ai-plan/public/*/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for boot to locate the current recovery point quickly
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active todos/ and traces/ entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
🧠 Learnings (24)
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : When a public C# API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/*{Startup,Init,Register,Setup,Configure}*.cs : CQRS handler registration should use generated products from CqrsHandlerRegistryGenerator at runtime, falling back to reflection scanning when generation cannot cover cases; explicitly register handlers from non-default assemblies using RegisterCqrsHandlersFromAssembly(...) or RegisterCqrsHandlersFromAssemblies(...)

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests in C#

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-16T13:25:59.124Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 235
File: GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs:1-3
Timestamp: 2026-04-16T13:25:59.124Z
Learning: In the GeWuYou/GFramework repo, treat `global using NUnit.Framework;` as provided project-wide by `GFramework.SourceGenerators.Tests/GlobalUsings.cs` (via GlobalUsings.cs). Do not require or flag missing per-file `using NUnit.Framework;` directives in test `.cs` files under `GFramework.SourceGenerators.Tests/`, since the project-wide global usings already include NUnit (along with other common namespaces).

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Keep source generators deterministic and free of hidden environment or network dependencies

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.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.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery document under `ai-plan/public/<topic>/todos/` before making substantive code changes

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough for `boot` to locate the current recovery point quickly

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active `todos/` and `traces/` entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under `ai-plan/public/<topic>/todos/` in the same change

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to {README.md,docs/**} : Public documentation MUST avoid rhetorical, self-referential, or AI-sounding headings and prompts; prefer neutral labels like '公开入口'、'模块与包关系'、'栏目覆盖范围' and '相关主题'

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/Cqrs/**/*.cs : Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias

Applied to files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/traces/** : Contributors MUST maintain a matching execution trace under `ai-plan/public/<topic>/traces/` for complex work, recording the current date, key decisions, validation milestones, and the immediate next step

Applied to files:

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

[grammar] ~55-~55: Ensure spelling is correct
Context: ...erRegistrar` 现会在激活 registry 后把 provider 注册进容器, 并把 provider 枚举出的 stream invoker 描述符写入 disp...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~61-~61: Ensure spelling is correct
Context: ...er 方法 - GFramework.Cqrs/README.mdGFramework.Cqrs.SourceGenerators/README.md、`docs/zh-CN...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

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

[style] ~195-~195: Three successive sentences begin with the same word. Consider rewording the sentence or use a thesaurus to find a synonym.
Context: ...mework.Cqrs/Internal/CqrsDispatcher.csGFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs`、 ...

(ENGLISH_WORD_REPEAT_BEGINNING_RULE)


[grammar] ~196-~196: Ensure spelling is correct
Context: ...mework.Cqrs/.cs 新增 stream provider 契约、GFramework.Cqrs.SourceGenerators/Cqrs/GFramewo...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (2)
GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs (2)

3159-3209: 这两条缺失描述符分支的回归用例补齐了。

这里把 CqrsStreamInvokerDescriptorCqrsStreamInvokerDescriptorEntry 两条 gating 分支都锁住了,断言也保持在可观察生成结果这一层,方向正确。
Based on learnings: Applies to **/.cs : Source generator changes MUST be covered by generator tests; Applies to **/.Tests.cs : Keep tests focused on observable behavior, not implementation trivia


3284-3371: 这组测试辅助方法设计得很稳。

RemoveBlock 降低了用例对原始三引号缩进的耦合,RenameTypeIdentifier 配合 IsIdentifierBoundary 也避免了共享前缀类型名的误替换,适合这类生成器回归场景。

@GeWuYou GeWuYou changed the title Feat/cqrs optimization Feat/Add stream invoker provider support to CQRS handler registry generator Apr 30, 2026
- 更新 active tracking,仅保留 RP-076、PR #307、活跃风险、权威验证与下一推荐步骤

- 重构 active trace,仅保留当前阶段决策、验证结果与后续恢复方向

- 补充 RP-062 至 RP-076 的 trace 归档,承接迁出的历史阶段上下文
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2247 2247 0 0 0 0 37.7s    ↑4.2s

Test Results

passed 2247 passed

Details

tests 2247 tests
clock 37.7s ↑4.2s
tool nunit
build CI - Build & Test arrow-right build-and-test link #1026
pull-request Feat/Add stream invoker provider support to CQRS handler registry generator link #307

Insights

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

build-and-test: Run #1026

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
CreateStream_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 6 4.6s 4.8s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 21 2.9s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 21 2.1s 2.2s
Generates_Scene_Behavior_Boilerplate 21 1.8s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 21 1.1s 1.1s
Append_ShouldNotBlock 21 1.0s 1.0s
Context_Caching_Should_Improve_Performance 21 784ms 795ms
PendingCount_ShouldReflectQueuedEntries 21 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 21 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 21 401ms 402ms

± Comparison with run #1024 at d7c1455 | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 21 runs.

Github Test Reporter by CTRF 💚

Comment on lines +394 to +414
/// <inheritdoc />
public IReadOnlyList<CqrsRequestInvokerDescriptorEntry> GetDescriptors()
{
return
[
new CqrsRequestInvokerDescriptorEntry(
typeof(GeneratedRequestInvokerRequest),
typeof(string),
new CqrsRequestInvokerDescriptor(
typeof(IRequestHandler<GeneratedRequestInvokerRequest, string>),
typeof(NonStaticRequestInvokerProviderRegistry).GetMethod(
nameof(InvokeGenerated),
BindingFlags.NonPublic | BindingFlags.Instance)!))
];
}

private ValueTask<string> InvokeGenerated(object handler, object request, CancellationToken cancellationToken)
{
return ValueTask.FromResult(string.Empty);
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Non-static invoker test fixture will throw during RegisterHandlers

NonStaticRequestInvokerProviderRegistry.GetDescriptors() constructs new CqrsRequestInvokerDescriptor(…, instanceMethod). The new ValidateInvokerMethod guard added to CqrsRequestInvokerDescriptor in this PR throws ArgumentException when !invokerMethod.IsStatic. This exception propagates from GetDescriptors()RegisterGeneratedRequestInvokerDescriptorsRegisterHandlers with no surrounding try-catch, so the test SendAsync_Should_Fall_Back_To_Runtime_Path_When_Generated_Request_Invoker_Is_Not_Static crashes at CqrsTestRuntime.RegisterHandlers(...) before the dispatch even runs, rather than falling back gracefully to the runtime path. The same problem exists for NonStaticStreamInvokerProviderRegistry.GetDescriptors() and the corresponding stream test.

Prompt To Fix With AI
This is a comment left during a code review.
Path: GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
Line: 394-414

Comment:
**Non-static invoker test fixture will throw during `RegisterHandlers`**

`NonStaticRequestInvokerProviderRegistry.GetDescriptors()` constructs `new CqrsRequestInvokerDescriptor(…, instanceMethod)`. The new `ValidateInvokerMethod` guard added to `CqrsRequestInvokerDescriptor` in this PR throws `ArgumentException` when `!invokerMethod.IsStatic`. This exception propagates from `GetDescriptors()``RegisterGeneratedRequestInvokerDescriptors``RegisterHandlers` with no surrounding try-catch, so the test `SendAsync_Should_Fall_Back_To_Runtime_Path_When_Generated_Request_Invoker_Is_Not_Static` crashes at `CqrsTestRuntime.RegisterHandlers(...)` before the dispatch even runs, rather than falling back gracefully to the runtime path. The same problem exists for `NonStaticStreamInvokerProviderRegistry.GetDescriptors()` and the corresponding stream test.

How can I resolve this? If you propose a fix, please make it concise.

Comment on lines +518 to +537
public IReadOnlyList<CqrsStreamInvokerDescriptorEntry> GetDescriptors()
{
return
[
new CqrsStreamInvokerDescriptorEntry(
typeof(GeneratedStreamInvokerRequest),
typeof(int),
new CqrsStreamInvokerDescriptor(
typeof(IStreamRequestHandler<GeneratedStreamInvokerRequest, int>),
typeof(NonStaticStreamInvokerProviderRegistry).GetMethod(
nameof(InvokeGenerated),
BindingFlags.NonPublic | BindingFlags.Instance)!))
];
}

private object InvokeGenerated(object handler, object request, CancellationToken cancellationToken)
{
return Array.Empty<int>().ToAsyncEnumerable();
}
}
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Same non-static constructor throw for stream non-static fixture

NonStaticStreamInvokerProviderRegistry.GetDescriptors() creates new CqrsStreamInvokerDescriptor(…, instanceMethod). CqrsStreamInvokerDescriptor.ValidateInvokerMethod throws ArgumentException for non-static methods, propagating through RegisterHandlers. The test CreateStream_Should_Fall_Back_To_Runtime_Path_When_Generated_Stream_Invoker_Is_Not_Static would fail at the RegisterHandlers call with an unhandled exception instead of demonstrating the expected fallback.

Prompt To Fix With AI
This is a comment left during a code review.
Path: GFramework.Cqrs.Tests/Cqrs/CqrsGeneratedRequestInvokerProviderTests.cs
Line: 518-537

Comment:
**Same non-static constructor throw for stream non-static fixture**

`NonStaticStreamInvokerProviderRegistry.GetDescriptors()` creates `new CqrsStreamInvokerDescriptor(…, instanceMethod)`. `CqrsStreamInvokerDescriptor.ValidateInvokerMethod` throws `ArgumentException` for non-static methods, propagating through `RegisterHandlers`. The test `CreateStream_Should_Fall_Back_To_Runtime_Path_When_Generated_Stream_Invoker_Is_Not_Static` would fail at the `RegisterHandlers` call with an unhandled exception instead of demonstrating the expected fallback.

How can I resolve this? If you propose a fix, please make it concise.

@GeWuYou
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 30, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 30, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@GeWuYou GeWuYou merged commit 1c21df1 into main May 1, 2026
7 checks passed
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