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

evaluator: inconsistent export output for different formats based on what default is selected #3157

Closed
gisle opened this issue May 18, 2024 · 3 comments
Assignees
Labels
evaluator evalv3-win Issues resolved by switching from evalv2 to evalv3 NeedsFix

Comments

@gisle
Copy link

gisle commented May 18, 2024

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

$ cue version
cue version v0.8.2

go version go1.22.2
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH arm64
            GOOS darwin

Does this issue reproduce with the latest stable release?

I belive v0.8.2 to be the latest stable release.

What did you do?

I tried to cue export based on this definition:

foo: *42 | _
foo: *43 | bool

What did you expect to see?

I expected it to actually complain about incompatible defaults, and if not that get consistent export output.

What did you see instead?

I see different result when I export as JSON than YAML or Cue.

$ cue export foo43.cue
{
    "foo": 43
}

$ cue export foo43.cue --out yaml
foo: 42

$ cue export foo43.cue --out cue
foo: 42
@gisle gisle added NeedsInvestigation Triage Requires triage/attention labels May 18, 2024
@jpluscplusm
Copy link
Collaborator

Possibly related to #2916, as they share several elements (disjunctions, defaults, JSON-vs-YAML).

@myitcv myitcv changed the title Inconsistent export output for different formats based on what default is selected evaluator: inconsistent export output for different formats based on what default is selected May 23, 2024
@myitcv myitcv added NeedsFix evaluator and removed Triage Requires triage/attention NeedsInvestigation labels May 23, 2024
@myitcv
Copy link
Member

myitcv commented May 23, 2024

This is a straight bug with the evaluator; neither is correct but the new evaluator is correct, i.e. the following test passes:

# old evaluator
env CUE_EXPERIMENT=''
exec cue export --out json x.cue
cmp stdout old_json.golden
exec cue export --out yaml x.cue
cmp stdout old_yaml.golden

# new evaluator
env CUE_EXPERIMENT='evalv3'
! exec cue export --out json x.cue
cmp stderr new_stderr.golden
! exec cue export --out yaml x.cue
cmp stderr new_stderr.golden

-- x.cue --
foo: *42 | _
foo: *43 | bool
-- old_json.golden --
{
    "foo": 43
}
-- old_yaml.golden --
foo: 42
-- new_stderr.golden --
foo: incomplete value 43 | bool

@myitcv
Copy link
Member

myitcv commented May 23, 2024

@mvdan is kindly taking this one on to create a regression tests against the new evaluator.

@mvdan mvdan added the evalv3-win Issues resolved by switching from evalv2 to evalv3 label Aug 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluator evalv3-win Issues resolved by switching from evalv2 to evalv3 NeedsFix
Projects
None yet
Development

No branches or pull requests

4 participants