Skip to content

#14746 Fix duplicate AppEnum serialization text and detect it in addItem - #14745

Merged
magnesj merged 1 commit into
OPM:devfrom
magnesj:14654-appenum-duplicate-serialization-text
Sep 14, 2026
Merged

magnesj merged 1 commit into
OPM:devfrom
magnesj:14654-appenum-duplicate-serialization-text

Conversation

@magnesj

@magnesj magnesj commented Sep 13, 2026

Copy link
Copy Markdown
Member

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_CASES used the serialization text "NONE", duplicating the NONE enum value.
  • RimIntersectionFilterEnum::INTERSECT_FILTER_BETWEEN used the serialization text "INTERSECT_SHOW_BELOW", duplicating the INTERSECT_FILTER_BELOW value (and BETWEEN is also the default value for this enum).

Both are fixed to use their own distinct text ("ALL_CASES" / "INTERSECT_SHOW_BETWEEN").

Previously AppEnumMapperBase::addItem only 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 a CAF_ASSERT that 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 all cafPdmCore_UnitTests (90 tests) pass.

…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
magnesj force-pushed the 14654-appenum-duplicate-serialization-text branch from ec62146 to 52e7c4b Compare September 13, 2026 07:22
@magnesj magnesj changed the title #14654 Fix duplicate AppEnum serialization text and detect it in addItem #14746 Fix duplicate AppEnum serialization text and detect it in addItem Sep 13, 2026
@magnesj
magnesj requested review from jonjenssen and a lite review from Copilot and removed request for Copilot September 14, 2026 06:27
@magnesj magnesj self-assigned this Sep 14, 2026
@magnesj
magnesj merged commit 64361c2 into OPM:dev Sep 14, 2026
10 checks passed
@magnesj
magnesj deleted the 14654-appenum-duplicate-serialization-text branch September 14, 2026 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AppEnum duplicate serialization text causes silent value swap on project reload

2 participants