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

evaluator: export as YAML vs JSON emits different templated data #2916

Closed
jpluscplusm opened this issue Mar 6, 2024 · 3 comments
Closed
Labels
encoding evaluator evalv3-win Issues resolved by switching from evalv2 to evalv3 NeedsInvestigation

Comments

@jpluscplusm
Copy link
Collaborator

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

$ cue version
cue version v0.8.0-alpha.5

go version go1.22.0
      -buildmode exe
       -compiler gc
       -trimpath true
     CGO_ENABLED 0
          GOARCH amd64
            GOOS linux
         GOAMD64 v1

Does this issue reproduce with the latest stable release?

Yes, 0.7.0.

What did you do?

I tried to export the same data as YAML and JSON:

exec cue export file.cue --out json
! stdout 1
exec cue export file.cue --out yaml
! stdout 1
-- file.cue --
a: {
	b: _
	[_]: c:      uint | *1
	[string]: c: >=3 | *3
}

What did you expect to see?

The same data emitted as both JSON and YAML.

What did you see instead?

> exec cue export file.cue --out json
[stdout]
{
    "a": {
        "b": {
            "c": 3
        }
    }
}
> ! stdout 1
> exec cue export file.cue --out yaml
[stdout]
a:
  b:
    c: 1
> ! stdout 1
FAIL: /tmp/testscript136453955/cue.export.yamlVsJsonDifferentData.txtar/script.txtar:4: unexpected match for `1` found in stdout: 1
@myitcv myitcv added evaluator and removed Triage Requires triage/attention labels Mar 17, 2024
@myitcv myitcv changed the title cmd/cue: export as YAML vs JSON emits different templated data evaluator: export as YAML vs JSON emits different templated data Mar 17, 2024
@myitcv
Copy link
Member

myitcv commented Mar 17, 2024

I've marked this as an evaluator issue for now. It we can be sure the evaluator has the "right" value here, then we can look at whether/why the encoders handle that differently.

@myitcv
Copy link
Member

myitcv commented Mar 17, 2024

As discussed, neither are valid i.e. the evaluator should have reported an unresolved disjunction in this situation:

Rewriting your example according to the notation used in the spec:

x: *1 | uint  // ⟨1 | uint, 1⟩
x: *3 | >=3   // ⟨3 | >=3, 3⟩

Applying rule U2, you can see that you end up with:

⟨(1 | uint)&(3 | >=3), 1&3⟩

1&3 is bottom, so we "lose" any default in this situation and we end up with:

⟨3&uint | >=3&uint⟩

which means we should be left with an unresolved disjunction.

What I think you were hinting at here is effectively achieved by:

job: {
	nginx: replicas:  2
	manager: command: "monit -I"
	etcd:     _
	boltdb:   _
	postgres: _
}

job: [Name=_]: {
	name:     Name
	command:  string | *"exec \(Name)"
}

#DB: =~"db$" | "etcd" | "postgres" | "mysql"
#NotDB: !~"db$" & !="etcd" & != "postgres" & != "mysql"

