From 975f556ab03daf25ab8dd26f427b115e3f449182 Mon Sep 17 00:00:00 2001 From: GeWuYou <95328647+GeWuYou@users.noreply.github.com> Date: Mon, 6 Apr 2026 17:24:04 +0800 Subject: [PATCH] =?UTF-8?q?docs(config):=20=E6=B7=BB=E5=8A=A0AI=E4=BB=A3?= =?UTF-8?q?=E7=90=86=E7=BC=96=E7=A0=81=E8=A7=84=E8=8C=83=E5=92=8C=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E7=B3=BB=E7=BB=9F=E9=9B=86=E6=88=90=E6=B5=8B=E8=AF=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 创建AGENTS.md文档定义AI代理编码行为规则 - 包含环境能力清单、注释规则、代码风格要求 - 定义测试要求、安全规则和文档规范 - 添加端到端集成测试验证生成配置消费者功能 - 实现跨域配置表加载和强类型访问验证 - 添加按域、表名和自定义谓词过滤注册支持 - 提供完整的测试验证命令和执行期望说明 --- AGENTS.md | 2 ++ .../GeneratedConfigConsumerIntegrationTests.cs | 15 +++++++++++++++ 2 files changed, 17 insertions(+) diff --git a/AGENTS.md b/AGENTS.md index 7f9fb3c1..4e39ad22 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -123,6 +123,8 @@ All generated or modified code MUST include clear and meaningful comments where - Every non-trivial feature, bug fix, or behavior change MUST include tests or an explicit justification for why a test is not practical. - Public API changes must be covered by unit or integration tests. +- When a public API defines multiple contract branches, tests MUST cover the meaningful variants, including null, + empty, default, and filtered inputs when those branches change behavior. - Regression fixes should include a test that fails before the fix and passes after it. ### Test Organization diff --git a/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs b/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs index 48c1a763..a80a1990 100644 --- a/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs +++ b/GFramework.Game.Tests/Config/GeneratedConfigConsumerIntegrationTests.cs @@ -138,6 +138,16 @@ public class GeneratedConfigConsumerIntegrationTests }); await tableNameLoader.LoadAsync(tableNameRegistry); + var emptyAllowListRegistry = new ConfigRegistry(); + var emptyAllowListLoader = new YamlConfigLoader(_rootPath) + .RegisterAllGeneratedConfigTables( + new GeneratedConfigRegistrationOptions + { + IncludedConfigDomains = Array.Empty(), + IncludedTableNames = Array.Empty() + }); + await emptyAllowListLoader.LoadAsync(emptyAllowListRegistry); + var monsterDomain = MonsterConfigBindings.ConfigDomain; var predicateRegistry = new ConfigRegistry(); var predicateLoader = new YamlConfigLoader(_rootPath) @@ -151,6 +161,11 @@ public class GeneratedConfigConsumerIntegrationTests Assert.Multiple(() => { + Assert.That(emptyAllowListRegistry.TryGetMonsterTable(out var emptyAllowListMonsterTable), Is.True); + Assert.That(emptyAllowListMonsterTable, Is.Not.Null); + Assert.That(emptyAllowListRegistry.TryGetItemTable(out var emptyAllowListItemTable), Is.True); + Assert.That(emptyAllowListItemTable, Is.Not.Null); + Assert.That(domainRegistry.TryGetMonsterTable(out var domainMonsterTable), Is.True); Assert.That(domainMonsterTable, Is.Not.Null); Assert.That(domainRegistry.TryGetItemTable(out _), Is.False);