Skip to content

eval: regression in use of close with matchN #3694

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 Jan 22, 2025 · 3 comments
Closed

eval: regression in use of close with matchN #3694

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

Comments

@myitcv
Copy link
Member

myitcv commented Jan 22, 2025

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

$ cue version
cue version v0.0.0-20250122112448-ac4c7d0c2f80

go version go1.23.2
      -buildmode exe
       -compiler gc
  DefaultGODEBUG asynctimerchan=1,gotypesalias=0,httpservecontentkeepheaders=1,tls3des=1,tlskyber=0,x509keypairleaf=0,x509negativeserial=1
     CGO_ENABLED 1
          GOARCH arm64
            GOOS linux
         GOARM64 v8.0
             vcs git
    vcs.revision ac4c7d0c2f80d276a134f6e0eebd3b4c724854eb
        vcs.time 2025-01-22T11:24:48Z
    vcs.modified false
cue.lang.version v0.12.0

Does this issue reproduce with the latest release?

n/a - working with tip.

What did you do?

env CUE_EXPERIMENT=evalv3

exec cue eval x.cue

-- x.cue --
#step: matchN(1, [{
	"uses"!: _
	...
}, {
	"run"!: _
	...
}]) & close({
	"uses"?: string
	"run"?:  string
})

What did you expect to see?

Passing test.

What did you see instead?

> env CUE_EXPERIMENT=evalv3
> exec go run cuelang.org/go/cmd/cue eval x.cue
[stderr]
#step: invalid value {uses?:string,run?:string} (does not satisfy matchN): 0 matched, expected 1:
    ./x.cue:1:8
    ./x.cue:1:15
exit status 1
[exit status 1]
FAIL: /tmp/testscript198252630/repro.txtar/script.txtar:6: unexpected command failure

This bisects to aa6781f, and is currently a blocker for curated modules.

@myitcv myitcv added evaluator evalv3 issues affecting only the evaluator version 3 NeedsInvestigation labels Jan 22, 2025
@mpvl
Copy link
Member

mpvl commented Jan 23, 2025

It is correct it is an error, but it should be an incomplete error, instead of terminal error. (i.e. eval should indeed pass.)

@myitcv
Copy link
Member Author

myitcv commented Jan 23, 2025

@mvdan is absolutely correct in that I should have reported the root problem here, which I do below, using cue export and not cue eval:

What did you do?

env CUE_EXPERIMENT=evalv3

exec cue export x.cue
cmp stdout stdout.golden

-- x.cue --
#step: matchN(1, [{
	"uses"!: _
	...
}, {
	"run"!: _
	...
}]) & close({
	"uses"?: string
	"run"?:  string
})

s: #step & {
	run: "echo hello world"
}
-- stdout.golden --
{
    "s": {
        "run": "echo hello world"
    }
}

What did you expect?

Passing test.

What did you see instead?

> env CUE_EXPERIMENT=evalv3
> exec cue export x.cue
[stderr]
#step: invalid value {uses?:string,run?:string} (does not satisfy matchN): 0 matched, expected 1:
    ./x.cue:1:8
    ./x.cue:1:15
[exit status 1]
FAIL: /tmp/testscript364055009/repro.txtar/script.txtar:3: unexpected command failure

The analysis/conclusion etc might be exactly the same, but either way for completeness' sake I capture the real trigger for this in our use case.

@mpvl
Copy link
Member

mpvl commented Jan 23, 2025

It was more intended as an analysis and note to self. :)

Found the cause, but not the solution. The bisect CL is correct, but exposes this preexisting bug.

cueckoo pushed a commit that referenced this issue Jan 24, 2025
Issue #3694

Signed-off-by: Marcel van Lohuizen <[email protected]>
Change-Id: Icab058ba8c14bcd4b5927505f80860c9b925cfeb
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1207713
TryBot-Result: CUEcueckoo <[email protected]>
Unity-Result: CUE porcuepine <[email protected]>
Reviewed-by: Roger Peppe <[email protected]>
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