GFramework/ai-plan/public/ai-first-config-system/traces/ai-first-config-system-trace.md
gewuyou d6a154726c fix(game-config): 显式拒绝 oneOf 与 anyOf 组合关键字
- 修复 Runtime、Source Generator 与 Tooling 对 oneOf/anyOf 的静默接受,统一改为显式报错

- 补充 JS 与 Release 测试回归,覆盖生成器诊断和运行时拒绝路径

- 更新 ai-plan 跟踪与中文文档,明确后续默认跳过会改变生成类型形状的组合关键字
2026-04-30 13:23:19 +08:00

138 lines
8.4 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# AI-First Config System 执行 Trace
## 2026-04-19
### 阶段active 入口归档收口AI-FIRST-CONFIG-RP-002
- 已将截至 `2026-04-17` 的详细实现历史从默认 trace 入口移到主题内归档
- active trace 现在只保留当前恢复点和下一步,避免 `boot` 每次恢复都重新读取已完成的长历史
- 当前功能主线不变,仍是:
- `C# Runtime + Source Generator + Consumer DX`
- 下一批共享 JSON Schema 关键字评估
- 优先看 `if` / `then` / `else`
### Archive Context
- 历史跟踪归档:
- `ai-plan/public/ai-first-config-system/archive/todos/ai-first-config-system-history-through-2026-04-17.md`
- 历史 trace 归档:
- `ai-plan/public/ai-first-config-system/archive/traces/ai-first-config-system-history-through-2026-04-17.md`
### 验证
- 2026-04-19入口归档收口验证
- 执行命令:`wc -l ai-plan/public/ai-first-config-system/todos/ai-first-config-system-tracking.md ai-plan/public/ai-first-config-system/traces/ai-first-config-system-trace.md`
- 结果:通过
- 备注active 入口文件行数显著减少,已完成阶段详细历史已移至归档
- 2026-04-17 之前:详细实现与定向验证命令
- 参考:`ai-plan/public/ai-first-config-system/archive/todos/ai-first-config-system-history-through-2026-04-17.md`
- 备注:包含 Runtime / Generator / Tooling 三端同步落地的每日验证记录与具体测试命令
### 下一步
1.`ai-first-config-system-csharp-experience-next.md` 读取当前 backlog而不是继续翻已完成历史
2. 先判断 `if` / `then` / `else` 是否满足“三端一致且不改变生成形状”的前提
3. 若不满足,直接回退到下一批收益更明确的共享关键字评估
## 2026-04-20
### 阶段object-focused `if` / `then` / `else` 收口AI-FIRST-CONFIG-RP-003
- 已在 Runtime、Source Generator 与 VS Code Tooling 三端落地 object-focused `if` / `then` / `else`
- 本轮采用的约束边界:
- 仅允许 object 节点上的 object-typed inline schema
- `if` 必填,且必须至少存在 `then``else` 之一
- `then` / `else` 只能约束父对象已声明字段,不做属性合并
- 条件匹配沿用 `dependentSchemas` / `allOf` 的 focused matcher 语义,允许未在条件块中声明的额外同级字段继续存在
- 生成器新增 `GF_ConfigSchema_013`,在生成阶段提前拒绝坏形状的条件元数据,并把条件摘要写入 XML 文档
- VS Code 工具同步补齐 schema 解析、校验消息、本地化文本与表单 hint 元数据显示
### 验证
- 2026-04-20`bun run test``tools/gframework-config-tool`
- 结果:通过
- 2026-04-20`dotnet test GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj -c Release --filter "FullyQualifiedName~SchemaConfigGeneratorTests"`
- 结果:通过
- 2026-04-20`dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~YamlConfigLoaderIfThenElseTests"`
- 结果:通过
- 备注:修正断言路径后,运行时诊断显示路径与 `reward[if]` / `reward[then]` 的约定保持一致
- 2026-04-20`dotnet build GFramework.sln -c Release`
- 结果:通过
- 备注:解决方案构建成功;输出包含仓库既有 analyzer warning但无新增错误
### 阶段PR #262 review follow-up 与分支同步
- 已使用 `gframework-pr-review` 复核 PR #262,并确认 latest CodeRabbit review body 的第一行下方存在 folded `🧹 Nitpick comments (5)`
- 已修复 `fetch_current_pr_review.py` 的 follow-up 盲区:
- 不再只依赖 issue comments而会解析 latest review body 中的 folded nitpick cards
- `parse_comment_cards` 现已覆盖 `.js/.ts` 等工具文件路径
- text 输出会同时显示 declared / parsed 数量,避免 future drift 时静默少报
- 已按 5 条 nitpick 收口代码:
- VS Code tooling 的 `ifElse` hint 现会显示 `condition`
- `extension.js` 已抽出可复用的 `InlineObjectSchemaHint` typedef
- `configValidation.js` 已抽取共享 target reference 校验 helper
- Source Generator tests 已补齐对称分支覆盖
- Runtime test cleanup 已从 `catch (Exception)` 收窄到 IO / 权限异常
- 已处理本地分支与远端分支差异:
- 本地 `feat/ai-first-config` 已 rebase 到 `origin/feat/ai-first-config`
- rebase 过程中 Git 跳过了远端已具备的 commit `76488dc`
- 当前分支已不再 behind 远端,仅保留本地领先提交
### PR `#262` review follow-up 验证
- 2026-04-20`python3 .codex/skills/gframework-pr-review/scripts/fetch_current_pr_review.py`
- 结果:通过
- 备注:输出 `CodeRabbit actionable comments: 2``CodeRabbit nitpick comments: 2 declared, 1 parsed`,并暴露剩余 review follow-up
- 2026-04-20skill parser follow-up
- 结果:已补齐
- 备注:`gframework-pr-review` 现可解析 latest review body 中的 `Outside diff range comments`,并且不再遗漏 `.codex/.../*.py` nitpick cards
- 2026-04-20`python3 .codex/skills/gframework-pr-review/scripts/fetch_current_pr_review.py --pr 262 --format json`
- 结果:通过
- 备注:输出 `CodeRabbit outside-diff comments: 1 declared, 1 parsed``CodeRabbit nitpick comments: 2 declared, 2 parsed`parser warning 清零
- 2026-04-20运行时条件分支 follow-up
- 结果:已补齐
- 备注:`YamlConfigSchemaValidator` 现对非 object 的 `if` / `then` / `else` 使用分支级诊断路径;运行时测试新增 `else` 缺失 `if` 回归
- 2026-04-20`bun run test``tools/gframework-config-tool`
- 结果通过122 tests
- 备注新增条件分支坏形状回归后tooling 现在会拒绝缺失 `type: "object"`、坏形状 `properties`、坏形状 `required` 与空白 required 成员
- 2026-04-20`dotnet test GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj -c Release --filter "FullyQualifiedName~SchemaConfigGeneratorTests"`
- 结果通过46 tests
- 2026-04-20`dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~YamlConfigLoaderIfThenElseTests"`
- 结果通过8 tests
- 备注:新增 `LoadAsync_Should_Throw_When_Else_Is_Declared_Without_If` 后,运行时回归覆盖保持对称
- 2026-04-20`dotnet build GFramework.sln -c Release`
- 结果:通过(历史记录)
- 备注:存在仓库既有 analyzer warning但无新增错误本轮只需重新验证受影响测试切片
### 下一步
1. 跳过 `oneOf` / `anyOf`,优先筛选下一个仍不改变生成类型形状、且不需要属性合并或联合分支生成的共享关键字
2. 若继续扩共享关键字,先在 Runtime / Generator / Tooling 三端同时定义一致边界,再进入实现
3. 继续把 active 入口保持精简,只记录当前恢复点、验证与下一步
## 2026-04-30
### 阶段组合关键字边界收口AI-FIRST-CONFIG-RP-003
- 已在 Runtime、Source Generator 与 VS Code Tooling 三端显式拒绝 `oneOf` / `anyOf`
- 本轮结论不是继续做 object-focused 子集,而是先收紧共享边界:
- `oneOf` / `anyOf` 更容易引入联合分支、属性合并或生成类型形状漂移
- 当前配置系统主线仍优先保证 `C# Runtime + Source Generator + Consumer DX` 的稳定契约
- 因此三端统一改为在 schema 解析 / 生成阶段直接失败,避免静默忽略同一份 schema
- active tracking 也已同步更新,不再把 `oneOf` / `anyOf` 作为下一批默认候选
### 验证
- 2026-04-30`bun run test``tools/gframework-config-tool`
- 目标:验证工具端会拒绝 `oneOf`
- 2026-04-30`dotnet test GFramework.SourceGenerators.Tests/GFramework.SourceGenerators.Tests.csproj -c Release --filter "FullyQualifiedName~SchemaConfigGeneratorTests"`
- 目标:验证生成器新增 `GF_ConfigSchema_015`
- 2026-04-30`dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~YamlConfigLoaderAllOfTests"`
- 目标:验证运行时会拒绝对象节点上的 `oneOf`
### 下一步
1. 若本轮定向验证通过,继续盘点下一批真正低风险、且不改变生成类型形状的共享关键字
2. 不再重复评估 `oneOf` / `anyOf` 的 object-focused 子集,除非未来主线明确接受联合形状生成
3. 若后续关键字需要新诊断编号或文档边界说明,继续保持 Runtime / Generator / Tooling 同步收口