refactors and hardens the MessageFactory#39
Merged
Conversation
…move legacy Errors system
Phase 1 — integrity test: add SystemCodeMapIntegrityTests asserting every
SystemCodeMap domain key has ar+en translations, no duplicate codes, and
every SystemCode constant value matches its field name. Link Resources.yaml
into Application.Tests output so YamlLocalizationStore finds it at test time.
Phase 2 — observable fallbacks: inject ILogger<MessageFactory>; ResolveCode()
logs Warning when a key falls back to ERR900, Localize() logs Warning when
GetString returns the raw key unchanged. All 6 entry points route through
these helpers.
Phase 4 — legacy removal:
- Delete CCE.Application.Common.Errors and its DI registration (no live
injection sites); 44 prefixed legacy yaml keys removed (IDENTITY_*,
CONTENT_*-prefixed, COMMUNITY_*, COUNTRY_COUNTRY_*, GENERAL_*,
NOTIFICATIONS_*-prefixed, VALIDATION_*-prefixed duplicates).
- Fix 3 silent ERR900 bugs: add COUNTRY_CODE_NOT_FOUND (ERR130),
LOOKUP_CREATED (CON070), LOOKUP_UPDATED (CON071) to SystemCode +
SystemCodeMap.
- Add ~60 missing ar+en translations so every SystemCodeMap key resolves
in Resources.yaml (integrity test enforces this going forward).
- Extend ApplicationErrors with PlatformSettings, Media, Verification,
Lookups domain classes; standardize all 35 MessageFactory convenience
shortcuts to ApplicationErrors.* constants — zero bare string literals.
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.
Summary
This PR refactors and hardens the MessageFactory pipeline to improve reliability, observability, and localization integrity while removing the legacy
Errorsinfrastructure.Changes
Localization Integrity Validation
SystemCodeMapIntegrityTeststo validate:SystemCodeMapkey has both Arabic and English translations.SystemCodeconstant value matches its field name.Resources.yamlintoApplication.Testsoutput to ensureYamlLocalizationStorecan resolve translations during test execution.Improved Observability
ILogger<MessageFactory>intoMessageFactory.ResolveCode()falls back toERR900due to an unmapped key.Localize()returns the original key because a translation is missing.Legacy Errors System Removal
CCE.Application.Common.Errors.IDENTITY_*CONTENT_*COMMUNITY_*COUNTRY_COUNTRY_*GENERAL_*NOTIFICATIONS_*VALIDATION_*Bug Fixes
Fixed three cases that silently fell back to
Key | Code -- | -- COUNTRY_CODE_NOT_FOUND | ERR130 LOOKUP_CREATED | CON070 LOOKUP_UPDATED | CON071ERR900:Added the missing entries to both
SystemCodeandSystemCodeMap.Translation Coverage
SystemCodeMapentry resolves successfully fromResources.yaml.ApplicationErrors Standardization
Added new domain groups:
PlatformSettingsMediaVerificationLookupsRefactored all 35
MessageFactoryconvenience methods to useApplicationErrors.*constants, eliminating remaining hardcoded string literals.Result