#14746 Fix duplicate AppEnum serialization text and detect it in addItem - #14745
Merged
magnesj merged 1 commit intoSep 14, 2026
Merged
Conversation
…ddItem RimGridCalculation::AdditionalCasesType::ALL_CASES and RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN both reused the serialization text of a sibling enum value (NONE and INTERSECT_SHOW_BELOW respectively), so they would silently round-trip as the wrong value when read back from a project file. AppEnumMapperBase::addItem only asserted alias uniqueness, not text uniqueness, so this class of bug went undetected. Add a CAF_ASSERT checking that a new enum value's serialization text does not match an existing value's text or aliases. Found while investigating the AppEnum alias-duplication note in OPM#14654.
magnesj
force-pushed
the
14654-appenum-duplicate-serialization-text
branch
from
September 13, 2026 07:22
ec62146 to
52e7c4b
Compare
magnesj
requested review from
jonjenssen
and
a lite review from Copilot
and removed request for
Copilot
September 14, 2026 06:27
kriben
approved these changes
Sep 14, 2026
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.
Fixes #14746
While investigating the "AppEnum alias duplication" note in #14654, I scanned every
AppEnum<T>::setUp()in the codebase for duplicate serialization text/aliases and found two real bugs:RimGridCalculation::AdditionalCasesType::ALL_CASESused the serialization text"NONE", duplicating theNONEenum value.RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEENused the serialization text"INTERSECT_SHOW_BELOW", duplicating theINTERSECT_FILTER_BELOWvalue (andBETWEENis also the default value for this enum).Both are fixed to use their own distinct text (
"ALL_CASES"/"INTERSECT_SHOW_BETWEEN").Previously
AppEnumMapperBase::addItemonly asserted that alias text was unique, not that the primary serialization text was unique, so this class of bug went undetected at registration time. Added aCAF_ASSERTthat checks new text against existing text/aliases too.Verified locally (Windows Debug, asserts fully active) by running
ResInsight --console --generate <file>, which instantiates every registered PDM object/enum: exits cleanly with no assert firing, and allcafPdmCore_UnitTests(90 tests) pass.