Skip to content

Fix/analyzer warning reduction batch#286

Merged
GeWuYou merged 6 commits into
mainfrom
fix/analyzer-warning-reduction-batch
Apr 24, 2026
Merged

Fix/analyzer warning reduction batch#286
GeWuYou merged 6 commits into
mainfrom
fix/analyzer-warning-reduction-batch

Conversation

@GeWuYou

@GeWuYou GeWuYou commented Apr 24, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

版本更新说明

  • Bug Fixes

    • 修复了 JSON 坐标解析在不同系统区域设置下可能导致的解析差异,保证数值解析一致性。
  • Chores

    • 改进了异步流程的同步与稳定性,降低因上下文切换引发的问题。
    • 重构与清理测试基础设施:移除旧测试工具、添加更稳健的测试数据类型与位置表示、并提高测试行为的确定性(包括文本/环境比较和场景生命周期同步)。

GeWuYou added 5 commits April 24, 2026 17:04
- 优化 GodotYamlConfigEnvironment 目录枚举逻辑,拆分 helper 以消除 MA0051

- 修复 Godot 生命周期 await 的上下文声明,显式保留主线程同步上下文

- 更新 Godot.Tests 异步断言与字符串 comparer,用例项目构建收敛到 0 warning(s)

- 补充 analyzer-warning-reduction 跟踪与 trace,记录 RP-053 的批次结果与验证
- 修复多组 YAML 与 persistence 测试中的 ConfigureAwait 使用与状态校验,清理低风险 analyzer 告警

- 重构 PersistenceTestUtilities 为单类型文件,消除测试辅助模型的文件命名告警

- 更新 analyzer-warning-reduction 跟踪与 trace,记录 RP-054 批次结果与 75 文件阈值停止点
- 修复架构配置、启动流程与序列化测试中的异步等待和 invariant 解析告警

- 补充 AllOf 与 persistence 测试的残余状态校验与 ConfigureAwait 修正,继续压低 Game.Tests warning

- 更新 analyzer-warning-reduction 跟踪与 trace,纠正 RP-054 的 stop-condition 口径并记录 RP-055 指标
- 修复 GeneratedConfigConsumerIntegrationTests 的 raw string 缩进和方法边界,恢复编译通过\n- 重构生成配置消费者集成测试的断言辅助方法,清理该文件剩余 warning\n- 更新 analyzer warning reduction 的 tracking 与 trace,记录 RP-056 验证结果和当前分支体积
- 修复 PersistenceTests 中统一设置仓库失败场景测试的剩余 ConfigureAwait 告警\n- 验证 PersistenceTests 不再出现在非增量 GFramework.Game.Tests 构建告警输出中\n- 更新 analyzer warning reduction 的 tracking 与 trace,记录 RP-057 验证结果和当前分支体积
@coderabbitai

coderabbitai Bot commented Apr 24, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

对测试和部分 Godot 运行时代码进行异步等待语义和小范围重构:广泛添加/调整 ConfigureAwait 调用、将若干测试内联断言提取为辅助方法、拆分/重建测试数据模型文件、进行少量 null-guard 与目录枚举重构及文化不变性解析调整。

Changes

Cohort / File(s) Summary
Config 测试:ConfigureAwait 标准化
GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs, GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs, GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs, GFramework.Game.Tests/Config/YamlConfigLoaderDependentRequiredTests.cs, GFramework.Game.Tests/Config/YamlConfigLoaderDependentSchemasTests.cs, GFramework.Game.Tests/Config/YamlConfigLoaderEnumTests.cs, GFramework.Game.Tests/Config/YamlConfigLoaderIfThenElseTests.cs, GFramework.Game.Tests/Config/YamlConfigLoaderNegationTests.cs
为测试中的异步调用(如 LoadAsyncInitializeAsync 等)统一添加 .ConfigureAwait(false);在若干测试辅助中将 ArgumentNullException.ThrowIfNull(_rootPath) 替换为显式 null 检查并抛出 InvalidOperationException
GeneratedConfigConsumerIntegrationTests 重构
GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
将大型内联断言拆分为静态私有辅助断言方法,并对相关异步调用加上 .ConfigureAwait(false)
Yaml 校验/文本验证调整
GFramework.Game.Tests/Config/YamlConfigSchemaValidatorTests.cs, GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs
将部分 null-guard 替换为显式 InvalidOperationException 抛出;对异步校验调用添加 .ConfigureAwait(false)
Data 测试:持久化异步与工具拆分
GFramework.Game.Tests/Data/PersistenceTests.cs, GFramework.Game.Tests/Data/PersistenceTestUtilities.cs
在持久化相关测试中为所有异步 API(读写、保存、加载、删除、存在性检查等)添加 .ConfigureAwait(false);删除旧的 PersistenceTestUtilities.cs(114 行)。
Data 测试模型新增
GFramework.Game.Tests/Data/TestDataLocation.cs, GFramework.Game.Tests/Data/TestNamedData.cs, GFramework.Game.Tests/Data/TestSaveData.cs, GFramework.Game.Tests/Data/TestSimpleData.cs, GFramework.Game.Tests/Data/TestVersionedSaveData.cs
新增一组内部测试类型以替代被删除的测试实用工具,包含 TestDataLocation (实现 IDataLocation) 与若干 IData/IVersionedData 测试模型。
JSON 序列化解析文化不变性
GFramework.Game.Tests/Serializer/JsonSerializerTests.cs
坐标解析改为使用 CultureInfo.InvariantCulture,并加入相应 using。
Godot Tests: 异步断言 & 字典初始化
GFramework.Godot.Tests/Architectures/AbstractArchitectureModuleInstallationTests.cs, GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs, GFramework.Godot.Tests/Text/RichTextMarkupTests.cs
在测试中的异步断言 lambda 中使用 .ConfigureAwait(false);在 RichTextMarkup 测试中以 StringComparer.Ordinal 初始化环境字典以确保确定性。
Godot 运行时上下文与目录枚举重构
GFramework.Godot/Architectures/AbstractArchitecture.cs, GFramework.Godot/Scene/SceneBehaviorBase.cs, GFramework.Godot/Config/GodotYamlConfigEnvironment.cs
对 Godot 相关 await 显式保留同步上下文(ConfigureAwait(true))以保证在主线程/节点 API 上下文继续执行;将目录枚举拆分为 Godot 路径与文件系统路径两套私有实现并统一异常过滤逻辑。
分析器警告追踪文档
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md, ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
更新追踪与待办文档:记录新的恢复点/追踪条目、构建/测试观察结果及已完成的警告清理记录。

