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

cmd/cue: vet's behaviour with multiple -d flags is order dependent #3726

Open
jpluscplusm opened this issue Feb 4, 2025 · 2 comments
Open
Labels
NeedsInvestigation vet candidate for a vet rule to detect suspect usage

Comments

@jpluscplusm
Copy link
Collaborator

jpluscplusm commented Feb 4, 2025

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
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH amd64
            GOOS linux
         GOAMD64 v1
cue.lang.version v0.12.0

Does this issue reproduce with the latest stable release?

v0.12.0 is latest.

What did you do?

env CUE_EXPERIMENT=evalv3=1

# These two cue vet invocations should fail with the same error message as they
# both validate the same data against the same pair of constraints, but with
# the constraints mentioned in different orders.

# cue vet #1
! exec cue vet .:A data.yaml -d '#B' -d '#C'
cmp stderr err

# cue vet #2
! exec cue vet .:A data.yaml -d '#C' -d '#B'
cmp stderr err
-- a.cue --
package A

#C: X: number & <10
#B: X: number & >100
-- data.yaml --
X: 4200
-- err --
X: invalid value 4200 (out of bound <10):
    ./a.cue:3:17
    ./data.yaml:1:4

What did you expect to see?

A passing test, given https://cuelang.org/docs/reference/command/cue-help-vet/:

More than one expression may be given using multiple -d flags. Each non-CUE
file must match all expression values.

What did you see instead?

# These two cue vet invocations should fail with the same error message as they
# both validate the same data against the same pair of constraints, but with
# the constraints mentioned in different orders.
# cue vet #1 (0.138s)
# cue vet #2 (0.084s)
> ! exec cue vet .:A data.yaml -d '#C' -d '#B'
FAIL: cue.vet.multipleNamedSchemasDoNotFail.txtar:12: unexpected command success
@jpluscplusm jpluscplusm added NeedsInvestigation Triage Requires triage/attention ordering Bugs where the evaluator behaves differently depending on the order of fields, files, etc. labels Feb 4, 2025
@myitcv

This comment has been minimized.

@myitcv myitcv removed Triage Requires triage/attention ordering Bugs where the evaluator behaves differently depending on the order of fields, files, etc. labels Feb 4, 2025
@jpluscplusm

This comment has been minimized.

@myitcv myitcv added the vet candidate for a vet rule to detect suspect usage label Feb 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
NeedsInvestigation vet candidate for a vet rule to detect suspect usage
Projects
None yet
Development

No branches or pull requests

2 participants