Skip to content

Feat/cqrs optimization#261

Merged
GeWuYou merged 7 commits into
mainfrom
feat/cqrs-optimization
Apr 20, 2026
Merged

Feat/cqrs optimization#261
GeWuYou merged 7 commits into
mainfrom
feat/cqrs-optimization

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Apr 20, 2026

Summary by CodeRabbit

  • Bug Fixes

    • 生成器现在拒绝将指针/函数指针视为可精确注册的泛型参数,避免错误生成并提供相应诊断与回退路径。
  • Refactor

    • 优化处理程序注册去重与接口发现:构建本地映射索引并引入支持接口缓存,减少重复线性扫描与反射开销。
    • 激活工厂生成改为优先使用动态方法并保留反射回退。
  • Tests

    • 扩展了指针相关、缓存行为、去重与私有构造激活的单元测试。
  • Documentation

    • 更新迁移跟踪与里程碑记录、测试与执行说明。

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 2026

Warning

Rate limit exceeded

@GeWuYou has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 28 minutes and 53 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 28 minutes and 53 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c14227ce-c33c-44fe-bdf3-97579fa600e5

📥 Commits

Reviewing files that changed from the base of the PR and between 2440dbe and 13d52a8.

📒 Files selected for processing (6)
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • 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
📝 Walkthrough

Walkthrough

源生成器收紧了对指针与函数指针泛型参数的精确引用判定并新增指针运行时解析路径;registrar 在程序集处理时改为本地映射去重与按类型支持接口缓存,并尝试使用动态方法生成已生成 registry 的激活工厂(失败时回退);新增多项回归测试与迁移记录更新。

Changes

Cohort / File(s) Summary
源生成器:指针/函数指针处理
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
IPointerTypeSymbolIFunctionPointerTypeSymbol 视为不可用于精确生成(TryCreateRuntimeTypeReference 返回 false,CanReferenceFromGeneratedRegistry 不再递归允许指针元素),并新增 PointerElementTypeReferenceRuntimeTypeReferenceSpec;在 AppendRuntimeTypeReferenceResolution 中增加指针解析分支,递归解析指向类型后调用 .MakePointerType()
生成器测试与诊断
GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
新增/更新测试覆盖对隐藏指针响应(delegate* unmanaged<T>/函数指针)场景的行为,断言输入编译器诊断(CS0306)、生成器诊断 GF_Cqrs_001(指示回退到 CqrsReflectionFallbackAttribute)且不产生生成源;增强测试执行结果以区分输入与生成阶段诊断。
Registrar:去重与接口缓存
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
RegisterAssemblyHandlers 使用预计算 HashSet<HandlerMapping> 避免对 IServiceCollection 的逐项线性扫描;将接口发现抽成 GetSupportedHandlerInterfaces(Type) 并通过 SupportedHandlerInterfacesCache 缓存;引入 HandlerMapping record struct。
Registrar:生成 registry 激活工厂
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
构建 RegistryActivationMetadata 时尝试使用 CreateRegistryFactory(...) 生成基于 System.Reflection.Emit 的动态方法工厂以实例化已生成的 registry,若失败则回退到反射 ConstructorInfo.Invoke
Registrar 测试与测试基础设施
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
新增三项回归测试(私有无参构造激活、跨容器支持接口缓存复用、重复类型时跳过重复映射);新增 ClearRegistrarCaches() 与若干反射辅助方法以清理静态缓存并防止测试污染;新增内部测试用 PrivateConstructorNotificationHandlerRegistry
迁移/追踪文档更新
ai-plan/public/cqrs-rewrite/todos/..., ai-plan/public/cqrs-rewrite/traces/...
更新恢复点编号与迁移跟踪条目(包括 pointer/function-pointer 拒绝、registrar 去重索引、接口缓存、dynamic registry activator 等),并记录相应测试/验证命令与优先级调整。

Sequence Diagram(s)

