mirror of
https://github.com/GeWuYou/GFramework.git
synced 2026-05-07 00:39:00 +08:00
- 修复 YamlConfigAllowedValue 与 YamlConfigConstantValue 对空对象 const 或 enum 比较键的误判,同时继续拒绝非空纯空白输入 - 补充 YamlConfigModelContractTests 对空比较键与纯空白比较键的回归覆盖,并验证空对象 const 场景 - 更新 ai-plan 公共索引并归档 analyzer-warning-reduction 主题,保留最终 PR review 结论与验证记录
17 KiB
17 KiB
Analyzer Warning Reduction History Trace
该文档于
2026-04-19从旧local-plan/traces/analyzer-warning-reduction-trace.md迁入,作为ANALYZER-WARNING-REDUCTION-RP-001的历史执行 trace 归档保留。
Legacy Trace Content
2026-04-18
Stage: Discovery
- Read
AGENTS.mdand.ai/environment/tools.ai.yamlbefore choosing commands. - Confirmed the repository currently surfaces a large batch of Meziantou analyzer diagnostics during
dotnet build GFramework.sln -c Release -nologo -clp:Summary;WarningsOnly. - Confirmed that
dotnet build ... -t:Rebuildis required to force the compiler/analyzers to emit the warnings reliably during project-level validation. - Identified three independent work slices suitable for parallel handling:
GFramework.Coreplus closely relatedGFramework.Cqrsruntime warningsGFramework.Godotruntime warnings- source generator warnings under
GFramework.Core.SourceGenerators,GFramework.Cqrs.SourceGenerators, andGFramework.Godot.SourceGenerators
Current Recovery Point
ANALYZER-WARNING-REDUCTION-RP-001
Stage: Delegation
- Delegated
GFramework.Godot/**low-risk warning reduction to workerNewton. Scope:- runtime-focused analyzer fixes only
- no edits outside
GFramework.Godot/**exceptGFramework.Godot.Tests/**if validation strictly needs it - avoid broad refactors and preserve behavior
- Delegated source generator low-risk warning reduction to worker
Aristotle. Scope:- only
GFramework.Core.SourceGenerators/**,GFramework.Cqrs.SourceGenerators/**, andGFramework.Godot.SourceGenerators/** - explicitly exclude
GFramework.Game.SourceGenerators/** - prioritize string-comparison, parameter-name, file/type-name, and localized method-splitting fixes
- only
Stage: Main-Thread Focus
- Reserved
GFramework.Core/**andGFramework.Cqrs/**for the main thread because they dominate the current warning surface and form the primary validation path. - Confirmed the current worktree already contains an unrelated git status entry:
AD GFramework.Core/Directory.Build.propsThis file is not part of the current warning-reduction edit scope and must not be reverted.
Stage: Implementation
- Applied low-risk runtime fixes across
GFramework.Core/**andGFramework.Cqrs/**, including:ConfigureAwait(false)on context-independent asynchronous hot pathsStringComparer.Ordinal/StringComparison.Ordinalfor string-keyed collections and comparisons- invariant-formatting fixes for logging/statistics paths
- targeted
ArgumentException/ArgumentNullExceptionoverload cleanup - localized file-structure cleanup for cache/config helper types
- Split a few file/type mismatches that were cheap to resolve without API churn:
GFramework.Cqrs/Internal/WeakTypePairCache.csGFramework.Core/Logging/AppenderConfiguration.csGFramework.Core/Logging/FilterConfiguration.csGFramework.Core/Logging/ConfigurableLoggerFactory.csGFramework.Core/Resource/ResourceCacheEntry.cs
Stage: Worker Results
- Worker
Aristotlecompleted the source-generator slice and landed:MA0006string-comparison cleanupMA0048fix by renamingLoggerDiagnostic.cstoLoggerDiagnostics.cs- localized
MA0015cleanup - small
MA0051splits inAutoRegisterModuleGenerator.csandEnumExtensionsGenerator.cs
- Worker
Newtoncompleted the Godot slice and landed:ConfigureAwait(false)cleanup where context capture was unnecessary- string-comparison / comparer fixes
- invariant formatting and argument-overload cleanup
- file split for
GodotYamlConfigEnvironmentandGodotYamlConfigDirectoryEntry - explicit observation of an async result in
AbstractArchitecture
- Accepted residual worker findings:
GFramework.Core.SourceGenerators/Rule/ContextAwareGenerator.csstill has a broaderMA0051refactor remaining.GFramework.Godot/Setting/Data/LocalizationMap.csstill has twoMA0016warnings on publicDictionary-typed properties that were intentionally left unchanged to avoid public-surface / serialization impact.
Stage: Validation
- Ran:
dotnet build GFramework.Core.SourceGenerators/GFramework.Core.SourceGenerators.csproj -c Release --no-restoredotnet build GFramework.Cqrs/GFramework.Cqrs.csproj -c Release -t:Rebuild --no-restore -p:TargetFramework=net8.0 -p:UseSharedCompilation=false -nologo -clp:Summary;WarningsOnlydotnet build GFramework.Core/GFramework.Core.csproj -c Release -t:Rebuild --no-restore -p:UseSharedCompilation=false -p:TargetFramework=net8.0 -nologo -clp:Summary;WarningsOnlydotnet build GFramework.Godot/GFramework.Godot.csproj -c Release --no-restore -p:TargetFramework=net8.0 -p:UseSharedCompilation=false
- Results:
GFramework.Core.SourceGenerators:0 Warning(s),0 Error(s)GFramework.Cqrs(net8.0rebuild):1 Warning(s),0 Error(s)GFramework.Core(net8.0rebuild):- intermediate focused rebuild:
49 Warning(s),0 Error(s) - latest focused rebuild:
31 Warning(s),0 Error(s)
- intermediate focused rebuild:
GFramework.Godot: worker-reported success after the Godot-owned fixes; broader direct builds still include a large inheritedGFramework.Gamewarning set from dependencies
Stage: Regression Repair
- After the checkpoint commit, reproduced the user-reported test regressions from the current branch instead of resuming warning cleanup blindly.
- Isolated the failures to three behavior changes:
LocalizationStringenabledRegexOptions.ExplicitCapturebut still read unnamed capture groups, so every localization placeholder fell back to the original token text.ResultExtensions.Ensurestarted constructingArgumentExceptionwith a parameter name, which changed the externally observed message contract covered by tests.MicrosoftDiContainer.RegisterCqrsHandlersFromAssembliesrejected null assembly items withArgumentExceptioninstead of the previously expectedArgumentNullException.
- Repaired the regressions by:
- switching the localization placeholder regex to named capture groups and reading those names explicitly
- restoring the message-only
ArgumentExceptionconstruction inEnsure - restoring
ArgumentNullExceptionfor null assembly entries in CQRS registration
- Revalidated with:
dotnet test GFramework.Core.Tests -c Release --filter "FullyQualifiedName~GetString_WithUnknownCompactFormatterArgs_ShouldIgnoreUnknownOptions|FullyQualifiedName~GetString_WithVariable_ShouldFormatCorrectly|FullyQualifiedName~GetString_WithMultipleVariables_ShouldFormatCorrectly|FullyQualifiedName~GetString_WithInvalidCompactFormatterArgs_ShouldFallbackToDefaultFormatting|FullyQualifiedName~GetString_WithCompactFormatterArgs_ShouldApplyOptions|FullyQualifiedName~GetString_WithCompactFormatter_ShouldFormatCorrectly|FullyQualifiedName~Ensure_Should_Create_ArgumentException_With_Message|FullyQualifiedName~RegisterCqrsHandlersFromAssemblies_WithNullAssemblyItem_Should_ThrowArgumentNullException"
- Result:
8 Passed,0 Failed,0 Skipped
Stage: Review Follow-Up
- Applied a focused batch of review-driven fixes across
GFramework.Core,GFramework.Cqrs,GFramework.Godot,GFramework.Game, and the paired docs:- completed missing XML exception contracts for public APIs such as
UiPageBehaviorFactory.Create<T>andResourceManager.LoadAsync<T>/PreloadAsync<T> - aligned
NumericExtensions.Betweenwith its documented null contract - removed duplicate XML documentation on
WaitForTask - made
Resultsafe fordefault(Result)in equality, hashing, and string formatting - restored Godot main-thread affinity by removing
ConfigureAwait(false)from scene/module paths that touch node APIs - observed async destroy failures in
AbstractArchitectureinstead of discarding them silently - made
ConfigurableLoggerFactory.Disposeidempotent under concurrent calls and switched logger-level lookup to longest-prefix matching - corrected CQRS weak-cache XML exception docs and weak-type-pair cache remarks
- changed
IApplyAbleSettings.ApplytoApplyAsyncand updated implementations, callers, tests, and settings docs - fixed
GodotYamlConfigEnvironmentso Godot-path byte reads now throw on engine-reported read/open errors instead of silently returning an empty byte array
- completed missing XML exception contracts for public APIs such as
Stage: Review Follow-Up Validation
- Ran:
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~NumericExtensionsTests|FullyQualifiedName~ResultTests|FullyQualifiedName~ResultExtensionsTests|FullyQualifiedName~LoggingConfigurationTests"dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~SettingsSystemTests|FullyQualifiedName~GodotLocalizationSettingsTests"dotnet build GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Releasedotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~LoadAsync_Should_Use_Globalized_Res_Directory_Directly_When_Running_In_Editor"
- Results:
GFramework.Core.Tests:101 Passed,0 FailedGFramework.Game.Tests:7 Passed,0 FailedGFramework.Godot.Testsbuild: succeeded- targeted
GFramework.Godot.Testssmoke test:1 Passed,0 Failed
- Validation caveat:
- parallel
dotnet testinvocations against the Windows-backed worktree caused transient file-lock failures in sharedobj/binoutputs, so the final validation was rerun serially. - a dedicated test for
GodotYamlConfigEnvironment.Default.ReadAllBytes("res://missing")was attempted but removed because the native Godot file API crashes the test host in this environment before managed assertions can observe the failure.
- parallel
Current Remaining Hotspots
MA0051long methods in:GFramework.Cqrs/Internal/CqrsHandlerRegistrar.csGFramework.Core/Architectures/ArchitectureLifecycle.csGFramework.Core/Coroutine/CoroutineScheduler.csGFramework.Core/Pause/PauseStackManager.csGFramework.Core/StateManagement/Store.cs
MA0048file/type mismatches in generic/non-generic families and multi-type files such as:AbstractCommand*AbstractAsyncCommand*AbstractQuery*EasyEventGeneric.cs
MA0046delegate-shape warnings in architecture/coroutine/logging callbacks.MA0016collection-abstraction warnings on some public logging configuration properties.
Immediate Next Step
- Stop at
ANALYZER-WARNING-REDUCTION-RP-001for this batch unless the next round explicitly wants to take on the remaining structural refactors. - If the next round resumes from this point, keep the restored localization /
Ensure/ CQRS registration test contracts intact while tackling the remaining analyzer hotspots.
Stage: Review Follow-Up Batch 2
- Applied the current CodeRabbit follow-up fixes across
GFramework.Godot,GFramework.Core,GFramework.Cqrs, andGFramework.Game.Tests:- moved
AbstractArchitecture.InstallGodotModuleanchor validation ahead ofmodule.Install(this)so a missingSceneTreeanchor fails before any module-side effects occur - normalized
ConfigurableLoggerFactoryconfiguration collections when JSON deserialization yieldsnull - merged
GetLogger(..., minLevel)with_config.MinLevelusing the stricter level and updated the XML contract - added a compatibility disposal path for
AsyncLogAppender - made
GodotYamlConfigEnvironmentreturnnullfor inaccessible non-Godot directories and always callListDirEnd()for Godot directory iteration - completed the missing XML exception contract on
WeakTypePairCache.GetValueOrDefaultForTesting - added XML summaries to the modified public
GodotLocalizationSettingsTestsmethods
- moved
- Added focused regression tests for:
ConfigurableLoggerFactorynull-collection normalization- caller
minLevellower-bound behavior - factory disposal of
AsyncLogAppender
- Planned validation for this batch:
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests|FullyQualifiedName~LoggingConfigurationTests"dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~LoadAsync_Should_Use_Globalized_Res_Directory_Directly_When_Running_In_Editor"dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~GodotLocalizationSettingsTests"dotnet build GFramework.sln -c Release
- Attempted to add a direct
AbstractArchitectureregression test for the anchor-ordering change, but the current Godot .NET test host crashes when initializing that runtime path. Removed the unstable test and kept the code change covered by project build plus existing Godot loader smoke validation instead.
Stage: Review Follow-Up Batch 2 Validation
- First attempted to run the targeted tests and solution build in parallel, but the Windows-backed worktree reproduced
the known
obj/binfile-lock failures (CS2012,MSB3026,MSB3883). Switched all remaining validation to serial invocations with-m:1. - Ran:
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests" -m:1dotnet test GFramework.Game.Tests/GFramework.Game.Tests.csproj -c Release --filter "FullyQualifiedName~GodotLocalizationSettingsTests" -m:1dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~LoadAsync_Should_Use_Globalized_Res_Directory_Directly_When_Running_In_Editor" -m:1dotnet build GFramework.sln -c Release -m:1
- Results:
GFramework.Core.Tests:3 Passed,0 FailedGFramework.Game.Tests:3 Passed,0 FailedGFramework.Godot.Teststargeted smoke:1 Passed,0 FailedGFramework.slnrelease build:698 Warning(s),0 Error(s)
Stage: Review Follow-Up Batch 3
- Applied the latest review-driven fixes across
GFramework.Godot,GFramework.Core,GFramework.Cqrs, andGFramework.Core.Tests:- recorded Godot modules in
_extensionsimmediately aftermodule.Install(this)so failed attach paths still participate in later teardown - tightened
ConfigurableLoggerFactory.GetLoggerwith explicitnamenull validation - aligned the
minLevelXML contract with the actual override precedence semantics - added inline comments to the two-level weak cache
GetOrAddhot path - replaced the reflection-based
AsyncLogAppenderdisposal test with an observable post-disposal logger behavior assertion
- recorded Godot modules in
- Added a stable Godot-specific regression test that directly invokes
InstallGodotModule(...)without going throughInitialize(), avoiding the native crash path while still covering the anchor-before-install contract. - Documented the remaining test gap:
- the destroy-observation path introduced by
ObserveDestroyAsyncstill lacks a dedicated automated assertion because capturingGD.PushErrordeterministically in the current Godot .NET test host is not yet practical.
- the destroy-observation path introduced by
Stage: Review Follow-Up Batch 3 Validation
- Ran:
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests" -m:1dotnet test GFramework.Godot.Tests/GFramework.Godot.Tests.csproj -c Release --filter "FullyQualifiedName~AbstractArchitectureModuleInstallationTests" -m:1dotnet build GFramework.sln -c Release -m:1
- Results:
GFramework.Core.Tests:5 Passed,0 FailedGFramework.Godot.Teststargeted install-ordering test:1 Passed,0 FailedGFramework.slnrelease build:847 Warning(s),0 Error(s)
Stage: Review Follow-Up Batch 4
- Applied the latest review-driven fixes across
GFramework.Core,GFramework.Core.Tests, and the Godot settings docs:- made
ConfigurableLoggerFactoryrejectappendersentries deserialized asnullwith an explicitInvalidOperationExceptioninstead of deferring to an unclear downstream failure - extended the constructor XML docs to describe that validation contract explicitly
- added a focused regression test for
appenders: [null] - fixed the
docs/zh-CN/godot/setting.mdaudio examples so bothSetMasterVolumesamples compile while awaitingaudioSettings.ApplyAsync()
- made
Stage: Review Follow-Up Batch 4 Validation
- Ran:
dotnet test GFramework.Core.Tests/GFramework.Core.Tests.csproj -c Release --filter "FullyQualifiedName~ConfigurableLoggerFactoryTests" -m:1dotnet build GFramework.Core/GFramework.Core.csproj -c Release -m:1
- Results:
GFramework.Core.Tests:6 Passed,0 FailedGFramework.Corerelease build:79 Warning(s),0 Error(s)