Skip to content

bug: cross-enum conflict detection is order-dependent due to GetValues() returning prefixed names #2391

@natalie-o-perret

Description

@natalie-o-perret

GenerateEnums prefixes enum constant names when two enums share a value (e.g. "running" in both instance-state and volume-state becomes InstanceStateRunning / VolumeStateRunning). The conflict check calls e1.GetValues(), which returns already-prefixed names for enums marked in an earlier iteration. Those prefixed names no longer match the raw values of later enums, so some conflicts are missed and affected enums stay unprefixed.

Whether an enum gets prefixed ends up depending on iteration order rather than actual value overlap.

Minimal reproduction: three string enums where A shares "running" with B and "migrating" with C. A and B are compared first and both get marked. When A is later compared with C, A.GetValues() returns ["AStateRunning", "AStateMigrating"], neither of which matches C's raw value "Migrating", so C stays unprefixed.

Fix: compare Schema.EnumValues keys instead of GetValues() output. EnumValues always holds unprefixed identifiers regardless of whether the enum has been marked yet. PR: #2390

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions