Skip to content

cue def --inline-imports mishandle labels #3854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
fboismenu opened this issue Mar 27, 2025 · 0 comments
Open

cue def --inline-imports mishandle labels #3854

fboismenu opened this issue Mar 27, 2025 · 0 comments
Labels
NeedsInvestigation Triage Requires triage/attention

Comments

@fboismenu
Copy link

What version of CUE are you using (cue version)?

$ cue version

cue version v0.12.0

go version go1.23.5
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.12.0

Does this issue reproduce with the latest stable release?

Yes

What did you do?

Pretty hard to come with a minimal reproducer ...
But I have a construct looking like the following in a Cue file explicitly imported by the target of cue def --inline-imports target.cue

#TopLevel: {
	#AlertLabels: {
		P1: severity: "critical"
		P2: severity: "high"
		P3: severity: "moderate"
		P4: severity: "low"
		P5: severity: "info"
		...
	}

	#PriorityDelta: strconv.Atoi(strings.Split(_p_monitoring.alerting.priority, "P")[1]) - 1

	#AlertLabels: [Prio=string]: {
		// Compute final priority
		let _prioNum = strconv.Atoi(strings.Split(Prio, "P")[1])
		let _prio = list.Min([_prioNum + #PriorityDelta, 5])
		priority: "P\(_prio)"
...
}

And after cue def it becomes:

		#AlertLabels: {
			[Prio=string]: {
				let _prioNum = strconv.Atoi(strings.Split(string, "P")[1])

What did you expect to see?

The alias name has replaced by it's "type" constrain ...

What did you see instead?

		#AlertLabels: {
			[Prio=string]: {
				let _prioNum = strconv.Atoi(strings.Split(Prio, "P")[1])
@fboismenu fboismenu added NeedsInvestigation Triage Requires triage/attention labels Mar 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation Triage Requires triage/attention
Projects
None yet
Development

No branches or pull requests

1 participant