sequenceDiagram
    participant Source as Source Generator
    participant Spec as RuntimeTypeReferenceSpec
    participant Generator as CqrsHandlerRegistryGenerator
    participant Registrar as CqrsHandlerRegistrar
    participant DI as IServiceCollection

    Source->>Spec: Inspect generic argument type (pointer / function-pointer)
    Spec-->>Source: Mark as non-referenceable OR create PointerElementTypeReference
    Source->>Generator: Emit diagnostics (GF_Cqrs_001) or generate runtime resolution using PointerElementTypeReference
    Registrar->>Registrar: Build HashSet<HandlerMapping> and query SupportedHandlerInterfacesCache
    Registrar->>Generator: Request generated registry activation factory
    Generator-->>Registrar: Return dynamic factory (or throw)
    alt dynamic factory created
        Registrar->>Registrar: Invoke dynamic factory -> instantiate registry
    else fallback
        Registrar->>Registrar: Use Reflection ConstructorInfo.Invoke -> instantiate registry
    end
    Registrar->>DI: Register handler service mappings (skip duplicates via HashSet)
Loading

代码审查工作量

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

可能相关的PR


概览

该PR收紧了CQRS源生成器对指针与函数指针泛型参数的精确运行时引用判定(将二者视为不可精确生成),在运行时类型重建中新增指针解析路径以支持生成时的 PointerElementTypeReference 与 .MakePointerType() 调用;在 registrar 中用预计算 HashSet 替换对 IServiceCollection 的逐项线性扫描以做去重,引入按 Type 缓存的支持接口发现并尝试通过动态方法(Reflection.Emit)生成已生成 registry 的激活工厂(失败时回退到反射);同时补充相关回归测试以覆盖私有构造器激活、缓存复用与重复类型跳过场景,并更新迁移/追踪文档记录。

改动

内聚体 / 文件 改动摘要
生成器指针和函数指针支持
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs, GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
源生成器将 IPointerTypeSymbolIFunctionPointerTypeSymbol 视为不可用于精确生成;RuntimeTypeReferenceSpec 新增 PointerElementTypeReferenceFromPointer(...) 工厂,AppendRuntimeTypeReferenceResolution 增加指针解析分支(递归解析元素类型后 .MakePointerType());测试新增/调整以断言输入编译器 CS0306 与生成器回退诊断。
Registrar 去重与缓存优化
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
RegisterAssemblyHandlers 采用预计算 HashSet<HandlerMapping> 替代对 IServiceCollection 的重复线性扫描;将接口发现提取为 GetSupportedHandlerInterfaces(Type) 并通过 SupportedHandlerInterfacesCache 缓存;新增 HandlerMapping record struct。
Registrar 激活工厂改进
GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
在构建 RegistryActivationMetadata 时优先使用 CreateRegistryFactory(...) 生成基于 System.Reflection.Emit 的动态方法工厂实例化已生成 registry,若抛出异常则回退至反射 ConstructorInfo.Invoke
Registrar 测试增强
GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
新增测试:RegisterHandlers_Should_Activate_Generated_Registry_With_Private_Parameterless_Constructor..._Cache_Supported_Handler_Interfaces_Across_Containers..._Skip_Duplicate_Handler_Mappings_When_Assembly_Returns_Duplicate_Types;增加 ClearRegistrarCaches() 与反射辅助方法以清理静态缓存;新增测试用 PrivateConstructorNotificationHandlerRegistry
文档追踪更新
ai-plan/public/cqrs-rewrite/todos/..., ai-plan/public/cqrs-rewrite/traces/...
更新恢复点与迁移追踪条目(引入 CQRS-REWRITE-RP-050 指针/函数指针拒绝条目及相关 RP 条目),记录已完成的生成器与 registrar 收敛项及测试验证指令。

代码审查工作量(重复展示)

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

可能相关的PR(重复展示)

