Skip to content
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

cue/cmd: export encoding is hiding errors #1153

Closed
verdverm opened this issue Jul 27, 2021 · 4 comments
Closed

cue/cmd: export encoding is hiding errors #1153

verdverm opened this issue Jul 27, 2021 · 4 comments

Comments

@verdverm
Copy link

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

0.4.0

What did you do?

Given foo.cue

package foo

#SomeBaseType: {
 "a" | "b"
 #AUTO: "z"
}

V1: ("x" | "y") | *"z"
V2: ("x" | "y") | *#SomeBaseType.#AUTO

No error is printed, but exit code is 1

$ cue export foo.cue

$ echo $?
1

Specifying the output format does help a little

$ cue export foo.cue --out yaml
yaml: unsupported node "x"|"y" (*ast.BinaryExpr)

$ cue export foo.cue --out json

$ cue export foo.cue --out cue
V1: "z"
V2: "x" | "y"

What did you expect to see?

errors about V2 not being concrete

@verdverm verdverm added NeedsInvestigation Triage Requires triage/attention labels Jul 27, 2021
@verdverm
Copy link
Author

Related to #1152

@myitcv myitcv changed the title cue/cmd export encoding is hiding errors cue/cmd: export encoding is hiding errors Jul 28, 2021
@myitcv
Copy link
Member

myitcv commented Jul 28, 2021

Thanks for raising this, @verdverm.

I think the following captures the essence of the bug:

# Default export mode
! exec cue export x.cue
stderr 'incomplete'

# Yaml
! exec cue export --out yaml x.cue
stderr 'incomplete'

# JSON
! exec cue export --out json x.cue
stderr 'incomplete'

-- x.cue --
package foo

#SomeBaseType: {
	"a" | "b"
	#AUTO: "z"
}

V1: ("x" | "y") | *"z"
V2: ("x" | "y") | *#SomeBaseType.#AUTO

Namely that regardless of export format, we should be seeing an error related to the incomplete-ness of V2.

(grr, hit Cmd+Enter instead of enter!)

The current output is:

# Default export mode (0.021s)
> ! exec cue export x.cue
[stderr]

[exit status 1]
> stderr 'incomplete'
FAIL: /tmp/testscript967438656/repro.txt/script.txt:3: no match for `incomplete` found in stderr

Confirmed with 370fac9.

@myitcv myitcv added NeedsFix S and removed NeedsInvestigation Triage Requires triage/attention labels Jul 28, 2021
@myitcv myitcv removed the S label Oct 26, 2021
@mpvl
Copy link
Member

mpvl commented Nov 24, 2021

This is an intriguing case. One could argue that this is not an incomplete error. According to the current CUE spec, it should be an error though. I guess in the future we could relax this, if we can define a good way to hold this.

@mpvl mpvl added this to the v0.4.1: bug fixes milestone Nov 24, 2021
cueckoo pushed a commit that referenced this issue Nov 24, 2021
Fixes #1152
Fixes #1153

Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>

Change-Id: Ida2ba39e361621dba1c5a14bfa45bae004de893c
@myitcv
Copy link
Member

myitcv commented Nov 25, 2021

One could argue that this is not an incomplete error.

What type of error do you think it should be?

cueckoo pushed a commit that referenced this issue Nov 25, 2021
Fixes #1152
Fixes #1153

Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>

Change-Id: Ida2ba39e361621dba1c5a14bfa45bae004de893c
Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>
jlongtine pushed a commit to jlongtine/cue that referenced this issue Dec 8, 2021
Fixes cue-lang#1152
Fixes cue-lang#1153

Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>

Change-Id: Ida2ba39e361621dba1c5a14bfa45bae004de893c
Signed-off-by: Marcel van Lohuizen <mpvl@golang.org>
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/528037
Reviewed-by: Marcel van Lohuizen <mpvl@gmail.com>
Unity-Result: CUEcueckoo <cueckoo@cuelang.org>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Signed-off-by: Joel Longtine <joel@longtine.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants