Fix/analyzer warning reduction batch#301
Conversation
- 优化 Mediator 架构集成测试的 helper 类型作用域,消除文件名与类型名警告 - 补充异步测试路径的 ConfigureAwait(false),满足 analyzer 要求 - 更新测试集合暴露类型为只读或抽象集合,保留行为不变
- 修复 Mediator 高级测试中的异步等待告警 - 修复 验证请求异常参数名告警 - 优化 测试辅助类型区域的文件名告警处理
- 优化测试 helper 类型作用域以消除文件名匹配告警 - 补充异步等待 ConfigureAwait(false) 以满足 analyzer 约束 - 调整集合抽象、字符串比较器和异常参数名用法
- 修复 schema 正则校验缺少超时边界导致的 analyzer 风险 - 更新字符串等值比较为 ordinal 语义 - 补充 warning reduction 批处理恢复状态与验证结果
- 重构 dependentRequired 与 dependentSchemas 的单项解析流程 - 重构 allOf 与条件 schema 的分支解析流程 - 优化 object-focused 内联 schema 的 properties 与 required 校验拆分
- 拆分 schema model 类型到独立同名文件 - 清理 schema 校验模型的文件命名 analyzer 告警 - 更新 warning reduction 批处理收口状态
- 重构 YamlConfigSchemaValidator 的长方法为语义化 helper,清理剩余 MA0051 warning - 修复 条件分支 helper 的字符串比较方式,避免新增 MA0006 warning - 更新 analyzer warning reduction 跟踪与 trace,记录仓库根 clean build 已归零
|
Warning Rate limit exceeded
To keep reviews running without waiting, you can enable usage-based add-on for your organization. This allows additional reviews beyond the hourly cap. Account admins can enable it under billing. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (19)
📝 WalkthroughWalkthrough本次变更为 CQRS 测试统一添加 Changes
Estimated code review effort🎯 4 (复杂) | ⏱️ ~60 分钟 Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Review rate limit: 0/1 reviews remaining, refill in 36 minutes and 18 seconds.Comment |
Summary
Test ResultsDetails
Insights
Fail Rate
build-and-test: Run #1006
🎉 All tests passed!Slowest Tests
± Comparison with run #1005 at 1c48866 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 54 runs. Github Test Reporter by CTRF 💚 |
✅
|
| Descriptor | Linter | Files | Fixed | Errors | Warnings | Elapsed time |
|---|---|---|---|---|---|---|
| dotnet-format | yes | 1 | no | 5.71s | ||
| ✅ REPOSITORY | gitleaks | yes | no | no | 7.69s | |
| ✅ REPOSITORY | trufflehog | yes | no | no | 6.67s |
Detailed Issues
⚠️ CSHARP / dotnet-format - 1 error
Welcome to .NET 9.0!
---------------------
SDK Version: 9.0.114
----------------
Installed an ASP.NET Core HTTPS development certificate.
To trust the certificate, run 'dotnet dev-certs https --trust'
Learn about HTTPS: https://aka.ms/dotnet-https
----------------
Write your first app: https://aka.ms/dotnet-hello-world
Find out what's new: https://aka.ms/dotnet-whats-new
Explore documentation: https://aka.ms/dotnet-docs
Report issues and find source on GitHub: https://github.com/dotnet/core
Use 'dotnet --help' to see available commands or visit: https://aka.ms/dotnet-cli
--------------------------------------------------------------------------------------
Unhandled exception: System.Exception: Restore operation failed.
at Microsoft.CodeAnalysis.Tools.CodeFormatter.OpenMSBuildWorkspaceAsync(String solutionOrProjectPath, WorkspaceType workspaceType, Boolean noRestore, Boolean requiresSemantics, String binaryLogPath, Boolean logWorkspaceWarnings, ILogger logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.CodeFormatter.FormatWorkspaceAsync(FormatOptions formatOptions, ILogger logger, CancellationToken cancellationToken, String binaryLogPath)
at Microsoft.CodeAnalysis.Tools.FormatCommandCommon.FormatAsync(FormatOptions formatOptions, ILogger`1 logger, CancellationToken cancellationToken)
at Microsoft.CodeAnalysis.Tools.Commands.RootFormatCommand.FormatCommandDefaultHandler.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
at System.CommandLine.Invocation.InvocationPipeline.InvokeAsync(ParseResult parseResult, CancellationToken cancellationToken)
See detailed reports in MegaLinter artifacts
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

Show us your support by starring ⭐ the repository
|
| Filename | Overview |
|---|---|
| GFramework.Game/Config/YamlConfigSchemaValidator.cs | Major refactor adding regex timeouts, pattern constraints, format validation, and complex schema keywords (allOf, dependentSchemas, if/then/else). RegexMatchTimeoutException is not caught when pattern matching times out on YAML values. |
| GFramework.Game/Config/YamlConfigSchemaNode.cs | New internal node model cleanly separating NodeChildren and NodeValidation sub-records; immutable wither methods are well-structured. |
| GFramework.Game/Config/YamlConfigSchemaValidator.ObjectKeywords.cs | Partial class adding object-keyword parsing (dependentRequired, dependentSchemas, allOf, if/then/else). Logic is consistent and well-guarded. |
| GFramework.Game/Config/YamlConfigStringConstraints.cs | New immutable record for string constraints; correct paired-null guard for pattern/patternRegex. |
| GFramework.Game.Tests/Config/YamlConfigModelContractTests.cs | New test file covering contract behavior of new YAML config model classes; good regression coverage. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[LoadAsync / Load] --> B[ParseLoadedSchema]
B --> C[ParseNode]
C --> D{type?}
D -->|object| E[ParseObjectNode\nParseObjectConstraints]
D -->|array| F[ParseArrayNode\nParseArrayConstraints]
D -->|scalar| G[CreateScalarNode\nParseScalarConstraints]
E --> H[dependentRequired\ndependentSchemas\nallOf\nif/then/else]
F --> I[minItems/maxItems\nuniqueItems\ncontains]
G --> J[min/maxLength\npattern\u2190compiled Regex\nformat\nnumeric bounds]
K[Validate / ValidateAndCollectReferences] --> L[ValidateNode]
L --> M{NodeType}
M -->|Object| N[ValidateObjectNode\nValidateObjectConstraints]
M -->|Array| O[ValidateArrayNode\nValidateArrayConstraints]
M -->|Scalar| P[ValidateScalarNode\nValidateStringScalarConstraints]
N --> Q[TryMatchSchemaNode\nfor dependentSchemas/allOf/if-then-else]
O --> Q
P --> R[PatternRegex.IsMatch\nRegexMatchTimeoutException not caught]
Q -->|catches ConfigLoadException only| S[return false]
R -->|timeout fires| T[Unhandled exception]
Comments Outside Diff (1)
-
GFramework.Game/Config/YamlConfigSchemaValidator.cs, line 2922-2934 (link)RegexMatchTimeoutExceptionnot caught in pattern validation pathPatternRegex.IsMatch(rawValue)at line 2922 can throwRegexMatchTimeoutExceptionwhen the 1-second timeout fires on adversarial input.TryMatchSchemaNode's catch block only filtersConfigLoadException, so the timeout propagates as an unhandled exception instead of being translated into a diagnosticConfigLoadException. The PR explicitly adds regex timeouts to prevent runaway matching, but the timeout exception itself escapes both the trial-match path and the direct validation path.if (constraints.PatternRegex is not null) { bool isMatch; try { isMatch = constraints.PatternRegex.IsMatch(rawValue); } catch (RegexMatchTimeoutException) { throw ConfigLoadExceptionFactory.Create( ConfigLoadFailureKind.ConstraintViolation, tableName, $"Property '{displayPath}' in config file '{yamlPath}' pattern '{constraints.Pattern}' timed out while matching value '{rawValue}'.", yamlPath: yamlPath, schemaPath: schemaNode.SchemaPathHint, displayPath: GetDiagnosticPath(displayPath), rawValue: rawValue); } if (!isMatch) { throw ConfigLoadExceptionFactory.Create(...); } }
Prompt To Fix With AI
This is a comment left during a code review. Path: GFramework.Game/Config/YamlConfigSchemaValidator.cs Line: 2922-2934 Comment: **`RegexMatchTimeoutException` not caught in pattern validation path** `PatternRegex.IsMatch(rawValue)` at line 2922 can throw `RegexMatchTimeoutException` when the 1-second timeout fires on adversarial input. `TryMatchSchemaNode`'s catch block only filters `ConfigLoadException`, so the timeout propagates as an unhandled exception instead of being translated into a diagnostic `ConfigLoadException`. The PR explicitly adds regex timeouts to prevent runaway matching, but the timeout exception itself escapes both the trial-match path and the direct validation path. ```csharp if (constraints.PatternRegex is not null) { bool isMatch; try { isMatch = constraints.PatternRegex.IsMatch(rawValue); } catch (RegexMatchTimeoutException) { throw ConfigLoadExceptionFactory.Create( ConfigLoadFailureKind.ConstraintViolation, tableName, $"Property '{displayPath}' in config file '{yamlPath}' pattern '{constraints.Pattern}' timed out while matching value '{rawValue}'.", yamlPath: yamlPath, schemaPath: schemaNode.SchemaPathHint, displayPath: GetDiagnosticPath(displayPath), rawValue: rawValue); } if (!isMatch) { throw ConfigLoadExceptionFactory.Create(...); } } ``` How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
This is a comment left during a code review.
Path: GFramework.Game/Config/YamlConfigSchemaValidator.cs
Line: 2922-2934
Comment:
**`RegexMatchTimeoutException` not caught in pattern validation path**
`PatternRegex.IsMatch(rawValue)` at line 2922 can throw `RegexMatchTimeoutException` when the 1-second timeout fires on adversarial input. `TryMatchSchemaNode`'s catch block only filters `ConfigLoadException`, so the timeout propagates as an unhandled exception instead of being translated into a diagnostic `ConfigLoadException`. The PR explicitly adds regex timeouts to prevent runaway matching, but the timeout exception itself escapes both the trial-match path and the direct validation path.
```csharp
if (constraints.PatternRegex is not null)
{
bool isMatch;
try
{
isMatch = constraints.PatternRegex.IsMatch(rawValue);
}
catch (RegexMatchTimeoutException)
{
throw ConfigLoadExceptionFactory.Create(
ConfigLoadFailureKind.ConstraintViolation,
tableName,
$"Property '{displayPath}' in config file '{yamlPath}' pattern '{constraints.Pattern}' timed out while matching value '{rawValue}'.",
yamlPath: yamlPath,
schemaPath: schemaNode.SchemaPathHint,
displayPath: GetDiagnosticPath(displayPath),
rawValue: rawValue);
}
if (!isMatch)
{
throw ConfigLoadExceptionFactory.Create(...);
}
}
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: GFramework.Game/Config/YamlConfigSchemaValidator.cs
Line: 2186-2203
Comment:
**Regex compiled twice per `pattern` field**
`TryParsePatternConstraint` (around line 2189) constructs a temporary `Regex` only to validate the pattern syntax, then discards it. A second `Regex` is compiled and stored in `CreateStringScalarConstraints` (around line 2659). For schemas with many `pattern` constraints, this doubles compilation cost at load time. The simplest fix is to return the compiled regex directly from `TryParsePatternConstraint` instead of the raw string, letting `CreateStringScalarConstraints` consume it directly.
How can I resolve this? If you propose a fix, please make it concise.Reviews (4): Last reviewed commit: "fix(game): 修复空对象配置比较键并归档 warning reducti..." | Re-trigger Greptile
There was a problem hiding this comment.
Actionable comments posted: 6
🧹 Nitpick comments (11)
GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs (3)
402-419: 静态缓存字典缺少线程安全保护
_cache是一个静态字典,在并发访问时可能会出现问题。虽然当前测试是顺序执行的,但如果测试并行运行或重用此处理器,可能会导致意外行为。此外,这里也使用了
Task.Delay().Wait()阻塞调用,建议与上一个处理器一样改为async方法。💡 建议的改进
public sealed class TestCachedRequestHandler : IRequestHandler<TestCachedRequest, int> { - private static readonly Dictionary<int, int> _cache = new(); + private static readonly ConcurrentDictionary<int, int> _cache = new(); - public ValueTask<int> Handle(TestCachedRequest request, CancellationToken cancellationToken) + public async ValueTask<int> Handle(TestCachedRequest request, CancellationToken cancellationToken) { if (_cache.TryGetValue(request.Id, out var cachedValue)) { - return new ValueTask<int>(cachedValue); + return cachedValue; } // 模拟处理时间 - Task.Delay(10, cancellationToken).Wait(cancellationToken); - var newValue = request.Id; - _cache[request.Id] = newValue; - return new ValueTask<int>(newValue); + await Task.Delay(10, cancellationToken).ConfigureAwait(false); + _cache[request.Id] = request.Id; + return request.Id; } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs` around lines 402 - 419, Replace the non-thread-safe static Dictionary and blocking Wait in TestCachedRequestHandler: change the static field _cache to a thread-safe collection (e.g., ConcurrentDictionary<int,int>) and make the Handle method async so you can await Task.Delay instead of calling Task.Delay(...).Wait(...); update references inside Handle to use the concurrent dictionary's TryGetValue or GetOrAdd patterns to safely read/update cache.
392-400:Task.Delay().Wait()是阻塞调用使用
Task.Delay(5, cancellationToken).Wait(cancellationToken)会阻塞当前线程。虽然在测试代码中模拟延迟是可接受的,但更好的做法是将方法改为async并使用await。💡 建议的改进
public sealed class TestUncachedRequestHandler : IRequestHandler<TestUncachedRequest, int> { - public ValueTask<int> Handle(TestUncachedRequest request, CancellationToken cancellationToken) + public async ValueTask<int> Handle(TestUncachedRequest request, CancellationToken cancellationToken) { // 模拟一些处理时间 - Task.Delay(5, cancellationToken).Wait(cancellationToken); - return new ValueTask<int>(request.Id); + await Task.Delay(5, cancellationToken).ConfigureAwait(false); + return request.Id; } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs` around lines 392 - 400, The Handle implementation in TestUncachedRequestHandler blocks the thread by calling Task.Delay(...).Wait(...); change the method to be async and await the delay instead: make Handle an async ValueTask<int> (or Task<int> if preferred), replace Task.Delay(5, cancellationToken).Wait(cancellationToken) with await Task.Delay(5, cancellationToken), and return request.Id directly; this preserves cancellation support and avoids blocking in TestUncachedRequestHandler.Handle.
329-343:TestNestedRequestHandler中存在冗余的条件逻辑当前实现中,无论
request.Depth >= 1条件是否成立,都返回相同的结果字符串。这使得if块变得冗余。💡 建议简化代码
public sealed class TestNestedRequestHandler : IRequestHandler<TestNestedRequest, string> { public ValueTask<string> Handle(TestNestedRequest request, CancellationToken cancellationToken) { TestNestedRequestHandler2.ExecutionCount++; - - if (request.Depth >= 1) // 简化条件 - { - // 模拟嵌套调用 - return new ValueTask<string>($"Nested execution completed at depth {request.Depth}"); - } - + // 模拟嵌套调用 return new ValueTask<string>($"Nested execution completed at depth {request.Depth}"); } }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs` around lines 329 - 343, The Handle method in TestNestedRequestHandler contains a redundant if that returns the same string regardless of request.Depth; remove the conditional and simply increment TestNestedRequestHandler2.ExecutionCount then return the result once (keep the ValueTask<string> return and use request.Depth in the interpolated message) so the behavior is unchanged but the unnecessary branching is eliminated.GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs (1)
239-240: 建议为 MA0048 抑制添加注释说明根据编码规范,当添加分析器抑制时,如果原因不明显,应在代码注释中说明理由。建议添加简短注释解释为什么需要抑制此规则。
💡 建议的改进
-#pragma warning disable MA0048 +#pragma warning disable MA0048 // File name must match type name - test helper classes are intentionally co-located `#region` Advanced Test ClassesAs per coding guidelines: "When adding C# analyzers or suppressions, keep them minimal and justify them in code comments if the reason is not obvious"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs` around lines 239 - 240, Add a short explanatory comment immediately above the pragma disabling MA0048 (the line with "#pragma warning disable MA0048" in MediatorAdvancedFeaturesTests.cs / the "Advanced Test Classes" region) that states why the analyzer is suppressed for these test classes (e.g., tests require internal access or naming prevents refactor), so the suppression is justified and discoverable; keep the comment concise and specific to MA0048 and the Advanced Test Classes region.GFramework.Game/Config/YamlConfigConstantValue.cs (1)
14-20: 建议同时拒绝空白comparableValue,避免产生“空比较键”
displayValue已做空白校验,但comparableValue目前允许空白字符串,后续匹配语义可能变得不明确。可选修改
public YamlConfigConstantValue(string comparableValue, string displayValue) { - ArgumentNullException.ThrowIfNull(comparableValue); + ArgumentException.ThrowIfNullOrWhiteSpace(comparableValue); ArgumentException.ThrowIfNullOrWhiteSpace(displayValue); ComparableValue = comparableValue; DisplayValue = displayValue; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigConstantValue.cs` around lines 14 - 20, The constructor YamlConfigConstantValue currently only null-checks comparableValue but allows empty/whitespace, so change the validation to reject blank comparableValue as well (use ArgumentException.ThrowIfNullOrWhiteSpace or equivalent) to mirror the displayValue check and ensure ComparableValue is never an empty/whitespace string; keep setting ComparableValue and DisplayValue as before.GFramework.Game/Config/YamlConfigArrayContainsConstraints.cs (1)
15-25: 建议在构造时校验minContains/maxContains边界,防止无效约束进入模型当前允许负值和
minContains > maxContains,会把非法状态带到后续校验流程。可选修改
public YamlConfigArrayContainsConstraints( YamlConfigSchemaNode containsNode, int? minContains, int? maxContains) { ArgumentNullException.ThrowIfNull(containsNode); + if (minContains.HasValue && minContains.Value < 0) + { + throw new ArgumentOutOfRangeException(nameof(minContains)); + } + if (maxContains.HasValue && maxContains.Value < 0) + { + throw new ArgumentOutOfRangeException(nameof(maxContains)); + } + if (minContains.HasValue && maxContains.HasValue && minContains.Value > maxContains.Value) + { + throw new ArgumentException("minContains 不能大于 maxContains。"); + } ContainsNode = containsNode; MinContains = minContains; MaxContains = maxContains; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigArrayContainsConstraints.cs` around lines 15 - 25, The constructor of YamlConfigArrayContainsConstraints allows negative values and minContains > maxContains; add validation in the constructor (YamlConfigArrayContainsConstraints) to throw when MinContains or MaxContains are negative and to throw when both MinContains and MaxContains are non-null but MinContains > MaxContains; use ArgumentOutOfRangeException for negative values and ArgumentException for the min>max case, and keep assigning ContainsNode, MinContains and MaxContains only after validation.GFramework.Game/Config/YamlConfigArrayConstraints.cs (1)
16-26: 建议约束minItems/maxItems的取值范围与大小关系建议在构造函数内阻止负数和
minItems > maxItems,避免出现不可解释的数组约束状态。可选修改
public YamlConfigArrayConstraints( int? minItems, int? maxItems, bool uniqueItems, YamlConfigArrayContainsConstraints? containsConstraints) { + if (minItems.HasValue && minItems.Value < 0) + { + throw new ArgumentOutOfRangeException(nameof(minItems)); + } + if (maxItems.HasValue && maxItems.Value < 0) + { + throw new ArgumentOutOfRangeException(nameof(maxItems)); + } + if (minItems.HasValue && maxItems.HasValue && minItems.Value > maxItems.Value) + { + throw new ArgumentException("minItems 不能大于 maxItems。"); + } + MinItems = minItems; MaxItems = maxItems; UniqueItems = uniqueItems; ContainsConstraints = containsConstraints; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigArrayConstraints.cs` around lines 16 - 26, 在 YamlConfigArrayConstraints 构造函数中添加对 minItems 和 maxItems 的验证:如果 minItems 或 maxItems 为负值则抛出 ArgumentOutOfRangeException(或类似异常),并且当两者都不为 null 时确保 minItems <= maxItems,否则抛出 ArgumentException;更新构造函数(YamlConfigArrayConstraints(...))在赋值 MinItems/MaxItems 之前进行这些检查,以避免产生不可解释的数组约束状态(参照 MinItems、MaxItems、UniqueItems、ContainsConstraints 字段/属性来定位修改点)。GFramework.Game/Config/YamlConfigObjectConstraints.cs (1)
18-32: 建议补充minProperties/maxProperties的合法性校验建议在构造时拦截负数与
minProperties > maxProperties,避免对象约束进入无效状态。可选修改
public YamlConfigObjectConstraints( int? minProperties, int? maxProperties, IReadOnlyDictionary<string, IReadOnlyList<string>>? dependentRequired, IReadOnlyDictionary<string, YamlConfigSchemaNode>? dependentSchemas, IReadOnlyList<YamlConfigSchemaNode>? allOfSchemas, YamlConfigConditionalSchemas? conditionalSchemas) { + if (minProperties.HasValue && minProperties.Value < 0) + { + throw new ArgumentOutOfRangeException(nameof(minProperties)); + } + if (maxProperties.HasValue && maxProperties.Value < 0) + { + throw new ArgumentOutOfRangeException(nameof(maxProperties)); + } + if (minProperties.HasValue && maxProperties.HasValue && minProperties.Value > maxProperties.Value) + { + throw new ArgumentException("minProperties 不能大于 maxProperties。"); + } + MinProperties = minProperties; MaxProperties = maxProperties; DependentRequired = dependentRequired; DependentSchemas = dependentSchemas; AllOfSchemas = allOfSchemas; ConditionalSchemas = conditionalSchemas; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigObjectConstraints.cs` around lines 18 - 32, 在 YamlConfigObjectConstraints 的构造函数中添加对 MinProperties/MaxProperties 的合法性校验:确保传入的 minProperties 和 maxProperties 非负且当两者都不为 null 时满足 minProperties <= maxProperties,否则在构造时抛出合适的异常(如 ArgumentOutOfRangeException 或 ArgumentException);更新构造函数(YamlConfigObjectConstraints(...))以在赋值前执行这些检查并保留现有属性赋值逻辑(MinProperties、MaxProperties、DependentRequired、DependentSchemas、AllOfSchemas、ConditionalSchemas)。GFramework.Game/Config/YamlConfigStringConstraints.cs (1)
20-31: 建议在构造器中强制Pattern与PatternRegex成对一致这两个字段语义绑定很强,建议在模型层加约束,避免后续调用方传出不一致状态。
可选修改
public YamlConfigStringConstraints( int? minLength, int? maxLength, string? pattern, Regex? patternRegex, YamlConfigStringFormatConstraint? formatConstraint) { + if ((pattern is null) != (patternRegex is null)) + { + throw new ArgumentException("pattern 与 patternRegex 需要同时为空或同时非空。"); + } + MinLength = minLength; MaxLength = maxLength; Pattern = pattern; PatternRegex = patternRegex; FormatConstraint = formatConstraint; }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigStringConstraints.cs` around lines 20 - 31, The constructor for YamlConfigStringConstraints allows Pattern and PatternRegex to be set inconsistently; enforce they are paired by validating in the constructor (either both null or both non-null) or by deriving one from the other (e.g., if Pattern is provided and PatternRegex is null, compile Pattern into PatternRegex); if inconsistency is detected throw an ArgumentException with a clear message. Update the YamlConfigStringConstraints constructor to perform this validation/derivation referencing the constructor itself and the Pattern and PatternRegex properties so callers cannot create an inconsistent instance.GFramework.Game/Config/YamlConfigSchema.cs (1)
15-27: 建议对referencedTableNames做一次拷贝,强化不可变语义当前是直接引用传入集合;若未来调用方传入可变集合并在外部继续修改,会影响模型内部状态。
可选修改
SchemaPath = schemaPath; RootNode = rootNode; - ReferencedTableNames = referencedTableNames; + ReferencedTableNames = referencedTableNames.ToArray(); }🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigSchema.cs` around lines 15 - 27, The constructor YamlConfigSchema currently assigns the passed referencedTableNames directly to the ReferencedTableNames property; make a defensive copy instead to preserve immutability of the model (e.g., create a new list/collection from referencedTableNames and assign a read-only wrapper or an immutable collection). Update the YamlConfigSchema constructor to set ReferencedTableNames to a copied, read-only/immutable collection (created from the referencedTableNames parameter) rather than storing the original reference.GFramework.Game/Config/YamlConfigSchemaNode.cs (1)
283-290: 移除未使用的NodeValidation.None静态属性。代码搜索确认
NodeValidation.None在整个仓库中未被引用。此静态属性未提供任何功能,应删除以避免死代码。🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Game/Config/YamlConfigSchemaNode.cs` around lines 283 - 290, Remove the unused static property NodeValidation.None by deleting its declaration (the public static NodeValidation None { get; } = new(...) initializer) from the NodeValidation type; ensure no remaining references to NodeValidation.None exist (search the repo), run the build/tests to confirm nothing breaks, and remove any related XML docs or using directives made redundant by its deletion.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs`:
- Around line 434-441: The handler TestStateModificationRequestHandler's Handle
method mutates request.SharedState.Counter using a non-atomic "Counter +=
request.Increment" which introduces a race under concurrency; change the
mutation to an atomic update (e.g., use Interlocked.Add(ref
request.SharedState.Counter, request.Increment) or protect the operation with a
dedicated lock) so increments can't be lost; apply the same fix to the other
similar handler referenced by the review (the handler at the second occurrence
where Counter is updated) so both use atomic updates or locking around
SharedState.Counter.
In `@GFramework.Game/Config/YamlConfigAllowedValue.cs`:
- Around line 9-21: The constructor YamlConfigAllowedValue(string
comparableValue, string displayValue) throws ArgumentNullException for
comparableValue and ArgumentException (via ThrowIfNullOrWhiteSpace) for
displayValue but the XML docs lack <exception> tags; update the XML
documentation on the YamlConfigAllowedValue ctor to add <exception
cref="System.ArgumentNullException"> describing when comparableValue is null and
<exception cref="System.ArgumentException"> describing when displayValue is null
or whitespace, keeping the existing <summary> and <param> tags for
comparableValue and displayValue.
In `@GFramework.Game/Config/YamlConfigConditionalSchemas.cs`:
- Around line 9-20: The constructor YamlConfigConditionalSchemas currently
throws ArgumentNullException for a null ifSchema but the XML doc comments lack
an <exception> tag; update the XML documentation for the constructor to include
an <exception cref="System.ArgumentNullException"> describing that ifSchema is
null (and mention which parameter causes it), and ensure the existing <summary>
and <param name="ifSchema">, <param name="thenSchema">, <param
name="elseSchema"> remain accurate to match the thrown behavior in the
constructor.
In `@GFramework.Game/Config/YamlConfigSchemaPropertyType.cs`:
- Around line 6-37: Add the [GenerateEnumExtensions] attribute to the
YamlConfigSchemaPropertyType enum so code generation will produce the standard
enum extension methods; update the enum declaration to be annotated with
[GenerateEnumExtensions] (ensure the attribute's namespace is imported or
referenced, e.g., GenerateEnumExtensionsAttribute) and keep the enum name and
members unchanged so the generated extensions target
YamlConfigSchemaPropertyType.
In `@GFramework.Game/Config/YamlConfigStringFormatConstraint.cs`:
- Around line 9-22: The constructor YamlConfigStringFormatConstraint performs
argument validation on parameter schemaName and can throw ArgumentException;
update the XML documentation for the constructor
(YamlConfigStringFormatConstraint(string schemaName, YamlConfigStringFormatKind
kind)) to include an <exception> entry documenting that an ArgumentException is
thrown when schemaName is null, empty, or whitespace, and ensure the existing
<summary> and <param> tags remain accurate.
In `@GFramework.Game/Config/YamlConfigStringFormatKind.cs`:
- Around line 6-42: The enum YamlConfigStringFormatKind is missing the required
[GenerateEnumExtensions] attribute; add the [GenerateEnumExtensions] attribute
decoration to the YamlConfigStringFormatKind declaration so the enum extension
methods are generated consistently (apply the attribute directly above the
internal enum YamlConfigStringFormatKind definition).
---
Nitpick comments:
In `@GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs`:
- Around line 239-240: Add a short explanatory comment immediately above the
pragma disabling MA0048 (the line with "#pragma warning disable MA0048" in
MediatorAdvancedFeaturesTests.cs / the "Advanced Test Classes" region) that
states why the analyzer is suppressed for these test classes (e.g., tests
require internal access or naming prevents refactor), so the suppression is
justified and discoverable; keep the comment concise and specific to MA0048 and
the Advanced Test Classes region.
In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs`:
- Around line 402-419: Replace the non-thread-safe static Dictionary and
blocking Wait in TestCachedRequestHandler: change the static field _cache to a
thread-safe collection (e.g., ConcurrentDictionary<int,int>) and make the Handle
method async so you can await Task.Delay instead of calling
Task.Delay(...).Wait(...); update references inside Handle to use the concurrent
dictionary's TryGetValue or GetOrAdd patterns to safely read/update cache.
- Around line 392-400: The Handle implementation in TestUncachedRequestHandler
blocks the thread by calling Task.Delay(...).Wait(...); change the method to be
async and await the delay instead: make Handle an async ValueTask<int> (or
Task<int> if preferred), replace Task.Delay(5,
cancellationToken).Wait(cancellationToken) with await Task.Delay(5,
cancellationToken), and return request.Id directly; this preserves cancellation
support and avoids blocking in TestUncachedRequestHandler.Handle.
- Around line 329-343: The Handle method in TestNestedRequestHandler contains a
redundant if that returns the same string regardless of request.Depth; remove
the conditional and simply increment TestNestedRequestHandler2.ExecutionCount
then return the result once (keep the ValueTask<string> return and use
request.Depth in the interpolated message) so the behavior is unchanged but the
unnecessary branching is eliminated.
In `@GFramework.Game/Config/YamlConfigArrayConstraints.cs`:
- Around line 16-26: 在 YamlConfigArrayConstraints 构造函数中添加对 minItems 和 maxItems
的验证:如果 minItems 或 maxItems 为负值则抛出 ArgumentOutOfRangeException(或类似异常),并且当两者都不为
null 时确保 minItems <= maxItems,否则抛出
ArgumentException;更新构造函数(YamlConfigArrayConstraints(...))在赋值 MinItems/MaxItems
之前进行这些检查,以避免产生不可解释的数组约束状态(参照 MinItems、MaxItems、UniqueItems、ContainsConstraints
字段/属性来定位修改点)。
In `@GFramework.Game/Config/YamlConfigArrayContainsConstraints.cs`:
- Around line 15-25: The constructor of YamlConfigArrayContainsConstraints
allows negative values and minContains > maxContains; add validation in the
constructor (YamlConfigArrayContainsConstraints) to throw when MinContains or
MaxContains are negative and to throw when both MinContains and MaxContains are
non-null but MinContains > MaxContains; use ArgumentOutOfRangeException for
negative values and ArgumentException for the min>max case, and keep assigning
ContainsNode, MinContains and MaxContains only after validation.
In `@GFramework.Game/Config/YamlConfigConstantValue.cs`:
- Around line 14-20: The constructor YamlConfigConstantValue currently only
null-checks comparableValue but allows empty/whitespace, so change the
validation to reject blank comparableValue as well (use
ArgumentException.ThrowIfNullOrWhiteSpace or equivalent) to mirror the
displayValue check and ensure ComparableValue is never an empty/whitespace
string; keep setting ComparableValue and DisplayValue as before.
In `@GFramework.Game/Config/YamlConfigObjectConstraints.cs`:
- Around line 18-32: 在 YamlConfigObjectConstraints 的构造函数中添加对
MinProperties/MaxProperties 的合法性校验:确保传入的 minProperties 和 maxProperties 非负且当两者都不为
null 时满足 minProperties <= maxProperties,否则在构造时抛出合适的异常(如
ArgumentOutOfRangeException 或
ArgumentException);更新构造函数(YamlConfigObjectConstraints(...))以在赋值前执行这些检查并保留现有属性赋值逻辑(MinProperties、MaxProperties、DependentRequired、DependentSchemas、AllOfSchemas、ConditionalSchemas)。
In `@GFramework.Game/Config/YamlConfigSchema.cs`:
- Around line 15-27: The constructor YamlConfigSchema currently assigns the
passed referencedTableNames directly to the ReferencedTableNames property; make
a defensive copy instead to preserve immutability of the model (e.g., create a
new list/collection from referencedTableNames and assign a read-only wrapper or
an immutable collection). Update the YamlConfigSchema constructor to set
ReferencedTableNames to a copied, read-only/immutable collection (created from
the referencedTableNames parameter) rather than storing the original reference.
In `@GFramework.Game/Config/YamlConfigSchemaNode.cs`:
- Around line 283-290: Remove the unused static property NodeValidation.None by
deleting its declaration (the public static NodeValidation None { get; } =
new(...) initializer) from the NodeValidation type; ensure no remaining
references to NodeValidation.None exist (search the repo), run the build/tests
to confirm nothing breaks, and remove any related XML docs or using directives
made redundant by its deletion.
In `@GFramework.Game/Config/YamlConfigStringConstraints.cs`:
- Around line 20-31: The constructor for YamlConfigStringConstraints allows
Pattern and PatternRegex to be set inconsistently; enforce they are paired by
validating in the constructor (either both null or both non-null) or by deriving
one from the other (e.g., if Pattern is provided and PatternRegex is null,
compile Pattern into PatternRegex); if inconsistency is detected throw an
ArgumentException with a clear message. Update the YamlConfigStringConstraints
constructor to perform this validation/derivation referencing the constructor
itself and the Pattern and PatternRegex properties so callers cannot create an
inconsistent instance.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ccecfb79-1bb5-42d9-ac1e-d47d675dccd3
📒 Files selected for processing (22)
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.csGFramework.Game/Config/YamlConfigAllowedValue.csGFramework.Game/Config/YamlConfigArrayConstraints.csGFramework.Game/Config/YamlConfigArrayContainsConstraints.csGFramework.Game/Config/YamlConfigConditionalSchemas.csGFramework.Game/Config/YamlConfigConstantValue.csGFramework.Game/Config/YamlConfigNumericConstraints.csGFramework.Game/Config/YamlConfigObjectConstraints.csGFramework.Game/Config/YamlConfigReferenceUsage.csGFramework.Game/Config/YamlConfigScalarConstraints.csGFramework.Game/Config/YamlConfigSchema.csGFramework.Game/Config/YamlConfigSchemaNode.csGFramework.Game/Config/YamlConfigSchemaPropertyType.csGFramework.Game/Config/YamlConfigSchemaValidator.ObjectKeywords.csGFramework.Game/Config/YamlConfigSchemaValidator.csGFramework.Game/Config/YamlConfigStringConstraints.csGFramework.Game/Config/YamlConfigStringFormatConstraint.csGFramework.Game/Config/YamlConfigStringFormatKind.csai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.mdai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Analyze (C#)
- GitHub Check: Code Quality & Security
- GitHub Check: Build and Test
🧰 Additional context used
📓 Path-based instructions (3)
**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.cs: Apply [Log] attribute for automatic logging field and logging helper method generation
Apply [Priority] attribute for automatic priority comparison implementation generation
Apply [GenerateEnumExtensions] attribute to generate enumeration extension capabilities
Apply [ContextAware] attribute to automatically implement IContextAware boilerplate logic
**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with<summary>,<param>,<returns>,<exception>, and<remarks>where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interactions, why the abstraction exists, and when to use it
Generated logic and generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every requiredusingexplicitly in C# files
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace patternGFramework.{Module}.{Feature}with PascalCase segments in C# files
Follow standard C# naming: types/methods/properties/events/constants in PascalCase, interfaces withIprefix, parameters and locals in camelCase, private fields in_camelCase
Use 4 spaces for indentation in C# files; do not use tabs
Use Allman braces in C# files
Keepusingdirectives at the top of C# files and sort them consistently
Prefer one primary type per C# file unless the surrounding project already uses a different local pattern
Keep...
Files:
GFramework.Game/Config/YamlConfigSchemaPropertyType.csGFramework.Game/Config/YamlConfigScalarConstraints.csGFramework.Game/Config/YamlConfigAllowedValue.csGFramework.Game/Config/YamlConfigStringFormatConstraint.csGFramework.Game/Config/YamlConfigStringFormatKind.csGFramework.Game/Config/YamlConfigNumericConstraints.csGFramework.Game/Config/YamlConfigConstantValue.csGFramework.Game/Config/YamlConfigReferenceUsage.csGFramework.Game/Config/YamlConfigConditionalSchemas.csGFramework.Game/Config/YamlConfigArrayContainsConstraints.csGFramework.Game/Config/YamlConfigStringConstraints.csGFramework.Game/Config/YamlConfigSchemaNode.csGFramework.Game/Config/YamlConfigSchema.csGFramework.Game/Config/YamlConfigArrayConstraints.csGFramework.Game/Config/YamlConfigObjectConstraints.csGFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Game/Config/YamlConfigSchemaValidator.ObjectKeywords.csGFramework.Game/Config/YamlConfigSchemaValidator.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
ai-plan/public/*/traces/**
📄 CodeRabbit inference engine (AGENTS.md)
Contributors MUST maintain a matching execution trace under
ai-plan/public/<topic>/traces/for complex work, recording the current date, key decisions, validation milestones, and the immediate next step
Files:
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/**
📄 CodeRabbit inference engine (AGENTS.md)
ai-plan/public/*/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document underai-plan/public/<topic>/todos/in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough forbootto locate the current recovery point quickly
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the activetodos/andtraces/entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation
Files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
🧠 Learnings (15)
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.
Applied to files:
GFramework.Game/Config/YamlConfigSchemaPropertyType.csGFramework.Game/Config/YamlConfigScalarConstraints.csGFramework.Game/Config/YamlConfigAllowedValue.csGFramework.Game/Config/YamlConfigStringFormatConstraint.csGFramework.Game/Config/YamlConfigStringFormatKind.csGFramework.Game/Config/YamlConfigNumericConstraints.csGFramework.Game/Config/YamlConfigConstantValue.csGFramework.Game/Config/YamlConfigReferenceUsage.csGFramework.Game/Config/YamlConfigConditionalSchemas.csGFramework.Game/Config/YamlConfigArrayContainsConstraints.csGFramework.Game/Config/YamlConfigStringConstraints.csGFramework.Game/Config/YamlConfigSchemaNode.csGFramework.Game/Config/YamlConfigSchema.csGFramework.Game/Config/YamlConfigArrayConstraints.csGFramework.Game/Config/YamlConfigObjectConstraints.csGFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Game/Config/YamlConfigSchemaValidator.ObjectKeywords.csGFramework.Game/Config/YamlConfigSchemaValidator.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/Cqrs/**/*.cs : Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests in C#
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : When a public C# API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: When the goal is to inspect or reduce warnings, establish the warning baseline by running `dotnet clean` and then `dotnet build`, not repeated incremental builds
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under `ai-plan/public/<topic>/todos/` in the same change
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: For any multi-step refactor, migration, or cross-module task, contributors MUST create or adopt a dedicated recovery document under `ai-plan/public/<topic>/todos/` before making substantive code changes
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the active `todos/` and `traces/` entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Match existing async patterns and naming conventions with `Async` suffix for asynchronous methods in C#
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
[grammar] ~49-~49: Ensure spelling is correct
Context: ... errors - 已接受的 worker 范围: - ed269d4:`GFramework.Cqrs.Tests/Mediator/MediatorArchitectureInte...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~50-~50: Ensure spelling is correct
Context: ...48/MA0004/MA0016 -121df44:GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeatures...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~51-~51: Ensure spelling is correct
Context: ...48/MA0004/MA0015 -9109eec:GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTes...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (24)
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs (2)
49-237: 测试方法中.ConfigureAwait(false)的一致性应用看起来不错!在测试代码中统一添加
.ConfigureAwait(false)是一个良好的实践,可以避免不必要的同步上下文捕获,特别是在这些测试可能在各种测试运行器环境中执行时。这些更改在整个文件中保持了一致性。
382-385:ArgumentException参数名称更改的考量将参数名从
nameof(request.Value)改为nameof(request)在技术上是正确的,因为request是方法的实际参数。但是,由于验证针对的是request.Value,使用nameof(request.Value)(解析为"Value")可能会为调用者提供更精确的错误定位信息。这两种方式都是可接受的,当前的更改与整个 PR 中的统一风格保持一致。
GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTests.cs (4)
86-426: 测试方法中的异步调用更新看起来很好!在整个测试文件中一致地添加
.ConfigureAwait(false)是一个合理的改进,包括:
SendRequestAsync、PublishAsync、SendAsync调用Task.WhenAll和Task.Delay调用await foreach异步枚举这确保了测试在不同的执行环境中表现一致。
494-498: 良好的改进:使用StringComparer.Ordinal为
Cache字典添加StringComparer.Ordinal是一个好的实践,确保了字符串键的大小写敏感比较行为一致且高效。同时使用IDictionary<string, string>接口类型也提供了更好的抽象。
521-530:ReceivedMessages类型更改为ICollection<string>是合适的将类型从
List<string>改为ICollection<string>提供了更好的接口抽象。测试代码通过局部变量receivedOrder(类型为List<string>)访问索引器,因此不会受到此更改的影响。
585-596:ArgumentException参数名称更改与其他文件保持一致与
MediatorAdvancedFeaturesTests.cs中的更改类似,使用nameof(request)是可接受的,保持了整个 PR 中的一致性。GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs (2)
58-308: 测试方法中的.ConfigureAwait(false)添加看起来不错!在所有异步调用上一致地添加
.ConfigureAwait(false)是一个合理的改进,与其他测试文件保持一致。
463-496:TestPerDispatchContextAwareHandler的实现结构良好使用
IReadOnlyList<T>属性公开内部跟踪列表是一个良好的封装实践。Reset()方法在SetUp中调用,确保测试之间的隔离。ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md (1)
9-75: 恢复文档信息完整且真值收口清晰本次更新已覆盖恢复点、阶段、验证结果、风险与下一步,且 active 内容保持精简,适合作为继续执行的恢复入口。
Based on learnings: "Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point".
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md (1)
3-82: Trace 记录维度完整,阶段衔接明确新增 RP-094 / RP-093 段落都包含日期、关键决策、验证里程碑与立即下一步,便于后续继续接力。
As per coding guidelines: "Contributors MUST maintain a matching execution trace under
ai-plan/public/<topic>/traces/for complex work, recording the current date, key decisions, validation milestones, and the immediate next step".GFramework.Game/Config/YamlConfigScalarConstraints.cs (1)
3-31: 结构清晰,职责边界合理将数值/字符串约束聚合为只读包装模型的做法可读性好,也便于后续按语义扩展。
GFramework.Game/Config/YamlConfigNumericConstraints.cs (1)
3-55: 数值约束模型设计简洁且一致字段语义明确、不可变属性清晰,作为 schema 约束载体实现是稳妥的。
GFramework.Game/Config/YamlConfigReferenceUsage.cs (1)
18-74: 实现清晰,数据模型职责单一参数防御和只读属性设计都很稳健,当前改动没有看到功能性风险。
GFramework.Game/Config/YamlConfigSchemaValidator.ObjectKeywords.cs (1)
1-893: 代码重构结构清晰,符合规范。该文件将对象级 schema 关键字(
dependentRequired、dependentSchemas、allOf、if/then/else)的解析逻辑拆分为独立的辅助方法,有效降低了认知复杂度。XML 文档完整,错误处理一致,符合编码规范。GFramework.Game/Config/YamlConfigSchemaNode.cs (1)
1-330: 模型设计良好,不可变模式实现正确。
YamlConfigSchemaNode采用私有构造函数配合工厂方法的不可变设计模式,With*方法通过复用内部状态实现高效的部分更新。嵌套类封装了实现细节,整体结构清晰。GFramework.Game/Config/YamlConfigSchemaValidator.cs (9)
25-60: 正则超时设置是良好的安全实践。添加 1 秒的正则超时(
SupportedFormatRegexTimeout)可有效防止 ReDoS(正则表达式拒绝服务)攻击,特别是当处理用户提供的 schema 模式时。所有预编译的正则实例都已正确应用此超时。
317-337: 重构后的ParseNode结构清晰。将节点解析拆分为类型解析、对象专属关键字验证、类型分派创建三个阶段,职责明确,便于维护和测试。
770-802: 对象验证重构合理,职责分离清晰。将对象验证拆分为映射节点获取、属性遍历、必填属性检查、约束验证等阶段,每个阶段职责单一。
seenProperties集合在各阶段间正确传递,确保依赖关系验证的一致性。
1397-1419: 标量验证流水线设计良好。将标量验证重构为节点类型检查 → 值提取 → 类型验证 → 约束规范化/验证 → 跨表引用收集的阶段化流程,逻辑清晰,便于定位问题。
2698-2834: 数值约束验证拆分合理。将数值区间和步进约束的验证拆分为下界检查、上界检查、
multipleOf检查三个独立方法,符合单一职责原则,降低了主方法的复杂度。
2186-2203: 模式正则验证正确应用超时。在解析
pattern约束时创建临时正则对象来验证模式合法性,正确应用了超时参数。实际用于运行时匹配的编译正则在CreateStringScalarConstraints中创建,同样应用了超时。
1223-1319: 条件 schema 验证逻辑正确。
if/then/else的实现遵循 JSON Schema 语义:先评估if条件,根据结果选择验证then或else分支。ValidateConditionalSchemaBranch辅助方法提供了统一的分支验证和错误报告机制。
3078-3081: 字符串比较一致使用序数比较。整个文件中的字符串比较都正确使用了
StringComparison.Ordinal,确保跨环境的一致行为。
1-4023: 重构有效降低了分析器警告。该文件通过以下方式成功减少复杂度:
- 添加正则超时防止 ReDoS
- 将大型方法拆分为语义明确的辅助方法
- 一致使用
StringComparison.Ordinal进行字符串比较- 将对象/标量/数值约束验证分离为独立流程
虽然文件行数较多,但作为 partial class 的一部分,且每个方法的认知复杂度已控制在合理范围内。
- 修复 Mediator 集成测试中的阻塞等待、缓存竞态与共享状态原子性问题 - 补充 YamlConfig 运行时模型的构造期约束与 exception XML 文档 - 新增 模型契约回归测试并更新 analyzer warning reduction 恢复文档
Summary
Test ResultsDetails
Insights
Fail Rate
build-and-test: Run #1007
❌ Some tests failed!
Slowest Tests
± Comparison with run #1006 at bf1da2d | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 55 runs. Github Test Reporter by CTRF 💚 |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs (1)
456-489: 静态跟踪列表在顺序测试场景下可接受,但建议添加注释说明。
TrackedContexts和TrackedInstanceIds是普通List<>,依赖于SetUp中调用Reset()和测试顺序执行来保证正确性。建议添加简短注释说明这些静态字段的线程安全假设。💡 建议添加注释说明线程安全假设
public sealed class TestPerDispatchContextAwareHandler : ContextAwareBase, IRequestHandler<TestPerDispatchContextAwareRequest, int> { private static int _nextInstanceId; + // 以下静态列表仅在顺序测试场景下使用,SetUp 会调用 Reset() 重置状态。 private static readonly List<IArchitectureContext?> TrackedContexts = []; private static readonly List<int> TrackedInstanceIds = [];🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed. In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs` around lines 456 - 489, Add a brief comment to TestPerDispatchContextAwareHandler clarifying that the static lists TrackedContexts and TrackedInstanceIds are intentionally non-thread-safe and rely on tests running sequentially with Reset() called in SetUp; mention the expectation that no concurrent test execution or parallel handler invocations will mutate these lists so readers understand the thread-safety assumption and where Reset() is used to clear state.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Nitpick comments:
In `@GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs`:
- Around line 456-489: Add a brief comment to TestPerDispatchContextAwareHandler
clarifying that the static lists TrackedContexts and TrackedInstanceIds are
intentionally non-thread-safe and rely on tests running sequentially with
Reset() called in SetUp; mention the expectation that no concurrent test
execution or parallel handler invocations will mutate these lists so readers
understand the thread-safety assumption and where Reset() is used to clear
state.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: fc60f8b3-d579-4e30-bc39-9569960c51c8
📒 Files selected for processing (15)
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.csGFramework.Game.Tests/Config/YamlConfigModelContractTests.csGFramework.Game/Config/YamlConfigAllowedValue.csGFramework.Game/Config/YamlConfigArrayConstraints.csGFramework.Game/Config/YamlConfigArrayContainsConstraints.csGFramework.Game/Config/YamlConfigConditionalSchemas.csGFramework.Game/Config/YamlConfigConstantValue.csGFramework.Game/Config/YamlConfigObjectConstraints.csGFramework.Game/Config/YamlConfigSchema.csGFramework.Game/Config/YamlConfigSchemaNode.csGFramework.Game/Config/YamlConfigStringConstraints.csGFramework.Game/Config/YamlConfigStringFormatConstraint.csai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.mdai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
✅ Files skipped from review due to trivial changes (3)
- GFramework.Game/Config/YamlConfigStringFormatConstraint.cs
- GFramework.Game/Config/YamlConfigConditionalSchemas.cs
- GFramework.Game/Config/YamlConfigConstantValue.cs
🚧 Files skipped from review as they are similar to previous changes (4)
- GFramework.Game/Config/YamlConfigAllowedValue.cs
- GFramework.Game/Config/YamlConfigSchema.cs
- GFramework.Game/Config/YamlConfigArrayConstraints.cs
- GFramework.Game/Config/YamlConfigStringConstraints.cs
📜 Review details
⏰ Context from checks skipped due to timeout of 900000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Code Quality & Security
- GitHub Check: Build and Test
- GitHub Check: Analyze (C#)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.cs
📄 CodeRabbit inference engine (CLAUDE.md)
**/*.cs: Apply [Log] attribute for automatic logging field and logging helper method generation
Apply [Priority] attribute for automatic priority comparison implementation generation
Apply [GenerateEnumExtensions] attribute to generate enumeration extension capabilities
Apply [ContextAware] attribute to automatically implement IContextAware boilerplate logic
**/*.cs: All public, protected, and internal types and members MUST include XML documentation comments (///) with<summary>,<param>,<returns>,<exception>, and<remarks>where applicable
Add inline comments for non-trivial logic, concurrency/threading behavior, performance-sensitive paths, workarounds, edge cases, registration order, lifecycle sequencing, and generated code assumptions
Core framework components such as Architecture, Module, System, Context, Registry, Service Module, and Lifecycle types MUST include high-level explanations of responsibilities, lifecycle, interactions, why the abstraction exists, and when to use it
Generated logic and generator pipelines MUST explain what is generated, why it is generated, semantic assumptions, and diagnostics or fallback behavior
Methods with non-trivial logic MUST document the core idea, key decisions, and edge case handling
Do not rely on implicit imports; declare every requiredusingexplicitly in C# files
Write null-safe code that respects nullable annotations instead of suppressing warnings by default
Use the namespace patternGFramework.{Module}.{Feature}with PascalCase segments in C# files
Follow standard C# naming: types/methods/properties/events/constants in PascalCase, interfaces withIprefix, parameters and locals in camelCase, private fields in_camelCase
Use 4 spaces for indentation in C# files; do not use tabs
Use Allman braces in C# files
Keepusingdirectives at the top of C# files and sort them consistently
Prefer one primary type per C# file unless the surrounding project already uses a different local pattern
Keep...
Files:
GFramework.Game/Config/YamlConfigArrayContainsConstraints.csGFramework.Game/Config/YamlConfigObjectConstraints.csGFramework.Game.Tests/Config/YamlConfigModelContractTests.csGFramework.Game/Config/YamlConfigSchemaNode.csGFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
ai-plan/public/*/traces/**
📄 CodeRabbit inference engine (AGENTS.md)
Contributors MUST maintain a matching execution trace under
ai-plan/public/<topic>/traces/for complex work, recording the current date, key decisions, validation milestones, and the immediate next step
Files:
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
ai-plan/public/*/todos/**
📄 CodeRabbit inference engine (AGENTS.md)
ai-plan/public/*/todos/**: When working from a tracked implementation plan, contributors MUST update the corresponding tracking document underai-plan/public/<topic>/todos/in the same change
Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Active tracking and trace files are recovery entrypoints, not append-only changelogs; they MUST stay concise enough forbootto locate the current recovery point quickly
Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
When completed and validated stages begin to accumulate, contributors MUST archive their detailed history out of the activetodos/andtraces/entry files in the same change, keeping only the current recovery point, active facts, active risks, immediate next step, and pointers to archive files
When a task spans multiple commits or is likely to exceed a single agent context window, update both the recovery document and the trace at each meaningful milestone before pausing or handing work off
If subagents are used on a complex task, the main agent MUST capture the delegated scope and any accepted findings in the active recovery document or trace before continuing implementation
Files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
🧠 Learnings (13)
📚 Learning: 2026-04-06T12:45:43.921Z
Learnt from: GeWuYou
Repo: GeWuYou/GFramework PR: 190
File: GFramework.Game/Config/GameConfigBootstrap.cs:1-3
Timestamp: 2026-04-06T12:45:43.921Z
Learning: In the GeWuYou/GFramework repository, C# files may omit explicit `using System*` imports because the project-wide `GlobalUsings.cs` (referenced via manual global `using` directives) supplies common namespaces (e.g., `System`, `System.Threading`, `System.Threading.Tasks`). During code review, do not flag missing `using System...` directives in `.cs` files as long as `GlobalUsings.cs` is present/used to provide those namespaces.
Applied to files:
GFramework.Game/Config/YamlConfigArrayContainsConstraints.csGFramework.Game/Config/YamlConfigObjectConstraints.csGFramework.Game.Tests/Config/YamlConfigModelContractTests.csGFramework.Game/Config/YamlConfigSchemaNode.csGFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/traces/** : Contributors MUST maintain a matching execution trace under `ai-plan/public/<topic>/traces/` for complex work, recording the current date, key decisions, validation milestones, and the immediate next step
Applied to files:
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : When a public C# API defines multiple contract branches, tests MUST cover the meaningful variants including null, empty, default, and filtered inputs when those branches change behavior
Applied to files:
GFramework.Game.Tests/Config/YamlConfigModelContractTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Regression fixes should include a test that fails before the fix and passes after it
Applied to files:
GFramework.Game.Tests/Config/YamlConfigModelContractTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Public API changes must be covered by unit or integration tests in C#
Applied to files:
GFramework.Game.Tests/Config/YamlConfigModelContractTests.csGFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Preserve snapshot-based verification patterns already used in the repository for source generator tests
Applied to files:
GFramework.Game.Tests/Config/YamlConfigModelContractTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Keep tests focused on observable behavior, not implementation trivia
Applied to files:
GFramework.Game.Tests/Config/YamlConfigModelContractTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.cs : Source generator changes MUST be covered by generator tests
Applied to files:
GFramework.Game.Tests/Config/YamlConfigModelContractTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Tracking updates MUST reflect completed work, newly discovered issues, validation results, and the next recommended recovery point
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : When working from a tracked implementation plan, contributors MUST update the corresponding tracking document under `ai-plan/public/<topic>/todos/` in the same change
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to ai-plan/public/*/todos/** : Recovery documents MUST record the current phase, the active recovery point identifier, known risks, and the next recommended resume step so another contributor or subagent can continue the work safely
Applied to files:
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
📚 Learning: 2026-04-17T11:35:08.762Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: CLAUDE.md:0-0
Timestamp: 2026-04-17T11:35:08.762Z
Learning: Applies to **/Cqrs/**/*.cs : Use CQRS (Command Query Responsibility Segregation) pattern with the Cqrs naming entry point instead of the historical Mediator alias
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.csGFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
📚 Learning: 2026-04-26T03:16:48.230Z
Learnt from: CR
Repo: GeWuYou/GFramework PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-04-26T03:16:48.230Z
Learning: Applies to **/*.Tests.cs : Reuse existing architecture test infrastructure when relevant: `ArchitectureTestsBase<T>`, `SyncTestArchitecture`, `AsyncTestArchitecture`
Applied to files:
GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs
🪛 LanguageTool
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md
[grammar] ~82-~82: Ensure spelling is correct
Context: ... errors - 已接受的 worker 范围: - ed269d4:`GFramework.Cqrs.Tests/Mediator/MediatorArchitectureInte...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~83-~83: Ensure spelling is correct
Context: ...48/MA0004/MA0016 -121df44:GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeatures...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
[grammar] ~84-~84: Ensure spelling is correct
Context: ...48/MA0004/MA0015 -9109eec:GFramework.Cqrs.Tests/Mediator/MediatorComprehensiveTes...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md
[grammar] ~31-~31: Ensure spelling is correct
Context: ...ontractTests.cs作为模型契约回归覆盖 - 本轮修复集中在GFramework.Cqrs.Tests与GFramework.Game` 两个最新 review ...
(QB_NEW_EN_ORTHOGRAPHY_ERROR_IDS_1)
🔇 Additional comments (14)
ai-plan/public/analyzer-warning-reduction/traces/analyzer-warning-reduction-trace.md (1)
3-35: 追踪文档结构完整,符合规范。RP-095 条目准确记录了触发背景、triage 结论(接受/延后/驳回)、主线程实施、验证里程碑和下一步,满足
ai-plan/public/*/traces/**的追踪要求。GFramework.Cqrs.Tests/Mediator/MediatorArchitectureIntegrationTests.cs (3)
561-571: 竞态条件修复正确。
SharedState现在使用Interlocked.Add进行原子更新,解决了先前 review 中指出的Counter += request.Increment非原子操作问题。这确保了并发测试Context_State_Should_Remain_Consistent_Under_Concurrency的稳定性。
397-412: 缓存实现改进合理。使用
ConcurrentDictionary替代普通Dictionary并配合GetOrAdd是正确的线程安全缓存模式。
66-70:.ConfigureAwait(false)统一应用正确。所有
SendRequestAsync调用都已添加.ConfigureAwait(false),符合测试代码中避免同步上下文捕获的最佳实践。Also applies to: 78-82, 90-94, 103-108
GFramework.Cqrs.Tests/Mediator/MediatorAdvancedFeaturesTests.cs (2)
239-241:MA0048抑制已附带原因注释,符合规范。注释 "这些高级特性测试需要把一组仅供当前文件使用的辅助类型共置,避免拆成多个噪声文件" 清晰说明了抑制理由,满足 coding guidelines 中关于 analyzer suppressions 需要注释的要求。
Also applies to: 509-510
383-386:ArgumentException参数名称调整合理。从
nameof(request.Value)改为nameof(request)更准确地反映了异常的语义——问题在于请求对象的整体状态(Value 字段为负数),而不仅仅是 Value 属性本身。GFramework.Game/Config/YamlConfigObjectConstraints.cs (1)
1-86: 对象约束模型设计良好。构造函数契约校验(拒绝负数、拒绝
min > max)、<exception>XML 文档、只读属性设计都符合框架规范。不可变模型确保了运行时状态一致性。GFramework.Game/Config/YamlConfigSchemaNode.cs (2)
7-36: Schema 节点模型设计合理。私有构造函数配合静态工厂方法(
CreateObject、CreateArray、CreateScalar)清晰区分了不同节点类型的创建路径,同时With*方法提供了不可变更新能力。ArgumentNullException.ThrowIfNull确保了必需参数的契约。
242-261:NodeChildren.None静态实例是良好的空对象模式。为标量节点提供预分配的空 children 实例,避免了重复分配。
GFramework.Game/Config/YamlConfigArrayContainsConstraints.cs (1)
1-60: 数组 contains 约束模型契约完整。构造函数校验逻辑(非空
containsNode、非负边界、min <= max)与其他约束模型保持一致,<exception>文档准确描述了抛出条件。GFramework.Game.Tests/Config/YamlConfigModelContractTests.cs (2)
10-125: 契约测试覆盖全面。测试用例涵盖了所有关键契约场景:
- 空白值拒绝(
AllowedValue、ConstantValue)- 负值和反向区间拒绝(
ArrayContainsConstraints、ArrayConstraints、ObjectConstraints)- 成对约束(
pattern/patternRegex)- 防御性复制(
ReferencedTableNames)
Assert.Multiple的使用确保了分组断言都能执行并报告。
93-94: Regex 超时设置符合MA0009规范。测试中的
new Regex("value", RegexOptions.None, TimeSpan.FromSeconds(1))正确添加了超时参数,避免潜在的 ReDoS 风险。ai-plan/public/analyzer-warning-reduction/todos/analyzer-warning-reduction-tracking.md (2)
9-15: 恢复点文档更新完整。RP-095 记录了当前阶段、焦点、已完成修复和 triage 结论(接受/延后/驳回),符合恢复文档规范。
37-42: 风险与缓解措施记录清晰。文档正确识别了两个当前风险(PR 线程状态、仓库级 warning 真值未重采样)并提供了具体缓解措施,便于后续恢复工作。
Summary
Test ResultsDetails
Insights
Fail Rate
build-and-test: Run #1008
❌ Some tests failed!
Slowest Tests
± Comparison with run #1007 at 4cf15b9 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 56 runs. Github Test Reporter by CTRF 💚 |
- 修复 YamlConfigAllowedValue 与 YamlConfigConstantValue 对空对象 const 或 enum 比较键的误判,同时继续拒绝非空纯空白输入 - 补充 YamlConfigModelContractTests 对空比较键与纯空白比较键的回归覆盖,并验证空对象 const 场景 - 更新 ai-plan 公共索引并归档 analyzer-warning-reduction 主题,保留最终 PR review 结论与验证记录
Summary
Test ResultsDetails
Insights
Fail Rate
build-and-test: Run #1009
🎉 All tests passed!Slowest Tests
± Comparison with run #1008 at dbcebf5 | 🍂 No flaky tests detected across all runs. | ⏱️ Measured over 57 runs. Github Test Reporter by CTRF 💚 |
Summary by CodeRabbit
发布说明
代码质量改进
配置架构增强
测试覆盖