Skip to content

Fix/analyzer warning reduction batch#269

Merged
GeWuYou merged 13 commits intomainfrom
fix/analyzer-warning-reduction-batch
Apr 23, 2026
Merged

Fix/analyzer warning reduction batch#269
GeWuYou merged 13 commits intomainfrom
fix/analyzer-warning-reduction-batch

Conversation

@GeWuYou
Copy link
Copy Markdown
Owner

@GeWuYou GeWuYou commented Apr 22, 2026

Summary by CodeRabbit

  • Bug 修复

    • 修复重复事件注册现在抛出 InvalidOperationException;上下文提供器设置在传入 null 时会抛出 ArgumentNullException,静态/实例同步更稳健;配置/查找键比较更严格(Ordinal)。
  • 增强功能

    • Option 实现 IEquatable;若干公开配置集合保持具体集合类型以兼容既有 API。
  • 重构

    • 源生成器重构以避免生成成员名冲突、改进懒初始化/同步和运行时类型解析;CQRS 与 配置生成器模块化拆分。
  • 测试

    • 新增/更新多项单元与快照测试(字段名冲突、返回类型断言、取消传播、运行时类型查找等)。
  • 文档

    • 修正若干 XML 文档/生成快照中的说明与示例文字。

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 2026

Note

Reviews paused

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

Use the following commands to manage reviews:

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

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review
📝 Walkthrough

Walkthrough

重构并拆分多个源生成器(ContextAware、Cqrs、SchemaConfig),引入冲突免疫的生成字段名、运行时类型引用/反射查找与更小的解析/发射辅助方法,同时在若干核心库添加 MA0016/MA0015 pragma、类型契约调整和对应测试。

Changes

Cohort / File(s) Summary
源生成器 — ContextAware 与快照测试
GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs, GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs, GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/*
为每个目标生成冲突免疫的字段名(实例缓存、静态 provider、静态 sync),将上下文成员生成拆为辅助方法,更新生成的 Context/SetContextProvider/ResetContextProvider/SetContext 实现以使用新字段并在静态锁内同步;新增处理用户同名字段的快照测试与快照输出。
源生成器 — Cqrs 重构与运行时类型引用
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs, GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs, GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs, GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
拆分为 partial 文件并新增模型/运行时类型引用/源码发射模块;添加 RuntimeTypeReferenceSpec、HandlerCandidateAnalysis 等类型;实现从符号递归构造运行时 Type 引用(数组/泛型/反射查找)、精确反射注册尝试与外部程序集类型查找,并重构注册排序与源码发射流程。
源生成器 — SchemaConfig 重构
GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
将 schema 读取/解析/遍历拆为多阶段 Try*/Parse* 辅助函数(含 TryReadSchemaText、ParseSchemaRoot、TryTraverse* 等),规范类型比较(IsSchemaType),并重构属性/数组/对象解析与生成输出拼接(Catalog/YAML/路径方法等)。
保留具体集合类型并加 pragma + 测试
GFramework.Core/Extensions/CollectionExtensions.cs, GFramework.Core/Logging/FilterConfiguration.cs, GFramework.Core/Logging/LoggingConfiguration.cs, GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs, GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
在公开成员处加入 #pragma warning disable/restore MA0016 以保留具体返回/属性类型(Dictionary/List 等),并新增测试以验证这些具体类型与大小写敏感字典语义。
行为/签名与文档/测试调整
GFramework.Core/Functional/Option.cs, GFramework.Core/Events/EasyEvents.cs, GFramework.Core.Tests/Events/EasyEventsTests.cs
Option<T> 声明添加 : IEquatable<Option<T>>;保留 EasyEvents.AddEventArgumentException 合约(用 pragma),并将相关测试断言从 ArgumentException 调整为 InvalidOperationException;若干文档/注释与行尾换行调整。
字符串键比较一致性
GFramework.Core/Coroutine/CoroutineScheduler.cs
将内部按组/标签的字典改为使用 StringComparer.Ordinal,改变字符串键匹配语义。
计划与痕迹文档更新
ai-plan/public/analyzer-warning-reduction/.../*.md
推进 analyzer-warning-reduction 跟踪阶段(RP-016..RP-024),追加多条痕迹、完成项、风险与验证命令/结果记录。

Sequence Diagram(s)

sequenceDiagram
    autonumber
    participant GeneratedRegistry as GeneratedRegistry
    participant Services as IServiceCollection
    participant Logger as ILogger
    participant AssemblyLoader as AppDomain/AssemblyLoader
    participant TypeResolver as TypeResolver

    GeneratedRegistry->>Services: Register(services, logger)
    Note right of GeneratedRegistry: 验证参数并(若需)缓存 registry assembly
    GeneratedRegistry->>AssemblyLoader: 查找/加载外部程序集(若需要)
    AssemblyLoader-->>GeneratedRegistry: Assembly[] / Assembly?
    GeneratedRegistry->>TypeResolver: Resolve implementation Type (typeof 或 GetType(..., throwOnError:false))
    TypeResolver-->>GeneratedRegistry: Type? (null guarded)
    GeneratedRegistry->>Services: AddTransient(handlerInterface, implementationType 或 constructedGeneric)
    GeneratedRegistry->>Logger: Debug 日志(解析成功或失败)
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

🚥 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的主要目的——分析器警告减少批次修复,与所有文件变更(生成器重构、运行时修复、回归测试、追踪更新)的整体意图一致。
Docstring Coverage ✅ Passed Docstring coverage is 80.65% 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 fix/analyzer-warning-reduction-batch

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 ⏱️
2145 2145 0 0 0 0 37.3s    ↑773ms

Test Results

passed 2145 passed

Details

tests 2145 tests
clock 37.3s ↑773ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #923
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 3 2 1 33.33    ↓16.67

build-and-test: Run #923

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 3 10.0s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 11 2.7s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 11 4.2s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 11 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 11 1.8s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 11 1.1s 1.1s
Append_ShouldNotBlock 11 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 4 501ms 1.0s
Context_Caching_Should_Improve_Performance 11 780ms 791ms
PendingCount_ShouldReflectQueuedEntries 11 501ms 501ms

± Comparison with run #921 at 876c28c | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 11 runs.

Github Test Reporter by CTRF 💚

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Apr 22, 2026

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ CSHARP dotnet-format yes 1 no 5.91s
✅ REPOSITORY gitleaks yes no no 7.29s
✅ REPOSITORY trufflehog yes no no 6.3s

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 22, 2026

Greptile Summary

This PR is a broad analyzer-warning-reduction batch that addresses several categories of static-analysis findings across the framework, with the following major changes:

  • ContextAwareGenerator refactoring: The generator now allocates collision-safe field names by walking the full inheritance chain before generating member names. The fix for the previously reported "inherited member names not included in collision detection" issue has been properly implemented via CollectReservedContextMemberNames, which traverses the base-type chain. The fast-path lock-free read in the Context getter was also removed in favour of the simpler, always-locked path, which is more correct under the CLR memory model.
  • CQRS generator modularisation: CqrsHandlerRegistryGenerator was split into four partial-class files (Models, RuntimeTypeReferences, SourceEmission, and the main file) to stay under file-size analyzer thresholds without changing observable behaviour. A new runtime-type-reference resolution path handles unresolved/error types without emitting uncompilable typeof(...) expressions.
  • SchemaConfigGenerator refactoring: ParseSchemaFile was split into TryReadSchemaText + ParseSchemaRoot sub-steps. OperationCanceledException is now explicitly rethrown when the generator's own cancellation token is signalled, preventing cancellation from being misreported as a schema read failure.
  • Core library fixes: CoroutineScheduler group/tag dictionaries now use StringComparer.Ordinal; Option<T> implements IEquatable<Option<T>>; FilterConfiguration and LoggingConfiguration suppress CA1002/MA0016 with inline pragmas to preserve the concrete collection API surface.

Key observations:

  • The inherited-collision fix in ContextAwareGenerator (previously flagged) is now correctly implemented and covered by two new snapshot tests (CollisionProneRule, InheritedCollisionRule).
  • The ArgumentException in EasyEvents.AddEvent<T> is preserved (with a #pragma disable MA0015) rather than changed to InvalidOperationException, keeping the public API contract.
  • All analyzer suppression pragmas include a justification comment explaining why the suppression is intentional.

Confidence Score: 4/5

PR is safe to merge; all previously flagged issues are addressed and no new blocking bugs were found.

The primary concern raised in the previous review round (inherited member names not included in collision detection) has been correctly fixed with a full base-type traversal loop and validated by two dedicated snapshot tests. The Option<T> IEquatable implementation is correct, the CQRS generator split is purely structural, and the pragma-based analyzer suppressions are each justified with a comment. No logic regressions or security issues were identified. Score is 4 rather than 5 because the PR touches 28 files with significant generator changes and the CQRS/SchemaConfig refactors are large enough that edge-case behaviour should be verified by the project's CI test suite before merge.

No files require special attention; the inherited-collision fix in ContextAwareGenerator.cs was the only outstanding concern and is now resolved.

Important Files Changed

Filename Overview
GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs Inherited member collision detection fixed via full base-type traversal in CollectReservedContextMemberNames; field names now allocated with numeric suffixes when conflicts exist; Context getter simplified to always-lock path; SetContextProvider gains null guard.
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs Class made partial and large method bodies extracted to new sibling files; no logic changes in the main pipeline orchestration.
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs New file containing runtime type-reference resolution logic; handles pointer types, dynamic, arrays, constructed generics, and assembly-internal types with graceful fallback.
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs New file containing all source-emission helpers; extracted from the monolithic generator file with no semantic changes.
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs New file containing record structs and enums used as data models for the CQRS generator; clean separation of concerns.
GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs Refactored to extract TryReadSchemaText/ParseSchemaRoot; OperationCanceledException is now explicitly re-thrown when the generator's own token is cancelled.
GFramework.Core/Functional/Option.cs Added IEquatable<Option<T>> implementation with Equals, GetHashCode, and ==/!= operators; correctly uses EqualityComparer<T>.Default.
GFramework.Core/Events/EasyEvents.cs ArgumentException preserved with #pragma disable MA0015 and justification comment; public API contract unchanged.
GFramework.Core/Coroutine/CoroutineScheduler.cs _grouped and _tagged dictionaries now use StringComparer.Ordinal for consistent, culture-invariant key lookups.
GFramework.Core/Logging/LoggingConfiguration.cs CA1002/MA0016 suppression pragmas added to preserve concrete List<T>/Dictionary<K,V> API surface; StringComparer.Ordinal initialiser kept on LoggerLevels.
GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs Two new snapshot tests added for field-name collision scenarios (direct user fields and inherited base-class fields); test helper refactored to avoid duplicating the large infrastructure source block.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[ContextAwareGenerator\ndetects ContextAware type] --> B[CollectReservedContextMemberNames]
    B --> C{Walk full\ninheritance chain}
    C --> D[Collect all non-implicit\nmember names into HashSet]
    D --> E[AllocateGeneratedMemberName\n_gFrameworkContextAwareContext]
    E --> F{base name\navailable?}
    F -- yes --> G[Use base name\nadd to reserved set]
    F -- no --> H[Try suffix 1, 2, 3...\nuntil unique]
    H --> I[Add suffixed name\nto reserved set]
    G --> J[AllocateGeneratedMemberName\n_gFrameworkContextAwareProvider]
    I --> J
    J --> K[AllocateGeneratedMemberName\n_gFrameworkContextAwareSync]
    K --> L[GeneratedContextMemberNames record\nContextFieldName / ProviderFieldName / SyncFieldName]
    L --> M[GenerateContextBackingFields]
    L --> N[GenerateContextGetter\nalways-lock path]
    L --> O[GenerateContextProviderConfiguration\nSetContextProvider + null guard\nResetContextProvider]
    L --> P[GenerateInterfaceImplementations\nSetContext / GetContext]
Loading

Reviews (13): Last reviewed commit: "fix(cqrs-source-generators): 化解注册生成器文件级冲..." | Re-trigger Greptile

Comment thread GFramework.Core/Extensions/CollectionExtensions.cs Outdated
Comment thread GFramework.Core/Logging/LoggingConfiguration.cs Outdated
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2145 2145 0 0 0 0 36.4s    ↓935ms

Test Results

passed 2145 passed

Details

tests 2145 tests
clock 36.4s ↓935ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #925
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 4 3 1 25.00    ↓8.33

build-and-test: Run #925

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 4 7.5s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 12 2.5s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 12 4.2s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 12 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 12 1.8s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 12 1.1s 1.1s
Append_ShouldNotBlock 12 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 5 401ms 1.0s
Context_Caching_Should_Improve_Performance 12 780ms 791ms
PendingCount_ShouldReflectQueuedEntries 12 501ms 501ms

± Comparison with run #923 at 91a8273 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 12 runs.

Github Test Reporter by CTRF 💚

Comment thread GFramework.Core/Events/EasyEvents.cs
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

Caution

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

⚠️ Outside diff range comments (3)
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs (1)

1-1792: ⚠️ Potential issue | 🟠 Major

文件大小超出编码规范限制,需进行职责拆分

当前文件共 1792 行,显著超出编码规范规定的 800-1000 行上限(超出 79%)。根据编码规范:"如果文件超出该范围,贡献者必须停下来检查是否应该拆分职责后再继续。" 这是一个 MUST 级别的要求。

建议考虑以下拆分点:

  1. 运行时类型引用解析逻辑(lines 455-606, 1315-1485 的运行时类型引用处理)提取到专门的类型引用处理器
  2. 源码发射逻辑(lines 720-1534 的源码构建和输出)提取到专门的源码构建器
  3. 数据结构定义(lines 1576-1792 的各类 record 和 struct)提取到单独的结构定义文件

这样的拆分将提升可维护性,并符合单一职责原则和框架内的文件管理规范。

🤖 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 1 - 1792, The file is too large (1792 lines) and must be split to satisfy
the repository's 800–1000 line limit; refactor by extracting responsibilities
into smaller files. Split out the runtime type reference logic (e.g.
TryCreateRuntimeTypeReference, TryCreateConstructedGenericRuntimeTypeReference,
CreateNamedRuntimeTypeReference, TryCreateGenericTypeDefinitionReference,
RuntimeTypeReferenceSpec and related helpers like
AppendRuntimeTypeReferenceResolution, AppendArrayRuntimeTypeReferenceResolution,
AppendConstructedGenericRuntimeTypeReferenceResolution,
ContainsExternalAssemblyTypeLookup) into a new TypeReferenceResolver class/file;
extract the source-emission logic (e.g. GenerateSource,
CreateGeneratedRegistrySourceShape, AppendGeneratedSourcePreamble,
AppendGeneratedRegistryType, AppendRegisterMethod, AppendGeneratedRegistryType
helper methods and AppendReflectionHelpers) into a RegistrySourceBuilder
class/file; and move the data records/structs (HandlerRegistrationSpec,
ReflectedImplementationRegistrationSpec, OrderedRegistrationSpec,
GeneratedRegistrySourceShape, RuntimeTypeReferenceSpec if not moved,
PreciseReflectedRegistrationSpec, ImplementationRegistrationSpec,
HandlerCandidateAnalysis, GenerationEnvironment) into a separate Models/Specs
file; ensure public/internal accessibility and update references in
CqrsHandlerRegistryGenerator to use the new types and methods while keeping API
surface and behavior unchanged.
GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs (2)

225-231: ⚠️ Potential issue | 🟡 Minor

为生成的 public provider API 加运行时 null 校验。

provider 是非空契约,但 nullable-disabled 调用方或 null! 仍可传入 null,当前实现会静默清空 provider 并回退默认上下文,和“配置 provider”的语义不一致。

建议补充参数校验和异常文档
         sb.AppendLine("    /// <param name=\"provider\">后续懒加载上下文时要使用的提供者实例。</param>");
+        sb.AppendLine("    /// <exception cref=\"global::System.ArgumentNullException\">当 <paramref name=\"provider\" /> 为 null 时抛出。</exception>");
         sb.AppendLine("    /// <remarks>");
@@
         sb.AppendLine("    public static void SetContextProvider(global::GFramework.Core.Abstractions.Architectures.IArchitectureContextProvider provider)");
         sb.AppendLine("    {");
+        sb.AppendLine("        global::System.ArgumentNullException.ThrowIfNull(provider);");
         sb.AppendLine("        lock (_contextSync)");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs` around lines
225 - 231, 在生成的
SetContextProvider(global::GFramework.Core.Abstractions.Architectures.IArchitectureContextProvider
provider) 方法中增加运行时的非空校验:在进入 lock(_contextSync) 之前或内部对 provider 做 null 检查并在为 null
时抛出 ArgumentNullException(以避免静默回退 _contextProvider),同时更新方法的文档注释以说明当 provider 为
null 会抛出 ArgumentNullException,确保使用的符号包括
SetContextProvider、_contextProvider、_contextSync 和 IArchitectureContextProvider
以便定位和修改生成器模板。

188-203: ⚠️ Potential issue | 🟠 Major

使用 Volatile.Read/Write 确保 _context 字段的内存可见性。

当前实现在第 188 行进行无锁读取,但在锁内进行写入(第 201、321 行),导致数据竞争:线程 A 读取 _context 为 null,线程 B 随后调用 SetContext 写入新值,线程 A 进入锁后又通过 ??= 用 provider 获取的值覆盖了线程 B 的更改。需要使用 global::System.Threading.Volatile.Read(ref _context)global::System.Threading.Volatile.Write(ref _context, context) 统一发布与读取语义。

具体修改:

  • 第 188 行:替换为 var context = global::System.Threading.Volatile.Read(ref _context);
  • 第 201 行:替换为带 null 检查的显式赋值,最后用 global::System.Threading.Volatile.Write(ref _context, context);
  • 第 321 行(SetContext):替换为 global::System.Threading.Volatile.Write(ref _context, context);
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs` around lines
188 - 203, Replace the current non-volatile unsynchronized read/write of the
_context field with Volatile semantics to prevent lost updates: in the
GetContext generation use global::System.Threading.Volatile.Read(ref _context)
instead of a plain read for the initial local variable; inside the lock where
you set _context via provider (the block that references _contextProvider and
does the _context ??= ...), perform an explicit null-check and assign the
resolved context then publish it with
global::System.Threading.Volatile.Write(ref _context, context) rather than using
??=; likewise update the SetContext implementation to publish the new value
using global::System.Threading.Volatile.Write(ref _context, context). Ensure you
still synchronize provider creation with lock(_contextSync) and keep
provider.GetContext() usage unchanged except for storing and publishing via
Volatile.Write.
🧹 Nitpick comments (1)
GFramework.Core/Functional/Option.cs (1)

16-20: 建议为 Option<T> 类型补充 <remarks>,明确契约与边界语义。

类型已写了 <summary>,但这里建议再补充 <remarks>,说明 Some/Nonenull 约束及使用注意点,便于 API 使用者理解行为契约。

As per coding guidelines **/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> tags where applicable.

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