🚥 Pre-merge checks | ✅ 1 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive 标题'Feat/cqrs optimization'过于宽泛,未能准确反映PR的具体变更内容。PR包含多项针对指针类型处理、处理程序接口缓存、重复映射去重等具体优化,但标题未体现这些细节。 建议更新标题以更具体地概括主要变更,如'Fix pointer type registration and add CQRS optimizations'或'Precise pointer handling and caching improvements in CQRS'。
✅ Passed checks (1 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.

✏️ 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

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 ⏱️
2112    ↑9 2112    ↑9 0 0 0 0 36.3s    ↑699ms

Test Results

passed 2112 passed ↑9

Details

tests 2112 tests ↑9
clock 36.3s ↑699ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #899
pull-request Feat/cqrs optimization link #261

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2104 0 0 4.7s

build-and-test: Run #899

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 7 4.0s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 7 2.1s 2.2s
Generates_Scene_Behavior_Boilerplate 7 1.9s 1.9s
CleanupDuringAcquire_Should_NotCauseRaceCondition 7 1.1s 1.1s
Append_ShouldNotBlock 7 1.0s 1.0s
Context_Caching_Should_Improve_Performance 7 781ms 789ms
PendingCount_ShouldReflectQueuedEntries 7 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 7 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 7 401ms 402ms
Generates_Precise_Assembly_Type_Lookups_For_Inaccessible_External_Protected_Types 7 328ms 349ms

± Comparison with run #883 at 04f2062 | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 7 runs.

Github Test Reporter by CTRF 💚

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 20, 2026

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ CSHARP dotnet-format yes 1 no 5.43s
✅ REPOSITORY gitleaks yes no no 7.05s
✅ REPOSITORY trufflehog yes no no 6.41s

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

@GeWuYou
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 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.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

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

Inline comments:
In `@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs`:
- Around line 415-420: Reject pointer and function-pointer types early so the
generator never emits CQRS generic registrations for T* or delegate*; in
TryCreateRuntimeTypeReference(...) add an early check that if the incoming
symbol is IPointerTypeSymbol or IFunctionPointerTypeSymbol you return false
immediately (do not recurse into PointedAtType), and update
CanReferenceFromGeneratedRegistry(...) so its pointer and function-pointer
branches return false (again, do not attempt to inspect the pointed-at type).
Refer to the TryCreateRuntimeTypeReference and CanReferenceFromGeneratedRegistry
symbols when making these changes.

In `@GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`:
- Around line 850-875: The test uses invalid generic type arguments
(HiddenResponse* and function pointer types) for IRequest<T> and
IRequestHandler<,> which cause C# compiler error CS0306; update the test so the
input source is a valid CQRS contract (e.g., change HiddenResponse* to a
non-pointer type like HiddenResponse and adjust HiddenHandler to
IRequestHandler<HiddenRequest, HiddenResponse>) OR explicitly assert that the
generator/compilation produces the expected diagnostics (check
GeneratedCompilationDiagnostics/GeneratorDiagnostics for CS0306) instead of
asserting successful compilation and a generated source; ensure assertions
around execution.GeneratedSources and the filename/content expectations only run
when the source is compilable (or when you intend to verify generation behavior
on invalid input, assert the diagnostics and document intent).
🪄 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: f9ebe85c-a29e-4b12-8bd0-cbe8d5b22ed6

📥 Commits

Reviewing files that changed from the base of the PR and between 702dec6 and 4085ae9.

📒 Files selected for processing (6)
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • 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
🧰 Additional context used
📓 Path-based instructions (5)
**/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
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.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. Comments must explain intent, contract, and usage constraints instead of restating syntax.
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds or compatibility constraints, and registration order or lifecycle sequencing.
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why the abstraction exists, and when to use it instead of alternatives.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling.
Follow the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
Use the following C# naming conventions: Types, methods, properties, events, and constants use PascalCase; interfaces use I prefix; parameters and locals use camelCase; private fields use _camelCase.
Do not rely on implicit imports. Declare every required using explicitly. Keep using directives at the top of the file and sort them consistently.
Write null-safe code that respects nullable annotations instead of suppressing warnings by default. The project has Nullable enabled.
Use 4 spaces for indentation. Do not use tabs. Use Allman braces. Keep line length readable, around 120 characters as the preferred upper bound.
Prefer one primary type per...

Files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
ai-plan/public/**/*

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST maintain a matching execution trace under ai-plan/public/<topic>/traces/ for complex work. The trace should record the current date, key decisions, validation milestones, and the immediate next step. Update traces at each meaningful milestone before pausing or handing work off.

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change. Updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point. Tracking files are recovery entrypoints, not append-only changelogs, and MUST stay concise.

Files:

  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
🧠 Learnings (10)
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to **/*.g.cs : Source generator changes MUST be covered by generator tests. Preserve snapshot-based verification patterns already used in the repository. When generator behavior changes intentionally, update snapshots together with the implementation.

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.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
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers. Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs.

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.cs
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants, including null, empty, default, and filtered inputs when those branches change behavior. Regression fixes should include a test that fails before the fix and passes after it.

Applied to files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.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
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
  • GFramework.Cqrs.Tests/Cqrs/CqrsHandlerRegistrarTests.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-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
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. 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-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
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. Updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point. Tracking files are recovery entrypoints, not append-only changelogs, and MUST stay concise.

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:

  • GFramework.Cqrs/Internal/CqrsHandlerRegistrar.cs
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to **/*.Tests.cs : Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical. Public API changes must be covered by unit or integration tests.

Applied to files:

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

[grammar] ~7-~7: Ensure spelling is correct
Context: ... mapping 判定从逐条线性扫描 IServiceCollection 收敛为单次构建的本地映射索引 - reflection fallback 或重复类型输入场景下,后续 dup...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~17-~17: Ensure spelling is correct
Context: ...ported handler interface 元数据,reflection 注册路径现会复用已筛选且排序好的接口列表 - 同一 handler 类型跨容器重复注册时,不再重复执行 `GetInte...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

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

10-20: 跟踪文档更新符合恢复入口要求。

恢复点、已完成项、验证结果和下一步都已同步,且未看到不应进入 ai-plan/public/** 的敏感环境信息。

As per coding guidelines, ai-plan/public/*/todos/**/*: tracking files must reflect completed work, newly discovered issues, validation results, and the next recommended recovery point.

Also applies to: 33-52, 74-88

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

3-46: Trace 与本轮 CQRS 收敛进度保持同步。

记录了日期、关键决策、验证里程碑和后续恢复步骤,适合作为交接入口。

As per coding guidelines, ai-plan/public/*/traces/**/*: traces should record the current date, key decisions, validation milestones, and the immediate next step.

Also applies to: 57-59

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

29-32: Registrar 缓存与去重改动看起来合理。

本地 HashSet 避免重复线性扫描,supported-interface 缓存和 generated-registry factory 都有卸载/回退语义说明,注册路径仍保持确定性。

Also applies to: 168-226, 365-406, 490-490

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

145-168: 新增 registrar 回归覆盖到位。

私有无参构造 registry、supported-interface 缓存复用、重复 handler mapping 去重以及测试间缓存隔离都覆盖到了本轮实现变化。

Based on learnings, regression fixes should include a test that fails before the fix and passes after it.

Also applies to: 441-516, 518-583, 783-811

Comment thread GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs Outdated
Comment thread GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs Outdated
GeWuYou added a commit that referenced this pull request Apr 20, 2026
- 修复 CqrsHandlerRegistryGenerator 对 pointer 与 function pointer 的精确注册建模
- 补充生成器测试对输入源 CS0306 与 fallback 诊断的断言
- 更新 cqrs-rewrite 跟踪文档记录 PR #261 review follow-up
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2118    ↑6 2118    ↑6 0 0 0 0 1m 7s    ↑31.1s

Test Results

passed 2118 passed ↑6

Details

tests 2118 tests ↑6
clock 1m 7s ↑31.1s
tool nunit
build CI - Build & Test arrow-right build-and-test link #905
pull-request Feat/cqrs optimization link #261

Insights

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

build-and-test: Run #905

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
2118 2118 0 0 0 0 0 1m 7s

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
Flush_ShouldWaitForAllEntriesToBeProcessed 8 3.8s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 8 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 8 2.1s 2.2s
Generates_Scene_Behavior_Boilerplate 8 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 8 1.1s 1.1s
Append_ShouldNotBlock 8 1.0s 1.0s
Context_Caching_Should_Improve_Performance 8 782ms 789ms
PendingCount_ShouldReflectQueuedEntries 8 501ms 502ms
Cleanup_Should_NotRemoveActiveLocks 8 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 8 401ms 402ms

± Comparison with run #899 at 582263c | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 8 runs.

Github Test Reporter by CTRF 💚

@GeWuYou
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 20, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 20, 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 enabled auto-merge April 20, 2026 11:25
coderabbitai[bot]
coderabbitai Bot previously requested changes Apr 20, 2026
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

🧹 Nitpick comments (1)
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs (1)

988-998: 建议移除当前不可达的 pointer runtime-reference 建模分支。

TryCreateRuntimeTypeReference 现在已经在入口拒绝 IPointerTypeSymbol,所以 PointerElementTypeReferenceFromPointer(...).MakePointerType() 发射分支和外部程序集递归检查在当前生成器路径里没有调用来源。保留这些分支会让后续维护者误以为 pointer precise registration 仍受支持。

♻️ 可选清理方向
-        if (runtimeTypeReference.PointerElementTypeReference is not null)
-        {
-            var pointedAtExpression = AppendRuntimeTypeReferenceResolution(
-                builder,
-                runtimeTypeReference.PointerElementTypeReference,
-                $"{variableBaseName}PointedAt",
-                reflectedArgumentNames,
-                indent);
-
-            return $"{pointedAtExpression}.MakePointerType()";
-        }
-
         if (runtimeTypeReference.GenericTypeDefinitionReference is not null)
-        if (runtimeTypeReference.PointerElementTypeReference is not null &&
-            ContainsExternalAssemblyTypeLookup(runtimeTypeReference.PointerElementTypeReference))
-        {
-            return true;
-        }
-
         if (runtimeTypeReference.GenericTypeDefinitionReference is not null &&
-        RuntimeTypeReferenceSpec? PointerElementTypeReference,
         RuntimeTypeReferenceSpec? GenericTypeDefinitionReference,
         ImmutableArray<RuntimeTypeReferenceSpec> GenericTypeArguments)
-            return new RuntimeTypeReferenceSpec(typeDisplayName, null, null, null, 0, null, null,
+            return new RuntimeTypeReferenceSpec(typeDisplayName, null, null, null, 0, null,
                 ImmutableArray<RuntimeTypeReferenceSpec>.Empty);
-        public static RuntimeTypeReferenceSpec FromPointer(RuntimeTypeReferenceSpec pointedAtTypeReference)
-        {
-            return new RuntimeTypeReferenceSpec(null, null, null, null, 0, pointedAtTypeReference, null,
-                ImmutableArray<RuntimeTypeReferenceSpec>.Empty);
-        }
-

如果这是为后续非泛型 runtime type 场景预留的,请加一条注释说明当前 CQRS handler contract 路径不会调用它。

Also applies to: 1116-1120, 1160-1194

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

In `@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs` around
lines 988 - 998, The pointer-handling branch is unreachable because
TryCreateRuntimeTypeReference now rejects IPointerTypeSymbol; remove the
PointerElementTypeReference / FromPointer / .MakePointerType() branch in
AppendRuntimeTypeReferenceResolution (and any related checks for pointer runtime
references such as the sections around PointerElementTypeReference and calls to
FromPointer/MakePointerType), or if you intend to reserve it for future
non-generic runtime-type scenarios, replace the branch with a clear TODO comment
stating that TryCreateRuntimeTypeReference eliminates IPointerTypeSymbol on the
CQRS handler path so this code is currently unused; ensure references to
runtimeTypeReference.PointerElementTypeReference,
AppendRuntimeTypeReferenceResolution, FromPointer and MakePointerType are
cleaned up or documented accordingly.
🤖 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/traces/cqrs-rewrite-migration-trace.md`:
- Around line 39-48: Update the trace entry for "阶段:pointer precise runtime type
覆盖扩展(CQRS-REWRITE-RP-047)" to explicitly mark RP-047 as superseded by RP-050 and
avoid ambiguity: locate the paragraph referencing CqrsHandlerRegistryGenerator
and MakePointerType and append a clear statement like "This approach was
superseded/abandoned by RP-050 — do not revert to MakePointerType precise
registration," ensure the historical note explains that pointer/function pointer
behavior now uniformly uses fallback/diagnostic per RP-050, and add a brief
"Next step" line indicating RP-050 is the authoritative source for current
behavior (so future contributors won't reinstate RP-047).

---

Nitpick comments:
In `@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs`:
- Around line 988-998: The pointer-handling branch is unreachable because
TryCreateRuntimeTypeReference now rejects IPointerTypeSymbol; remove the
PointerElementTypeReference / FromPointer / .MakePointerType() branch in
AppendRuntimeTypeReferenceResolution (and any related checks for pointer runtime
references such as the sections around PointerElementTypeReference and calls to
FromPointer/MakePointerType), or if you intend to reserve it for future
non-generic runtime-type scenarios, replace the branch with a clear TODO comment
stating that TryCreateRuntimeTypeReference eliminates IPointerTypeSymbol on the
CQRS handler path so this code is currently unused; ensure references to
runtimeTypeReference.PointerElementTypeReference,
AppendRuntimeTypeReferenceResolution, FromPointer and MakePointerType are
cleaned up or documented accordingly.
🪄 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: f3ba3d1e-d82e-4c42-b7df-05bed09b9499

📥 Commits

Reviewing files that changed from the base of the PR and between 4085ae9 and 2440dbe.

📒 Files selected for processing (4)
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • 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
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (5)
**/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.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.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. Comments must explain intent, contract, and usage constraints instead of restating syntax.
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds or compatibility constraints, and registration order or lifecycle sequencing.
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interaction with other components, why the abstraction exists, and when to use it instead of alternatives.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling.
Follow the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
Use the following C# naming conventions: Types, methods, properties, events, and constants use PascalCase; interfaces use I prefix; parameters and locals use camelCase; private fields use _camelCase.
Do not rely on implicit imports. Declare every required using explicitly. Keep using directives at the top of the file and sort them consistently.
Write null-safe code that respects nullable annotations instead of suppressing warnings by default. The project has Nullable enabled.
Use 4 spaces for indentation. Do not use tabs. Use Allman braces. Keep line length readable, around 120 characters as the preferred upper bound.
Prefer one primary type per...

Files:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
ai-plan/public/**/*

📄 CodeRabbit inference engine (AGENTS.md)

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

Files:

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

📄 CodeRabbit inference engine (AGENTS.md)

When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under ai-plan/public/<topic>/todos/ in the same change. Updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point. Tracking files are recovery entrypoints, not append-only changelogs, and MUST stay concise.

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. The trace should record the current date, key decisions, validation milestones, and the immediate next step. Update traces at each meaningful milestone before pausing or handing work off.

Files:

  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
🧠 Learnings (7)
📚 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.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to **/*.g.cs : Source generator changes MUST be covered by generator tests. Preserve snapshot-based verification patterns already used in the repository. When generator behavior changes intentionally, update snapshots together with the implementation.

Applied to files:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • ai-plan/public/cqrs-rewrite/todos/cqrs-rewrite-migration-tracking.md
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers. Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs.

Applied to files:

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

Applied to files:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
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. 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
  • ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md
📚 Learning: 2026-04-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
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. Updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point. Tracking files are recovery entrypoints, not append-only changelogs, and MUST stay concise.

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-19T07:58:40.583Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-19T07:58:40.583Z
Learning: Applies to ai-plan/public/*/traces/**/* : Contributors MUST maintain a matching execution trace under `ai-plan/public/<topic>/traces/` for complex work. The trace should record the current date, key decisions, validation milestones, and the immediate next step. Update traces at each meaningful milestone before pausing or handing work off.

Applied to files:

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

[grammar] ~9-~9: Ensure spelling is correct
Context: ...e(),而测试只校验生成源诊断,未显式暴露输入源 CS0306- 已在GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~12-~12: Ensure spelling is correct
Context: ...言 CS0306 与 fallback / diagnostic 结果 - 定向验证已通过: - dotnet test GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj -c Release --no-restore -p:RestoreFallbackFolders= -m:1 -nodeReuse:false --filter "FullyQualifiedName~Reports_Compilation_Error_And_Skips_Precise_Registration_For_Hidden_Pointer_Response|FullyQualifiedName~Reports_Diagnostic_And_Skips_Registry_When_Fallback_Metadata_Is_Required_But_Runtime_Contract_Lacks_Fallback_Attribute|FullyQualifiedName~Emits_Assembly_Level_Fallback_Metadata_When_Fallback_Is_Required_And_Runtime_Contract_Is_Available" - 3/3 passed - 扩展验证已通过: - `dotnet test GFra...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~21-~21: Ensure spelling is correct
Context: ... mapping 判定从逐条线性扫描 IServiceCollection 收敛为单次构建的本地映射索引 - reflection fallback 或重复类型输入场景下,后续 dup...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~31-~31: Ensure spelling is correct
Context: ...ported handler interface 元数据,reflection 注册路径现会复用已筛选且排序好的接口列表 - 同一 handler 类型跨容器重复注册时,不再重复执行 `GetInte...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (2)
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs (1)

401-408: pointer / function pointer 的拒绝路径看起来正确。

这里在运行时类型引用入口和可直接引用判定里都统一返回失败,能避免为非法 CQRS 泛型合同继续生成 precise registration,符合本轮修复目标。

Also applies to: 530-532

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

10-20: 跟踪文档更新清晰。

当前恢复点、已完成的 generator / registrar 收敛项、验证命令和下一步都已集中到 active 文档里,便于后续从 RP-050 恢复。

Also applies to: 33-52, 74-85, 89-91

Comment thread ai-plan/public/cqrs-rewrite/traces/cqrs-rewrite-migration-trace.md Outdated
GeWuYou added 7 commits April 20, 2026 19:42
- 更新 CQRS 重写跟踪中的恢复点与活跃事实,记录 PR #253 已关闭且剩余 thread 为 stale review\n- 调整 CQRS 重写 trace 的下一步,恢复 Phase 8 主线优先级
- 优化 generated registry 激活流程,使用缓存工厂委托优先替代 ConstructorInfo.Invoke\n- 补充私有无参构造 registry 的回归测试,保持生成器产物兼容性\n- 更新 CQRS ai-plan 恢复点与验证记录,指向新的 Phase 8 下一步
- 优化 CqrsHandlerRegistryGenerator 对 pointer 类型的 runtime type 递归重建与发射逻辑
- 修复 function pointer 签名默认直出导致隐藏类型漏回退的判定边界
- 补充 pointer precise registration 与 function pointer fallback 回归测试
- 更新 cqrs-rewrite 跟踪与 trace 到 RP-047
- 优化 CqrsHandlerRegistrar 复用 supported handler interface 缓存
- 补充 registrar 静态缓存隔离与接口缓存复用回归测试
- 更新 cqrs-rewrite 跟踪与 trace 到 RP-048
- 优化 CqrsHandlerRegistrar 使用本地映射索引替代重复线性扫描
- 补充 重复 handler 类型输入仍只注册一份映射的回归测试
- 更新 cqrs-rewrite 跟踪与 trace 到 RP-049
- 修复 CqrsHandlerRegistryGenerator 对 pointer 与 function pointer 的精确注册建模
- 补充生成器测试对输入源 CS0306 与 fallback 诊断的断言
- 更新 cqrs-rewrite 跟踪文档记录 PR #261 review follow-up
- 更新 cqrs-rewrite migration trace,标记 RP-047 已被 RP-050 覆盖并禁止恢复 MakePointerType precise registration
- 同步 migration tracking 中 PR #261 的 open thread、CTRF 测试结果与 MegaLinter 状态
@GeWuYou GeWuYou force-pushed the feat/cqrs-optimization branch from 2440dbe to 13d52a8 Compare April 20, 2026 11:52
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2134    ↑16 2134    ↑16 0 0 0 0 36.6s    ↓30.8s

Test Results

passed 2134 passed ↑16

Details

tests 2134 tests ↑16
clock 36.6s ↓30.8s
tool nunit
build CI - Build & Test arrow-right build-and-test link #907
pull-request Feat/cqrs optimization link #261

Insights

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

build-and-test: Run #907

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
Flush_ShouldWaitForAllEntriesToBeProcessed 9 3.3s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 9 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 9 2.2s 2.2s
Generates_Scene_Behavior_Boilerplate 9 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 9 1.1s 1.1s
Append_ShouldNotBlock 9 1.0s 1.0s
Context_Caching_Should_Improve_Performance 9 782ms 789ms
PendingCount_ShouldReflectQueuedEntries 9 501ms 502ms
Cleanup_Should_NotRemoveActiveLocks 9 404ms 405ms
Cleanup_Should_RemoveUnusedLocks 9 401ms 402ms

± Comparison with run #905 at a9fd3a8 | 🎉 No failed tests detected across all runs. | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 9 runs.

Github Test Reporter by CTRF 💚

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