fix(analyzer): 清理 YamlConfigLoaderTests 的异步等待 warning

- 修复 YamlConfigLoaderTests 中 Assert.ThrowsAsync 的冗余 async/await 写法

- 补充 WaitForTaskWithinAsync 的 ConfigureAwait(false) 以消除剩余 MA0004

- 更新 analyzer-warning-reduction 的 RP-059 跟踪与验证记录
This commit is contained in:
gewuyou 2026-04-25 08:27:32 +08:00
parent 9964962416
commit b56e08adae
3 changed files with 89 additions and 70 deletions

View File

@ -143,7 +143,7 @@ public class YamlConfigLoaderTests
.RegisterTable<int, MonsterConfigStub>("monster", "monster", static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -185,7 +185,7 @@ public class YamlConfigLoaderTests
.RegisterTable<int, MonsterConfigStub>("monster", "monster", static config => config.Id)
.RegisterTable<int, MonsterConfigStub>("broken", "broken", static config => config.Id);
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -216,7 +216,7 @@ public class YamlConfigLoaderTests
.RegisterTable<int, MonsterConfigStub>("monster", "monster", static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -257,7 +257,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -306,7 +306,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -352,7 +352,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -398,7 +398,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -445,7 +445,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -494,7 +494,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -543,7 +543,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -591,7 +591,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -681,7 +681,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -769,7 +769,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -817,7 +817,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -931,7 +931,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -980,7 +980,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1028,7 +1028,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1074,7 +1074,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1174,7 +1174,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1226,7 +1226,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1280,7 +1280,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1336,7 +1336,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1394,7 +1394,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1452,7 +1452,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1561,7 +1561,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1617,7 +1617,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1740,7 +1740,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1797,7 +1797,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1904,7 +1904,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -1954,7 +1954,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2004,7 +2004,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2055,7 +2055,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2107,7 +2107,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2161,7 +2161,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2261,7 +2261,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2317,7 +2317,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2369,7 +2369,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2423,7 +2423,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2478,7 +2478,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2537,7 +2537,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2618,7 +2618,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2749,7 +2749,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2824,7 +2824,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -2899,7 +2899,7 @@ public class YamlConfigLoaderTests
static config => config.Id);
var registry = new ConfigRegistry();
var exception = Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry));
var exception = Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry));
Assert.Multiple(() =>
{
@ -3389,13 +3389,13 @@ public class YamlConfigLoaderTests
/// <returns>任务结果。</returns>
private static async Task<T> WaitForTaskWithinAsync<T>(Task<T> task, TimeSpan timeout)
{
var completedTask = await Task.WhenAny(task, Task.Delay(timeout));
var completedTask = await Task.WhenAny(task, Task.Delay(timeout)).ConfigureAwait(false);
if (!ReferenceEquals(completedTask, task))
{
Assert.Fail($"Timed out after {timeout} while waiting for file watcher notification.");
}
return await task;
return await task.ConfigureAwait(false);
}
/// <summary>

View File

@ -6,13 +6,14 @@
## 当前恢复点
- 恢复点编号:`ANALYZER-WARNING-REDUCTION-RP-058`
- 当前阶段:`Phase 58`
- 恢复点编号:`ANALYZER-WARNING-REDUCTION-RP-059`
- 当前阶段:`Phase 59`
- 当前焦点:
- `2026-04-24` 使用 `$gframework-pr-review` 复核当前分支 PR #286 的 latest-head review threads、MegaLinter 与测试状态
- 已确认最新 head 上唯一未解决的实质代码线程指向 `GFramework.Godot/Scene/SceneBehaviorBase.cs``OnPauseAsync` 的缩进异常,并顺带对齐 `OnResumeAsync``OnUnloadAsync`
- `dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release` 通过,结果为 `565 Warning(s)``0 Error(s)`;当前跟进只处理 PR review 指向的格式问题,不扩散到既有 warning 基线
- `dotnet format GFramework.Godot/GFramework.Godot.csproj --verify-no-changes --no-restore --include GFramework.Godot/Scene/SceneBehaviorBase.cs` 已通过,当前文件不再残留格式差异
- `2026-04-25``$gframework-batch-boot 75` 继续 warning reduction基线使用本地现有 `origin/main`
- 当前 `HEAD``origin/main` 同为 `9964962`,已提交 branch diff 为 `0` 个文件;本轮工作树投影为 `1` 个文件、`92`
- 已将 `GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs``44``Assert.ThrowsAsync(... async () => await ...)` 改为直接返回 `Task`,并为 `WaitForTaskWithinAsync` 补齐 `ConfigureAwait(false)`
- `dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental` 通过,结果从 `249 Warning(s)` 降到 `203 Warning(s)`;该文件不再出现在 `MA0004` 输出中
- `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-build --filter "FullyQualifiedName~YamlConfigLoaderTests"` 已通过,结果为 `Passed: 74`
## 当前活跃事实
@ -21,13 +22,10 @@
- 当前整仓最近一次直接观测值仍是 `dotnet build GFramework.sln -c Release``116 warning(s)`
- `RP-056` 已验证 `GeneratedConfigConsumerIntegrationTests.cs` 不再出现在项目 build warning 输出中
- `RP-057` 已验证 `PersistenceTests.cs` 不再出现在 `dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental` 的 warning 输出中
- 本轮已验证 `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~UnifiedSettingsDataRepository_SaveAsync_When_Persist_Fails_Should_Keep_Cache_Consistent|FullyQualifiedName~UnifiedSettingsDataRepository_DeleteAsync_When_Persist_Fails_Should_Keep_Cache_Consistent"`,结果为 `Passed: 2`
- `GFramework.Game.Tests` 当前剩余热点已经几乎完全集中到 `YamlConfigLoaderTests.cs` 这一高上下文文件
- PR #286 当前标题为 `Fix/analyzer warning reduction batch`;最新抓取时间点的 PR 状态仍为 `OPEN`
- 最新 reviewed commit 为 `2b707343577193fc9904517e6078149653e95698`CodeRabbit 于 `2026-04-24T12:44:12Z` 给出 `CHANGES_REQUESTED`
- latest-head review threads 中只有 `1` 个未解决线程,内容是 `SceneBehaviorBase.OnPauseAsync` 的缩进不一致;本地源码已修复并扩展到同段的 `OnResumeAsync` / `OnUnloadAsync`
- MegaLinter 的 `dotnet-format` 详细问题与上述格式异常一致;本地 `dotnet format --verify-no-changes` 已通过
- PR 上其余 nitpick 仅为可选建议或已明确留待后续批次处理,当前没有额外需要立即修复的 latest-head 代码线程
- `RP-059` 已验证 `YamlConfigLoaderTests.cs` 中的 `MA0004` 已清零,当前该文件在项目 build 输出里只剩 `MA0051`
- `GFramework.Game.Tests` 当前 `--no-incremental Release build` 结果为 `203 Warning(s)``0 Error(s)`
- 当前 `origin/main` 基线提交为 `9964962``2026-04-24T23:05:53+08:00`),与本地 `HEAD` 相同
- 本轮 batch 的主停止条件仍为相对 `origin/main` 的 changed files `< 75`;当前工作树投影仅 `1` 个文件,因此停止原因不是体积,而是剩余切片不再低风险
## 当前风险
@ -37,10 +35,8 @@
- 缓解措施:后续若继续整仓 warning reduction需要单独定位 clean 失败原因,或明确继续沿用 direct build 观测值作为临时真值
- 当前 worktree 仍存在未跟踪的 `.codex` 目录
- 缓解措施:提交当前批次时只暂存 analyzer-warning-reduction 相关源码与 `ai-plan` 文件,避免把工作目录辅助文件混入提交
- 下一轮若继续深入 `GFramework.Game.Tests`,很可能需要进入 `YamlConfigLoaderTests.cs` 这种高上下文大文件
- 缓解措施:把它单独作为一个明确的新批次处理,不与其它 warning family 混批
- PR 标题检查当前仍显示 `Inconclusive`
- 缓解措施:如需让该检查转绿,需要单独更新 GitHub PR 标题;这不属于本地代码修改范围
- `YamlConfigLoaderTests.cs` 剩余切片已经从机械性的 `MA0004` 进入 `MA0051` 长方法重构,继续自动推进的风险明显高于前几轮
- 缓解措施:下一轮若继续处理该文件,只处理一到两个长方法,并以 helper 抽取为主,不与其他文件混批
## 活跃文档
@ -68,19 +64,17 @@
- `dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental`
- `RP-057` 热点重排前:成功;`253 Warning(s)``0 Error(s)`
- `RP-057` 当前结果:成功;`249 Warning(s)``0 Error(s)`
- `RP-059` 当前结果:成功;`203 Warning(s)``0 Error(s)`
- `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~ArchitectureConfigIntegrationTests|FullyQualifiedName~GameConfigBootstrapTests|FullyQualifiedName~JsonSerializerTests"`
- 结果:成功;`Passed: 19``Failed: 0`
- `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~GeneratedConfigConsumerIntegrationTests"`
- 结果:成功;`Passed: 4``Failed: 0`
- `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~UnifiedSettingsDataRepository_SaveAsync_When_Persist_Fails_Should_Keep_Cache_Consistent|FullyQualifiedName~UnifiedSettingsDataRepository_DeleteAsync_When_Persist_Fails_Should_Keep_Cache_Consistent"`
- 结果:成功;`Passed: 2``Failed: 0`
- `dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release`
- 结果:成功;`565 Warning(s)``0 Error(s)`
- `dotnet format GFramework.Godot/GFramework.Godot.csproj --verify-no-changes --no-restore --include GFramework.Godot/Scene/SceneBehaviorBase.cs`
- 首次运行失败restore 阶段异常退出,未进入格式验证
- 第二次运行(同命令追加 sandbox 提权成功workspace 仅提示加载 warning无格式差异
- `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-build --filter "FullyQualifiedName~YamlConfigLoaderTests"`
- 结果:成功;`Passed: 74``Failed: 0`
## 下一步建议
1. 提交 `SceneBehaviorBase.cs` 与 `RP-058` tracking/trace 更新,清掉 PR #286 当前 latest-head 上的格式类 review thread
2. 若继续 warning reduction 主线,应回到 `GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs`,把它作为独立高上下文批次处理
1. 提交 `YamlConfigLoaderTests.cs` 与 `RP-059` tracking/trace 更新,保留这一轮单文件 `MA0004` 清理的独立边界
2. 若继续 warning reduction 主线,优先把 `YamlConfigLoaderTests.cs``MA0051` 作为新的高上下文批次单独处理;若希望继续保持低风险节奏,则改选其它单文件小热点

View File

@ -2,6 +2,31 @@
# Analyzer Warning Reduction 追踪
## 2026-04-25 — RP-059
### 阶段:`YamlConfigLoaderTests.cs` 单文件 `MA0004` 清理
- 触发背景:
- 用户要求继续按 `$gframework-batch-boot 75` 自动推进 warning reduction需要先按 skill 重新确认基线与 stop-condition
- 当前 `HEAD` 与本地现有 `origin/main` 都是 `9964962`,因此已提交 branch diff 为 `0` 个文件,仍有充分批次空间
- `GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs` 已是剩余 warning 的主要热点,但其中 `MA0004` 仍属于机械且低风险的单文件切片
- 主线程实施:
- 运行 `dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental` 重新建立观测值,确认 `YamlConfigLoaderTests.cs` 主要由 `Assert.ThrowsAsync(... async () => await ...)``WaitForTaskWithinAsync` 触发 `MA0004`
- 将文件内 `44``Assert.ThrowsAsync<ConfigLoadException>(async () => await loader.LoadAsync(registry))` 统一改为 `Assert.ThrowsAsync<ConfigLoadException>(() => loader.LoadAsync(registry))`
- 在 `WaitForTaskWithinAsync` 中为 `Task.WhenAny` 与最终 `task` await 补齐 `.ConfigureAwait(false)`,避免文件监听测试 helper 继续触发 analyzer
- 更新 active tracking / trace明确本轮停止原因是剩余切片已转为 `MA0051` 长方法重构,不再属于同等级低风险清理
- 验证里程碑:
- `dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental`
- 修复前:成功;`249 Warning(s)``0 Error(s)`
- 修复后:成功;`203 Warning(s)``0 Error(s)`
- 结论:`YamlConfigLoaderTests.cs` 不再出现在 `MA0004` warning 输出中,仅剩同文件 `MA0051`
- `dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-build --filter "FullyQualifiedName~YamlConfigLoaderTests"`
- 结果:成功;`Passed: 74``Failed: 0`
- 当前结论:
- 这轮以单文件单 warning-family 的边界完成了 `YamlConfigLoaderTests.cs``MA0004` 清理
- 当前工作树投影相对 `origin/main``1` 个文件、`92` 行,远低于 `$gframework-batch-boot 75`
- 下一候选若继续留在同文件,将进入 `MA0051` 长方法拆分,风险高于本轮,适合作为新的独立批次而不是立即连做
## 2026-04-24 — RP-058
### 阶段PR #286 latest-head review 格式跟进