In `@GFramework.Core/Functional/Option.cs` around lines 16 - 20, Add an XML
<remarks> section to the Option<T> type documentation (the public readonly
struct Option<T>) that clearly states the contract and boundary semantics:
describe the Some/None semantics, whether Option<T> can wrap null for reference
types (and any behavior for T being a nullable/reference type), expectations
when calling methods or accessing Value, thread-safety or immutability
guarantees, and typical usage/interop guidance (e.g., prefer pattern matching,
avoid treating None as null). Ensure the new doc follows the project's XML doc
rules alongside the existing <summary> and include any applicable <exception> or
<remarks> nuance for Option<T> consumers.
🤖 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/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md`:
- Around line 224-225: The comment notes the real entry point in
SchemaConfigGenerator.cs is GenerateCatalogClass but the next-step notes
reference GenerateConfigCatalogSource; update the reference and any new code to
use the actual method name GenerateCatalogClass (or restore
GenerateConfigCatalogSource by adding a forwarding wrapper that calls
GenerateCatalogClass) and adjust all callers/usages accordingly (including any
TODOs or recovery scripts that expect GenerateCatalogClass); also verify
high-yield methods TryBuildConstraintDocumentation and GenerateCatalogClass are
the ones targeted for MA0051 fixes so tooling and tests point to the correct
symbol.

In `@GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs`:
- Around line 152-157: The generated backing fields in
GenerateContextBackingFields use generic names (_context, _contextProvider,
_contextSync) that can collide with user code; rename them to unique, stable
prefixed names (e.g. _gFrameworkContextAwareContext,
_gFrameworkContextAwareProvider, _gFrameworkContextAwareSync) and update every
generated reference accordingly: adjust the GetContext accessor, the
SetContextProvider and ResetContextProvider methods, and the explicit SetContext
implementation so they all use the new prefixed symbols (ensure you update
references in the methods named GetContext, SetContextProvider,
ResetContextProvider, and SetContext).

---

Outside diff comments:
In `@GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs`:
- Around line 225-231: 在生成的
SetContextProvider(global::GFramework.Core.Abstractions.Architectures.IArchitectureContextProvider
provider) 方法中增加运行时的非空校验:在进入 lock(_contextSync) 之前或内部对 provider 做 null 检查并在为 null
时抛出 ArgumentNullException(以避免静默回退 _contextProvider),同时更新方法的文档注释以说明当 provider 为
null 会抛出 ArgumentNullException,确保使用的符号包括
SetContextProvider、_contextProvider、_contextSync 和 IArchitectureContextProvider
以便定位和修改生成器模板。
- Around line 188-203: Replace the current non-volatile unsynchronized
read/write of the _context field with Volatile semantics to prevent lost
updates: in the GetContext generation use
global::System.Threading.Volatile.Read(ref _context) instead of a plain read for
the initial local variable; inside the lock where you set _context via provider
(the block that references _contextProvider and does the _context ??= ...),
perform an explicit null-check and assign the resolved context then publish it
with global::System.Threading.Volatile.Write(ref _context, context) rather than
using ??=; likewise update the SetContext implementation to publish the new
value using global::System.Threading.Volatile.Write(ref _context, context).
Ensure you still synchronize provider creation with lock(_contextSync) and keep
provider.GetContext() usage unchanged except for storing and publishing via
Volatile.Write.

In `@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs`:
- Around line 1-1792: The file is too large (1792 lines) and must be split to
satisfy the repository's 800–1000 line limit; refactor by extracting
responsibilities into smaller files. Split out the runtime type reference logic
(e.g. TryCreateRuntimeTypeReference,
TryCreateConstructedGenericRuntimeTypeReference,
CreateNamedRuntimeTypeReference, TryCreateGenericTypeDefinitionReference,
RuntimeTypeReferenceSpec and related helpers like
AppendRuntimeTypeReferenceResolution, AppendArrayRuntimeTypeReferenceResolution,
AppendConstructedGenericRuntimeTypeReferenceResolution,
ContainsExternalAssemblyTypeLookup) into a new TypeReferenceResolver class/file;
extract the source-emission logic (e.g. GenerateSource,
CreateGeneratedRegistrySourceShape, AppendGeneratedSourcePreamble,
AppendGeneratedRegistryType, AppendRegisterMethod, AppendGeneratedRegistryType
helper methods and AppendReflectionHelpers) into a RegistrySourceBuilder
class/file; and move the data records/structs (HandlerRegistrationSpec,
ReflectedImplementationRegistrationSpec, OrderedRegistrationSpec,
GeneratedRegistrySourceShape, RuntimeTypeReferenceSpec if not moved,
PreciseReflectedRegistrationSpec, ImplementationRegistrationSpec,
HandlerCandidateAnalysis, GenerationEnvironment) into a separate Models/Specs
file; ensure public/internal accessibility and update references in
CqrsHandlerRegistryGenerator to use the new types and methods while keeping API
surface and behavior unchanged.

---

Nitpick comments:
In `@GFramework.Core/Functional/Option.cs`:
- Around line 16-20: Add an XML <remarks> section to the Option<T> type
documentation (the public readonly struct Option<T>) that clearly states the
contract and boundary semantics: describe the Some/None semantics, whether
Option<T> can wrap null for reference types (and any behavior for T being a
nullable/reference type), expectations when calling methods or accessing Value,
thread-safety or immutability guarantees, and typical usage/interop guidance
(e.g., prefer pattern matching, avoid treating None as null). Ensure the new doc
follows the project's XML doc rules alongside the existing <summary> and include
any applicable <exception> or <remarks> nuance for Option<T> consumers.
🪄 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: e9e368ce-389c-42eb-8b72-618542b8185b

📥 Commits

Reviewing files that changed from the base of the PR and between 3425b29 and 3766fbd.

📒 Files selected for processing (12)
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core.Tests/Events/EasyEventsTests.cs
  • GFramework.Core/Coroutine/CoroutineScheduler.cs
  • GFramework.Core/Events/EasyEvents.cs
  • GFramework.Core/Extensions/CollectionExtensions.cs
  • GFramework.Core/Functional/Option.cs
  • GFramework.Core/Logging/FilterConfiguration.cs
  • GFramework.Core/Logging/LoggingConfiguration.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-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). (4)
  • GitHub Check: submit-nuget
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.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> tags 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/compatibility constraints/edge cases, and registration order/lifecycle sequencing/generated code assumptions. Avoid obvious comments such as // increment i.
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.
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling if any.
Follow C# naming conventions: use PascalCase for types, methods, properties, events, and constants; use I prefix for interfaces; use camelCase for parameters and locals; use _camelCase for private fields.
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
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 re...

Files:

  • GFramework.Core/Events/EasyEvents.cs
  • GFramework.Core.Tests/Events/EasyEventsTests.cs
  • GFramework.Core/Coroutine/CoroutineScheduler.cs
  • GFramework.Core/Logging/FilterConfiguration.cs
  • GFramework.Core/Logging/LoggingConfiguration.cs
  • GFramework.Core/Extensions/CollectionExtensions.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core/Functional/Option.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
ai-plan/public/**

📄 CodeRabbit inference engine (AGENTS.md)

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; use repository-relative paths, branch names, PR numbers, or stable document identifiers instead.

Files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
ai-plan/public/*/traces/*.md

📄 CodeRabbit inference engine (AGENTS.md)

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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST keep ai-plan/public/<topic>/todos/ recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Files:

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

Applied to files:

  • GFramework.Core/Events/EasyEvents.cs
  • GFramework.Core.Tests/Events/EasyEventsTests.cs
  • GFramework.Core/Coroutine/CoroutineScheduler.cs
  • GFramework.Core/Logging/FilterConfiguration.cs
  • GFramework.Core/Logging/LoggingConfiguration.cs
  • GFramework.Core/Extensions/CollectionExtensions.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core/Functional/Option.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/traces/*.md : 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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs. When adding analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not obvious.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/todos/*.md : Contributors MUST keep `ai-plan/public/<topic>/todos/` recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Treat source code, `*.csproj`, tests, generated snapshots, and packaging metadata as the primary evidence for documentation updates. Treat verified reference implementations under `ai-libs/` as a secondary evidence source for real project adoption patterns, directory layouts, and end-to-end usage examples.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-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 **/*.cs : Apply [ContextAware] attribute to automatically implement IContextAware boilerplate logic

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/SourceGenerators/**/*.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.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.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: Use IArchitectureContext and Provider classes to propagate context capabilities between components rather than direct coupling to implementation details

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Prefer explicit, readable code over clever shorthand in framework internals. Match existing async patterns and naming conventions with `Async` suffix for asynchronous methods. Avoid hidden side effects in property getters, constructors, and registration helpers.

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.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.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md

[grammar] ~42-~42: Ensure spelling is correct
Context: ... 决策: - 本轮暂缓 MA0158,转入单文件、可由生成器测试覆盖的 GFramework.Cqrs.SourceGenerators 结构拆分 - 未使用 subagent...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~109-~109: Ensure spelling is correct
Context: ...路径表示状态冲突, 不是某个方法参数无效,因此不能为 MA0015 人造参数名 - 为 Option<T> 声明 `IEquatable<Option...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md

