From 1e5ca14620d6f13178aa19bf6925885d5eed3ae0 Mon Sep 17 00:00:00 2001 From: gewuyou <95328647+GeWuYou@users.noreply.github.com> Date: Fri, 24 Apr 2026 22:18:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(godot):=20=E4=BF=AE=E5=A4=8D=E5=9C=BA?= =?UTF-8?q?=E6=99=AF=E8=A1=8C=E4=B8=BA=E6=A0=BC=E5=BC=8F=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复 SceneBehaviorBase 中暂停、恢复、卸载方法的缩进,消除 PR review 指向的格式问题 - 更新 analyzer-warning-reduction 的 tracking 与 trace,记录 PR #286 latest-head review 跟进和验证结果 - 补充 GFramework.Godot 的 Release build 与 dotnet format verify 结论,保留后续 warning reduction 恢复点 --- GFramework.Godot/Scene/SceneBehaviorBase.cs | 34 +++++++++---------- .../analyzer-warning-reduction-tracking.md | 28 ++++++++++----- .../analyzer-warning-reduction-trace.md | 25 ++++++++++++++ 3 files changed, 62 insertions(+), 25 deletions(-) diff --git a/GFramework.Godot/Scene/SceneBehaviorBase.cs b/GFramework.Godot/Scene/SceneBehaviorBase.cs index fee000f5..826be58f 100644 --- a/GFramework.Godot/Scene/SceneBehaviorBase.cs +++ b/GFramework.Godot/Scene/SceneBehaviorBase.cs @@ -141,11 +141,11 @@ public abstract class SceneBehaviorBase : ISceneBehavior /// 当场景被其他场景覆盖或失去焦点时调用。 /// /// 表示暂停操作完成的ValueTask。 - public virtual async ValueTask OnPauseAsync() - { - if (_scene != null) - // 暂停后紧接着会修改 Owner 的处理开关,必须回到 Godot 主线程继续执行。 - await _scene.OnPauseAsync().ConfigureAwait(true); + public virtual async ValueTask OnPauseAsync() + { + if (_scene != null) + // 暂停后紧接着会修改 Owner 的处理开关,必须回到 Godot 主线程继续执行。 + await _scene.OnPauseAsync().ConfigureAwait(true); // 暂停处理 Owner.SetProcess(false); @@ -160,14 +160,14 @@ public abstract class SceneBehaviorBase : ISceneBehavior /// 当场景重新获得焦点或从暂停状态恢复时调用。 /// /// 表示恢复操作完成的ValueTask。 - public virtual async ValueTask OnResumeAsync() - { - if (Owner.IsInvalidNode()) - return; + public virtual async ValueTask OnResumeAsync() + { + if (Owner.IsInvalidNode()) + return; - if (_scene != null) - // 恢复完成后要立刻重新启用节点处理流程,因此显式保留当前同步上下文。 - await _scene.OnResumeAsync().ConfigureAwait(true); + if (_scene != null) + // 恢复完成后要立刻重新启用节点处理流程,因此显式保留当前同步上下文。 + await _scene.OnResumeAsync().ConfigureAwait(true); // 恢复处理 Owner.SetProcess(true); @@ -197,11 +197,11 @@ public abstract class SceneBehaviorBase : ISceneBehavior /// 在场景完全退出后调用,释放占用的内存和资源。 /// /// 表示卸载操作完成的ValueTask。 - public virtual async ValueTask OnUnloadAsync() - { - if (_scene != null) - // 卸载后的 QueueFreeX 必须在 Godot 节点线程上调用,不能切走同步上下文。 - await _scene.OnUnloadAsync().ConfigureAwait(true); + public virtual async ValueTask OnUnloadAsync() + { + if (_scene != null) + // 卸载后的 QueueFreeX 必须在 Godot 节点线程上调用,不能切走同步上下文。 + await _scene.OnUnloadAsync().ConfigureAwait(true); // 释放节点 Owner.QueueFreeX(); diff --git a/ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md b/ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md index 41fe7647..cfeb8489 100644 --- a/ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md +++ b/ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md @@ -6,13 +6,13 @@ ## 当前恢复点 -- 恢复点编号:`ANALYZER-WARNING-REDUCTION-RP-057` -- 当前阶段:`Phase 57` +- 恢复点编号:`ANALYZER-WARNING-REDUCTION-RP-058` +- 当前阶段:`Phase 58` - 当前焦点: - - `2026-04-24` 本轮继续吃掉 `GFramework.Game.Tests` 中仍然独立且低风险的 `PersistenceTests.cs` 残余 `MA0004` - - 已补齐两个失败缓存一致性测试中的剩余 `.ConfigureAwait(false)`,使 `PersistenceTests.cs` 不再出现在非增量构建 warning 输出中 - - 非增量 `dotnet build GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --no-incremental` 从 `253 Warning(s)` 进一步收敛到 `249 Warning(s)`,剩余热点几乎全部集中在 `YamlConfigLoaderTests.cs` - - 按当前工作树投影重新计算后,分支体积为 `27` 个文件、`991` 行,仍低于 `$gframework-batch-boot 75` + - `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` 已通过,当前文件不再残留格式差异 ## 当前活跃事实 @@ -23,6 +23,11 @@ - `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 代码线程 ## 当前风险 @@ -34,6 +39,8 @@ - 缓解措施:提交当前批次时只暂存 analyzer-warning-reduction 相关源码与 `ai-plan` 文件,避免把工作目录辅助文件混入提交 - 下一轮若继续深入 `GFramework.Game.Tests`,很可能需要进入 `YamlConfigLoaderTests.cs` 这种高上下文大文件 - 缓解措施:把它单独作为一个明确的新批次处理,不与其它 warning family 混批 +- PR 标题检查当前仍显示 `Inconclusive` + - 缓解措施:如需让该检查转绿,需要单独更新 GitHub PR 标题;这不属于本地代码修改范围 ## 活跃文档 @@ -67,8 +74,13 @@ - 结果:成功;`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,无格式差异 ## 下一步建议 -1. 提交 `PersistenceTests.cs` 与 `RP-057` tracking/trace 更新,继续保持只纳入本 topic 相关文件 -2. 若继续 warning reduction,应把 `YamlConfigLoaderTests.cs` 视为独立的高上下文批次,不再与其它文件混批 +1. 提交 `SceneBehaviorBase.cs` 与 `RP-058` tracking/trace 更新,清掉 PR #286 当前 latest-head 上的格式类 review thread +2. 若继续 warning reduction 主线,应回到 `GFramework.Game.Tests/Config/YamlConfigLoaderTests.cs`,把它作为独立高上下文批次处理 diff --git a/ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md b/ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md index 5363a4d3..bbed0ac9 100644 --- a/ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md +++ b/ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md @@ -2,6 +2,31 @@ # Analyzer Warning Reduction 追踪 +## 2026-04-24 — RP-058 + +### 阶段:PR #286 latest-head review 格式跟进 + +- 触发背景: + - 用户要求执行 `$gframework-pr-review`,需要以当前分支 PR 页面而不是本地记忆为准,重新核对 CodeRabbit、MegaLinter 和测试状态 + - 抓取脚本当前解析到的 PR 是 `#286`,最新 reviewed commit 为 `2b707343577193fc9904517e6078149653e95698` + - 最新 head 上真正未解决的代码线程只剩 `GFramework.Godot/Scene/SceneBehaviorBase.cs:148` 的缩进问题;其余 nitpick 为可选建议或已留待后续批次 +- 主线程实施: + - 运行 `python3 .agents/skills/gframework-pr-review/scripts/fetch_current_pr_review.py --json-output /tmp/current-pr-review.json`,确认 PR `OPEN`、测试 `2156/2156` 通过、MegaLinter 仅剩 `dotnet-format` 警告 + - 复核 `SceneBehaviorBase.cs` 后确认 `OnPauseAsync` 的方法签名与方法体缩进异常仍存在于本地源码;同段的 `OnResumeAsync`、`OnUnloadAsync` 也有同类偏差 + - 在不改变行为的前提下统一修正三个方法的缩进,保持现有 XML 注释、`ConfigureAwait(true)` 语义与 Godot 主线程说明不变 + - 更新 active tracking / trace,记录当前 PR review follow-up 已完成,本地剩余外部信号只剩 PR 标题检查 +- 验证里程碑: + - `dotnet build GFramework.Godot/GFramework.Godot.csproj -c Release` + - 结果:成功;`565 Warning(s)`、`0 Error(s)` + - 结论:当前格式修复未引入编译错误;模块既有 warning 基线仍存在,但不属于本次 PR review 跟进范围 + - `dotnet format GFramework.Godot/GFramework.Godot.csproj --verify-no-changes --no-restore --include GFramework.Godot/Scene/SceneBehaviorBase.cs` + - 首次运行:失败;sandbox 环境下在 build host / pipe 建立阶段报错,未进入真实格式比较 + - 提权复验:成功;仅提示 workspace load warning,无格式差异 +- 当前结论: + - PR #286 当前 latest-head 上唯一未解决的实质代码 review thread 已在本地修复 + - MegaLinter 暴露的 `dotnet-format` 问题已被本地 `verify-no-changes` 复验覆盖 + - `Title check: Inconclusive` 仍然存在,但属于 GitHub PR 标题元数据问题,不能通过本地代码提交直接消除 + ## 2026-04-24 — RP-057 ### 阶段:清理 `PersistenceTests.cs` 残余 `MA0004`