Sequence Diagram(s)

(无序列图:变更为测试/小范围同步上下文调整与重构,未引入新的多组件顺序控制流。)

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 分钟

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 标题准确地反映了变更集的主要目的,即进行分析器警告的批量修复工作。
Docstring Coverage ✅ Passed Docstring coverage is 93.26% 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 docstrings
  • Create stacked PR
  • Commit on current branch
🧪 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.

@greptile-apps

greptile-apps Bot commented Apr 24, 2026

Copy link
Copy Markdown

Greptile Summary

This PR reduces analyzer warnings across test and production code through three categories of changes: (1) pervasive ConfigureAwait annotations — false in test methods to suppress threading warnings, and true in Godot production code (AbstractArchitecture, SceneBehaviorBase) to correctly preserve the Godot main-thread synchronization context for Node API calls that follow each await; (2) test infrastructure cleanup — splitting the monolithic PersistenceTestUtilities.cs into per-class files and extracting large assertion blocks into named helper methods; and (3) minor correctness fixes — CultureInfo.InvariantCulture on coordinate int.Parse, StringComparer.Ordinal on test dictionaries, and replacing ArgumentNullException.ThrowIfNull (designed for parameters) with InvalidOperationException on test fixture fields.

Confidence Score: 5/5

Safe to merge; all findings are P2 style/clarity observations with no blocking defects.

All production changes are either correct ConfigureAwait(true) for Godot main-thread requirements or clean refactors with preserved behavior. The one P2 observation is a documentation/consistency nit and does not affect correctness today.

GFramework.Godot/Scene/SceneBehaviorBase.cs — minor comment asymmetry between ConfigureAwait(false) methods and the newly-commented ConfigureAwait(true) methods.

Important Files Changed

Filename Overview
GFramework.Godot/Architectures/AbstractArchitecture.cs Changed ConfigureAwait(true) on WaitUntilReadyAsync to preserve Godot main-thread sync context before AddChild and OnAttach. Correct and well-commented.
GFramework.Godot/Scene/SceneBehaviorBase.cs Added ConfigureAwait(true) to OnPauseAsync, OnResumeAsync, and OnUnloadAsync to ensure Godot Node API calls run on the main thread. OnEnterAsync and OnExitAsync remain ConfigureAwait(false) and are safe today but lack a clarifying comment.
GFramework.Godot/Config/GodotYamlConfigEnvironment.cs Refactored EnumerateDirectoryCore into EnumerateFileSystemDirectory and EnumerateGodotDirectory helpers; introduced IsExpectedDirectoryEnumerationException catch-filter. Behavior is preserved and the code is now cleaner.
GFramework.Game.Tests/Serializer/JsonSerializerTests.cs Added CultureInfo.InvariantCulture to int.Parse calls in the coordinate stub converter, fixing a potential locale-sensitivity bug.
GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs Extracted large Assert.Multiple blocks into focused private helper methods to reduce analyzer method-length warnings. Logic is functionally equivalent to the original.
GFramework.Game.Tests/Data/PersistenceTestUtilities.cs Deleted — split into separate per-class files (TestDataLocation.cs, TestSaveData.cs, TestSimpleData.cs, TestNamedData.cs, TestVersionedSaveData.cs) to reduce file size warnings.
GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs Added ConfigureAwait(false) to all async calls and replaced ArgumentNullException.ThrowIfNull on field _rootPath with semantically correct InvalidOperationException.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[SceneBehaviorBase / AbstractArchitecture\nasync method called] --> B{Needs Godot\nNode API after await?}
    B -- Yes\nOnPauseAsync / OnResumeAsync\nOnUnloadAsync / InstallGodotModule --> C[ConfigureAwait true\nPreserve Godot main-thread\nsync context]
    B -- No\nOnEnterAsync / OnExitAsync\nset plain C# fields only --> D[ConfigureAwait false\nno sync context needed]
    C --> E[Owner.SetProcess\nOwner.QueueFreeX\nanchor.AddChild / OnAttach]
    D --> F[_isActive = true/false\n_isTransitioning = false]
Loading
Prompt To Fix All With AI
This is a comment left during a code review.
Path: GFramework.Godot/Scene/SceneBehaviorBase.cs
Line: 133

Comment:
**`OnEnterAsync` uses `ConfigureAwait(false)` inconsistently with sibling methods**

`OnPauseAsync`, `OnResumeAsync`, and `OnUnloadAsync` were all updated in this PR to use `ConfigureAwait(true)` to preserve the Godot main-thread synchronization context. However, `OnEnterAsync` (line 133) and `OnExitAsync` (line 190) were not changed and still use `ConfigureAwait(false)`.

