Skip to content

Explore CUE embedding semantics experiment #112

@myitcv

Description

@myitcv

Is your feature request related to a problem? Please describe.

helm2cue relies heavily on struct embedding for helper includes. When a helper produces structured YAML (labels, annotations, etc.), the generated CUE embeds the helper reference into the parent struct:

metadata: {
    name: "test"
    labels: {
        _myapp_labels
        extra: "field"
    }
}

The current CUE embedding semantics implicitly open closed structs, which can have surprising interactions with schema validation. The generated CUE works correctly today, but the implicit opening behavior means the relationship between embedding and struct closedness is not always obvious from reading the output.

Describe the solution you'd like

CUE's proposed experiment to eliminate embedding-based struct opening (cue-lang/cue#4032) introduces an explicit postfix ... operator for recursively opening composite structs. Instead of implicit opening through embedding, code would use {x...} to explicitly open a struct.

Explore this experiment to:

  1. Determine whether helm2cue's embedding patterns need the implicit opening behavior, or whether explicit ... would be more correct.
  2. Evaluate what changes to the generated CUE would be needed under the new semantics.
  3. Check whether any current output relies on implicit opening and would break.
  4. Provide feedback on the proposal from the perspective of a code generator.

Additional context

Upstream discussion: cue-lang/cue#4032

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions