Repository navigation
Fix three bugs in the frozen rule violation stores - #528
Draft
alexanderlinne wants to merge 3 commits into
Draft
alexanderlinne wants to merge 3 commits into
alexanderlinne wants to merge 3 commits into
Conversation
StoreCurrentViolations wrote to the default storage path instead of the path passed to the constructor, so a custom XML store was read from but never written to. Add a regression test using a temporary store directory. Signed-off-by: Alexander Linne <alexander.linne@tngtech.com>
LoadStorage caught every exception and returned an empty store, which the next write then persisted, so a single malformed or locked file silently un-froze all rules. Only a missing file or directory now counts as an empty store; parse errors and IO errors propagate. Signed-off-by: Alexander Linne <alexander.linne@tngtech.com>
Assembly.FullName includes Version, Culture and PublicKeyToken, so a frozen target framework rule stopped matching on every assembly version bump. Assembly.Name is the simple name set in ArchBuilder and is stable. Signed-off-by: Alexander Linne <alexander.linne@tngtech.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #528 +/- ##
==========================================
+ Coverage 86.50% 87.02% +0.52%
==========================================
Files 261 261
Lines 12691 12691
Branches 1232 1232
==========================================
+ Hits 10978 11044 +66
+ Misses 1366 1300 -66
Partials 347 347 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Nov 27, 2026
This branch has not been deployed
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.
Why
This is the first of three PRs on frozen rules. #529 stops the loader from sharing members between types with the same full name, and #531 tells frozen types and members apart by assembly. This PR fixes three bugs in the violation stores that came up along the way:
XmlViolationStoreread from the path passed to its constructor, but always wrote to the default../../../ArchUnitNET/Storage/FrozenRules.xml. A custom XML path was never written, and the default file was written instead.JsonViolationStoreandXmlViolationStorecaught every exception while loading and returned an empty store, which the next write then persisted. A single merge conflict marker or typo in a store file silently un-froze every rule in it, and the file was overwritten with only the rule that was just evaluated.TargetFrameworkRulesidentified assemblies byAssembly.FullName, which includesVersion=,Culture=andPublicKeyToken=. A frozen target-framework rule therefore broke on every version bump.What changes
Custom XML path.
XmlViolationStore.StoreCurrentViolationswrites to the configured path.Malformed stores. Both stores treat only
FileNotFoundExceptionandDirectoryNotFoundExceptionas an empty store. Parse errors and otherIOExceptions now propagate, and the file is left untouched.Target-framework rules.
TargetFrameworkRulesusesAssembly.Name, the simple name set inArchBuilder, as identifier.Tests. A new helper,
TempStoreDirectory, provides throwaway store files, so that the new tests don't touch the checked-inStorage/FrozenRules.*files.FreezeTestscovers that a custom XML path is written to, that malformed JSON and XML stores throw and stay unchanged, that a store in a missing directory is created, and that a frozen target-framework rule stores no version.Behaviour changes
XmlViolationStorepath is now written to. Previously the default path was written instead, so check whether your defaultFrozenRules.xmlcontains rules that belong in the custom file.TargetFrameworkRules.ShouldBeDotNet…) now store the simple assembly name. Existing entries hold the full assembly name, so these rules report their violations after the upgrade until they are re-frozen by deleting the rule's entry from the store. From then on they survive version bumps.