[grammar] ~17-~17: Ensure spelling is correct
Context: ....cs的剩余MA0051结构拆分,生成输出保持不变 - 已完成GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~20-~20: Ensure spelling is correct
Context: ...ConfigurationCollectionExtensions已改用集合抽象接口,并保留内部具体集合默认值 -CoroutineScheduler的 tag/group 字典已显式使用StringComparer.Ordin...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~26-~26: Ensure spelling is correct
Context: ...atorswarnings-only 基线已降到0条 - 当前GFramework.Cqrs.SourceGeneratorswarnings-only 基线已降到...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~51-~51: Ensure spelling is correct
Context: ...051收口;warnings-only 基线已降到0条 - 已完成GFramework.Cqrs.SourceGeneratorsCqrsHandlerRegistr...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (36)
GFramework.Core/Events/EasyEvents.cs (1)

56-62: 异常类型调整合理

将重复注册抛出的异常由 ArgumentException 改为 InvalidOperationException,语义上更贴切(属于状态冲突而非参数校验),与 .NET 约定一致,XML 文档注释也同步更新。注意这是对外 API 的破坏性变更,若存在外部调用方捕获旧的 ArgumentException,需在发布说明中提醒。

GFramework.Core.Tests/Events/EasyEventsTests.cs (1)

101-110: 测试与生产代码变更保持同步

断言类型和 XML 文档措辞均已同步更新为 InvalidOperationException / “状态冲突”,与 EasyEvents.AddEvent<T>() 的新契约一致。

GFramework.Core/Functional/Option.cs (2)

316-316: 该处仅为结构性收尾,无需评论。


20-20: 实现 IEquatable<Option<T>> 的变更是正确且一致的。

当前声明与现有 Equals/GetHashCode/运算符 实现保持一致,方向正确、无明显回归风险。

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

84-84: Return type 改为 IDictionary 在仓库内部无兼容性问题。

验证显示仓库内所有 ToDictionarySafe 调用均使用 var 声明,无任何代码显式依赖 Dictionary<TKey, TValue> 具体返回类型。返回接口而非具体实现类是符合 C# 最佳实践的 API 设计,提供更好的抽象和扩展性。若此改动系有意为之的 API 改进,可按需在发布说明中注明。

GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs (1)

206-207: 类型比较收敛为 ordinal 语义,改动看起来合理。

主键类型校验、约束文档、inline schema 摘要和路径拼接都保持了 JSON schema keyword 的大小写敏感语义;schemaType 的 nullable flow 也更清晰。

Also applies to: 1857-1876, 3967-4111, 4374-4397, 4516-4518

ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md (1)

3-31: RP-019 trace 记录完整。

本段包含恢复点日期、决策、实现范围、验证命令和下一步建议,也未记录不可公开的环境细节。

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

92-98: 重构改进了可读性

将接口收集和候选分析拆分为独立辅助方法提升了代码的语义清晰度,保持了早期返回的逻辑流程。


100-111: LGTM!

接口过滤和排序逻辑正确,使用稳定的字符串比较器确保生成输出的确定性,这对于可重现构建至关重要。


113-165: 重构改进了性能和可维护性

提取候选分析逻辑为独立方法,并优化了 canReferenceImplementation 的计算(只计算一次而非在循环中重复计算),提升了代码清晰度。


167-215: 优秀的逻辑整合

将接口分类逻辑整合到单一方法中,清晰地处理了三种注册路径(直接注册、实现类型反射注册、精确反射注册),提升了代码的可测试性和可维护性。


485-501: LGTM!

将已构造泛型和命名类型的处理逻辑委托给专门的辅助方法,保持了核心方法的简洁性。未绑定泛型的检查条件正确。


503-543: 正确处理已构造泛型类型

该方法通过递归验证泛型定义和全部泛型实参的可表达性,保持了快速失败行为。逻辑清晰且正确。


545-561: LGTM!

正确根据类型所属程序集选择当前程序集反射查找或外部程序集反射查找,确保跨程序集类型引用的正确性。


724-730: 重构简化了源码生成流程

将源码形状计算和发射逻辑提取到独立辅助方法,使主生成流程更加线性和易于理解。


732-755: 优化生成流程的预计算策略

预先计算生成输出需要的辅助分支,避免在发射阶段重复扫描注册集合,这是一个有效的性能优化。


757-784: LGTM!

正确发射生成文件头和程序集级元数据特性,条件性发射 reflection fallback 特性的逻辑正确。


786-809: LGTM!

正确发射程序集级 reflection fallback 元数据特性,字符串转义和参数分隔符处理正确。


811-842: LGTM!

正确发射生成注册器类型本体,基于 HasExternalAssemblyTypeLookups 标志条件性发射反射辅助方法的逻辑正确。


844-892: 优化的条件性变量发射

使用预计算的 RequiresRegistryAssemblyVariable 标志条件性发射程序集变量,避免了在发射阶段重复检查每个注册项,提升了效率。


913-938: 良好的代码复用

提取服务注册发射逻辑为可复用辅助方法,减少代码重复。方法正确格式化 AddTransient 调用并支持可配置的缩进。


940-959: LGTM!

提取日志发射逻辑确保所有生成注册路径的日志文本格式一致,字符串转义正确应用。


988-1030: 正确合并和排序多种注册类型

该方法将直接注册、实现类型反射注册和精确反射注册合并为统一的有序列表,并按 handler 接口日志名排序以确保输出稳定性。逻辑清晰且正确。


1032-1059: LGTM!

正确根据类型可访问性选择直接 typeof 引用或反射查找,字符串转义应用正确。


1061-1105: 良好的分派逻辑

使用 switch 语句根据注册类型分派到专门的发射方法,并在 default 分支抛出异常以防御未来新增的注册类型,这是良好的防御性编程实践。


1107-1184: 优秀的关注点分离

三个专门的有序注册发射方法通过复用通用的 AppendServiceRegistrationAppendRegistrationLog 辅助方法保持一致性,同时为每种注册类型提供了专门处理。


1224-1252: LGTM!

正确递归处理每个 handler 泛型实参,并收集需要空值检查的反射解析变量。逻辑清晰且正确。


1254-1281: 正确的空值保护实现

为运行时反射解析的泛型实参生成空值保护块,使用 "is not null" 模式检查所有反射变量,避免注册无法完整构造的服务类型。


1283-1313: LGTM!

正确发射 MakeGenericType 构造语句以在运行时创建关闭的 handler 服务类型,参数连接逻辑正确。


1357-1447: 正确的递归类型引用处理

四个专门的运行时类型引用发射方法正确处理数组、指针和已构造泛型类型,通过递归处理组成类型确保完整的类型重建。数组处理正确区分一维和多维数组。


1449-1485: LGTM!

正确发射命名类型的运行时反射查找语句,并将变量名添加到需要空值检查的集合中。条件逻辑根据是否为外部程序集正确选择查找方式。


1586-1601: 设计良好的数据结构

新的数据结构设计合理:OrderedRegistrationSpec 用于跟踪有序注册项及其来源,GeneratedRegistrySourceShape 预计算代码分支需求。RequiresRegistryAssemblyVariable 属性正确组合了三个条件。

GFramework.Core/Coroutine/CoroutineScheduler.cs (1)

44-44: 显式指定分组和标签键的比较器没问题。

这里让 _grouped / _tagged 的字符串键比较语义更明确,且添加、删除、查询都走同一组字典实例,没有看到一致性问题。

Also applies to: 53-53

GFramework.Core/Logging/LoggingConfiguration.cs (1)

18-24: 此更改是意图清晰的析构器警告减少方案,不是破坏性变更。