Looking at `OnEnterAsync`, after the await it sets `_isActive = true` and `_isTransitioning = false` (plain C# fields, no Godot API calls), and `OnExitAsync` similarly only sets `_isActive = false` — so `ConfigureAwait(false)` is technically safe for these two today. However, this asymmetry may cause confusion for future contributors extending these methods with Godot node API calls. A clarifying comment (similar to the ones added on the `ConfigureAwait(true)` calls) would make the intent explicit.

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

Reviews (2): Last reviewed commit: "fix(godot): 修复场景行为格式问题" | Re-trigger Greptile

@github-actions

Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2156 2156 0 0 0 0 37.9s    ↑975ms

Test Results

passed 2156 passed

Details

tests 2156 tests
clock 37.9s ↑975ms
tool nunit
build CI - Build & Test arrow-right build-and-test link #962
pull-request Fix/analyzer warning reduction batch link #286

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 20 19 1 5.00    ↓0.26
Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names 28 27 1 3.57    ↓0.13

build-and-test: Run #962

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 28 4.0s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 28 2.2s 2.4s
Generates_Scene_Behavior_Boilerplate 28 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 28 1.1s 1.1s
Append_ShouldNotBlock 28 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 21 96ms 1.0s
Context_Caching_Should_Improve_Performance 28 782ms 791ms
PendingCount_ShouldReflectQueuedEntries 28 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 28 404ms 406ms
Cleanup_Should_RemoveUnusedLocks 28 401ms 402ms

± Comparison with run #959 at d78f53f | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 28 runs.

Github Test Reporter by CTRF 💚

@github-actions

github-actions Bot commented Apr 24, 2026

Copy link
Copy Markdown

⚠️MegaLinter analysis: Success with warnings

Descriptor Linter Files Fixed Errors Warnings Elapsed time
⚠️ CSHARP dotnet-format yes 1 no 5.25s
✅ REPOSITORY gitleaks yes no no 7.43s
✅ REPOSITORY trufflehog yes no no 6.19s

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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (4)
GFramework.Game.Tests/Serializer/JsonSerializerTests.cs (1)

186-187: 修复合理:使用 InvariantCulture 消除文化相关解析警告。

该变更正确解决了分析器对文化相关 int.Parse 的告警(如 CA1305 / MA0011),且与测试中使用固定字符串 "3:9" 的断言保持一致,行为确定。

可选的对称性改进:WriteJson 中的字符串插值 $"{value?.X}:{value?.Y}" 在整数场景下实际输出稳定,但为保持读写两端一致的文化无关语义,可显式使用 InvariantCulture 格式化。

♻️ 可选的一致性改进
-            writer.WriteValue($"{value?.X}:{value?.Y}");
+            writer.WriteValue(FormattableString.Invariant($"{value?.X}:{value?.Y}"));
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@GFramework.Game.Tests/Serializer/JsonSerializerTests.cs` around lines 186 -
187, 将 int.Parse 调用显式使用 CultureInfo.InvariantCulture 来消除文化相关解析警告:在解析
parts[0]/parts[1](用于赋值到 X 和 Y)的代码中传入 InvariantCulture;可选地,在序列化端 WriteJson 的插值表达式
($"{value?.X}:{value?.Y}") 也改为显式使用 InvariantCulture 格式化 value?.X 和
value?.Y,以保证读写两端文化无关并保持对称性。
GFramework.Game.Tests/Data/TestVersionedSaveData.cs (1)

29-34: 可选:LastModified 使用 DateTime.UtcNow 字段初始化会降低测试确定性。

每次构造实例都会捕获当下的 UTC 时间。若后续有断言依赖具体时间戳或要对比相等性,建议在用例里显式设置;作为默认占位当前用法可以接受。

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

In `@GFramework.Game.Tests/Data/TestVersionedSaveData.cs` around lines 29 - 34,
The LastModified auto-property on TestVersionedSaveData is initialized to
DateTime.UtcNow which makes tests nondeterministic; remove the runtime timestamp
default (or replace it with a stable sentinel like DateTime.MinValue) so test
cases explicitly set LastModified when they need a specific time; locate the
LastModified property in the TestVersionedSaveData class and change its
initialization accordingly.
GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs (1)

213-216: 可选:抽取 _rootPath 空值守卫辅助方法以消除重复。

同一套 if (_rootPath is null) throw new InvalidOperationException("Root path is not initialized."); 在本文件中重复出现 3 次(Line 213、525、615),在其他测试文件中(YamlConfigLoaderIfThenElseTests.csYamlConfigLoaderDependentSchemasTests.csYamlConfigSchemaValidatorTests.cs)也是同样的模式。可以考虑抽取一个返回非空值的小辅助方法,例如:

♻️ 示例重构
+    private string GetRootPathOrThrow()
+    {
+        return _rootPath ?? throw new InvalidOperationException("Root path is not initialized.");
+    }

调用点:

-        if (_rootPath is null)
-        {
-            throw new InvalidOperationException("Root path is not initialized.");
-        }
-
-        var filePath = Path.Combine(_rootPath, relativePath.Replace('/', Path.DirectorySeparatorChar));
+        var rootPath = GetRootPathOrThrow();
+        var filePath = Path.Combine(rootPath, relativePath.Replace('/', Path.DirectorySeparatorChar));

本轮批次目标是降 warning,这里属于 DRY 层面的改进,可以后续再处理。

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

In `@GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs` around lines 213
- 216, 在多个测试中重复出现的空值检查 if (_rootPath is null) throw new
InvalidOperationException("Root path is not initialized."); 抽取为一个小辅助方法(例如
EnsureRootPath() 或 GetRootPathOrThrow())返回非空的 _rootPath
字符串并在抛出时保留相同的异常消息;将当前文件中所有直接检查(以及其他测试类中的相同模式)替换为对该辅助方法的调用以消除重复并保持行为一致,定位时关注符号
_rootPath 和抛出的 InvalidOperationException 消息以替换所有重复处。
GFramework.Game.Tests/Data/PersistenceTests.cs (1)

41-46: 批次收敛范围合理,其余 await 建议后续统一处理。

这一批 .ConfigureAwait(false) 补齐了 FileStorage/SaveRepository 以及两个 "Persist_Fails_Should_Keep_Cache_Consistent" 测试里的 MA0004 热点。不过同文件中仍有多处 await(如 Line 68-78、98、110、136、305、314、317 等)未补齐 .ConfigureAwait(false),虽然与 tracking 文档“只聚焦缓存一致性测试”的口径一致,但建议后续批次尽快把整文件收敛到统一风格,避免再次出现“部分文件部分行”的零散 warning 残留。

(属于本 PR 有意留到后续批次的工作,不需要本 PR 内修复。)

Also applies to: 111-111, 188-188, 221-222, 273-274, 596-613, 659-675

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

In `@GFramework.Game.Tests/Data/PersistenceTests.cs` around lines 41 - 46, Some
await calls in GFramework.Game.Tests/Data/PersistenceTests.cs were updated with
.ConfigureAwait(false) but several remain inconsistent (e.g., awaits around
lines mentioned and in tests referencing FileStorage, SaveRepository and the
Persist_Fails_Should_Keep_Cache_Consistent tests); update all remaining await
expressions in this file to append .ConfigureAwait(false) for consistency
(including awaits used in ReadAsync/WriteAsync calls and any Task-returning
helper invocations) so the file uses a uniform ConfigureAwait(false) style
throughout, locating occurrences by symbols like storage.ReadAsync,
storage.WriteAsync, SaveRepository usages and the
Persist_Fails_Should_Keep_Cache_Consistent test methods.
🤖 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/Scene/SceneBehaviorBase.cs`:
- Around line 144-148: The method declarations and their initial blocks for
OnPauseAsync, OnResumeAsync, and OnUnloadAsync are over-indented by 4 spaces;
adjust the indentation so the method signature, opening brace, the if (_scene !=
null) line and the await _scene...ConfigureAwait(true); line use the file's
standard 4-space indent (matching methods like OnLoadAsync and OnEnterAsync),
leaving the rest of the method body unchanged; apply the same 4-space
normalization to OnPauseAsync, OnResumeAsync and OnUnloadAsync to restore
consistent formatting per the repository style.

---

Nitpick comments:
In `@GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs`:
- Around line 213-216: 在多个测试中重复出现的空值检查 if (_rootPath is null) throw new
InvalidOperationException("Root path is not initialized."); 抽取为一个小辅助方法(例如
EnsureRootPath() 或 GetRootPathOrThrow())返回非空的 _rootPath
字符串并在抛出时保留相同的异常消息;将当前文件中所有直接检查(以及其他测试类中的相同模式)替换为对该辅助方法的调用以消除重复并保持行为一致,定位时关注符号
_rootPath 和抛出的 InvalidOperationException 消息以替换所有重复处。

In `@GFramework.Game.Tests/Data/PersistenceTests.cs`:
- Around line 41-46: Some await calls in
GFramework.Game.Tests/Data/PersistenceTests.cs were updated with
.ConfigureAwait(false) but several remain inconsistent (e.g., awaits around
lines mentioned and in tests referencing FileStorage, SaveRepository and the
Persist_Fails_Should_Keep_Cache_Consistent tests); update all remaining await
expressions in this file to append .ConfigureAwait(false) for consistency
(including awaits used in ReadAsync/WriteAsync calls and any Task-returning
helper invocations) so the file uses a uniform ConfigureAwait(false) style
throughout, locating occurrences by symbols like storage.ReadAsync,
storage.WriteAsync, SaveRepository usages and the
Persist_Fails_Should_Keep_Cache_Consistent test methods.

In `@GFramework.Game.Tests/Data/TestVersionedSaveData.cs`:
- Around line 29-34: The LastModified auto-property on TestVersionedSaveData is
initialized to DateTime.UtcNow which makes tests nondeterministic; remove the
runtime timestamp default (or replace it with a stable sentinel like
DateTime.MinValue) so test cases explicitly set LastModified when they need a
specific time; locate the LastModified property in the TestVersionedSaveData
class and change its initialization accordingly.

In `@GFramework.Game.Tests/Serializer/JsonSerializerTests.cs`:
- Around line 186-187: 将 int.Parse 调用显式使用 CultureInfo.InvariantCulture
来消除文化相关解析警告:在解析 parts[0]/parts[1](用于赋值到 X 和 Y)的代码中传入 InvariantCulture;可选地,在序列化端
WriteJson 的插值表达式 ($"{value?.X}:{value?.Y}") 也改为显式使用 InvariantCulture 格式化
value?.X 和 value?.Y,以保证读写两端文化无关并保持对称性。
🪄 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: f773bea9-494f-4e21-b302-67b67676eac4

📥 Commits

Reviewing files that changed from the base of the PR and between 608e639 and 2b70734.

📒 Files selected for processing (27)
  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
  • GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs
  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentRequiredTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentSchemasTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderEnumTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderIfThenElseTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderNegationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigSchemaValidatorTests.cs
  • GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs
  • GFramework.Game.Tests/Data/PersistenceTestUtilities.cs
  • GFramework.Game.Tests/Data/PersistenceTests.cs
  • GFramework.Game.Tests/Data/TestDataLocation.cs
  • GFramework.Game.Tests/Data/TestNamedData.cs
  • GFramework.Game.Tests/Data/TestSaveData.cs
  • GFramework.Game.Tests/Data/TestSimpleData.cs
  • GFramework.Game.Tests/Data/TestVersionedSaveData.cs
  • GFramework.Game.Tests/Serializer/JsonSerializerTests.cs
  • GFramework.Godot.Tests/Architectures/AbstractArchitectureModuleInstallationTests.cs
  • GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
  • GFramework.Godot.Tests/Text/RichTextMarkupTests.cs
  • GFramework.Godot/Architectures/AbstractArchitecture.cs
  • GFramework.Godot/Config/GodotYamlConfigEnvironment.cs
  • GFramework.Godot/Scene/SceneBehaviorBase.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 with no reviewable changes (1)
  • GFramework.Game.Tests/Data/PersistenceTestUtilities.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 (1)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

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

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML docs
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, or 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
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what
Prefer slightly more explanation over too little for framework code
Missing required documentation is a coding standards violation
Code that does not meet the documentation rules is considered incomplete
Follow repository defaults: ImplicitUsings disabled, Nullable enabled, GenerateDocumentationFile enabled for shipped libraries, LangVersion generally preview in main libraries
Do not rely on implicit ...

Files:

  • GFramework.Game.Tests/Config/YamlConfigSchemaValidatorTests.cs
  • GFramework.Godot/Architectures/AbstractArchitecture.cs
  • GFramework.Game.Tests/Data/TestSimpleData.cs
  • GFramework.Game.Tests/Data/TestVersionedSaveData.cs
  • GFramework.Game.Tests/Serializer/JsonSerializerTests.cs
  • GFramework.Game.Tests/Data/TestNamedData.cs
  • GFramework.Game.Tests/Data/TestSaveData.cs
  • GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs
  • GFramework.Godot.Tests/Text/RichTextMarkupTests.cs
  • GFramework.Godot.Tests/Architectures/AbstractArchitectureModuleInstallationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderEnumTests.cs
  • GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
  • GFramework.Godot/Scene/SceneBehaviorBase.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderNegationTests.cs
  • GFramework.Godot/Config/GodotYamlConfigEnvironment.cs
  • GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs
  • GFramework.Game.Tests/Data/TestDataLocation.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentRequiredTests.cs
  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentSchemasTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderIfThenElseTests.cs
  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
  • GFramework.Game.Tests/Data/PersistenceTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs
🧠 Learnings (14)
📚 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.Game.Tests/Config/YamlConfigSchemaValidatorTests.cs
  • GFramework.Godot/Architectures/AbstractArchitecture.cs
  • GFramework.Game.Tests/Data/TestSimpleData.cs
  • GFramework.Game.Tests/Data/TestVersionedSaveData.cs
  • GFramework.Game.Tests/Serializer/JsonSerializerTests.cs
  • GFramework.Game.Tests/Data/TestNamedData.cs
  • GFramework.Game.Tests/Data/TestSaveData.cs
  • GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs
  • GFramework.Godot.Tests/Text/RichTextMarkupTests.cs
  • GFramework.Godot.Tests/Architectures/AbstractArchitectureModuleInstallationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderEnumTests.cs
  • GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
  • GFramework.Godot/Scene/SceneBehaviorBase.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderNegationTests.cs
  • GFramework.Godot/Config/GodotYamlConfigEnvironment.cs
  • GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs
  • GFramework.Game.Tests/Data/TestDataLocation.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentRequiredTests.cs
  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentSchemasTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderIfThenElseTests.cs
  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
  • GFramework.Game.Tests/Data/PersistenceTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs
📚 Learning: 2026-04-16T13:26:01.780Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 235
File: GFramework.SourceGenerators.Tests/Rule/ContextAwareGeneratorSnapshotTests.cs:1-3
Timestamp: 2026-04-16T13:26:01.780Z
Learning: In the GeWuYou/GFramework repository, the test project `GFramework.SourceGenerators.Tests` provides `global using NUnit.Framework;` via its `GlobalUsings.cs`. Do not flag missing `using NUnit.Framework;` directives in test files within this project, as the global using already covers it. The project-wide GlobalUsings.cs pattern is used broadly to supply common namespaces (including NUnit, System.IO, etc.) without per-file imports.

Applied to files:

  • GFramework.Godot.Tests/Text/RichTextMarkupTests.cs
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`

Applied to files:

  • GFramework.Godot.Tests/Architectures/AbstractArchitectureModuleInstallationTests.cs
  • GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs
  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
  • GFramework.Game.Tests/Data/PersistenceTests.cs
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests

Applied to files:

  • GFramework.Game.Tests/Config/YamlConfigLoaderEnumTests.cs
  • GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs
  • GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentRequiredTests.cs
  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderDependentSchemasTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderIfThenElseTests.cs
  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
  • GFramework.Game.Tests/Data/PersistenceTests.cs
  • GFramework.Game.Tests/Config/YamlConfigLoaderAllOfTests.cs
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Keep tests focused on observable behavior, not implementation trivia

Applied to files:

  • GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs
  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
  • GFramework.Game.Tests/Data/PersistenceTests.cs
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : 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
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Source generator changes MUST be covered by generator tests

Applied to files:

  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical

Applied to files:

  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Regression fixes should include a test that fails before the fix and passes after it

Applied to files:

  • GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.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: Lifecycle management in Architecture implementations should handle Init, Ready, and Destroy phases with fine-grained initialization and destruction stages to maintain order consistency across Utility, Model, System, service modules, and hooks

Applied to files:

  • GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs
📚 Learning: 2026-04-24T08:52:52.326Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.326Z
Learning: Treat source code, `*.csproj`, tests, generated snapshots, and packaging metadata as the primary evidence for documentation updates

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : When generator behavior changes intentionally, update snapshots together with the implementation

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-24T08:52:52.326Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.326Z
Learning: When the goal is to inspect or reduce warnings printed during project build, establish the warning baseline from a non-incremental repository-root build by running `dotnet clean` and then `dotnet build`

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-24T08:52:52.326Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.326Z
Learning: Before considering work complete, confirm: required comments and XML docs are present, code follows repository style and naming rules, relevant tests were added or updated, sensitive or unsafe behavior was not introduced, user-facing documentation is updated when needed, and feature adoption docs under `docs/zh-CN/` were added or updated when functionality was added, removed, or refactored

Applied to files:

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

[grammar] ~15-~15: Ensure spelling is correct
Context: ...检查、后续保存和最终验证读取 - 更新 active tracking / trace,明确下一批若继续推进应单独进入 YamlConfigLoaderTests.cs - 验证里程碑: - dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental - 热点重排前:成功;253 Warning(s)0 Error(s) ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~25-~25: Ensure spelling is correct
Context: ...s.cs - 当前工作树投影下,分支体积为27 个文件、991行,仍低于$gframework-batch-boot 75 - 按 batch skill 的低风险边界,这一轮应在提交后收口;下一轮再把Ya...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~135-~135: Ensure spelling is correct
Context: ...下一批候选将主要落在 GFramework.Game 等高 warning 基线模块,已不再属于当前同等级低风险切片,因此本轮在这里收口并进入提交 ## 2026-04-24 — RP-052 ### 阶段:PR review fo...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

🔇 Additional comments (26)
GFramework.Godot/Config/GodotYamlConfigEnvironment.cs (4)

105-110: 分发方法简洁清晰。

按路径类型分派到两个语义明确的私有助手方法,拆分后 EnumerateDirectoryCore 的职责单一,可读性和可维护性都有提升。


135-170: Godot 分支行为保持不变,提取得当。

ListDirBegin 失败时直接返回 null、成功时通过 try/finally 确保 ListDirEnd() 成对调用的既有语义都被完整保留,同时独立方法让 Godot 专用流程更易单独测试和维护。


172-175: 异常分类助手集中且职责清晰。

把“预期可恢复”的目录枚举异常集中到单个谓词中,既让过滤 catch 更简洁,也让后续扩充异常种类时只需修改一处。命名准确反映语义,符合仓库一贯风格。


112-133: 无需添加 SecurityException 处理。

当前的异常过滤条件已完全覆盖 Directory.EnumerateFileSystemEntries 会抛出的所有异常。根据官方 Microsoft .NET 文档和底层实现,此方法仅会抛出 ArgumentExceptionArgumentOutOfRangeExceptionDirectoryNotFoundExceptionPathTooLongExceptionUnauthorizedAccessException

SecurityException 是代码访问安全 (CAS) 机制的产物,该机制在 .NET Framework 4.0+ 中已被禁用,在 .NET Core/.NET 5+ 中不适用。底层使用的 Win32 API 将权限失败映射为 UnauthorizedAccessException 而非 SecurityException,这在任何受支持的 .NET 环境中都一致。现有的异常处理已充分满足契约需求,无需进一步扩充。

GFramework.Godot.Tests/Config/GodotYamlConfigLoaderTests.cs (1)

200-200: 正确应用了 .ConfigureAwait(false) 以消除分析器警告。

Assert.ThrowsAsync 的异步 lambda 中为 await 表达式添加 .ConfigureAwait(false) 是正确的做法,符合 Meziantou.Analyzer 的要求,可以避免不必要的同步上下文捕获。这些更改在测试代码中是安全的,且与 PR 目标(减少分析器警告)一致。

Also applies to: 228-228, 257-257

GFramework.Godot.Tests/Text/RichTextMarkupTests.cs (2)

29-29: 好的改进:显式指定序数比较器。

在字典构造函数中添加 StringComparer.Ordinal 是一个很好的改进,原因如下:

  1. 与生产代码对齐RichTextMarkup.Effect 方法在 CollectEnvironmentPairs 中使用 StringComparer.Ordinal.Compare() 对环境参数进行排序(参见 GFramework.Godot/Text/RichTextMarkup.cs:140)
  2. 提高测试确定性:显式指定比较器可避免因不同字典实现或区域性设置导致的行为差异
  3. 符合分析器最佳实践:此更改很可能修复了 Meziantou.Analyzer 关于字符串字典应显式指定比较器的警告

基于相关代码片段:生产代码明确使用序数比较来保证稳定排序,避免输出顺序漂移。


57-57: 一致的改进:与第 29 行相同的优化。

Effect_Should_Sort_Environment_Parameters_By_Key 测试中的改进一致,此处同样显式指定了 StringComparer.Ordinal,确保测试行为的确定性和一致性。

GFramework.Game.Tests/Config/YamlConfigTextValidatorTests.cs (1)

135-135: LGTM!

Assert.ThrowsAsync 的 async lambda 内对 ValidateAsync 结果追加 .ConfigureAwait(false),与 PR 中其他测试用例保持一致,异常传播语义不受影响。

GFramework.Game.Tests/Config/YamlConfigLoaderNegationTests.cs (1)

73-73: LGTM!

统一在成功加载路径与 Assert.ThrowsAsync 断言 lambda 中追加 .ConfigureAwait(false),与全 PR 风格一致,测试语义未发生变化。

Also applies to: 121-121, 175-175, 230-230, 275-275

GFramework.Game.Tests/Config/YamlConfigLoaderDependentRequiredTests.cs (1)

78-78: LGTM!

所有 LoadAsync 调用(成功路径与抛异常断言)均已统一添加 .ConfigureAwait(false),与 PR 中其他 Yaml loader 测试文件风格保持一致。

Also applies to: 127-127, 172-172, 220-220, 270-270, 320-320

GFramework.Game.Tests/Config/YamlConfigLoaderEnumTests.cs (1)

78-78: LGTM!

三处 await 都正确追加了 .ConfigureAwait(false),成功路径与 Assert.ThrowsAsync 断言一致处理,符合 PR 统一模式。

Also applies to: 130-130, 179-179

GFramework.Game.Tests/Data/TestSaveData.cs (1)

1-14: LGTM!

极简 IData 测试桩,命名、命名空间、可空初始化与 XML 文档均符合仓库规范,能够覆盖 SaveRepository<TestSaveData> 基础存档路径。

GFramework.Game.Tests/Data/TestSimpleData.cs (1)

1-14: LGTM!

简单的 IData 测试模型,命名空间、封装级别与文档注释均符合规范。

GFramework.Game.Tests/Data/TestNamedData.cs (1)

1-14: LGTM!

TestSaveData 属于并列的轻量 IData 测试模型,结构、封装性与文档一致,可用于验证接口路径上的运行时类型行为。

GFramework.Game.Tests/Config/YamlConfigLoaderIfThenElseTests.cs (1)

108-108: LGTM!

.ConfigureAwait(false) 的补齐与 _rootPath 守卫替换与本 PR 内其他测试文件保持一致的收敛模式,行为等价。重复守卫的抽取建议已在 YamlConfigLoaderAllOfTests.cs 中统一给出。

GFramework.Game.Tests/Config/YamlConfigLoaderDependentSchemasTests.cs (1)

77-77: LGTM!

改动与其他 YamlConfigLoader*Tests 保持一致,ConfigureAwait(false) 补齐、_rootPath 守卫替换均为低风险形变,没有引入行为变化。

GFramework.Game.Tests/Config/YamlConfigSchemaValidatorTests.cs (1)

194-197: LGTM!

ArgumentNullException.ThrowIfNull(_rootPath) 替换为显式 InvalidOperationException 守卫,更准确地表达了"字段态未初始化"的语义(字段不是传入参数)。与同 PR 其他 Schema / Loader 测试的守卫模式保持一致。

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

5-135: LGTM!

RP-053 到 RP-057 的 trace 记录清晰地说明了每一批的触发背景、改动范围和验证里程碑(build/test 命令与 warning/error 数量),有助于后续复盘与断点续跑。无需代码层面改动。

GFramework.Godot/Architectures/AbstractArchitecture.cs (1)

115-116: LGTM!

注释明确说明了"显式保留 Godot 同步上下文"的意图,配合后续 CallDeferred(AddChild, ...)module.OnAttach(this) 对节点线程的依赖非常清晰。WaitUntilReadyAsync 底层走 ToSignal(Node, Ready),恢复时通常已在 Godot 主线程,因此与 ConfigureAwait(true) 语义一致。

GFramework.Godot.Tests/Architectures/AbstractArchitectureModuleInstallationTests.cs (1)

22-23: LGTM!

Assert.ThrowsAsync lambda 内部为 InstallGodotModuleForTestAsync 补齐 .ConfigureAwait(false),与本 PR 在测试项目中统一应用的异步等待风格一致。断言逻辑未变更,行为等价。

GFramework.Godot/Scene/SceneBehaviorBase.cs (1)

144-148: 代码实现正确无误。Godot .NET 在主线程安装了 GodotSynchronizationContextConfigureAwait(true) 会捕获该上下文,保证在生命周期回调(如 OnPauseAsyncOnResumeAsyncOnUnloadAsync)中恢复到主线程。OnPauseAsync()OnResumeAsync()OnUnloadAsync() 三个方法都正确地在 Godot API 调用前使用了 ConfigureAwait(true),注释也清晰说明了这一设计意图。相比之下,OnExitAsync() 使用 ConfigureAwait(false) 是恰当的,因为其后续只有简单的字段赋值,无需回到主线程。

GFramework.Game.Tests/Data/TestDataLocation.cs (1)

1-49: LGTM!

实现完整覆盖了 IDataLocation 的四个成员,默认值 StorageKinds.Local 与可空 Namespace/Metadata 均与接口契约一致,XML 文档齐全,使用 namespaceValue 作为构造参数也合理地规避了 namespace 关键字冲突。

GFramework.Game.Tests/Config/ArchitectureConfigIntegrationTests.cs (1)

42-42: LGTM!

所有 InitializeAsync / DestroyAsync(含 Assert.ThrowsAsync lambda 内部)都一致地追加了 .ConfigureAwait(false),Line 182 的 GetAwaiter().GetResult() 仍然保留,这是同步桥接测试本身需要的阻塞语义,未受影响。

Also applies to: 66-66, 86-86, 100-100, 122-124, 131-131, 144-144, 206-206, 219-219, 225-225, 238-238, 243-243

GFramework.Game.Tests/Config/GameConfigBootstrapTests.cs (1)

53-53: LGTM!

WaitForTaskWithinAsync 在等待 WhenAny 与最终 await task 时都补齐了 .ConfigureAwait(false),与 bootstrap 初始化、Assert.ThrowsAsync/Assert.DoesNotThrowAsync 的异步 lambda 风格一致,行为保持不变。

Also applies to: 77-77, 98-98, 166-170, 314-320

GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs (1)

53-58: LGTM!

断言抽取为 AssertGeneratedCatalogMetadata / AssertGeneratedMonsterTableResults / AssertGeneratedItemTableResults / AssertGeneratedRegistrationFilteringResults 四个静态 helper 后,主测试方法显著变短,按“元数据/怪物表/物品表/筛选结果”四个语义阶段拆分清晰,符合“按语义阶段抽取命名 helper”的仓库 analyzer 规范,断言语义未变化。ConfigureAwait(false) 也与其余配置测试保持一致。

Also applies to: 131-167, 205-217, 302-432

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

9-74: LGTM!

恢复点切换到 RP-057、基线从 253 → 249 warning(s)PersistenceTests.cs 从 warning 输出中消失、两个缓存一致性测试 Passed: 2 等事实与本次代码改动可以对应上;风险和“下一步聚焦 YamlConfigLoaderTests.cs 独立批次”的措辞也合理。

Comment thread GFramework.Godot/Scene/SceneBehaviorBase.cs Outdated
- 修复 SceneBehaviorBase 中暂停、恢复、卸载方法的缩进,消除 PR review 指向的格式问题
- 更新 analyzer-warning-reduction 的 tracking 与 trace,记录 PR #286 latest-head review 跟进和验证结果
- 补充 GFramework.Godot 的 Release build 与 dotnet format verify 结论,保留后续 warning reduction 恢复点
@github-actions

Copy link
Copy Markdown

Summary

Tests 📝 Passed ✅ Failed ❌ Skipped ⏭️ Other ❓ Flaky 🍂 Duration ⏱️
2156 2156 0 0 0 0 36.2s    ↓1.7s

Test Results

passed 2156 passed

Details

tests 2156 tests
clock 36.2s ↓1.7s
tool nunit
build CI - Build & Test arrow-right build-and-test link #963
pull-request Fix/analyzer warning reduction batch link #286

Insights

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

Fail Rate

Fail Rate 0.00%
Test 📝 Results 📊 Passed ✅ Failed ❌ Fail Rate (%) 📈
ILogAppender_Flush_Should_Raise_OnFlushCompleted_Only_Once 21 20 1 4.76    ↓0.24
Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names 29 28 1 3.45    ↓0.12

build-and-test: Run #963

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

🎉 All tests passed!

Slowest Tests

Test 📝 Results 📊 Duration (avg) ⏱️ Duration (p95) ⏱️
SendRequestAsync_Should_ResolveCqrsRuntime_OnlyOnce_When_AccessedConcurrently 29 4.0s 4.7s
Does_Not_Report_When_FieldInjectedModel_Is_Registered 29 2.2s 2.4s
Generates_Scene_Behavior_Boilerplate 29 1.9s 2.0s
CleanupDuringAcquire_Should_NotCauseRaceCondition 29 1.1s 1.1s
Append_ShouldNotBlock 29 1.0s 1.0s
Flush_Should_Raise_OnFlushCompleted_With_Sender_And_Result 22 91ms 1.0s
Context_Caching_Should_Improve_Performance 29 782ms 791ms
PendingCount_ShouldReflectQueuedEntries 29 501ms 501ms
Cleanup_Should_NotRemoveActiveLocks 29 404ms 406ms
Cleanup_Should_RemoveUnusedLocks 29 401ms 402ms

± Comparison with run #962 at e9a37bc | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 29 runs.

Github Test Reporter by CTRF 💚

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

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

⚠️ Outside diff range comments (1)
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md (1)

1-3: ⚠️ Potential issue | 🟡 Minor

建议移除重复的一级标题

Line 1 与 Line 3 是相同的 H1,会导致文档层级重复。建议保留一个即可。

建议修改
 # Analyzer Warning Reduction 追踪
-
-# Analyzer Warning Reduction 追踪
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md`
around lines 1 - 3, 文档开头出现重复的一级标题 "Analyzer Warning Reduction
追踪"(出现在两处),请删除其中一个重复的 H1 保留一个即可,确保文档只保留单一顶级标题以修复层级重复问题;定位并编辑该 Markdown 文件中的两个相同的
"# Analyzer Warning Reduction 追踪" 标记,移除多余的那一行并保存。
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md`:
- Around line 1-3: 文档开头出现重复的一级标题 "Analyzer Warning Reduction
追踪"(出现在两处),请删除其中一个重复的 H1 保留一个即可,确保文档只保留单一顶级标题以修复层级重复问题;定位并编辑该 Markdown 文件中的两个相同的
"# Analyzer Warning Reduction 追踪" 标记,移除多余的那一行并保存。

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: ce5f8bf6-eea0-43e6-8d06-7066f6051e4b

📥 Commits

Reviewing files that changed from the base of the PR and between 2b70734 and 1e5ca14.

📒 Files selected for processing (3)
  • GFramework.Godot/Scene/SceneBehaviorBase.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). (3)
  • GitHub Check: Code Quality & Security
  • GitHub Check: Build and Test
  • GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (1)
**/*.cs

📄 CodeRabbit inference engine (CLAUDE.md)

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

**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with <summary>, <param>, <returns>, <exception>, and <remarks> where applicable
XML documentation comments must explain intent, contract, and usage constraints instead of restating syntax
If a member participates in lifecycle, threading, registration, or disposal behavior, document that behavior explicitly in XML docs
Add inline comments for non-trivial logic, concurrency or threading behavior, performance-sensitive paths, workarounds, compatibility constraints, edge cases, registration order, lifecycle sequencing, or 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
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Comments MUST NOT be trivial, redundant, or misleading. Prefer explaining why and when, not just what
Prefer slightly more explanation over too little for framework code
Missing required documentation is a coding standards violation
Code that does not meet the documentation rules is considered incomplete
Follow repository defaults: ImplicitUsings disabled, Nullable enabled, GenerateDocumentationFile enabled for shipped libraries, LangVersion generally preview in main libraries
Do not rely on implicit ...

Files:

  • GFramework.Godot/Scene/SceneBehaviorBase.cs
🧠 Learnings (6)
📓 Common learnings
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`
📚 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/Scene/SceneBehaviorBase.cs
📚 Learning: 2026-04-24T08:52:52.326Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.326Z
Learning: When the goal is to inspect or reduce warnings printed during project build, establish the warning baseline from a non-incremental repository-root build by running `dotnet clean` and then `dotnet build`

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-24T08:52:52.326Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.326Z
Learning: Before considering work complete, confirm: required comments and XML docs are present, code follows repository style and naming rules, relevant tests were added or updated, sensitive or unsafe behavior was not introduced, user-facing documentation is updated when needed, and feature adoption docs under `docs/zh-CN/` were added or updated when functionality was added, removed, or refactored

Applied to files:

  • ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : 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
📚 Learning: 2026-04-24T08:52:52.325Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-24T08:52:52.325Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests

Applied to files:

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

[grammar] ~40-~40: Ensure spelling is correct
Context: ...检查、后续保存和最终验证读取 - 更新 active tracking / trace,明确下一批若继续推进应单独进入 YamlConfigLoaderTests.cs - 验证里程碑: - dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental - 热点重排前:成功;253 Warning(s)0 Error(s) ...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~50-~50: Ensure spelling is correct
Context: ...s.cs - 当前工作树投影下,分支体积为27 个文件、991行,仍低于$gframework-batch-boot 75 - 按 batch skill 的低风险边界,这一轮应在提交后收口;下一轮再把Ya...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)


[grammar] ~160-~160: Ensure spelling is correct
Context: ...下一批候选将主要落在 GFramework.Game 等高 warning 基线模块,已不再属于当前同等级低风险切片,因此本轮在这里收口并进入提交 ## 2026-04-24 — RP-052 ### 阶段:PR review fo...

(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)

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

5-252: 追踪记录结构清晰,验证链路完整

各 RP 段落的“触发背景 → 实施 → 验证里程碑 → 当前结论”格式一致,且命令与结果可追溯,便于后续审计与回放。

GFramework.Godot/Scene/SceneBehaviorBase.cs (1)

144-148: 这组生命周期处理是合理的。

ConfigureAwait(true) 与后续的 SetProcess* / QueueFreeX() 主线程约束一致,缩进也已恢复到与文件其余方法一致的风格。

Also applies to: 163-170, 200-204

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

9-15: 这份跟踪文档已对齐当前批次。

恢复点、验证记录和下一步建议都与 PR #286 的当前收尾方向一致,没有看到明显的事实偏差。

Also applies to: 20-21, 36-37, 59-82, 85-86

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