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

pkg/struct: MinFields fails when combined with a conditional #3474

Closed
jpluscplusm opened this issue Oct 1, 2024 · 1 comment
Closed

pkg/struct: MinFields fails when combined with a conditional #3474

jpluscplusm opened this issue Oct 1, 2024 · 1 comment

Comments

@jpluscplusm
Copy link
Collaborator

jpluscplusm commented Oct 1, 2024

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

$ cue version
cue version v0.11.0-alpha.2

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

Does this issue reproduce with the latest stable release?

Yes, I've tested it and found it to fail with v0.10.0, v0.9.2, but it passes with v0.8.2. I've not tested v0.9.0.

What did you do?

exec cue vet -c file.cue
env CUE_EXPERIMENT=evalv3
exec cue vet -c file.cue
-- file.cue --
import "struct"

A: struct.MinFields(1)
A: {
	if true {B: true}
}

What did you expect to see?

A passing test.

What did you see instead?

> exec cue-0.11.0-alpha.2 vet -c file.cue
[stderr]
A: incomplete value struct.MinFields(1):
    ./file.cue:3:4
[exit status 1]
FAIL: /tmp/testscript2904768139/minFields.conditional.disagree.txtar/script.txtar:1: unexpected command failure
> env CUE_EXPERIMENT=evalv3
> exec cue-0.11.0-alpha.2 vet -c file.cue
[stderr]
A: incomplete value struct.MinFields(1):
    ./file.cue:3:4
[exit status 1]
FAIL: /tmp/testscript2904768139/minFields.conditional.disagree.txtar/script.txtar:3: unexpected command failure

This feels adjacent to #3450 but, unlike that issue, this issue strikes with both the current and new evaluator.

jpluscplusm added a commit to jpluscplusm-forks/cue-lang.cue-by-example that referenced this issue Oct 1, 2024
The Mythic Beasts DNS guide is broken by when used with CUE v0.9.x or
later. This updates the guide by removing a MinFields contraint,
allowing it to work with current CUE versions. We can re-add the
constraint when cue-lang/cue#3474 is resolved.

Fixes cue-labs#36

Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
jpluscplusm added a commit to jpluscplusm-forks/cue-lang.cue-by-example that referenced this issue Oct 1, 2024
The Mythic Beasts DNS guide is broken by when used with CUE v0.9.x or
later. This updates the guide by removing a MinFields contraint,
allowing it to work with current CUE versions. We can re-add the
constraint when cue-lang/cue#3474 is resolved.

Also: `cue fmt` individual and embedded files; reword a comment.

Fixes cue-labs#36

Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
@rogpeppe
Copy link
Member

rogpeppe commented Oct 1, 2024

After bisecting, it looks like the culprit is https://review.gerrithub.io/c/cue-lang/cue/+/1200328

@myitcv myitcv removed the Triage Requires triage/attention label Oct 1, 2024
@myitcv myitcv moved this to v0.11.0-alpha.3 in Release v0.11 Oct 1, 2024
@myitcv myitcv moved this from v0.11.0-alpha.3 to v0.11.0-rc.1 in Release v0.11 Oct 2, 2024
cueckoo pushed a commit that referenced this issue Oct 4, 2024
Validators are not correctly evaluated when combining
embedding with comprehensions.

Issue #3474

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I62cc860dec7515c91e470efa71cfa8b28bc0ea9b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202119
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
@cueckoo cueckoo closed this as completed in 37937f6 Oct 4, 2024
vanhtuan0409 pushed a commit to anduintransaction/cue that referenced this issue Oct 15, 2024
Validators are not correctly evaluated when combining
embedding with comprehensions.

Issue cue-lang#3474

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: I62cc860dec7515c91e470efa71cfa8b28bc0ea9b
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202119
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
vanhtuan0409 pushed a commit to anduintransaction/cue that referenced this issue Oct 15, 2024
Change https://review.gerrithub.io/c/cue-lang/cue/+/1200328
set hasTop for validators to ensure the validator
type was taken into account when embedding.
hasTop has special meaning, though, and broke
some other cases. We now only set it if the type
is actually top. This also seems not entirely correct,
but at least is more correct.

Fixes cue-lang#3474

Signed-off-by: Marcel van Lohuizen <mpvl@gmail.com>
Change-Id: Id23c1b4bc4270edf1a1c7177dc495da13179be73
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1202120
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Reviewed-by: Roger Peppe <rogpeppe@gmail.com>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
jpluscplusm added a commit to cue-labs/cue-by-example that referenced this issue Dec 23, 2024
The Mythic Beasts DNS guide is broken by when used with CUE v0.9.x or
later. This updates the guide by removing a MinFields contraint,
allowing it to work with current CUE versions. We can re-add the
constraint when cue-lang/cue#3474 is resolved.

Also: `cue fmt` individual and embedded files; reword a comment.

Fixes #36

Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
No open projects
Status: v0.11.0-rc.1
Development

No branches or pull requests

3 participants