From 833a95f7f3621fee2640867b73ce264a4cbd55ff Mon Sep 17 00:00:00 2001
From: gewuyou <95328647+GeWuYou@users.noreply.github.com>
Date: Fri, 24 Apr 2026 07:42:19 +0800
Subject: [PATCH] =?UTF-8?q?fix(analyzer-warning-reduction):=20=E6=94=B6?=
=?UTF-8?q?=E5=8F=A3PR280=E8=AF=84=E5=AE=A1=E5=B9=B6=E5=8E=8B=E7=BC=A9?=
=?UTF-8?q?=E6=81=A2=E5=A4=8D=E5=85=A5=E5=8F=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
- 修复 SchemaConfigGeneratorTests 中冗余的 global:: 返回类型声明
- 归档 analyzer-warning-reduction 主题的 RP-002 至 RP-041 详细 tracking 与 trace 历史
- 更新 RP-042 的 active 跟踪与验证记录以反映 PR #280 follow-up 结论
---
.../Config/SchemaConfigGeneratorTests.cs | 2 +-
...r-warning-reduction-history-rp002-rp041.md | 517 ++++++++
...r-warning-reduction-history-rp002-rp041.md | 1157 ++++++++++++++++
.../analyzer-warning-reduction-tracking.md | 526 +-------
.../analyzer-warning-reduction-trace.md | 1166 +----------------
5 files changed, 1732 insertions(+), 1636 deletions(-)
create mode 100644 ai-plan/public/analyzer-warning-reduction/archive/todos/analyzer-warning-reduction-history-rp002-rp041.md
create mode 100644 ai-plan/public/analyzer-warning-reduction/archive/traces/analyzer-warning-reduction-history-rp002-rp041.md
diff --git a/GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs b/GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
index 51c2c766..9826693f 100644
--- a/GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
+++ b/GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs
@@ -2553,7 +2553,7 @@ public class SchemaConfigGeneratorTests
/// 测试输入源码。
/// 参与本次生成的 schema 文件集合。
/// 按 HintName 索引的生成源码字典。
- private static global::System.Collections.Generic.IReadOnlyDictionary RunAndCollectGeneratedSources(
+ private static IReadOnlyDictionary RunAndCollectGeneratedSources(
string source,
params (string path, string content)[] additionalFiles)
{
diff --git a/ai-plan/public/analyzer-warning-reduction/archive/todos/analyzer-warning-reduction-history-rp002-rp041.md b/ai-plan/public/analyzer-warning-reduction/archive/todos/analyzer-warning-reduction-history-rp002-rp041.md
new file mode 100644
index 00000000..9c6368b0
--- /dev/null
+++ b/ai-plan/public/analyzer-warning-reduction/archive/todos/analyzer-warning-reduction-history-rp002-rp041.md
@@ -0,0 +1,517 @@
+# Analyzer Warning Reduction 跟踪
+
+## 目标
+
+继续以“优先低风险、保持行为兼容”为原则收敛当前仓库的 Meziantou analyzer warnings,并在首轮大规模清理完成后,
+判断剩余结构性 warning 是否值得在下一轮继续推进。
+
+## 当前恢复点
+
+- 恢复点编号:`ANALYZER-WARNING-REDUCTION-RP-041`
+- 当前阶段:`Phase 41`
+- 当前焦点:
+ - 已通过第五个有效 subagent 切片完成
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ `Generates_Precise_Service_Type_For_Hidden_Generic_Type_Definitions()` 的 `MA0051` 收口:
+ 将内联 `source` 文本提取为类级常量,保持既有 expected 常量和断言语义不变
+ - 当前 `GFramework.SourceGenerators.Tests` Release warnings-only 基线已从 `11` 条降到 `10` 条;
+ 行号 `680` 已从 `MA0051` 输出中消失,剩余热点继续集中在
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ - 已通过第四个有效 subagent 切片完成
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ `Generates_Precise_Service_Type_For_Hidden_Array_Type_Arguments()` 的 `MA0051` 收口:
+ 将内联 `source` 文本提取为类级常量,保持既有 expected 常量和断言语义不变
+ - 当前 `GFramework.SourceGenerators.Tests` Release warnings-only 基线已从 `12` 条降到 `11` 条;
+ 行号 `607` 已从 `MA0051` 输出中消失,剩余热点继续集中在
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ - 已通过第三个有效 subagent 切片完成
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ `Generates_Direct_Interface_Registrations_For_Hidden_Implementation_When_Handler_Interface_Is_Public()`
+ 的 `MA0051` 收口:将内联 `source` 文本提取为类级常量,保持既有 expected 常量和断言语义不变
+ - 当前 `GFramework.SourceGenerators.Tests` Release warnings-only 基线已从 `13` 条降到 `12` 条;
+ 行号 `536` 已从 `MA0051` 输出中消失,剩余热点继续集中在
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ - 已通过第二个有效 subagent 切片完成
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ `Generates_Visible_Handlers_And_Self_Registers_Private_Nested_Handler_When_Assembly_Contains_Hidden_Handler()`
+ 的 `MA0051` 收口:将内联 `source` 文本提取为类级常量,保持既有 expected 常量和断言语义不变
+ - 当前 `GFramework.SourceGenerators.Tests` Release warnings-only 基线已从 `14` 条降到 `13` 条;
+ 行号 `454` 已从 `MA0051` 输出中消失,剩余热点继续集中在
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ - 已通过 subagent 循环的首个可交付切片完成
+ `GFramework.SourceGenerators.Tests/Cqrs/CqrsHandlerRegistryGeneratorTests.cs`
+ `Generates_Assembly_Level_Cqrs_Handler_Registry()` 的 `MA0051` 收口:
+ 将内联 `source` / `expected` 文本提取为类级常量,保持生成文本、断言语义和文件名不变
+ - 当前 `GFramework.SourceGenerators.Tests` Release warnings-only 基线已从 `15` 条降到 `14` 条;
+ 行号 `337` 已从 `MA0051` 输出中消失,剩余热点仍全部集中在
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ - 已确认当前分支相对 `origin/main` 的唯一变更文件数仍只有 `3`;按该统计口径距离用户要求的
+ “接近 `75` 个文件变更”仍很远,需要继续多轮切片
+ - 已完成 `GFramework.SourceGenerators.Tests/Config/SchemaConfigGeneratorTests.cs` 的 `MA0051` 收口:
+ 将共享 consumer runtime fixture 提取到类级常量,并把生成结果收集与 catalog 契约断言拆成小 helper,
+ 保持 schema 文本、断言语义与生成输出契约不变
+ - 当前 `GFramework.SourceGenerators.Tests` Release warnings-only 基线已从 `22` 条降到 `15` 条;
+ `SchemaConfigGeneratorTests.cs` 已不再出现在 `MA0051` 列表中,剩余热点全部集中在
+ `CqrsHandlerRegistryGeneratorTests.cs`
+ - 已完成 `SchemaConfigGeneratorTests` 定向验证:串行重跑 `50` 个用例全部通过;并确认先前并行 build/test
+ 触发的 `MSB3030` / `CS0006` 属于共享输出竞争噪音,不是代码回归
+ - 已按 `gframework-boot` 重新恢复当前 worktree:确认分支 `fix/analyzer-warning-reduction-batch` 仍映射到
+ `analyzer-warning-reduction`,且当前不存在 `ai-plan/private/` 私有恢复上下文
+ - 已重新抓取当前分支关联的 PR #273 review 状态:PR 已处于 `CLOSED`,latest-head review 仍显示 `2` 条
+ CodeRabbit open thread,但本地复核后 `GeneratorSnapshotTest` 的 snapshot 路径空值防御已显式改为
+ `InvalidOperationException` 防御,`SchemaConfigGenerator` 的 `dependentSchemas` / `allOf` / conditional helper
+ 也已补齐 XML 文档,当前更像历史线程未随已关闭 PR 一起收敛
+ - 已重新以 `GFramework.SourceGenerators.Tests` Release warnings-only build 复核当前 `MA0051` 热点:
+ 基线现为 `22` 条,且已不再落在 `GeneratorSnapshotTest`、`ContextRegistrationAnalyzerTests` 或
+ `ContextGetGeneratorTests`,而是集中在 `CqrsHandlerRegistryGeneratorTests.cs`(`15` 条)与
+ `SchemaConfigGeneratorTests.cs`(`7` 条)
+ - 已完成 `GFramework.Core` 当前 `MA0016` / `MA0002` / `MA0015` / `MA0077` 低风险收口批次
+ - 已复核 `net10.0` 下的 `MA0158` 基线:`GFramework.Core` / `GFramework.Cqrs` 当前共有 `16` 个 object lock
+ 建议点,属于跨 target 兼容性风险,不在本轮直接批量替换
+ - 已完成 `GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.cs` 的剩余 `MA0051` 结构拆分,生成输出保持不变
+ - 已完成 `GFramework.Cqrs.SourceGenerators/Cqrs/CqrsHandlerRegistryGenerator.cs` 的 `MA0051` 结构拆分,生成输出保持不变
+ - 已完成 `GFramework.Game.SourceGenerators/Config/SchemaConfigGenerator.cs` 的 `MA0006` 低风险收口,schema 关键字比较显式使用
+ `StringComparison.Ordinal`
+ - 已完成 `SchemaConfigGenerator.cs` 的第一批 `MA0051` 结构拆分:schema 入口解析、属性解析、schema 遍历、数组属性解析、
+ 约束文档生成与若干生成代码发射 helper 已拆出语义阶段
+ - 已完成当前 PR #269 review follow-up:`CqrsHandlerRegistryGenerator` 按职责拆分为 partial 生成器文件,
+ `ContextAwareGenerator` 已补上字段名去冲突与锁内读取修正,`Option` 补齐 `` 契约说明
+ - 已完成当前 PR #269 第二轮 follow-up:恢复 `EasyEvents`、`CollectionExtensions`、`LoggingConfiguration` 与
+ `FilterConfiguration` 的公共 API 兼容形状,并将 analyzer 兼容性处理收敛到局部 pragma
+ - 已完成当前 PR #269 第三轮 follow-up:继续收口 `SchemaConfigGenerator` 的根类型标识符校验与 XML 文档转义,
+ 并补齐 `LoggingConfigurationTests`、`CollectionExtensionsTests`、`Cqrs` helper 抽取与 `ai-plan` 命令文本修正
+ - 已完成当前 PR #269 第四轮 follow-up:将 `CqrsHandlerRegistryGenerator` 的 Roslyn error type 直接引用改为
+ 运行时精确查找路径,并为 `SchemaConfigGenerator` 补上根 `type` 非字符串时的防御与回归测试
+ - 已完成当前 PR #269 第五轮 follow-up:`SchemaConfigGenerator` 补上归一化后属性名冲突诊断并新增
+ `GF_ConfigSchema_014`,`CqrsHandlerRegistryGenerator` 将 `dynamic` 归一化为 `global::System.Object`,
+ 同时收紧相关 generator regression tests
+ - 已完成当前 PR #269 failed-test follow-up:修正 `SchemaConfigGeneratorTests`
+ `Run_Should_Assign_Globally_Unique_Reference_Metadata_Member_Names` 的测试输入,使其继续覆盖
+ reference metadata 成员名全局去冲突,但不再依赖现已被 `GF_ConfigSchema_014` 拦截的非法同层 schema key 冲突
+ - 已完成当前 PR #269 Greptile follow-up:`ContextAwareGenerator` 现在会把基类链显式成员名也纳入
+ `_gFrameworkContextAware*` 字段分配冲突检测,并新增 inherited-field collision 快照回归测试
+ - 已完成当前分支与 `main` 的 `CqrsHandlerRegistryGenerator.cs` 文件级冲突收口:确认 `main` 侧新增的是
+ `OrderedRegistrationKind` / `RuntimeTypeReferenceSpec` 的 XML 文档,现已按当前 partial 拆分结构迁移到
+ `CqrsHandlerRegistryGenerator.Models.cs`,不回退已完成的生成器拆分
+ - 已完成 `SchemaConfigGenerator.cs` 剩余 `MA0051` 收口:将 `dependentRequired` / `allOf` / conditional schema 校验
+ 拆成更小的验证阶段,并将 `GenerateTableClass`、`GenerateBindingsClass`、`AppendGeneratedConfigCatalogType`
+ 拆成稳定的代码发射 helper,保持生成输出与快照一致
+ - 已更新 `AGENTS.md`:变更模块必须运行对应 `dotnet build -c Release`,并处理或显式报告模块构建 warning,
+ 不再默认留给长期 warning 清理分支
+ - `CoroutineScheduler` 的 tag/group 字典已显式使用 `StringComparer.Ordinal`,保持既有区分大小写语义
+ - `EasyEvents.AddEvent()` 的重复注册路径已恢复为 `ArgumentException`,以保持既有异常契约
+ - `Option` 已声明 `IEquatable