Repository navigation
Backlog
Labels
enhancementNew feature or requestknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposneeds-triageMaintainer needs to evaluate this issue
Description
Part of #138
Popularity: 1/7 corpus consumers (cuda-quantum)
Problem
Upstream reflect-cpp (v0.25.0) has three ergonomics gaps for C++ enum class wire serialization in user-facing config files:
- No built-in wire-name transform (e.g.
snake_case->kebab-case, such asdep_analysis->"dep-analysis",two_qubit_gate_count->"two-qubit-gate-count",single_qubit->"single-qubit") or out-of-band enumerator rename table. - Default enum deserialization accepts numeric fallback spellings or lacks a clean way to strictly reject non-matching/numeric strings without writing a custom
rfl::Reflector<E>. - Error messages on invalid enum strings do not list the allowed wire values (
unknown value 'foo' (allowed: ...)).
As a result, consumers hand-write a full rfl::Reflector<E> specialization with a switch statement for every enum, plus a shared linear-scan helper using rfl::get_enumerator_array<E>().
Observed Downstream Workarounds
NVIDIA/cuda-quantum (90e4aa08)
cudaq/lib/Target/Yaml/TargetConfigYamlAdapters.h#L27-L108: shareddetail::enumFromYamlName<E>()(iteratingrfl::get_enumerator_array<E>(), rejecting numeric spellings, and formatting(allowed: ...)) plus manualrfl::Reflectorspecializations forTargetFeatureFlagandArgumentType:/// Matches a YAML enum name against the names that `rfl::Reflector<E>::from` /// gives each enumerator. Unmatched (including numeric) spellings are /// rejected. template <typename E> requires std::is_enum_v<E> E enumFromYamlName(const std::string &name) { ... throw std::runtime_error("unknown value '" + name + "' (allowed: " + allowed + ")"); }
cudaq/lib/Target/Yaml/v2/QuakeUnmappedProfileYaml.h#L17-L53: manualrfl::Reflectorspecializations forCostModel(t_count->"t-count",two_qubit_gate_count->"two-qubit-gate-count",gate_count->"gate-count") andLoopUnrolling(index_use->"index-use").cudaq/lib/Target/Yaml/v2/QuakeReferenceSemanticsProfileYaml.h#L16-L32: manualrfl::Reflectorspecialization forMeasurementForm(single_qubit->"single-qubit").
Related Fork Work
- Prototype enum wire-name transform and per-enumerator rename hook #101 (closed) — Prototype enum wire-name transform and per-enumerator rename hook.
- Fork PR Add rfl::EnumNames<E> wire-name overrides, TransformEnumNames processors, and literal_from_table_t #123 (Add
rfl::EnumNames<E>wire-name overrides,TransformEnumNamesprocessors, andliteral_from_table_t) — addresses wire-name transforms (TransformEnumNames) and explicit per-enumerator mappings (EnumNames<E>) onfork/strictly-better-no-drama(noted in Triage & Design Notes (Fork-Only): Speculative Schema / Contract APIs #136). - Worth verifying whether strict non-numeric parsing and
(allowed: ...)error diagnostics are also covered or warrant a follow-up.
Upstream Overlap
- Add ability to rename enum values munich-data-engineering/reflect-cpp#731 (open, exact for enum case transforms) — Requests renaming enum values (e.g., case transforms); maintainer replied "My first instinct would be a processor, but I need to give it some thought."
- Enum values with spaces munich-data-engineering/reflect-cpp#106 (open, exact for custom per-enumerator wire names) — Requests custom wire strings (e.g., spaces) for enum values; maintainer suggested
rfl::Literalor acknowledged a compile-time mapper specialization is possible. - Enum can be deserialized from raw integers that don't map to enum values munich-data-engineering/reflect-cpp#714 / Add the EnumNamesOnly processor; resolves #714 munich-data-engineering/reflect-cpp#718 (closed/fixed via merged PR, post-
v0.25.0) — Added opt-inrfl::EnumNamesOnlyprocessor to strictly reject numeric fallback strings (maintainer declined changing the default behavior). - Improve error message when an invalid enum value is provided. munich-data-engineering/reflect-cpp#605 / Improve invalid enum error message munich-data-engineering/reflect-cpp#606 (closed/fixed via merged PR, shipped in
v0.24.0) — Improved invalid-enum error messages to list allowed enumerator names (bypassed incuda-quantumonly because customReflector<E>specializations were needed for kebab-case names; custom enumReflectors were enabled in Allows usage of custom Reflector for enums types munich-data-engineering/reflect-cpp#621).
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposneeds-triageMaintainer needs to evaluate this issue
Activity
clockblocker commentedon Nov 29, 2026
Tracking & PR Cross-Reference
Status: Fully addressed across merged upstream PRs +
upstream-queue(Draft PR #191).munich-data-engineering/reflect-cpp#718—rfl::EnumNamesOnlyprocessor (strict non-numeric enum parsing).munich-data-engineering/reflect-cpp#606— improved invalid enum error diagnostics listing allowed names.upstream-queue(Draft PR Upstream PR Queue (sorted by mergeability score) #191), split from fork PR Add rfl::EnumNames<E> wire-name overrides, TransformEnumNames processors, and literal_from_table_t #123:5b0e4df6, score 83/100, refs upstreammunich-data-engineering/reflect-cpp#731, parent: Rank Accept repeated list options and remaining positional arguments in rfl::cli #6 / upstream#802):rfl::TransformEnumNamesprocessors (includingEnumSnakeCaseToKebabCase,EnumCamelCaseToSnakeCase, etc.).--helpand--versionto rfl::cli through rfl::cli::App #28 (commit5fe4a070, score 71/100, refs upstreammunich-data-engineering/reflect-cpp#106, parent: Rank Fix rfl::DefaultVal in NamedTuples and TaggedUnion schemas #20):rfl::EnumNames<E>per-enum wire-name override trait andrfl::get_enum_wire_names<E, Ps...>().