[DRK-73] test(efcore-extensions): Tier-2 arch rule — no System.Console in library code - #323
Merged
Merged
Conversation
…Console in library code Library code must emit diagnostics through an injected ILogger, never System.Console, so hosts can filter/redirect/redact/suppress them. Adds a NetArchTest rule over the DKNet.EfCore.Extensions assembly with a KnownViolations allow-list containing exactly today's single offender (EfCoreExceptionHandler, EfCoreExceptionHandler.cs:61). The rule fails on any NEW Console usage; the allow-list must only shrink. A companion self-check asserts the rule can still detect the known offender, so it can never silently go blind. Test-only, no production code touched. Part of monthly architecture review DRK-73. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Co-authored-by: multica-agent <github@multica.ai>
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
📊 Code Coverage Report |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## dev #323 +/- ##
==========================================
+ Coverage 84.88% 84.93% +0.05%
==========================================
Files 159 159
Lines 3771 3771
Branches 591 591
==========================================
+ Hits 3201 3203 +2
+ Misses 389 388 -1
+ Partials 181 180 -1
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of the monthly architecture review DRK-73.
What
Adds a Tier-2 baseline NetArchTest rule to
EfCore.Extensions.Testsasserting that no type in theDKNet.EfCore.Extensionsassembly depends onSystem.Console.ProductionTypes_ExceptKnownOffenders_MustNotDependOnSystemConsole— the rule. Passes today because the single known offender (EfCoreExceptionHandler,EfCoreExceptionHandler.cs:61) is on aKnownViolationsallow-list. It fails the moment any newConsole.*usage appears in the assembly.Rule_CanDetectConsoleUsage_OnTheKnownOffender— a self-check asserting the rule still detects the known offender, so the rule can never silently go blind.Why
A library primitive that writes to
Consolebypasses the host's logging configuration entirely — it cannot be filtered, redirected, redacted, or suppressed — and pollutes stdout in production. Diagnostics must go through an injectedILogger. The allow-list must only shrink: whenEfCoreExceptionHandleris migrated toILogger, delete its entry so the rule covers the whole assembly.Scope
EfCore.Extensions.Tests.csproj: adds the centrally-managedNetArchTest.Rulespackage reference.Architecture/ConsoleUsageArchitectureTests.cs.Verification
Full-solution
dotnet build DKNet.FW.sln -c Debugis green (0 errors).🤖 Generated with Claude Code