AppendersLoggerLevels 的公开属性类型从具体类型改为接口类型(IList<T>/IDictionary<K,V>)是在 commit 2348957 "fix(analyzers): 降低 Core、Cqrs、Godot 与生成器的构建警告" 中有意进行的。该更改:

  • 已在代码库中广泛测试(112 个测试通过,包含 LoggingConfigurationTests 和 ConfigurableLoggerFactoryTests)
  • 与现有使用模式兼容——属性通过索引、迭代、Count 等接口方法访问,均对 IList<T>IDictionary<K,V> 无缝工作
  • 遵循 C# 设计最佳实践(依赖抽象而非具体实现)
  • 默认初始化器仍使用具体类型(new List<T>()/new Dictionary<K,V>(StringComparer.Ordinal)

无需回退或迁移计划。

GFramework.Core/Logging/FilterConfiguration.cs (1)

23-28: 这是一个经过规划的 API 设计改进,不应该回退。

根据 analyzer-warning-reduction 跟踪记录(RP-016),将 FilterConfiguration.NamespacesFiltersList<T> 改为 IList<T> 是为了解决 Meziantou 分析器警告(MA0016)而进行的有意改变。设计目标是"兼顾 analyzer 与现有配置消费路径",同时保留 List<T> 的默认实例行为。

IList<T> 对于配置 POCO 来说是更合适的公开接口,所有已确认的使用点(.ToArray().Select())都与此兼容。若要修改此更改,需要在项目的语义版本控制中反映破坏性变化(如主版本号递增),而不是回退到 List<T>

			> Likely an incorrect or invalid review comment.
GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs (1)

141-146: 生成器快照测试已覆盖,无需进一步措施。

快照测试 ContextAwareGeneratorSnapshotTests.Snapshot_ContextAwareGenerator() 已验证并通过,快照文件捕获了包括 SetContextProvider()ResetContextProvider()_contextProvider_contextSync 在内的全部新增生成逻辑。生成输出的同步协议、lazy 初始化语义和 provider 回退行为均已在快照中固定,避免了无意回退风险。

Comment thread GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs Outdated
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2145 2145 0 0 0 0 36.6s    ↑213ms

Test Results

passed 2145 passed

Details

tests 2145 tests
clock 36.6s ↑213ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #926
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 5 4 1 20.00    ↓5.00

build-and-test: Run #926

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 5 6.0s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 13 2.3s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 13 4.2s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 13 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 13 1.8s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 13 1.1s 1.1s
Append_ShouldNotBlock 13 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 6 334ms 1.0s
Context_Caching_Should_Improve_Performance 13 781ms 791ms
PendingCount_ShouldReflectQueuedEntries 13 501ms 501ms

± Comparison with run #925 at e3aedac | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 13 runs.

Github Test Reporter by CTRF 💚

GeWuYou added a commit that referenced this pull request Apr 22, 2026
- 重构 CqrsHandlerRegistryGenerator 为按职责拆分的 partial 生成器文件,保留现有注册输出与 fallback 契约
- 修复 ContextAwareGenerator 生成字段命名冲突并为 SetContextProvider 补充运行时 null 校验与异常文档
- 补充 Option<T> 的 XML remarks 契约说明与 ContextAwareGenerator 字段冲突快照测试
- 更新 analyzer-warning-reduction 跟踪与 trace,记录 PR #269 review follow-up 与验证结果
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2146    ↑1 2146    ↑1 0 0 0 0 35.9s    ↓663ms

Test Results

passed 2146 passed ↑1

Details

tests 2146 tests ↑1
clock 35.9s ↓663ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #927
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 6 5 1 16.67    ↓3.33

build-and-test: Run #927

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 6 5.0s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 14 2.1s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 14 4.2s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 14 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 14 1.8s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 14 1.1s 1.1s
Append_ShouldNotBlock 14 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 7 286ms 1.0s
Context_Caching_Should_Improve_Performance 14 781ms 791ms
PendingCount_ShouldReflectQueuedEntries 14 501ms 501ms

± Comparison with run #926 at cc1c3ca | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 14 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: 4

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

143-147: 可省略冗余参数传递。

外层已判断 sourceShape.HasExternalAssemblyTypeLookupstrue 才会进入该分支,AppendReflectionHelpers 再次接收 bool includeExternalAssemblyTypeLookupHelpers 并在方法内重复判断同一条件属于可简化项。可以去掉参数并内联当前为 true 的分支,或把参数留给日后可能的“反射辅助但非外部程序集查找”分支,并在注释中说明保留原因。

♻️ 建议的简化
-        if (sourceShape.HasExternalAssemblyTypeLookups)
-        {
-            builder.AppendLine();
-            AppendReflectionHelpers(builder, sourceShape.HasExternalAssemblyTypeLookups);
-        }
+        if (sourceShape.HasExternalAssemblyTypeLookups)
+        {
+            builder.AppendLine();
+            AppendReflectionHelpers(builder);
+        }

并相应去掉 AppendReflectionHelpersincludeExternalAssemblyTypeLookupHelpers 参数与内部 if

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

In
`@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs`
around lines 143 - 147, The call site checks
sourceShape.HasExternalAssemblyTypeLookups before calling
AppendReflectionHelpers, so remove the redundant bool parameter: change the
invocation to AppendReflectionHelpers(builder) and update the
AppendReflectionHelpers method signature to drop
includeExternalAssemblyTypeLookupHelpers; remove the internal if that re-checks
the same condition and inline the branch body (or keep conditional logic only
where needed inside the method), and update any other callers to the new
signature; leave a short comment on AppendReflectionHelpers if you chose to
preserve the parameter for future behaviors instead of removing it.
🤖 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.RuntimeTypeReferences.cs`:
- Around line 166-221: The external-reflection branches in
CreateNamedRuntimeTypeReference and TryCreateGenericTypeDefinitionReference
assume namedType.ContainingAssembly / genericTypeDefinition.ContainingAssembly
is non-null and call .Identity.ToString(), which can NRE for error/synthetic
symbols; update both methods to first check if ContainingAssembly is null and if
so avoid using .Identity: for CreateNamedRuntimeTypeReference return a failure
path (propagate by having the caller TryCreateRuntimeTypeReference treat it as
false) or emit a generator diagnostic instead of dereferencing, and for
TryCreateGenericTypeDefinitionReference detect null ContainingAssembly and set
genericTypeDefinitionReference = null and return false (or report a diagnostic)
so the caller falls back to the conservative registration path; ensure all
references to ContainingAssembly.Identity.ToString() are guarded by the null
check.

In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs`:
- Around line 133-146: The current catch-all around
file.GetText(cancellationToken) swallows OperationCanceledException and emits an
InvalidSchemaJson diagnostic; add a specific catch for
OperationCanceledException and rethrow (or simply let it propagate) before the
general catch so Roslyn cancellation is honored. Concretely, update the
try/catch in SchemaConfigGenerator.cs to catch OperationCanceledException (from
file.GetText with cancellationToken) and throw it, leaving the existing catch
(Exception) block to handle only real errors that should create
ConfigSchemaDiagnostics.InvalidSchemaJson via Diagnostic.Create and return
false.

In
`@GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs`:
- Around line 151-157: Add a test case in CollisionProneRule that declares both
the old field names (_context, _contextProvider, _contextSync) and the new
generated names (_gFrameworkContextAwareContext,
_gFrameworkContextAwareProvider, _gFrameworkContextAwareSync) on the same
partial type so the snapshot test exercises the generator's name-conflict
handling; update the test input in ContextAwareGeneratorSnapshotTests.cs to
include a partial class CollisionProneRule with both sets of fields and keep the
existing snapshot assertion pattern so the generator output vs. snapshot will
reveal whether duplicate-member conflicts are handled.

In
`@GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs`:
- Around line 37-49: The fast-path read of _gFrameworkContextAwareContext in the
Context property lacks acquire semantics so concurrent SetContext (which writes
under _gFrameworkContextAwareSync) can be invisible to readers; fix by replacing
the plain read with Volatile.Read on _gFrameworkContextAwareContext, keep the
existing lock(_gFrameworkContextAwareSync) block and inside it use a
double-check (Volatile.Read) and assign with Volatile.Write when initializing
_gFrameworkContextAwareProvider and _gFrameworkContextAwareContext (calls to
GameContextProvider.GetContext remain inside the lock); alternatively, if you
prefer the conservative approach, remove the fast-path entirely and always
acquire lock(_gFrameworkContextAwareSync) before reading/initializing to
guarantee visibility.

---

Nitpick comments:
In
`@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs`:
- Around line 143-147: The call site checks
sourceShape.HasExternalAssemblyTypeLookups before calling
AppendReflectionHelpers, so remove the redundant bool parameter: change the
invocation to AppendReflectionHelpers(builder) and update the
AppendReflectionHelpers method signature to drop
includeExternalAssemblyTypeLookupHelpers; remove the internal if that re-checks
the same condition and inline the branch body (or keep conditional logic only
where needed inside the method), and update any other callers to the new
signature; leave a short comment on AppendReflectionHelpers if you chose to
preserve the parameter for future behaviors instead of removing it.
🪄 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: 6ce7e4e7-4d81-4669-a7d9-722c68f42fb9

📥 Commits

Reviewing files that changed from the base of the PR and between 3766fbd and 232b761.

📒 Files selected for processing (12)
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core/Functional/Option.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
✅ Files skipped from review due to trivial changes (1)
  • GFramework.Core/Functional/Option.cs
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.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> tags 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/compatibility constraints/edge cases, and registration order/lifecycle sequencing/generated code assumptions. Avoid obvious comments such as // increment i.
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.
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling if any.
Follow C# naming conventions: use PascalCase for types, methods, properties, events, and constants; use I prefix for interfaces; use camelCase for parameters and locals; use _camelCase for private fields.
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
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 re...

Files:

  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
ai-plan/public/**

📄 CodeRabbit inference engine (AGENTS.md)

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; use repository-relative paths, branch names, PR numbers, or stable document identifiers instead.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST keep ai-plan/public/<topic>/todos/ recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-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.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
ai-plan/public/*/traces/*.md

📄 CodeRabbit inference engine (AGENTS.md)

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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🧠 Learnings (11)
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/SourceGenerators/**/*.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/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.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/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.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/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.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 **/*.cs : Apply [ContextAware] attribute to automatically implement IContextAware boilerplate logic

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.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: Use IArchitectureContext and Provider classes to propagate context capabilities between components rather than direct coupling to implementation details

Applied to files:

  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/todos/*.md : Contributors MUST keep `ai-plan/public/<topic>/todos/` recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/traces/*.md : 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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-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:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs. When adding analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not obvious.

Applied to files:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.Models.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Treat source code, `*.csproj`, tests, generated snapshots, and packaging metadata as the primary evidence for documentation updates. Treat verified reference implementations under `ai-libs/` as a secondary evidence source for real project adoption patterns, directory layouts, and end-to-end usage examples.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md

[grammar] ~17-~17: Ensure spelling is correct
Context: ....cs的剩余MA0051结构拆分,生成输出保持不变 - 已完成GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~24-~24: Ensure spelling is correct
Context: ...ConfigurationCollectionExtensions已改用集合抽象接口,并保留内部具体集合默认值 -CoroutineScheduler的 tag/group 字典已显式使用StringComparer.Ordin...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~30-~30: Ensure spelling is correct
Context: ...atorswarnings-only 基线已降到0条 - 当前GFramework.Cqrs.SourceGeneratorswarnings-only 基线已降到...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~55-~55: Ensure spelling is correct
Context: ...051收口;warnings-only 基线已降到0条 - 已完成GFramework.Cqrs.SourceGeneratorsCqrsHandlerRegistr...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~55-~55: Ensure spelling is correct
Context: ...剩余 MA0051 收口;warnings-only 基线已降到 0 条 - 已完成当前 PR #269 的 review follow-up:收口 `ContextA...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md

[grammar] ~18-~18: Ensure spelling is correct
Context: ...rovider/_contextSync- 实施调整: - 将GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~104-~104: Ensure spelling is correct
Context: ... 决策: - 本轮暂缓 MA0158,转入单文件、可由生成器测试覆盖的 GFramework.Cqrs.SourceGenerators 结构拆分 - 未使用 subagent...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~171-~171: Ensure spelling is correct
Context: ...路径表示状态冲突, 不是某个方法参数无效,因此不能为 MA0015 人造参数名 - 为 Option<T> 声明 `IEquatable<Option...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

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

81-215: 拆分后的 handler 接口分类流程清晰且保持确定性。

GetSupportedHandlerInterfaces 显式使用 StringComparer.Ordinal 对接口排序,TryAddStaticHandlerRegistration 将三类静态注册分支拆分干净,CreateHandlerCandidateAnalysis 只负责聚合结果;整体保持了原有语义且与拆分出来的 Models/RuntimeTypeReferences/SourceEmission 三个 partial 职责边界一致。

GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs (1)

1-103: 生成快照与生成器改动一致。

_gFrameworkContextAware* 前缀字段规避了用户类型字段重名冲突;SetContextProviderArgumentNullException.ThrowIfNull 及各路径统一在 _gFrameworkContextAwareSync 下写入/重置,行为与 <remarks> 中声明的契约(provider 切换不会清除已缓存实例上下文)自洽。

ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md (1)

250-251: todo 中引用的方法名均已验证存在,可用作切入点。

GenerateBindingsClassAppendGeneratedConfigCatalogTypeGenerateCatalogClass 在当前 SchemaConfigGenerator.cs 中都已正确定义,不存在之前 GenerateConfigCatalogSource 的问题。恢复点中的建议入口是有效的。

Comment thread GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
Comment thread GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs Outdated
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2150    ↑4 2150    ↑4 0 0 0 0 36.4s    ↑486ms

Test Results

passed 2150 passed ↑4

Details

tests 2150 tests ↑4
clock 36.4s ↑486ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #929
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 7 6 1 14.29    ↓2.38

build-and-test: Run #929

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 7 4.3s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 15 2.0s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 15 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 15 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 15 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 15 1.1s 1.1s
Append_ShouldNotBlock 15 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 8 251ms 1.0s
Context_Caching_Should_Improve_Performance 15 781ms 791ms
PendingCount_ShouldReflectQueuedEntries 15 501ms 501ms

± Comparison with run #927 at 3411e9e | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 15 runs.

Github Test Reporter by CTRF 💚

@GeWuYou
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 22, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 22, 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: 3

Caution

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

⚠️ Outside diff range comments (1)
GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs (1)

3113-3118: ⚠️ Potential issue | 🟠 Major

转义 XML 文档中的泛型类型。

第 3115 行在 /// 注释中包含未转义的 IEqualityComparer<{schema.KeyClrType}>?。当 schema.KeyClrType 被替换(例如为 int)时,XML 文档解析器会将 <int> 解析为 XML 标签,导致生成代码出现文档警告。

使用 EscapeXmlDocumentation() 方法转义泛型类型,并用 <c> 标签包裹以实现代码格式化,与文件中现有的文档处理模式保持一致。

建议修复
         for (var index = 0; index < schemas.Count; index++)
         {
             var schema = schemas[index];
+            var comparerTypeDocumentation = EscapeXmlDocumentation(
+                $"global::System.Collections.Generic.IEqualityComparer<{schema.KeyClrType}>?");
             builder.AppendLine("    /// <summary>");
             builder.AppendLine(
-                $"    ///     Gets or sets the optional key comparer forwarded to {schema.EntityName}ConfigBindings.Register{schema.EntityName}Table(global::GFramework.Game.Config.YamlConfigLoader, global::System.Collections.Generic.IEqualityComparer<{schema.KeyClrType}>?) when aggregate registration runs.");
+                $"    ///     Gets or sets the optional key comparer forwarded to {schema.EntityName}ConfigBindings.Register{schema.EntityName}Table using <c>{comparerTypeDocumentation}</c> when aggregate registration runs.");
             builder.AppendLine("    /// </summary>");
             builder.AppendLine(
                 $"    public global::System.Collections.Generic.IEqualityComparer<{schema.KeyClrType}>? {schema.EntityName}Comparer {{ get; init; }}");
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs` around
lines 3113 - 3118, The XML doc in SchemaConfigGenerator is inserting raw generic
text ("IEqualityComparer<{schema.KeyClrType}>?") into a /// summary which can be
parsed as XML tags; call the existing EscapeXmlDocumentation() on the full
generic type and wrap it in a <c> tag when building the summary string.
Concretely, update the builder.AppendLine that writes the summary (the line
constructing "IEqualityComparer<{schema.KeyClrType}>?") to use something like
"<c>" +
EscapeXmlDocumentation($"global::System.Collections.Generic.IEqualityComparer<{schema.KeyClrType}>?")
+ "</c>" so the generic angle brackets are escaped in the XML docs for the
{schema.EntityName}Comparer property.
🧹 Nitpick comments (2)
GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs (1)

62-69: 建议补充正向断言以增强回归价值。

当前仅断言小写键不存在,若 LoggerLevels 初始化失败导致字典为空,测试依然会通过。建议同时断言原始大小写键存在,这样才能真正锁定 StringComparer.Ordinal 的契约。

♻️ 建议修改
     var config = new LoggingConfiguration();
     config.LoggerLevels["GFramework.Core"] = LogLevel.Info;

-    Assert.That(config.LoggerLevels.ContainsKey("gframework.core"), Is.False);
+    Assert.Multiple(() =>
+    {
+        Assert.That(config.LoggerLevels.ContainsKey("GFramework.Core"), Is.True);
+        Assert.That(config.LoggerLevels.ContainsKey("gframework.core"), Is.False);
+    });
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs` around lines 62 -
69, The test LoggerLevels_Should_Remain_Case_Sensitive_By_Default currently only
asserts that the lowercase key "gframework.core" is absent, which would still
pass if LoggerLevels were empty; update the test to also assert that the
original-cased key exists and maps to LogLevel.Info to confirm
LoggingConfiguration initializes LoggerLevels with case-sensitive comparer.
Locate the test method LoggerLevels_Should_Remain_Case_Sensitive_By_Default and
add a positive assertion that config.LoggerLevels.ContainsKey("GFramework.Core")
is true (and optionally assert config.LoggerLevels["GFramework.Core"] ==
LogLevel.Info) to validate the StringComparer.Ordinal contract used by
LoggingConfiguration.
GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs (1)

171-243: 建议抽取重复的“按所属程序集选择反射查找形式”分支。

TryCreateNamedRuntimeTypeReference(171-192)与 TryCreateGenericTypeDefinitionReference 的后半段(226-242)在判定流程上完全一致:先比较 ContainingAssembly 是否为当前编译程序集,再在 ContainingAssembly is null 时返回失败,最后落到 FromExternalReflectionLookup。两处重复维护很容易出现一侧改了、一侧忘改的漂移(例如将来需要区分 netstandard.dll 之类的转发程序集或加 diagnostic 报告时)。

可以抽一个小 helper,比如 TryCreateReflectionLookupReference(compilation, symbol, metadataName, out spec),让两个方法共享同一份逻辑;TryCreateGenericTypeDefinitionReference 只需在 CanReferenceFromGeneratedRegistry 命中时负责 ConstructUnboundGenericType() 的特殊化。这样可以把“反射查找形式的选择”收敛到单一实现,并方便未来为这两条路径加统一的 generator diagnostic。

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

In
`@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs`
around lines 171 - 243, Both TryCreateNamedRuntimeTypeReference and
TryCreateGenericTypeDefinitionReference duplicate the "choose reflection lookup
form by containing assembly" logic; extract that branch into a single helper
(e.g., TryCreateReflectionLookupReference) that takes Compilation,
INamedTypeSymbol (or ISymbol), metadata name and out RuntimeTypeReferenceSpec?
and performs the ContainingAssembly == compilation.Assembly check, null check,
and FromExternalReflectionLookup fallback. Update
TryCreateNamedRuntimeTypeReference to call the new helper directly, and change
TryCreateGenericTypeDefinitionReference to first handle the
CanReferenceFromGeneratedRegistry + ConstructUnboundGenericType() path and
otherwise call the same helper for the reflection lookup decision so both
methods share the same logic and diagnostic hook point.
🤖 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/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md`:
- Around line 251-259: Replace the escaped quotes \"\" used for the MSBuild
property RestoreFallbackFolders in the dotnet command lines with plain double
quotes "" so the shell copies a valid MSBuild argument; specifically update the
occurrences in the dotnet build and dotnet test command strings (the lines
containing -p:RestoreFallbackFolders=\"\") to use -p:RestoreFallbackFolders=""
(affecting the build commands for GFramework.Core.csproj,
GFramework.Cqrs.SourceGenerators.csproj, GFramework.Game.SourceGenerators.csproj
and the dotnet test invocations).

In `@GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs`:
- Around line 174-179: The test currently only asserts the return type is
Dictionary<,>; update the assertion for the method found via
typeof(GFramework.Core.Extensions.CollectionExtensions).GetMethods().Single(m =>
m.Name ==
nameof(GFramework.Core.Extensions.CollectionExtensions.ToDictionarySafe)) (the
method variable) to also verify the generic parameter identities so the API
remains Dictionary<TKey, TValue>: assert method.IsGenericMethodDefinition is
true, then assert method.GetGenericArguments() contains two generic parameters
named "TKey" and "TValue" (or assert the return type's generic argument names
match those method type parameter names) to ensure the return type is
specifically Dictionary<TKey, TValue>.

In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs`:
- Around line 179-180: The root entity name derived by
ToPascalCase(GetSchemaBaseName(filePath)) can produce invalid C# identifiers
(e.g. starting with digits) and is used to build root type names in
ParseObjectSpec and CreateSchemaFileSpec; validate the computed entityName with
the same mechanism used for properties (TryBuildPropertyIdentifier /
SyntaxFacts.IsValidIdentifier) and if invalid normalize it (for example prefix
with an underscore or a fixed letter and re-run ToPascalCase) so that
$"{entityName}Config" and $"{entityName}Table" always produce legal C#
identifiers; update the code path around the entityName assignment and any
callers (ParseObjectSpec, CreateSchemaFileSpec) to use the validated/normalized
identifier.

---

Outside diff comments:
In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs`:
- Around line 3113-3118: The XML doc in SchemaConfigGenerator is inserting raw
generic text ("IEqualityComparer<{schema.KeyClrType}>?") into a /// summary
which can be parsed as XML tags; call the existing EscapeXmlDocumentation() on
the full generic type and wrap it in a <c> tag when building the summary string.
Concretely, update the builder.AppendLine that writes the summary (the line
constructing "IEqualityComparer<{schema.KeyClrType}>?") to use something like
"<c>" +
EscapeXmlDocumentation($"global::System.Collections.Generic.IEqualityComparer<{schema.KeyClrType}>?")
+ "</c>" so the generic angle brackets are escaped in the XML docs for the
{schema.EntityName}Comparer property.

---

Nitpick comments:
In `@GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs`:
- Around line 62-69: The test
LoggerLevels_Should_Remain_Case_Sensitive_By_Default currently only asserts that
the lowercase key "gframework.core" is absent, which would still pass if
LoggerLevels were empty; update the test to also assert that the original-cased
key exists and maps to LogLevel.Info to confirm LoggingConfiguration initializes
LoggerLevels with case-sensitive comparer. Locate the test method
LoggerLevels_Should_Remain_Case_Sensitive_By_Default and add a positive
assertion that config.LoggerLevels.ContainsKey("GFramework.Core") is true (and
optionally assert config.LoggerLevels["GFramework.Core"] == LogLevel.Info) to
validate the StringComparer.Ordinal contract used by LoggingConfiguration.

In
`@GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs`:
- Around line 171-243: Both TryCreateNamedRuntimeTypeReference and
TryCreateGenericTypeDefinitionReference duplicate the "choose reflection lookup
form by containing assembly" logic; extract that branch into a single helper
(e.g., TryCreateReflectionLookupReference) that takes Compilation,
INamedTypeSymbol (or ISymbol), metadata name and out RuntimeTypeReferenceSpec?
and performs the ContainingAssembly == compilation.Assembly check, null check,
and FromExternalReflectionLookup fallback. Update
TryCreateNamedRuntimeTypeReference to call the new helper directly, and change
TryCreateGenericTypeDefinitionReference to first handle the
CanReferenceFromGeneratedRegistry + ConstructUnboundGenericType() path and
otherwise call the same helper for the reflection lookup decision so both
methods share the same logic and diagnostic hook point.
🪄 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: 553de8f2-858e-4756-b8a5-28e26ec9fe76

📥 Commits

Reviewing files that changed from the base of the PR and between 232b761 and 9c51ae0.

📒 Files selected for processing (18)
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Core.Tests/Events/EasyEventsTests.cs
  • GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs
  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.Core/Events/EasyEvents.cs
  • GFramework.Core/Extensions/CollectionExtensions.cs
  • GFramework.Core/Logging/FilterConfiguration.cs
  • GFramework.Core/Logging/LoggingConfiguration.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
✅ Files skipped from review due to trivial changes (3)
  • GFramework.Core/Logging/FilterConfiguration.cs
  • GFramework.Core/Extensions/CollectionExtensions.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
🚧 Files skipped from review as they are similar to previous changes (6)
  • GFramework.Core.Tests/Events/EasyEventsTests.cs
  • GFramework.Core/Logging/LoggingConfiguration.cs
  • GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs
  • GFramework.Core/Events/EasyEvents.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/MyRule.ContextAware.g.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.SourceEmission.cs
📜 Review details
🧰 Additional context used
📓 Path-based instructions (5)
**/*.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> tags 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/compatibility constraints/edge cases, and registration order/lifecycle sequencing/generated code assumptions. Avoid obvious comments such as // increment i.
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.
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling if any.
Follow C# naming conventions: use PascalCase for types, methods, properties, events, and constants; use I prefix for interfaces; use camelCase for parameters and locals; use _camelCase for private fields.
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
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 re...

Files:

  • GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs
  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.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.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
ai-plan/public/**

📄 CodeRabbit inference engine (AGENTS.md)

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; use repository-relative paths, branch names, PR numbers, or stable document identifiers instead.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST keep ai-plan/public/<topic>/todos/ recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
ai-plan/public/*/traces/*.md

📄 CodeRabbit inference engine (AGENTS.md)

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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🧠 Learnings (13)
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/SourceGenerators/**/*.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.Core.Tests/Extensions/CollectionExtensionsTests.cs
  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
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. 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.Core.Tests/Extensions/CollectionExtensionsTests.cs
  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs
  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs
  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.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/Config/SchemaGeneratorTestDriver.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.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 **/*.cs : Apply [ContextAware] attribute to automatically implement IContextAware boilerplate logic

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • GFramework.SourceGenerators.Tests/Rule/snapshots/ContextAwareGenerator/CollisionProneRule.ContextAware.g.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Prefer explicit, readable code over clever shorthand in framework internals. Match existing async patterns and naming conventions with `Async` suffix for asynchronous methods. Avoid hidden side effects in property getters, constructors, and registration helpers.

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs. When adding analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not obvious.

Applied to files:

  • GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-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:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/todos/*.md : Contributors MUST keep `ai-plan/public/<topic>/todos/` recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/traces/*.md : 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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Write null-safe code that respects nullable annotations instead of suppressing warnings by default. Follow the repository defaults: `ImplicitUsings` disabled, `Nullable` enabled, `GenerateDocumentationFile` enabled for shipped libraries, and `LangVersion` is generally `preview`.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Treat source code, `*.csproj`, tests, generated snapshots, and packaging metadata as the primary evidence for documentation updates. Treat verified reference implementations under `ai-libs/` as a secondary evidence source for real project adoption patterns, directory layouts, and end-to-end usage examples.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md

[grammar] ~17-~17: Ensure spelling is correct
Context: ....cs的剩余MA0051结构拆分,生成输出保持不变 - 已完成GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~31-~31: Ensure spelling is correct
Context: ...atorswarnings-only 基线已降到0条 - 当前GFramework.Cqrs.SourceGeneratorswarnings-only 基线已降到...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~56-~56: Ensure spelling is correct
Context: ...051收口;warnings-only 基线已降到0条 - 已完成GFramework.Cqrs.SourceGeneratorsCqrsHandlerRegistr...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md

[grammar] ~54-~54: Ensure spelling is correct
Context: ...rovider/_contextSync- 实施调整: - 将GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~140-~140: Ensure spelling is correct
Context: ... 决策: - 本轮暂缓 MA0158,转入单文件、可由生成器测试覆盖的 GFramework.Cqrs.SourceGenerators 结构拆分 - 未使用 subagent...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~207-~207: Ensure spelling is correct
Context: ...路径表示状态冲突, 不是某个方法参数无效,因此不能为 MA0015 人造参数名 - 为 Option<T> 声明 `IEquatable<Option...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (4)
GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs (1)

42-60: 反射类型断言 LGTM。

通过反射锁定 AppendersLoggerLevelsNamespacesFilters 的具体集合类型,能够有效防止未来无意将公共属性改为接口类型(如 IList<>/IDictionary<>)而破坏已建立的 API 契约,与 LoggingConfiguration.cs / FilterConfiguration.cs 中的 MA0016 pragma 保持一致。

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

70-117: 整体实现 LGTM。

类型转换入口对指针 / 函数指针提前拒绝、CanReferenceFromGeneratedRegistry 先行用于最优的直接引用路径,再按数组、构造泛型、命名类型的顺序回退,语义清晰;TypeArgumentsforeach 保持 Roslyn 给出的顺序,满足生成器确定性输出的要求。之前评审提出的 ContainingAssembly NRE 隐患已在 182-186 / 233-237 显式 is null 分支中兜底,回退到调用方的宽松反射扫描路径也与 XML 文档承诺一致。


1-305: 快照测试已完整覆盖所有 runtime type reference 辅助方法的分支路径,无需采取行动。

已验证的测试覆盖:

  • 外部程序集泛型实参:Generates_Precise_Assembly_Type_Lookups_For_Inaccessible_External_Protected_Types()ExternalAssemblyPreciseLookupExpected 快照验证了 ResolveReferencedAssemblyType() 的外部程序集查找路径
  • 内嵌数组:Generates_Precise_Service_Type_For_Hidden_Array_Type_Arguments() 和上述外部程序集测试中的 .MakeArrayType() 递归分支
  • 不可访问命名类型:protected internal 嵌套类型在外部程序集测试中明确验证
  • 无法表示导致回退:Reports_Compilation_Error_And_Skips_Precise_Registration_For_Hidden_Pointer_Response() 测试了指针类型拒绝路径
  • 直接引用、当前程序集反射查找、混合注册场景:分别由 MixedDirectAndPreciseRegistrationsExpectedHiddenNestedHandlerSelfRegistrationExpected 等 7 个快照常量完整覆盖

测试框架使用自定义的 GeneratorTest<T>.RunAsync() 与预期输出常量进行快照式验证,符合仓库现有的生成器测试模式。

GFramework.SourceGenerators.Tests/Config/SchemaGeneratorTestDriver.cs (1)

20-39: API 设计可更清晰,但当前无编译问题。

虽然两个 params 重载在理论上共享相同的必填参数列表,但实际代码库中所有调用都显式传递 AdditionalFiles,不存在调用 Run(source) 的情况。代码已成功编译并合并,说明不存在 CS0121 二义性。

如需提高 API 清晰度,可选择添加显式单参数重载或重命名其中一个入口。但这是可选的设计改进,而非当前必需的修复。

Comment thread GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs Outdated
Comment thread GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs Outdated
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2151    ↑1 2151    ↑1 0 0 0 0 35.6s    ↓871ms

Test Results

passed 2151 passed ↑1

Details

tests 2151 tests ↑1
clock 35.6s ↓871ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #930
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 8 7 1 12.50    ↓1.79

build-and-test: Run #930

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 8 3.8s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 16 1.9s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 16 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 16 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 16 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 16 1.1s 1.1s
Append_ShouldNotBlock 16 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 9 223ms 1.0s
Context_Caching_Should_Improve_Performance 16 781ms 791ms
PendingCount_ShouldReflectQueuedEntries 16 501ms 501ms

± Comparison with run #929 at f5481c9 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 16 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: 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.RuntimeTypeReferences.cs`:
- Around line 254-279: The default branch in CanReferenceFromGeneratedRegistry
currently treats unresolved/error Roslyn types as referenceable which lets
TypeDisplayName from type.ToDisplayString(...) flow into FromDirectReference and
produce invalid typeof(...) in generated code; update
CanReferenceFromGeneratedRegistry to explicitly reject symbols where type.Kind
== TypeKind.Error (and similarly treat dynamic/unresolved/error appropriately)
so error-type symbols return false and force the generator to use the
conservative reflection path instead of emitting FromDirectReference for error
types; reference the CanReferenceFromGeneratedRegistry method, the
Type.Kind/TypeKind.Error check, and the downstream
FromDirectReference/ToDisplayString/TypeDisplayName flow when making the change.

In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs`:
- Around line 223-225: The code calls rootTypeElement.GetString() without first
ensuring rootTypeElement.ValueKind is JsonValueKind.String; update the
conditional in SchemaConfigGenerator (the block using
root.TryGetProperty("type", out var rootTypeElement) and IsSchemaType) to first
check rootTypeElement.ValueKind == JsonValueKind.String (or !=
JsonValueKind.String and treat as non-string) before calling GetString(),
mirroring the other schema checks (e.g., dependency/allOf/conditional checks) so
the InvalidOperationException is avoided and the RootObjectSchemaRequired
diagnostic is produced as intended.
🪄 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: 24353096-baa4-4d72-8a25-4ab5feb964f3

📥 Commits

Reviewing files that changed from the base of the PR and between 9c51ae0 and d245366.

📒 Files selected for processing (8)
  • GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs
  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Config/snapshots/SchemaConfigGenerator/GeneratedConfigCatalog.g.txt
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
✅ Files skipped from review due to trivial changes (1)
  • GFramework.SourceGenerators.Tests/Config/snapshots/SchemaConfigGenerator/GeneratedConfigCatalog.g.txt
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.Core.Tests/Extensions/CollectionExtensionsTests.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Build and Test
  • GitHub Check: Code Quality & Security
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.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> tags 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/compatibility constraints/edge cases, and registration order/lifecycle sequencing/generated code assumptions. Avoid obvious comments such as // increment i.
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.
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling if any.
Follow C# naming conventions: use PascalCase for types, methods, properties, events, and constants; use I prefix for interfaces; use camelCase for parameters and locals; use _camelCase for private fields.
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
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 re...

Files:

  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
ai-plan/public/**

📄 CodeRabbit inference engine (AGENTS.md)

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; use repository-relative paths, branch names, PR numbers, or stable document identifiers instead.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST keep ai-plan/public/<topic>/todos/ recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-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.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
ai-plan/public/*/traces/*.md

📄 CodeRabbit inference engine (AGENTS.md)

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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🧠 Learnings (12)
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
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. 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.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.

Applied to files:

  • GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/SourceGenerators/**/*.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/Config/SchemaConfigGeneratorTests.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.Tests.cs : Mirror the source structure in test projects whenever practical. Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`. Keep tests focused on observable behavior, not implementation trivia.

Applied to files:

  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.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/Config/SchemaConfigGeneratorTests.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/todos/*.md : Contributors MUST keep `ai-plan/public/<topic>/todos/` recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Treat source code, `*.csproj`, tests, generated snapshots, and packaging metadata as the primary evidence for documentation updates. Treat verified reference implementations under `ai-libs/` as a secondary evidence source for real project adoption patterns, directory layouts, and end-to-end usage examples.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/.csproj : Naming must remain compatible with `scripts/validate-csharp-naming.sh`. Project files and package metadata should reflect current implementation status and adopted naming conventions.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/traces/*.md : 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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-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:

  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs. When adding analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not obvious.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md

[grammar] ~17-~17: Ensure spelling is correct
Context: ....cs的剩余MA0051结构拆分,生成输出保持不变 - 已完成GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~33-~33: Ensure spelling is correct
Context: ...atorswarnings-only 基线已降到0条 - 当前GFramework.Cqrs.SourceGeneratorswarnings-only 基线已降到...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~58-~58: Ensure spelling is correct
Context: ...051收口;warnings-only 基线已降到0条 - 已完成GFramework.Cqrs.SourceGeneratorsCqrsHandlerRegistr...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md

[grammar] ~87-~87: Ensure spelling is correct
Context: ...rovider/_contextSync- 实施调整: - 将GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~173-~173: Ensure spelling is correct
Context: ... 决策: - 本轮暂缓 MA0158,转入单文件、可由生成器测试覆盖的 GFramework.Cqrs.SourceGenerators 结构拆分 - 未使用 subagent...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~240-~240: Ensure spelling is correct
Context: ...路径表示状态冲突, 不是某个方法参数无效,因此不能为 MA0015 人造参数名 - 为 Option<T> 声明 `IEquatable<Option...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (8)
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md (1)

3-34: RP-023 trace 记录完整,LGTM。

该段包含当前日期、关键决策、实施项、验证结果和下一步,且未写入敏感环境信息。

As per coding guidelines, ai-plan/public/*/traces/*.md: 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.

ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md (1)

10-39: 恢复点、风险和下一步已同步,LGTM。

RP-023 的状态、活跃事实、风险缓解和验证记录都已更新,下一步也指向了可恢复的具体切入点。

As per coding guidelines, ai-plan/public/*/todos/*.md: Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step.

Also applies to: 94-127, 266-285

GFramework.Core.Tests/Logging/LoggingConfigurationTests.cs (1)

42-74: 公共 API 形状和默认 comparer 回归覆盖到位。

新增测试能锁定 List<> / Dictionary<,> 公开契约,并验证 LoggerLevels 默认大小写敏感语义。

Based on learnings, Public API changes must be covered by unit or integration tests.

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

25-252: 运行时类型引用拆分清晰,LGTM。

精确注册、构造泛型、当前/外部程序集反射查找和 ContainingAssembly 空值回退都收敛到了独立 helper,职责边界更清楚。

Also applies to: 283-313

GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs (3)

75-115: 根类型标识符诊断覆盖到位。

该回归测试验证了非法 schema 文件名会复用 GF_ConfigSchema_006,并检查 <root>、原始片段和生成标识符,测试桩也足够小。

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

Also applies to: 117-139


2732-2737: comparer XML 转义断言有效,LGTM。

新增断言锁定了 <c> 内泛型尖括号的 XML 转义,能防止生成文档再次写入未转义类型文本。

Based on learnings, Source generator changes MUST be covered by generator tests.


15-30: 改用 SchemaGeneratorTestDriver 并配合自定义 AdditionalText 实现来测试取消传播,避免反射绑定私有 helper 方法。

当前测试通过反射调用 TryReadSchemaText,对私有 helper 方法名称或签名的任何改动都会导致测试失败。更稳健的方式是让 ThrowingAdditionalText(该类已存在)与 SchemaGeneratorTestDriver.Run() 一起工作,通过测试驱动的公开 API 来验证取消传播行为,而无须依赖私有方法的反射调用。

前提条件: 需确认 GeneratorDriver.RunGenerators() 会允许由生成器 Execute 方法抛出的 OperationCanceledException 向外传播(而非被驱动程序捕获或转换为诊断)。如果驱动程序会捕获该异常,当前的反射方案可能是必要的。

GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs (1)

4071-4074: 当前的验证逻辑已充分防止了转义标识符问题。

GetSchemaBaseName 提取的 @Foo 经由 ToPascalCase 处理后,@ 前缀会被保留(因为 @ 不在分割符列表 -, _, ., 中),导致 rootClassName = "@FooConfig"。根据 Roslyn 文档,SyntaxFacts.IsValidIdentifier("@FooConfig") 返回 false,因为 @ 不是有效的标识符起始字符。

既然 rootClassName 的验证会拒绝任何包含 @ 前缀的情形,就不会进入下游的方法名拼接逻辑。因此,不存在生成 Register@FooTable 这类非法方法名的风险。

无需添加额外的 IsComposableGeneratedIdentifier helper;当前的单一验证已足够保护。

			> Likely an incorrect or invalid review comment.

Comment thread GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2153    ↑2 2153    ↑2 0 0 0 0 37.0s    ↑1.4s

Test Results

passed 2153 passed ↑2

Details

tests 2153 tests ↑2
clock 37.0s ↑1.4s
tool nunit
build CI - Build & Test arrow-right build-and-test link #931
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 9 8 1 11.11    ↓1.39

build-and-test: Run #931

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 9 3.3s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 17 1.8s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 17 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 17 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 17 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 17 1.1s 1.1s
Append_ShouldNotBlock 17 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 10 201ms 1.0s
Context_Caching_Should_Improve_Performance 17 781ms 791ms
PendingCount_ShouldReflectQueuedEntries 17 501ms 501ms

± Comparison with run #930 at 74d7203 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 17 runs.

Github Test Reporter by CTRF 💚

Comment thread GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs
@GeWuYou GeWuYou enabled auto-merge April 22, 2026 11:00
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

Caution

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

⚠️ Outside diff range comments (1)
GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs (1)

358-373: ⚠️ Potential issue | 🟠 Major

补上归一化后属性名的冲突检测。

Line 480 只校验单个生成标识符是否合法,但没有校验同一对象内的唯一性;例如 schema 同时声明 foo-barfoo_bar 时,ToPascalCase 都会生成 FooBar,Line 372 随后会把两个属性都加入模型,最终生成重复属性/查询方法并导致消费项目编译失败。建议在 ParseObjectSpec 的属性循环中维护 HashSet<string>,在加入 properties 前对 parsedProperty.Property!.PropertyName 做冲突诊断,并为该场景补 generator regression/snapshot 测试。

Based on learnings: Source generator changes MUST be covered by generator tests. Preserve snapshot-based verification patterns already used in the repository.

Also applies to: 480-505

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

In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs` around
lines 358 - 373, The loop in ParseObjectSpec that enumerates properties doesn't
detect collisions after name normalization (e.g., "foo-bar" and "foo_bar" both
becoming "FooBar"), so add a HashSet<string> (e.g., normalizedPropertyNames) in
the method that contains the foreach and before adding
parsedProperty.Property!.PropertyName to properties check if
normalizedPropertyNames.Contains(parsedProperty.Property!.PropertyName); if it
does, return a diagnostic via ParsedObjectResult.FromDiagnostic describing the
duplicate normalized name (use the same diagnostic pattern used elsewhere);
otherwise add the normalized name to the HashSet and then add the Property to
properties; also add a generator regression/snapshot test that defines a schema
with colliding names to ensure the source generator emits the diagnostic (apply
same fix for the similar block handling properties around the 480-505 region).
🧹 Nitpick comments (1)
GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs (1)

1460-1471: 建议把该生成输出断言收紧为快照式校验。

当前只检查包含 GetType("MissingResponse"... 和 registry 类名;如果后续同时误发射 fallback marker、额外 helper,或又混入 typeof(MissingResponse),这个测试不一定能精准定位回归。这里最好像同文件其他用例一样比较完整 expected 生成源码;至少补负向断言。

最小增强示例
         Assert.Multiple(() =>
         {
             Assert.That(inputCompilationErrors.Select(static diagnostic => diagnostic.Id), Does.Contain("CS0246"));
             Assert.That(generatedCompilationErrors, Is.Empty);
             Assert.That(generatorErrors, Is.Empty);
             Assert.That(execution.GeneratedSources, Has.Length.EqualTo(1));
+            var generatedSource = execution.GeneratedSources[0].content;
             Assert.That(
-                execution.GeneratedSources[0].content,
+                generatedSource,
                 Does.Contain("registryAssembly.GetType(\"MissingResponse\", throwOnError: false, ignoreCase: false);"));
             Assert.That(
-                execution.GeneratedSources[0].content,
+                generatedSource,
                 Does.Contain("internal sealed class __GFrameworkGeneratedCqrsHandlerRegistry"));
+            Assert.That(generatedSource, Does.Not.Contain("typeof(MissingResponse"));
+            Assert.That(generatedSource, Does.Not.Contain("CqrsReflectionFallbackAttribute("));
         });

Based on learnings, “Source generator changes MUST be covered by generator tests. Preserve snapshot-based verification patterns already used in the repository.”

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

In `@GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`
around lines 1460 - 1471, Tighten the generated-source assertions in the
Assert.Multiple block by replacing the loose contains checks on
execution.GeneratedSources[0].content with a snapshot (exact string) comparison
used elsewhere in this test file (or add explicit negative assertions);
specifically, assert that execution.GeneratedSources has length 1 and compare
execution.GeneratedSources[0].content to the expected snapshot text (or to a
literal expected string) and additionally assert it does NOT contain
"typeof(MissingResponse)" and any known fallback marker; keep checks for
generatedCompilationErrors and generatorErrors as-is and reuse the same snapshot
helper/pattern used by other tests in this file for consistency.
🤖 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.RuntimeTypeReferences.cs`:
- Around line 70-88: The generated registry currently treats TypeKind.Dynamic as
a direct reference which yields "dynamic" and later emits typeof(dynamic)
(invalid); update TryCreateRuntimeTypeReference (or
CanReferenceFromGeneratedRegistry) to detect TypeKind.Dynamic and instead either
return false (forcing the reflection/backup path) or map the runtime reference
to "object" before calling RuntimeTypeReferenceSpec.FromDirectReference (use
type.ToDisplayString(SymbolDisplayFormat.FullyQualifiedFormat) but replace
dynamic with "global::System.Object" or similar); also add a regression test
exercising IRequestHandler<..., dynamic> to ensure the generator does not emit
typeof(dynamic).

---

Outside diff comments:
In `@GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs`:
- Around line 358-373: The loop in ParseObjectSpec that enumerates properties
doesn't detect collisions after name normalization (e.g., "foo-bar" and
"foo_bar" both becoming "FooBar"), so add a HashSet<string> (e.g.,
normalizedPropertyNames) in the method that contains the foreach and before
adding parsedProperty.Property!.PropertyName to properties check if
normalizedPropertyNames.Contains(parsedProperty.Property!.PropertyName); if it
does, return a diagnostic via ParsedObjectResult.FromDiagnostic describing the
duplicate normalized name (use the same diagnostic pattern used elsewhere);
otherwise add the normalized name to the HashSet and then add the Property to
properties; also add a generator regression/snapshot test that defines a schema
with colliding names to ensure the source generator emits the diagnostic (apply
same fix for the similar block handling properties around the 480-505 region).

---

Nitpick comments:
In `@GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`:
- Around line 1460-1471: Tighten the generated-source assertions in the
Assert.Multiple block by replacing the loose contains checks on
execution.GeneratedSources[0].content with a snapshot (exact string) comparison
used elsewhere in this test file (or add explicit negative assertions);
specifically, assert that execution.GeneratedSources has length 1 and compare
execution.GeneratedSources[0].content to the expected snapshot text (or to a
literal expected string) and additionally assert it does NOT contain
"typeof(MissingResponse)" and any known fallback marker; keep checks for
generatedCompilationErrors and generatorErrors as-is and reuse the same snapshot
helper/pattern used by other tests in this file for consistency.
🪄 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: a6f84dc6-afb6-413b-805c-c215b2f5594e

📥 Commits

Reviewing files that changed from the base of the PR and between d245366 and 750aca2.

📒 Files selected for processing (6)
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: Analyze (C#)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
🧰 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.RuntimeTypeReferences.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> tags 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/compatibility constraints/edge cases, and registration order/lifecycle sequencing/generated code assumptions. Avoid obvious comments such as // increment i.
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.
Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling if any.
Follow C# naming conventions: use PascalCase for types, methods, properties, events, and constants; use I prefix for interfaces; use camelCase for parameters and locals; use _camelCase for private fields.
Use the namespace pattern GFramework.{Module}.{Feature} with PascalCase segments.
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 re...

Files:

  • GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
ai-plan/public/**

📄 CodeRabbit inference engine (AGENTS.md)

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; use repository-relative paths, branch names, PR numbers, or stable document identifiers instead.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/*.md

📄 CodeRabbit inference engine (AGENTS.md)

Contributors MUST keep ai-plan/public/<topic>/todos/ recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
ai-plan/public/*/traces/*.md

📄 CodeRabbit inference engine (AGENTS.md)

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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🧠 Learnings (11)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/SourceGenerators/**/*.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.
📚 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.RuntimeTypeReferences.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/SourceGenerators/**/*.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
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.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.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs
  • GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.RuntimeTypeReferences.cs
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.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-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/todos/*.md : Contributors MUST keep `ai-plan/public/<topic>/todos/` recovery documents up-to-date with completed work, newly discovered issues, validation results, and the next recommended recovery point. For any multi-step refactor, migration, or cross-module task, create or adopt a dedicated recovery document 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.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Generated logic and generator pipelines MUST explain what is generated, why it is generated, the semantic assumptions the generator relies on, and any diagnostics or fallback behavior.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Treat source code, `*.csproj`, tests, generated snapshots, and packaging metadata as the primary evidence for documentation updates. Treat verified reference implementations under `ai-libs/` as a secondary evidence source for real project adoption patterns, directory layouts, and end-to-end usage examples.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/.csproj : Naming must remain compatible with `scripts/validate-csharp-naming.sh`. Project files and package metadata should reflect current implementation status and adopted naming conventions.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to ai-plan/public/*/traces/*.md : 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 both the recovery document and the trace at each meaningful milestone before pausing or handing work off.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-22T03:16:51.907Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-22T03:16:51.907Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs. When adding analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not obvious.

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md

[grammar] ~17-~17: Ensure spelling is correct
Context: ....cs的剩余MA0051结构拆分,生成输出保持不变 - 已完成GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~35-~35: Ensure spelling is correct
Context: ...atorswarnings-only 基线已降到0条 - 当前GFramework.Cqrs.SourceGeneratorswarnings-only 基线已降到...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~60-~60: Ensure spelling is correct
Context: ...051收口;warnings-only 基线已降到0条 - 已完成GFramework.Cqrs.SourceGeneratorsCqrsHandlerRegistr...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md

[grammar] ~119-~119: Ensure spelling is correct
Context: ...rovider/_contextSync- 实施调整: - 将GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegist...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~205-~205: Ensure spelling is correct
Context: ... 决策: - 本轮暂缓 MA0158,转入单文件、可由生成器测试覆盖的 GFramework.Cqrs.SourceGenerators 结构拆分 - 未使用 subagent...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~272-~272: Ensure spelling is correct
Context: ...路径表示状态冲突, 不是某个方法参数无效,因此不能为 MA0015 人造参数名 - 为 Option<T> 声明 `IEquatable<Option...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (2)
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md (1)

288-290: 恢复文档中建议的拆分切入点方法名均有效。GenerateBindingsClass(第 2461 行)与 AppendGeneratedConfigCatalogType(第 2791 行)在 SchemaConfigGenerator.cs 中均已验证存在,可按计划继续推进恢复工作。

ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md (1)

3-287: 追踪记录更新看起来没问题。

新增内容使用仓库相对路径,记录了日期、决策、实施调整、验证结果和下一步建议,且未发现不适合进入公开 Git 历史的环境敏感信息。

As per coding guidelines, ai-plan/public/**: “Keep committed ai-plan/public/** content safe to publish in Git history.” / ai-plan/public/*/traces/*.md: “The trace should record the current date, key decisions, validation milestones, and the immediate next step.”

@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2155    ↑2 2154    ↑1 1    ↑1 0 0 0 36.2s    ↓801ms

Test Results

failed 1 failed ↑1
passed 2154 passed ↑1

Details

tests 2155 tests ↑2
clock 36.2s ↓801ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #932
pull-request Fix/analyzer warning reduction batch link #269

Failed Tests

SchemaConfigGeneratorTests arrow-right Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names

Insights

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

Fail Rate

Fail Rate 0.01%    ↑0.01
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 10 9 1 10.00    ↓1.11
Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names 18 17 1 5.56    ↑5.56

build-and-test: Run #932

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Pending ⏳ Other ❓ Flaky 🍂 Duration ⏱️
2155 2154 1 0 0 0 0 36.2s

Some tests failed!

Name Failure Message
❌ Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names Assert.That(result.Results.Single().Diagnostics, Is.Empty) Expected: <empty> But was: < <monster.schema.json(1,1): error GF_ConfigSchema_014: Property 'drop_items' in schema file 'monster.schema.json' uses schema key 'drop_items', which generates duplicate C# identifier 'DropItems' already produced by schema key 'drop-items'> >

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 10 3.0s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 18 1.7s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 18 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 18 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 18 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 18 1.1s 1.1s
Append_ShouldNotBlock 18 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 11 182ms 1.0s
Context_Caching_Should_Improve_Performance 18 782ms 791ms
PendingCount_ShouldReflectQueuedEntries 18 501ms 501ms

± Comparison with run #931 at 4d7c1d6 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 18 runs.

Github Test Reporter by CTRF 💚

@GeWuYou
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 23, 2026

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 23, 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
Copy link
Copy Markdown
Owner Author

GeWuYou commented Apr 23, 2026

@greptile-apps review

GeWuYou added a commit that referenced this pull request Apr 23, 2026
- 修正 SchemaConfigGeneratorTests 的 reference metadata 唯一性用例,改用合法 schema 路径碰撞覆盖后缀分配逻辑

- 更新 analyzer-warning-reduction 跟踪与 trace,记录 PR #269 failed-test follow-up 和定向验证结果
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2155 2155    ↑1 0    ↓1 0 0 0 35.8s    ↓437ms

Test Results

passed 2155 passed ↑1

Details

tests 2155 tests
clock 35.8s ↓437ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #934
pull-request Fix/analyzer warning reduction batch link #269

Insights

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

Fail Rate

Fail Rate 0.00%    ↓0.01
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 11 10 1 9.09    ↓0.91
Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names 19 18 1 5.26    ↓0.30

build-and-test: Run #934

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 11 2.7s 30.0s
Append_FromMultipleThreads_ShouldHandleConcurrency 19 1.6s 30.0s
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 19 4.1s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 19 2.1s 2.3s
Generates_Scene_Behavior_Boilerplate 19 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 19 1.1s 1.1s
Append_ShouldNotBlock 19 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 12 167ms 1.0s
Context_Caching_Should_Improve_Performance 19 782ms 791ms
PendingCount_ShouldReflectQueuedEntries 19 501ms 501ms

± Comparison with run #932 at f5eb99a | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 19 runs.

Github Test Reporter by CTRF 💚

coderabbitai[bot]
coderabbitai Bot previously approved these changes Apr 23, 2026
GeWuYou added 13 commits April 23, 2026 09:49
- 更新 Core 配置与集合扩展的集合抽象契约

- 修复 CoroutineScheduler 字符串字典 comparer 与 EasyEvents 重复注册异常类型

- 补充 Option<T> 相等性接口并更新 analyzer recovery 记录
- 重构 ContextAwareGenerator 的上下文属性生成流程,降低 MA0051 复杂度
- 补充 analyzer warning reduction 的 RP-017 恢复记录与验证结果
- 更新 下一步 MA0158 多目标兼容性评估方向
- 重构 CQRS handler registry 生成器的候选分析、运行时类型引用和源码发射阶段

- 补充 analyzer warning reduction 的 RP-018 跟踪和验证记录
- 修复 SchemaConfigGenerator 中 schema 关键字比较缺少 StringComparison 的 analyzer warning

- 新增 schema 类型比较 helper 以统一 ordinal 比较语义

- 更新 analyzer warning reduction 的 RP-019 恢复记录与验证结果
- 重构 SchemaConfigGenerator 的 schema 解析、属性解析与遍历阶段

- 拆分数组属性、约束文档和生成代码发射 helper 以降低 MA0051 基线

- 更新 analyzer warning reduction 恢复文档和验证记录
- 重构 CqrsHandlerRegistryGenerator 为按职责拆分的 partial 生成器文件,保留现有注册输出与 fallback 契约
- 修复 ContextAwareGenerator 生成字段命名冲突并为 SetContextProvider 补充运行时 null 校验与异常文档
- 补充 Option<T> 的 XML remarks 契约说明与 ContextAwareGenerator 字段冲突快照测试
- 更新 analyzer-warning-reduction 跟踪与 trace,记录 PR #269 review follow-up 与验证结果
- 恢复 EasyEvents、CollectionExtensions 与 logging 配置模型的公共 API 兼容形状

- 修复 ContextAwareGenerator 字段命名冲突、锁内读取路径与相关快照回归测试

- 更新 Cqrs 与 schema generator 的 null/cancellation 契约,并同步 ai-plan 跟踪与验证记录
- 修复 SchemaConfigGenerator 的根类型标识符校验与 comparer XML 文档转义\n- 补强 LoggingConfiguration 与 CollectionExtensions 的公共 API 兼容断言\n- 重构 Cqrs 运行时类型反射查找 helper,并更新 analyzer-warning-reduction 跟踪与验证记录
- 修复 Cqrs handler registry 对 Roslyn error type 的直接引用,改走安全的运行时类型查找

- 补充 SchemaConfigGenerator 根 type 非字符串诊断回归与 Cqrs 未解析类型回归测试

- 更新 analyzer-warning-reduction 的 RP-024 跟踪与验证记录
- 修复 SchemaConfigGenerator 的归一化字段名冲突诊断,并补充对应 generator 回归测试

- 修复 CqrsHandlerRegistryGenerator 对 dynamic 的运行时类型引用,避免生成非法 typeof(dynamic)

- 更新 AGENTS 与 analyzer-warning-reduction 跟踪,明确受影响模块必须独立 build 并处理或显式报告 warning
- 修正 SchemaConfigGeneratorTests 的 reference metadata 唯一性用例,改用合法 schema 路径碰撞覆盖后缀分配逻辑

- 更新 analyzer-warning-reduction 跟踪与 trace,记录 PR #269 failed-test follow-up 和定向验证结果
- 修复 ContextAwareGenerator 的保留名收集逻辑,使 _gFrameworkContextAware* 字段分配覆盖完整基类链

- 新增 inherited collision 快照回归测试与快照文件,锁定基类占用字段名时的后缀回退行为

- 更新 analyzer-warning-reduction 跟踪与 trace,记录本轮 Greptile follow-up 与验证结果
- 合并 main 在线上单文件版本新增的模型 XML 文档,并迁移到当前 partial 拆分后的 Models 文件

- 保留 CqrsHandlerRegistryGenerator 主文件的现有生成管线拆分,不回退已完成的结构调整

- 更新 analyzer-warning-reduction 跟踪与 trace,记录本轮冲突确认、合并策略与构建验证结果
@GeWuYou GeWuYou force-pushed the fix/analyzer-warning-reduction-batch branch from 71472a8 to b8c2ad4 Compare April 23, 2026 02:09
@GeWuYou GeWuYou merged commit 9656393 into main Apr 23, 2026
5 checks passed
@GeWuYou GeWuYou deleted the fix/analyzer-warning-reduction-batch branch April 23, 2026 02:09
@github-actions
Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2156 2156 0 0 0 0 1ms

Test Results

passed 2156 passed

Details

tests 2156 tests
clock 35.7s
tool nunit
build CI - Build & Test arrow-right build-and-test link #936
pull-request Fix/analyzer warning reduction batch link #269

Insights

Average Tests per Run Total Flaky Tests Total Failed Slowest Test (p95)
2156 0 0 3.7s

build-and-test: Run #936

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 1 3.7s 3.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 1 2.4s 2.4s
Generates_Scene_Behavior_Boilerplate 1 1.8s 1.8s
CleanupDuringAcquire_Should_NotCauseRaceCondition 1 1.1s 1.1s
Append_ShouldNotBlock 1 1.0s 1.0s
Context_Caching_Should_Improve_Performance 1 785ms 785ms
PendingCount_ShouldReflectQueuedEntries 1 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 1 404ms 404ms
Cleanup_Should_RemoveUnusedLocks 1 402ms 402ms
Generates_Precise_Assembly_Type_Lookups_For_Inaccessible_External_Protected_Types 1 316ms 316ms

🎉 No failed tests in this run. | 🍂 No flaky tests in this run.

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