Skip to content

eval: error messages mention definition with evalv3 #3864

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

Closed
myitcv opened this issue Mar 31, 2025 · 3 comments
Closed

eval: error messages mention definition with evalv3 #3864

myitcv opened this issue Mar 31, 2025 · 3 comments
Labels
evaluator evalv3 issues affecting only the evaluator version 3 NeedsInvestigation

Comments

@myitcv
Copy link
Member

myitcv commented Mar 31, 2025

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

$ cue version
cue version v0.13.0-alpha.3

go version go1.24.0
      -buildmode exe
       -compiler gc
  DefaultGODEBUG gotestjsonbuildtext=1,multipathtcp=0,randseednop=0,rsa1024min=0,tlsmlkem=0,x509rsacrt=0,x509usepolicies=0
     CGO_ENABLED 1
          GOARCH arm64
            GOOS linux
         GOARM64 v8.0
             vcs git
    vcs.revision c565c1d31f2920ec79219ab04699e68fd32af93b
        vcs.time 2025-03-31T13:58:15Z
    vcs.modified false
cue.lang.version v0.13.0

Does this issue reproduce with the latest release?

Yes

What did you do?

# -- evalv2 --
env CUE_EXPERIMENT=evalv3=0
! exec cue export x.cue --out yaml
stderr 'config.serviceB.metadata.name: incomplete value string'

# -- evalv3 - CUE_DEBUG=sharing=0 --
env CUE_EXPERIMENT=evalv3=1
env CUE_DEBUG=sharing=0
! exec cue export x.cue --out yaml
stderr 'config.serviceB.metadata.name: incomplete value string'

# -- evalv3 - CUE_DEBUG=sharing=1 --
env CUE_EXPERIMENT=evalv3=1
env CUE_DEBUG=sharing=1
! exec cue export x.cue --out yaml
stderr 'config.serviceB.metadata.name: incomplete value string'

-- x.cue --
#Metadata: {
	name:      string
	namespace: string
}

#BaseConfig: {
	metadata: #Metadata
}

#Config: {
	metadata: #Metadata

	serviceA: #BaseConfig & {
		metadata: metadata
	}

	serviceB: #BaseConfig & {
		metadata: metadata
	}
}

config: #Config & {
	metadata: {
		name:      "test"
		namespace: "dev"
	}
}

What did you expect to see?

Passing test.

What did you see instead?

# -- evalv2 -- (0.010s)
# -- evalv3 - CUE_DEBUG=sharing=0 -- (0.037s)
# -- evalv3 - CUE_DEBUG=sharing=1 -- (0.030s)
> env CUE_EXPERIMENT=evalv3=1
> env CUE_DEBUG=sharing=1
> ! exec cue export x.cue --out yaml
[stderr]
#Metadata.name: incomplete value string:
    ./x.cue:2:13
#Metadata.namespace: incomplete value string:
    ./x.cue:3:13
[exit status 1]
> stderr 'config.serviceB.metadata.name: incomplete value string'
FAIL: repro.txtar:16: no match for `config.serviceB.metadata.name: incomplete value string` found in stderr
failed run
@myitcv myitcv added evaluator evalv3 issues affecting only the evaluator version 3 NeedsInvestigation labels Mar 31, 2025
@mpvl
Copy link
Member

mpvl commented Mar 31, 2025

This is probably a structure sharing issue. We are aware of this bug. You can verify this by turning sharing off.

@myitcv
Copy link
Member Author

myitcv commented Apr 7, 2025

Updated withCUE_DEBUG=sharing to show that this appears to be a structure sharing issue.

@myitcv
Copy link
Member Author

myitcv commented Apr 16, 2025

Now that this issue has fixed, my eyes have finally seen that the original CUE is really not as the author intended. It has a bug in it. So whilst the presence of the bug in the original repro served us well in terms of highlighting the structure sharing issue, I would like to note for completeness that the author's intent in the original CUE was almost certainly:

# -- evalv2 --
env CUE_EXPERIMENT=evalv3=0
exec cue export x.cue --out yaml
cmp stdout stdout.golden

# -- evalv3 - CUE_DEBUG=sharing=0 --
env CUE_EXPERIMENT=evalv3=1
env CUE_DEBUG=sharing=0
exec cue export x.cue --out yaml
cmp stdout stdout.golden

# -- evalv3 - CUE_DEBUG=sharing=1 --
env CUE_EXPERIMENT=evalv3=1
env CUE_DEBUG=sharing=1
exec cue export x.cue --out yaml
cmp stdout stdout.golden

-- x.cue --
#Metadata: {
	name:      string
	namespace: string
}

#BaseConfig: {
	metadata: #Metadata
}

#Config: {
	metadata: #Metadata

	serviceA: #BaseConfig & {
		"metadata": metadata
	}

	serviceB: #BaseConfig & {
		"metadata": metadata
	}
}

config: #Config & {
	metadata: {
		name:      "test"
		namespace: "dev"
	}
}
-- stdout.golden --
config:
  metadata:
    name: test
    namespace: dev
  serviceA:
    metadata:
      name: test
      namespace: dev
  serviceB:
    metadata:
      name: test
      namespace: dev

Which is confirmed as passing as of 7cfe774

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
evaluator evalv3 issues affecting only the evaluator version 3 NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

2 participants