-
Notifications
You must be signed in to change notification settings - Fork 303
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 -c flag may not be working as documented #2120
Comments
I've updated the repro to reflect this expectation, and for the Indeed, just to confirm my understanding, does this reflect the expectation? What did you do?
What did you expect to see?A passing test. What did you see instead?
(notice I have hand-crafted the output, because testscript ordinarily fails on the first failure) i.e. the bug here is not with Rather that without |
Correct.
I can see how it is better from a clarity perspective to represent the desired behavior in the testscript, not the current behavior. It's just hard to do that currently, as testscript stops at the first unexpected command result. That's why I tend to write a testscript which passes, even if that reflects the current bad behavior. Perhaps it would be enough for testscript to support Either way, it would be nice to clarify this in https://github.com/cue-lang/cue/wiki/Creating-test-or-performance-reproducers. That is, when filing a reproducer, should the testscript represent the desired or the current behavior? |
It's perhaps also worth noting that the thread is a bit confusing now that we have two slightly different test scripts and manually crafted outputs :) It's fine by me for you to continue editing my original post - then there's no need to have a sibling in a comment. |
Which is why I was pondering a mode for
I find this counterintuitive given that the heading is "What did you do?", not "What is the current behaviour?". As a reader, my expectation is therefore that I will be looking at a reproducer that shows me what the user tried to do. The heading that follows, "What did you expect to see?" then reflects their expectation given the reproducer. "What did you see instead?" represents the reality.
I'm not clear that this helps, because
Is that not clear from the questions in the bug report, per my comments above? I don't think it's specific to the wiki, rather the bug template itself. So if that can be improved we should do it there. |
I guess its usefulness would be rather limited, because some errors really are fatal and will break the following commands in basic ways. That's why I was thinking of
Sure, it's a bit of a tradeoff and I agree that clarity probably wins here. Though another aspect of manually constructing the testscript is that I can't run the whole thing to see what it does, as it just stops :) but perhaps that's solved by the same change we're talking about above.
Well, "what did you do" says nothing about whether the reproducer testscript should "PASS" or "FAIL". I default to "PASS to reproduce the bug", and you default to "PASS once the bug is fixed per my expectation". I don't think the template nor the wiki page point towards one method or the other. I did follow "what did you expect to see" (I expected to see "FAIL") and "what did you see instead" (I saw a "PASS", with the provided output). I don't have a particularly good idea about what the template could look like, yet. But where we explain how to write testscripts is the wiki page, so my intuition is that the expected result of running the testscript should be defined there too. |
FYI for anyone following along. Much of the exchange above will be dramatically improved by rogpeppe/go-internal#189. |
rogpeppe/go-internal#189 has landed, which makes it easier to express what's going on here in the form of test that is expected to pass. What did you do?Ran:
(notice use of the new What did you expect to see?Passing test. What did you see instead?
|
I've just been bitten by exactly this. I've tended to use The stderr warning given for non-concrete values when
|
The discussion about testscript was purely about providing a useful and self-describing reproduction script :) it has nothing to do with the fix itself. |
@rogpeppe pointed out that the flag currently has three states: Lines 113 to 118 in 48207fb
That is, the presence of the flag changes behavior, it's not just its true/false value. So we then have three modes currently:
I wasn't aware of the default mode being neither I would still leave this issue open. If the current behavior is desirable, it should be better documented, because I completely misunderstood it until Roger pointed me at the code. I would argue that the default behavior should be tweaked as well, though, per the discussion above; |
My last comment here is correct - I still think the three modes are slightly confusing and could be better documented - but we should focus on the bug at hand with |
Working on https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1203092 with @jpluscplusm, again highlights we should fix things here. |
FWIW, I'm still of the opinion here that the default of Hence:
We can therefore drop the tri-state nature of this flag, and lose Edit: updated to use incomplete/noncrete properly. I was sloppy given my focus on https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1203092 |
Changing the behavior is a breaking change for people that include But I think we are better served with coming up with a redesign on |
@myitcv and I are in agreement that, at minimum, for v0.12 we need to better document the existing behavior in |
On cuelang.org/docs/reference/command/ we have both the full set of auto-generated At the top of that page you'll see the link to the single guide we have thus far, for I propose we publish a parallel pair of |
Agreed. |
Tracked as cue-lang/docs-and-content#192 |
I've attempted to do this in https://cuelang.org/cl/1207991.
This is underway in https://cuelang.org/cl/1207010. |
This adds a brief landing page for cue-vet (at /docs/reference/command/cue-vet/) and links to it from a new card on the existing /docs/reference/command/ page. It adds a longer concept guide at /docs/concept/using-the-cue-vet-command/ which describes cue-vet's two operating modes: "CUE" mode and "data" mode. It also includes a mention of "cue vet -c" on /docs/concept/working-with-incomplete-cue/, so that a link to the page from the cue-vet concept guide to explain "incompleteness" then connects back (narratively speaking) to the concept guide. A header is added to the existing guide in order to split it up, as it's now a little too long just to be one section of prose. For cue-lang/cue#2120. Closes cue-lang/docs-and-content#192. Preview-Path: /docs/reference/command/ Preview-Path: /docs/reference/command/cue-vet/ Preview-Path: /docs/concept/using-the-cue-vet-command/ Preview-Path: /docs/concept/using-the-cue-vet-command/validating-cue/ Preview-Path: /docs/concept/using-the-cue-vet-command/validating-data/ Preview-Path: /docs/concept/working-with-incomplete-cue/ Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I4ab7af25f838b136f126e41682af9481e0eef15b Dispatch-Trailer: {"type":"trybot","CL":1207010,"patchset":11,"ref":"refs/changes/10/1207010/11","targetBranch":"master"}
How would folks feel about a CL that proposes a change in the general
... to ...
This small update would give the user of the current |
I think this might be a useful short term fix, however, I'm not clear that this is the best choice of wording. Because it seems to suggest we will suppress this message - what about the exit code? Instead, I would positively specify:
(granted the current error message is not good, but that's what we're trying to improve) |
Proposed in https://cuelang.org/cl/1208694. |
This adds a brief landing page for cue-vet (at /docs/reference/command/cue-vet/) and links to it from a new card on the existing /docs/reference/command/ page. It adds a longer concept guide at /docs/concept/using-the-cue-vet-command/ which describes cue-vet's two operating modes: "CUE" mode and "data" mode. It also includes a mention of "cue vet -c" on /docs/concept/working-with-incomplete-cue/, so that a link to the page from the cue-vet concept guide to explain "incompleteness" then connects back (narratively speaking) to the concept guide. A header is added to the existing guide in order to split it up, as it's now a little too long just to be one section of prose. For cue-lang/cue#2120. Closes cue-lang/docs-and-content#192. Preview-Path: /docs/reference/command/ Preview-Path: /docs/reference/command/cue-vet/ Preview-Path: /docs/concept/using-the-cue-vet-command/ Preview-Path: /docs/concept/using-the-cue-vet-command/validate-cue/ Preview-Path: /docs/concept/using-the-cue-vet-command/validate-data/ Preview-Path: /docs/concept/using-the-cue-vet-command/output/ Preview-Path: /docs/concept/working-with-incomplete-cue/ Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I4ab7af25f838b136f126e41682af9481e0eef15b Dispatch-Trailer: {"type":"trybot","CL":1207010,"patchset":14,"ref":"refs/changes/10/1207010/14","targetBranch":"master"}
This adds a brief landing page for cue-vet (at /docs/reference/command/cue-vet/) and links to it from a new card on the existing /docs/reference/command/ page. It adds a longer concept guide at /docs/concept/using-the-cue-vet-command/ which describes cue-vet's two operating modes: "CUE" mode and "data" mode. It also includes a mention of "cue vet -c" on /docs/concept/working-with-incomplete-cue/, so that a link to the page from the cue-vet concept guide to explain "incompleteness" then connects back (narratively speaking) to the concept guide. A header is added to the existing guide in order to split it up, as it's now a little too long just to be one section of prose. For cue-lang/cue#2120. Closes cue-lang/docs-and-content#192. Preview-Path: /docs/reference/command/cue-vet/ Preview-Path: /docs/reference/command/ Preview-Path: /docs/concept/using-the-cue-vet-command/ Preview-Path: /docs/concept/using-the-cue-vet-command/validate-cue/ Preview-Path: /docs/concept/using-the-cue-vet-command/validate-data/ Preview-Path: /docs/concept/using-the-cue-vet-command/output/ Preview-Path: /docs/concept/working-with-incomplete-cue/ Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I4ab7af25f838b136f126e41682af9481e0eef15b Dispatch-Trailer: {"type":"trybot","CL":1207010,"patchset":15,"ref":"refs/changes/10/1207010/15","targetBranch":"master"}
This adds a brief landing page for cue-vet (at /docs/reference/command/cue-vet/) and links to it from a new card on the existing /docs/reference/command/ page. It adds a longer concept guide at /docs/concept/using-the-cue-vet-command/ which describes cue-vet's two operating modes: "CUE" mode and "data" mode. It also includes a mention of "cue vet -c" on /docs/concept/working-with-incomplete-cue/, so that a link to the page from the cue-vet concept guide to explain "incompleteness" then connects back (narratively speaking) to the concept guide. A header is added to the existing guide in order to split it up, as it's now a little too long just to be one section of prose. For cue-lang/cue#2120. Closes cue-lang/docs-and-content#192. Preview-Path: /docs/reference/command/cue-vet/ Preview-Path: /docs/reference/command/ Preview-Path: /docs/concept/using-the-cue-vet-command/ Preview-Path: /docs/concept/using-the-cue-vet-command/validate-cue/ Preview-Path: /docs/concept/using-the-cue-vet-command/validate-data/ Preview-Path: /docs/concept/using-the-cue-vet-command/output/ Preview-Path: /docs/concept/working-with-incomplete-cue/ Signed-off-by: Jonathan Matthews <[email protected]> Change-Id: I4ab7af25f838b136f126e41682af9481e0eef15b Dispatch-Trailer: {"type":"trybot","CL":1207010,"patchset":16,"ref":"refs/changes/10/1207010/16","targetBranch":"master"}
What version of CUE are you using (
cue version
)?Does this issue reproduce with the latest release?
Yes; v0.4.3 has the same output.
What did you do?
What did you expect to see?
From
cue vet -h
, I see:So I would assume that
cue vet
would only check errors, andcue vet -c
would check for errors and require the resulting values to be concrete.So,
cue vet schema.cue data.json
should succeed, butcue vet -c schema.cue data.json
should fail as the value is not concrete.I would expect the same if the data is in CUE format rather than JSON. Any arguments being non-CUE files does make
vet
behave in a different mode, but as far as I can tell, that shouldn't affect whether we require concreteness (or completeness?).What did you see instead?
All four commands fail:
cc @rogpeppe
The text was updated successfully, but these errors were encountered: