Repository navigation
Not planned
Not planned
Copy link
Labels
enhancementNew feature or requestknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposwontfixThis will not be worked on
Description
Part of #138
Popularity: 1/7 corpus consumers (cuda-quantum)
Problem
When evolving versioned configuration schemas with rfl::TaggedUnion<"version", V1, V2>, legacy documents routinely omit the discriminator field (version). Upstream reflect-cpp (v0.25.0) provides no way to declare a default/fallback tag when the discriminator key is absent, forcing consumers to bypass rfl::yaml::read(string), parse the raw DOM themselves with yaml-cpp, mutate the DOM node to inject the default discriminator, and call the two-argument rfl::yaml::read(InputVarType, yaml_str) overload.
Observed Downstream Workaround
NVIDIA/cuda-quantum (90e4aa08)
cudaq/lib/Target/Yaml/TargetConfigSchema.h#L22-L23:/// Unversioned YAML files are treated as v1. using TargetConfigSchema = rfl::TaggedUnion<"version", v1::TargetConfigV1, v2::TargetConfigV2>;
cudaq/lib/Target/Yaml/TargetConfigSchema.cpp#L31-L42: directly includes<yaml-cpp/yaml.h>, callsYAML::Load, mutatesnode["version"] = "1", and invokes the two-argumentrfl::yaml::read:YAML::Node node; try { node = YAML::Load(substitutedYamlContent); } catch (const YAML::Exception &e) { throw std::runtime_error("Failed to parse target configuration YAML: " + std::string(e.what())); } // Unversioned configurations are schema v1, permanently. if (node.IsMap() && !node["version"]) node["version"] = "1"; const auto parsed = rfl::yaml::read<TargetConfigSchema, YamlProcessors>( rfl::yaml::InputVarType(node), substitutedYamlContent);
Related Fork Work
- Fork PR Add opt-in rfl::DefaultTag<Discriminator, Tag> processor for rfl::TaggedUnion #129 (Add opt-in
rfl::DefaultTag<Discriminator, Tag>processor forrfl::TaggedUnion) — directly addresses this gap via a zero-contagion processor on thefork/strictly-better-no-dramabranch (noted in Triage & Design Notes (Fork-Only): Speculative Schema / Contract APIs #136).
Upstream Overlap
- Feature request: Allow a 'fallback' type for tagged union munich-data-engineering/reflect-cpp#455 (closed/wontfix, partial) — Requested a fallback type for
rfl::TaggedUnion(for unknown discriminators); maintainer@liuzicheng1987declined adding a built-in fallback and recommended wrapping instd::variant<TaggedUnion<...>, FallbackType>.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestknown-downstream-workaroundsDownstream consumer pain or workaround observed in real-world OSS reposwontfixThis will not be worked on
Activity
clockblocker commentedon Nov 29, 2026
Triage decision: closing as
wontfix(not planned) for the upstream adoption track.Rationale:
DefaultTagfallback for missingrfl::TaggedUniondiscriminators is a valid single-repo convenience (cuda-quantum), not an adoption driver, and upstreammunich-data-engineering/reflect-cpp#455precedent favoredstd::variant<TaggedUnion<...>, Fallback>.Preserved prototype: Already prototyped in fork PR #129 (scored 60/100, below the
>= 65upstream cutline) and parked cleanly ondiscuss/ssot(see Draft PR #191 parked table).