job: [#DB]:    replicas: >=3 | *3
job: [#NotDB]: replicas: uint | *1

where #NotDB could be written as not(#DB) under #943.

cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
Dispatch-Trailer: {"type":"trybot","CL":1177673,"patchset":39,"ref":"refs/changes/73/1177673/39","targetBranch":"alpha"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
Dispatch-Trailer: {"type":"trybot","CL":1177673,"patchset":41,"ref":"refs/changes/73/1177673/41","targetBranch":"alpha"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
cueckoo pushed a commit to cue-lang/cuelang.org-trybot that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
Dispatch-Trailer: {"type":"trybot","CL":1177673,"patchset":42,"ref":"refs/changes/73/1177673/42","targetBranch":"alpha"}
cueckoo pushed a commit to cue-lang/cuelang.org that referenced this issue Mar 19, 2024
See previous commit for context.

Page-specific notes:

* types:
  - change plaintext hierarchy diagram to mermaid
    - include top and bottom
  - explain "cue eval" as we've avoided it until now
* bottom:
  - change values in the example so they pop more visibly
  - explain what the example is showing
* top: [new page]
* numbers:
  - move some prose into the example's comments
  - mention number type
  - align tour with spec: `4` is *not* compatible with `float`.
  - add examples of float-related sugar
  - move mention of arbitrary precision into here, from
    docs/tour/types/bounddef/
* stringlit:
  - rename to mirror "Bytes"
  - remove comparison to JSON as it feels out of place
  - include interpolation in the example
* stringraw:
  - expand example to show comparative versions of the same string with
    different delimiters
* bytes:
  - plain text table changed to markdown
  - include mention of how to emit a stringified byte array to help
    avoid newcomer frustration
  - example expanded to include the same string being output as a string
    and as bytes' base64, to show the behaviour more clearly
  - include string interpolation of bytes to demo "how to display some
    bytes that you know aren't binary data, as a string"
  - include multiple examples of both hex and octal escapes, and
    demonstrate their equivalence via unification
* structs:
  - renamed from /optional; alias added
  - moved ahead of closed and defs to permit for a more natural flow
    through learning struct concepts
  - example is changed from a definition to a regular field, as this
    page now precedes definitions' page.
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* closed:
  - updated so it's suitable to accept inbound links that
    previously targeted the language guide
* defs:
  - updated to be a 90% copy of docs/tour/basics/definitions/, as that
    content is already written. Examples differ.
* disjunctions:
  - revise awkward wording of first sentence, as it's really jarring
    until the 3rd or 4th read through
  - stop explaining the example via the prose; use cue-eval-i instead to
    demonstrate evaluation failure
  - expand example's disjunction to include 4 values, so as to demo the
    syntax beyond just 2 elements
* defaults:
  - add explanation of why defaults exist, what CUE does with a default,
    and when
  - reuse "options" language from preceding page
  - make example abstract
    - include a 3-way disjunction so it's not implied that the default
      has to unify with the non-default
* sumstruct:
  - show CUE in action in the example
* bounds:
  - more narrative example, including a multi-constraint field
  - removed the sentence "The bound is defined for all values for which
    the corresponding comparison operation is defined", as it feels a
    little too technical for the tour
* bounddef:
  - move mention of arbitrary precision to docs/tour/types/numbers/
  - reword "no unsigned integer type" more positively
  - use cue vet for examples
  - make all examples fail
* lists:
  - expand explanation
  - change example to be more narrative, with less prose required for
    explanation
  - begin the examples with common, concrete use cases, so users can get
    what they need from this longer set of eamples more easily, whilst
    still demonstrating important syntactic detail nearer the end
  - include sufficient distinct examples so that the various syntaxes
    implied by the prose have concrete visualisations
  - include examples of two failure modes that can confuse newcomers
* templates:
  - mention pattern constraints
  - expand example to include a disjunction-based pattern constraint,
    and use top for field instantiation where possible
  - opened cue-lang/cue#2916
* value-constraints: [new page]
  - left as draft (i.e. not published) following feedback and awaiting
    later updates

For cue-lang/docs-and-content#78

Preview-Path: /docs/tour/types/types/
Preview-Path: /docs/tour/types/bottom/
Preview-Path: /docs/tour/types/top/
Preview-Path: /docs/tour/types/bounddef/
Preview-Path: /docs/tour/types/bounds/
Preview-Path: /docs/tour/types/bytes/
Preview-Path: /docs/tour/types/defaults/
Preview-Path: /docs/tour/types/structs/
Preview-Path: /docs/tour/types/closed/
Preview-Path: /docs/tour/types/defs/
Preview-Path: /docs/tour/types/disjunctions/
Preview-Path: /docs/tour/types/numbers/
Preview-Path: /docs/tour/types/lists/
Preview-Path: /docs/tour/types/stringlit/
Preview-Path: /docs/tour/types/stringraw/
Preview-Path: /docs/tour/types/sumstruct/
Preview-Path: /docs/tour/types/templates/
Signed-off-by: Jonathan Matthews <github@hello.jonathanmatthews.com>
Change-Id: Id4870cb92903bfcb7662fb236a7da2ace15a24c5
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cuelang.org/+/1177673
TryBot-Result: CUEcueckoo <cueckoo@gmail.com>
Reviewed-by: Paul Jolly <paul@myitcv.io>
@myitcv
Copy link
Member

myitcv commented Jul 22, 2024

Noting that the new evaluator gets things right here:

env CUE_EXPERIMENT=evalv3

! exec cue export file.cue --out json
cmp stderr stderr.golden
! exec cue export file.cue --out yaml
cmp stderr stderr.golden
-- file.cue --
a: {
	b: _
	[_]: c:      uint | *1
	[string]: c: >=3 | *3
}
-- stderr.golden --
a.b.c: incomplete value >=3 & int | 3

i.e. this passes.

@mvdan mvdan added the evalv3-win Issues resolved by switching from evalv2 to evalv3 label Aug 13, 2024
cueckoo pushed a commit that referenced this issue Aug 28, 2024
While here, move the extremely similar regression test from #2916
out of a cmd/cue testscript and into cue/testdata.
The txtar tests in cue/testdata are better suited for evaluator tests
as they test all evaluator versions, diff between them, and also include
other information such as evaluator stats and compiler debugging info.

Closes #3157.

Signed-off-by: Daniel Martí <mvdan@mvdan.cc>
Change-Id: Icdb61cc89178b8236ea9ba8ad42c087a798c66ff
Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1200094
Reviewed-by: Matthew Sackman <matthew@cue.works>
TryBot-Result: CUEcueckoo <cueckoo@cuelang.org>
Unity-Result: CUE porcuepine <cue.porcuepine@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
encoding evaluator evalv3-win Issues resolved by switching from evalv2 to evalv3 NeedsInvestigation
Projects
None yet
Development

No branches or pull requests

3 participants