feat(generator): 添加对继承层次结构中注册方法的支持#214
Conversation
- 实现 EnumerateCandidateMethods 方法以搜索基类和接口中的注册方法 - 修改 AutoRegisterExportedCollectionsGenerator 以支持从继承链中查找兼容的注册方法 - 添加完整的单元测试覆盖继承、接口实现和泛型场景 - 修复静态成员和不可访问方法的诊断报告功能 - 增强源代码生成器对复杂继承结构的支持能力
📝 WalkthroughWalkthrough扩展源生成器以向上查找 registry 字段/属性并在基类与接口继承链中枚举注册方法;加强可访问性与类型兼容性检查;支持为接口生成 partial 声明;新增多项单元测试覆盖基接口、基类、基类 registry 和显式接口实现的场景。 Changes
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes 🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Greptile SummaryThis PR extends The core logic is sound —
Confidence Score: 4/5Safe to merge with minor documentation and test-coverage gaps; no correctness or security issues found. The core Both changed files have minor gaps: the generator needs comments on Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[TryCreateRegistration] --> B[EnumerateCandidateMethods]
B --> C["registryType.GetMembers(name)\n(direct declaration)"]
C --> D["BaseType loop\n(walk concrete hierarchy)"]
D --> E["AllInterfaces loop\n(transitive interface graph)"]
C & D & E --> F[".Any() filter:\n!IsStatic && Params==1 &&\nIsAccessible && CanAcceptElementType"]
F -->|"match found"| G[hasCompatibleMethod = true]
F -->|"no match"| H[Report GF_AutoExport_003]
G --> I[new RegistrationSpec]
I --> J[GenerateSource]
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs (1)
321-339: 建议为候选方法遍历逻辑补充方法级说明注释
EnumerateCandidateMethods是这次行为变更的核心入口,建议补充注释说明“为何遍历当前类型/基类/接口、语义假设以及不去重的影响边界”,方便后续维护和诊断。As per coding guidelines:
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling,并且Generated logic and source generator pipelines MUST explain ... semantic assumptions ...。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs` around lines 321 - 339, Add a method-level XML/summary comment to EnumerateCandidateMethods that documents the intent and semantics: explain that it yields IMethodSymbol candidates by name from the current registryType, then walks baseType chain, then iterates AllInterfaces; state the semantic assumptions about inheritance vs. interface declarations, that it does not deduplicate identical symbols (and why that is acceptable), and note edge cases such as shadowing, explicit interface implementations, and null BaseType handling; reference the parameters registryType and registerMethodName and the expected result so future maintainers understand the traversal order and rationale.
🤖 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.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 203-279: Add a regression test covering the generator branch that
traverses base classes: create a new test in
AutoRegisterExportedCollectionsGeneratorTests (modeled on
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface)
that defines BaseRegistry with the Register(…) method, a DerivedRegistry :
BaseRegistry used as the field type (e.g., _registry), and a class with
[RegisterExportedCollection(..., "Register")] pointing to that registry; run the
generator and assert the generated partial class (e.g.,
TestApp_Bootstrapper.AutoRegisterExportedCollections.g.cs) contains calls to
this._registry.Register(__generatedItem) to lock in the base-class traversal
behavior.
---
Nitpick comments:
In
`@GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs`:
- Around line 321-339: Add a method-level XML/summary comment to
EnumerateCandidateMethods that documents the intent and semantics: explain that
it yields IMethodSymbol candidates by name from the current registryType, then
walks baseType chain, then iterates AllInterfaces; state the semantic
assumptions about inheritance vs. interface declarations, that it does not
deduplicate identical symbols (and why that is acceptable), and note edge cases
such as shadowing, explicit interface implementations, and null BaseType
handling; reference the parameters registryType and registerMethodName and the
expected result so future maintainers understand the traversal order and
rationale.
🪄 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: 012fc5dc-1d26-4586-ba14-0740af8e75af
📒 Files selected for processing (2)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.csGFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. 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 (1)
**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute
**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with<summary>,<param>,<returns>,<exception>, and<remarks>tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, 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
Do not rely on implicit imports; declare every requiredusingexplicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace patternGFramework.{Module}.{Feature}with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces useIprefix, parame...
Files:
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.csGFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🧠 Learnings (6)
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers
Applied to files:
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.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.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.csGFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Public API changes must be covered by unit or integration tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🔇 Additional comments (1)
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs (1)
271-277: 继承链方法匹配的兼容性过滤实现合理这里保留了非静态、单参数、可访问性与隐式转换校验,能有效避免把不可调用签名错误地当作可注册方法。
- 添加了针对注解集合生成批处理注册方法的测试用例 - 添加了当集合元素类型无法推断时报告诊断的测试 - 添加了注册方法使用数组参数时的批处理注册测试 - 添加了从继承接口获取注册方法的批处理注册测试 - 添加了从基类获取注册方法的批处理注册测试 - 添加了当集合成员不可实例读取时报告诊断的测试 - 添加了当注册成员不可实例读取时报告诊断的测试 - 添加了当注册方法对所有者类型不可访问时报告诊断的测试 - 添加了当注册导出集合属性参数无效时报告诊断的测试 - 添加了多个分部声明注解时仅生成一个源文件的测试 - 为枚举候选方法功能添加了详细的XML文档注释
There was a problem hiding this comment.
GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In
`@GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs`:
- Around line 348-352: The generator currently iterates
registryType.AllInterfaces unconditionally which pulls in explicitly-implemented
interface methods (e.g., void IRegistry.Register(T)) and leads to emitted calls
like this.registry.Register(item) that won't compile on class/struct registry
fields; restrict that interface traversal so it only runs when registryType is
an interface (check registryType.TypeKind == TypeKind.Interface) before
iterating AllInterfaces and collecting IMethodSymbol members for
registerMethodName, otherwise only consider members directly on registryType.
🪄 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: 6d783b93-4129-440e-ae9b-c11b9b7c6fc3
📒 Files selected for processing (2)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.csGFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. 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 (1)
**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute
**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with<summary>,<param>,<returns>,<exception>, and<remarks>tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, 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
Do not rely on implicit imports; declare every requiredusingexplicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace patternGFramework.{Module}.{Feature}with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces useIprefix, parame...
Files:
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🧠 Learnings (4)
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Applied to files:
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Applied to files:
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : All public, protected, and internal types and members MUST include XML documentation comments (`///`) with `<summary>`, `<param>`, `<returns>`, `<exception>`, and `<remarks>` tags where applicable
Applied to files:
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.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.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🔇 Additional comments (1)
GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs (1)
271-277: 候选方法过滤条件设计合理这里把静态性、参数个数、可访问性和隐式转换统一放在同一处筛选,能有效避免误选不可调用方法,诊断路径也保持清晰。
- 实现了 AutoRegisterExportedCollectionsGenerator 源生成器 - 支持扫描标记了 AutoRegisterExportedCollectionsAttribute 的 partial 类型 - 为使用 RegisterExportedCollectionAttribute 声明的集合成员生成集中注册方法 - 提供详细的诊断支持,包括 GF_AutoExport_001 到 GF_AutoExport_008 错误码 - 支持从基类和接口继承链查找注册方法 - 实现了完整的单元测试覆盖各种使用场景 - 验证集合可枚举性、元素类型推导和注册表成员可访问性 - 生成安全的空值检查代码防止运行时异常 - 支持泛型类型约束和复杂继承关系的处理
There was a problem hiding this comment.
GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
- 将条件判断语句替换为 switch 表达式以提高可读性 - 添加对 partial interface 类型的支持 - 为不支持的类型添加异常处理机制 - 简化代码结构并提升维护性
There was a problem hiding this comment.
GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs (1)
203-279: 为新增的 public 测试补齐 XML 文档。Lines 204、282、342、412 这 4 个
public async Task用例都没有///注释;按仓库规则,这里至少应补一个<summary>,把各自锁定的继承链/显式接口回归点写清楚,后续排查失败原因会更直接。📝 一种最小补法
+ /// <summary> + /// 验证当注册方法声明在继承接口上时,生成器仍会生成批量注册代码。 + /// </summary> [Test] public async Task Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface()As per coding guidelines:
All public, protected, and internal types and members MUST include XML documentation comments ('///') with '<summary>', '<param>', '<returns>', '<exception>', and '<remarks>' tags where applicable。Also applies to: 281-339, 341-409, 411-478
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs` around lines 203 - 279, Add XML documentation comments (at minimum a /// <summary>) to the public test method Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface and the three other public async Task test methods in this test file (the ones starting near lines 282, 342, 412); each <summary> should succinctly state what the test verifies (e.g., that the generator emits a batch registration method when the register method is declared on an inherited/explicit interface) so future failures point immediately to the intended inheritance/explicit-interface behavior being tested.
🤖 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.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 324-332: The test instantiates a
CSharpSourceGeneratorTest<AutoRegisterExportedCollectionsGenerator,
DefaultVerifier> and sets TestBehaviors =
TestBehaviors.SkipGeneratedSourcesCheck; remove that SkipGeneratedSourcesCheck
entry so the test no longer bypasses generated-source verification (i.e., delete
or omit the TestBehaviors assignment that references
TestBehaviors.SkipGeneratedSourcesCheck from the test variable initialization),
ensuring the generator output (any .g.cs files) is validated by the test
harness.
---
Nitpick comments:
In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 203-279: Add XML documentation comments (at minimum a ///
<summary>) to the public test method
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface
and the three other public async Task test methods in this test file (the ones
starting near lines 282, 342, 412); each <summary> should succinctly state what
the test verifies (e.g., that the generator emits a batch registration method
when the register method is declared on an inherited/explicit interface) so
future failures point immediately to the intended inheritance/explicit-interface
behavior being tested.
🪄 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: 8ae182f2-4cbb-48ab-b790-1e3ee091b7fe
📒 Files selected for processing (2)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.csGFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Analyze (C#)
- GitHub Check: Code Quality & Security
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute
**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with<summary>,<param>,<returns>,<exception>, and<remarks>tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, 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
Do not rely on implicit imports; declare every requiredusingexplicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace patternGFramework.{Module}.{Feature}with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces useIprefix, parame...
Files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🧠 Learnings (11)
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Public API changes must be covered by unit or integration tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.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.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
- 添加了批量注册方法生成的基础功能测试 - 添加了集合元素类型推断失败时的诊断报告测试 - 添加了数组参数注册方法的生成测试 - 添加了从继承接口获取注册方法的测试 - 添加了显式接口实现成员不可访问的诊断测试 - 添加了从基类获取注册方法的测试 - 添加了从基类获取注册器成员的测试 - 添加了非实例可读集合成员的诊断测试 - 添加了非实例可读注册器成员的诊断测试 - 添加了注册方法不可访问的诊断测试 - 添加了属性参数无效时的诊断测试 - 添加了多个分部声明时只生成一个源文件的测试
There was a problem hiding this comment.
GeWuYou has reached the 50-review limit for trial accounts. To continue receiving code reviews, upgrade your plan.
There was a problem hiding this comment.
🧹 Nitpick comments (1)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs (1)
203-477: 为新增 public 测试补齐 XML 文档。这 4 个新增
public async Task测试方法没有///注释;按仓库规则,新增的public成员需要补<summary>,并在适用时补<returns>、<remarks>等说明。As per coding guidelines "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.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs` around lines 203 - 477, The four new public test methods (Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface, Reports_Diagnostic_When_Register_Method_Is_Only_Explicitly_Implemented_Interface_Member, Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Base_Class, Generates_Batch_Registration_Method_When_Registry_Member_Comes_From_Base_Class) are missing XML documentation; add a /// <summary> describing the purpose of each test and a /// <returns> explaining the async Task result, and include additional tags like <remarks> if needed per guidelines so each public async Task method has appropriate XML doc comments.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In
`@GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs`:
- Around line 203-477: The four new public test methods
(Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Inherited_Interface,
Reports_Diagnostic_When_Register_Method_Is_Only_Explicitly_Implemented_Interface_Member,
Generates_Batch_Registration_Method_When_Register_Method_Comes_From_Base_Class,
Generates_Batch_Registration_Method_When_Registry_Member_Comes_From_Base_Class)
are missing XML documentation; add a /// <summary> describing the purpose of
each test and a /// <returns> explaining the async Task result, and include
additional tags like <remarks> if needed per guidelines so each public async
Task method has appropriate XML doc comments.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 4966f6e8-8867-47cd-8325-402eeb5379ac
📒 Files selected for processing (2)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.csGFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
🚧 Files skipped from review as they are similar to previous changes (1)
- GFramework.Godot.SourceGenerators/Registration/AutoRegisterExportedCollectionsGenerator.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Code Quality & Security
- GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.cs: LoggerGenerator must automatically generate log fields and logging helper methods for classes decorated with [Log] attribute
PriorityGenerator must generate priority comparison implementations for classes decorated with [Priority] attribute
EnumExtensionsGenerator must generate enum extension capabilities for enums decorated with [GenerateEnumExtensions] attribute
ContextAwareGenerator must automatically implement IContextAware boilerplate logic for classes decorated with [ContextAware] attribute
**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with<summary>,<param>,<returns>,<exception>, and<remarks>tags where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components (Architecture, Module, System, Context, Registry, Service Module, Lifecycle types) MUST include high-level explanations of responsibilities, lifecycle, interactions with other components, why the abstraction exists, and when to use it instead of alternatives
Generated logic and source generator pipelines MUST explain what is generated, why it is generated, 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
Do not rely on implicit imports; declare every requiredusingexplicitly
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use namespace patternGFramework.{Module}.{Feature}with PascalCase segments
Follow standard C# naming: Types/methods/properties/events/constants use PascalCase, interfaces useIprefix, parame...
Files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🧠 Learnings (14)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Source generator changes MUST be covered by generator tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Public API changes must be covered by unit or integration tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : When a public API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Preserve deterministic behavior in registries, lifecycle orchestration, and generated outputs
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Avoid hidden side effects in property getters, constructors, and registration helpers
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Keep source generators deterministic and free of hidden environment or network dependencies
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
📚 Learning: 2026-04-10T09:05:17.311Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-10T09:05:17.311Z
Learning: Applies to **/*.cs : Generated logic and source generator pipelines MUST explain what is generated, why it is generated, semantic assumptions the generator relies on, and any diagnostics or fallback behavior
Applied to files:
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.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.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs
🔇 Additional comments (4)
GFramework.Godot.SourceGenerators.Tests/Registration/AutoRegisterExportedCollectionsGeneratorTests.cs (4)
203-279: 接口继承链的回归覆盖到位。这个用例准确锁定了接口类型注册表沿继承接口查找注册方法的分支,而且断言的是最终生成结果,粒度合适。
Based on learnings:
Source generator changes MUST be covered by generator testsandKeep tests focused on observable behavior, not implementation trivia
281-338: 显式接口实现的负向场景补得很好。这里只期望
GF_AutoExport_003,能防止生成器把只能经接口调用的显式实现误判为可直接调用成员,正好锁住这次修复边界。Based on learnings:
Regression fixes should include a test that fails before the fix and passes after it
340-408: 基类声明注册方法的分支已经被锁住。
DerivedRegistry : BaseRegistry配合生成结果快照,直接覆盖了沿基类链枚举注册方法的新增逻辑。Based on learnings:
Source generator changes MUST be covered by generator testsandPreserve snapshot-based verification patterns already used in the repository for source generator tests
410-477: 基类上的 registry 成员解析也覆盖到了。这个场景把 owner 继承链上的成员查找和最终生成调用一起验证了,能很好兜住后续回归。
Based on learnings:
Source generator changes MUST be covered by generator testsandRegression fixes should include a test that fails before the fix and passes after it
Summary by CodeRabbit
发布说明
错误修复
测试