Skip to content

Releases: cue-lang/cue

v0.8.0

15 Mar 12:33
Compare
Choose a tag to compare

This release includes experimental support for CUE Modules (more details below), as well as a number of improvements and fixes.

More CLs and refactors have also landed for the core evaluator's performance work. These aren't enabled yet as the work isn't complete; subscribe to the performance umbrella issue to read regular updates.

As a reminder: users can register their projects with Unity, our regression and performance testing setup. Unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. It continues to catch multiple issues with each release. Adding your project to Unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.

Modules

This release includes experimental support for CUE modules in cmd/cue, as outlined in the updated Modules and package management proposal v3.

Alongside this release, we have published a tutorial on the new website which shows how to publish and fetch modules with a custom module registry.

We have also published the first version of the Modules reference documentation, the canonical documentation page describing how CUE modules work in detail.

Note that support for CUE modules is still experimental and subject to change, and needs to be explicitly enabled via CUE_EXPERIMENT=modules. See cue help environment for more information on the environment variables used below.

CUE maps modules to registries via $CUE_REGISTRY, which supports a simple string configuration format as well as a more detailed CUE configuration format which can be read from disk. See cue help registryconfig for more details.

The new cue mod tidy command rewrites cue.mod/module.cue in its canonical format, adds any missing module dependency requirements, and removes unused ones.

The new cue mod publish command publishes the current module to a module registry.

The new cue mod get command can add a new module dependency, update an existing one, or downgrade an existing one as long as it does not cause any conflict.

When running commands like cue export with CUE_EXPERIMENT=modules, dependencies are automatically fetched from module registries following $CUE_REGISTRY and cached on disk inside $CUE_CACHE_DIR.

CUE Language Server Protocol Implementation

This release includes the first early version of an experimental Language Server Protocol (LSP) implementation for CUE. Whilst it remains experimental, the cmd/cuepls binary is separate from cmd/cue. However at a later date it will most likely to become a subcommand of cmd/cue like cue lsp serve.

We are working on updating the VSCode plugin to use cmd/cuepls, as well as supporting an initial version of a plugin for Neovim. For JetBrains users, we are working with the author of the CUE plugin to understand how best to integrate cmd/cuepls with JetBrains.

We will share announcements once the editor integrations are ready for use, and once more LSP features beyond formatting files are available. Subscribe to the LSP announce discussion, or join us in #cuepls on CUE Slack.

Go API

Note that this version of CUE requires Go 1.21 or later, following our policy to support the latest two stable Go releases just like upstream.

The cue/load package supports the CUE Modules experiment out of the box with the environment variable CUE_EXPERIMENT=modules. Alternatively, a custom registry and authorizer can be configured with the Config.Registry field via the modconfig.NewRegistry API.

cue/load also has a new Config.Env struct field to provide the environment variables used to load CUE modules from registries. It defaults to using os.Environ.

We have also added new Go examples to the cue/load package, including an example demonstrating the use of a CUE modules registry.

CL 1173271 drops support for legacy pkg directories, which have been deprecated since the transition to a cue.mod directory in 2019.

CL 1174069 replaces a few more uses of the deprecated cue.Instance type with cue.InstanceOrValue.

CL 1175779 deprecates the FileOffset and File.Base APIs in cue/token, which were inherited from go/token but never had any effect.

Language

There are no changes to the language in this version.

Spec

CL 1173197 makes the use of the term "builtin function" consistent across the document.

Core Evaluator

CL 1173262 fixes a regression introduced by v0.7.0's upgrade to github.com/cockroachdb/apd/v3 where some arithmetic operations would result in an extra 0 digit.

Encoders

CL 1173689 fixes the YAML encoder so that strings looking like hexadecimal numbers are properly quoted.

Builtins

CL 1173735 replaces the uses of Go's net package with net/netip when dealing with IP addresses, which makes them immutable, comparable, and take less memory.

CL 1173926 adds an IPv6 API to net to check that a value is a valid IPv6 address, mirroring IPv4 and taking advantage of the switch to the Go net/netip package.

CL 1174339 fixes tool/exec so that it correctly applies env defaults in CUE values.

CL 1174623 fixes tool/exec so that it accepts env list values as documented.

cmd/cue

CL 1176194 adds a language.version field to cue.mod/module.cue to track what CUE language version a module was written for. This will become necessary to make future language changes as smooth as possible for CUE users. For example, running cue mod init or cue mod tidy with the v0.8.0 release should add language: version: "v0.8.0" when the field isn't present.

CL 1173892 adds a cue help environment section to document the environment variables used by the CLI, such as CUE_EXPERIMENT and CUE_REGISTRY.

CL 1176665 fixes cue cmd so that legacy commands always get the corresponding CUE schema unified.

CL 1177330 fixes a bug where some evaluation errors in tools/flow and cue cmd were omitted, causing unintended results.

CL 1177546 tweaks cmd/cue so that it obeys the --package flag when the output format is CUE.

Full list of changes since v0.7.1
  • internal/cueversion: bump fallbackVersion for v0.8.0 by @mvdan in 7d75741
  • cue/load: make packages specified as args work correctly by @rogpeppe in c399d88
  • internal/mod/modresolve: do not use regular field in registry config schema by @rogpeppe in d272140
  • update cuelabs.dev/oci/ociregistry to pull in fix for #2934 by @mvdan in 0e33883
  • cmd/cue: mod init should only add @v0 with the experiment by @mvdan in 24f93c9
  • cmd/cue: repurpose modinit test for language.version by @mvdan in 77741ff
  • cmd/cue: mention CUE_DEBUG in cue help environment by @rogpeppe in d5ecd6c
  • internal/mod/modresolve: fix stripPrefix for exact match by @rogpeppe in fa65317
  • internal/_e2e: remove cleanup.go and tools.go by @mvdan in ec6cc09
  • internal/e2e: join into the root Go module by @mvdan in 31e47e2
  • internal/e2e: test that we can't replace published versions by @mvdan in d1104bd
  • internal/e2e: stop creating GitHub repositories by @mvdan in ba698de
  • all: prevent tests from using the host's docker/config.json by @mvdan in d48dcbe
  • internal/cueversion: bump fallbackVersion for v0.8.0-rc.1 by @mvdan in ccb64b1
  • doc/tutorial: skip module.cue as a golden file to avoid churn by @mvdan in d97e914
  • cmd/cue: use CUE_VERSION_OVERRIDE in script tests to avoid churn by @mvdan in e529ce6
  • cmd/cue: fix "login" on a clean environment, and add tests by @mvdan in f6238e5
  • internal/cueversion: convert spaces to underscore in Go version by @rogpeppe in 0b7c434
  • cmd/cue,mod/modconfig: send Use...
Read more

v0.8.0-rc.1

13 Mar 10:18
Compare
Choose a tag to compare
v0.8.0-rc.1 Pre-release
Pre-release

This release includes a number of fixes and improvements for the experimental support for CUE modules first released in v0.8.0-alpha.1.

Modules

cue mod tidy gained a --check flag, which succeeds only if the module file contains exactly the required dependencies and also contains a canonical CUE language version.

cmd/cue and cue/load now send a detailed HTTP User-Agent string to CUE registries when sending HTTP requests, including the CUE and Go versions, rather than Go's default net/http user agent string.

cmd/cue now supports CUE_DEBUG=http to print HTTP logging information to stderr in JSON format.

Local builds of cmd/cue, such as running go install ./cmd/cue, now include a proper CUE version, allowing cue mod init and cue mod tidy to insert language.version as expected.

Full list of changes since v0.8.0-alpha.5
  • internal/cueversion: bump fallbackVersion for v0.8.0-rc.1 by @mvdan in ccb64b1
  • doc/tutorial: skip module.cue as a golden file to avoid churn by @mvdan in d97e914
  • cmd/cue: use CUE_VERSION_OVERRIDE in script tests to avoid churn by @mvdan in e529ce6
  • cmd/cue: fix "login" on a clean environment, and add tests by @mvdan in f6238e5
  • internal/cueversion: convert spaces to underscore in Go version by @rogpeppe in 0b7c434
  • cmd/cue,mod/modconfig: send User-Agent header by @rogpeppe in 6db0b7f
  • internal/cueversion: new package by @rogpeppe in 5dbbbcb
  • cmd/cue: enable HTTP logging for cue login by @rogpeppe in 9f556fe
  • cmd/cue: implement cue mod tidy --check by @rogpeppe in 9789ee6
  • internal/modload: implement tidiness checker by @rogpeppe in 405511d
  • mod/modfile: check canonical language version by @rogpeppe in 2e503e0
  • internal/mod/modload: split Tidy from UpdateVersions by @rogpeppe in 0a23647
  • bump ociregistry dependency to pull in a panic fix by @mvdan in 382ea51
  • cmd/cue: implement support for HTTP logging by @rogpeppe in 9c8b09a
  • internal/httplog: new package by @rogpeppe in 893798b
  • Revert "internal/e2e: partially revert using cue mod init modpath@version" by @mvdan in b1e40ae
  • cmd/cue: use fallbackVersion when built via a directory replace by @mvdan in e54fb85
  • cmd/cue: hard-code a fallback CUE semver version by @mvdan in fc7038a
  • update golang.org/x/... dependencies for v0.8.0 by @mvdan in 6afa3ef
  • internal/ci: update the pinned Go version for v0.8 by @mvdan in a1e8429
  • internal/cuedebug: new package by @rogpeppe in 6ad495d
  • cue/load: fix race in testing by @rogpeppe in ee26ee2
  • mod/modconfig: make http transport configurable by @rogpeppe in 0ef11fc
  • internal/core/adt: set nonRooted by @mpvl in 28ae97d
  • internal/core/debug: more state in formation by @mpvl in 2273c7d
  • internal/core/adt: make runner a struct instead of func by @mpvl in 0651453
  • internal/core/adt: fix conjunct index by @mpvl in 2554094
  • internal/core/adt: implement new evaluator by @mpvl in 5f55954
  • internal/core/adt: only error if inspected node missed counters by @mpvl in c547590
  • internal/core/adt: closedness improvements by @mpvl in b7f76be
  • internal/core/adt: add lifetime check for closedness by @mpvl in cdcb6fa
  • internal/core/adt: mark functions only used in old evaluator by @mpvl in f55405b
  • internal/core/adt: exclude tests with disjunctions by @mpvl in 145b436
  • internal/core/adt: propagate closedness up by @mpvl in 9d951f6
  • internal/core/adt: introduce visual CUE debugger by @mpvl in 37c0260

v0.8.0-alpha.5

05 Mar 16:06
Compare
Choose a tag to compare
v0.8.0-alpha.5 Pre-release
Pre-release

This release includes a number of fixes and improvements for the experimental support for CUE modules first released in v0.8.0-alpha.1.

Modules

A new cue mod get command is added, which can add a new module dependency, update an existing one, or downgrade an existing one as long as it does not cause any conflict.

The cue/load package has a new Config.Env struct field to provide the environment variables used to load CUE modules from registries.

A new cue help registryconfig documentation section has been added, explaining how $CUE_REGISTRY works as well as the configuration file schema it supports.

Full list of changes since v0.8.0-alpha.4

v0.8.0-alpha.4

29 Feb 15:53
Compare
Choose a tag to compare
v0.8.0-alpha.4 Pre-release
Pre-release

This release includes a number of fixes and improvements for the experimental support for CUE modules first released in v0.8.0-alpha.1.

Thank you to @kharf, @mvdan, @myitcv, @nickfiggins, and @rogpeppe for contributing to this release!

Modules

The cue/load package now supports loading CUE instances using the CUE Modules experiment, which was first added to cmd/cue in v0.8.0-alpha.1.

cue/load supports the CUE Modules experiment out of the box with the environment variable CUE_EXPERIMENT=modules. Alternatively, a custom registry and authorizer can be configured with the Config.Registry field via the modconfig.NewRegistry API.

We have also added new Go examples to the cue/load package, including an example demonstrating the use of a CUE modules registry.

Other changes

CL 1177330 fixes a bug where some evaluation errors in tools/flow and cue cmd were omitted, causing unintended results.

CL 1177546 tweaks cmd/cue so that it obeys the --package flag when the output format is CUE.

Full list of changes since v0.8.0-alpha.3

v0.8.0-alpha.3

21 Feb 13:17
Compare
Choose a tag to compare
v0.8.0-alpha.3 Pre-release
Pre-release

This release includes a number of fixes and improvements for the experimental support for CUE modules first released in v0.8.0-alpha.1.

Note that we skipped over v0.8.0-alpha.2 due to a minor release automation issue.

Modules

CUE_REGISTRY now supports a CUE configuration file in addition to the simple string form, which allows greater control over how to publish CUE modules as artifacts on OCI registries. This is useful when publishing to OCI registries which do not support arbitrary repository names, for example. This is not fully documented yet, but the schema for the file is available here and setting CUE_REGISTRY=file:path/to/file enables its use.

All cue subcommands should now support the modules experiment when it is enabled via CUE_EXPERIMENT=modules.

cue mod init now adds the language.version field as needed, to ensure that running cue mod tidy immediately after results in no changes.

CUE_MODCACHE has been replaced with CUE_CACHE_DIR, a parent directory to hold all cache files, much like how CUE_CONFIG_DIR already works for configuration files.

cue mod registry, a hidden command to start a local in-memory OCI registry for testing purposes, now treats repository tags as immutable to ensure published module versions cannot be modified. The "Working with a custom module registry" tutorial has been updated to use cue mod registry.

CUE Language Server Protocol Implementation

This release includes the first version of an experimental Language Server Protocol (LSP) implementation for CUE. Whilst it remains experimental, the cmd/cuepls binary is separate from cmd/cue. However at a later date it will most likely to become a subcommand of cmd/cue like cue lsp serve.

We are working on updating the VSCode plugin to use cmd/cuepls, as well as supporting an initial version of a plugin for Neovim. For JetBrains users, we are working with the author of the CUE plugin to understand how best to integrate cmd/cuepls with JetBrains.

Subscribe to the LSP announce discussion, or join us in #cuepls on CUE Slack.

Full list of changes since v0.8.0-alpha.1

v0.8.0-alpha.1

13 Feb 10:10
Compare
Choose a tag to compare
v0.8.0-alpha.1 Pre-release
Pre-release

This release includes experimental support for CUE Modules (more details below), as well as a number of improvements and fixes.

More CLs and refactors have also landed for the core evaluator's performance work; they aren't enabled yet as the work isn't complete.

As a reminder: users can register their projects with Unity, our regression and performance testing setup. Unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. It continues to catch multiple issues with each release. Adding your project to Unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.

Thank you to @4ad, @cedricgc, @jpluscplusm, @martingreber, @mpvl, @mvdan, @myitcv, @nickfiggins, @nnnkkk7, @rogpeppe, and @vikstrous for contributing to this release!

Modules

This release includes experimental support for CUE modules in cmd/cue, as outlined in the Modules and package management proposal. We are also working on v3 of the modules proposal docs to coincide with the release of v0.8.0.

Alongside this release, we have published a tutorial on the new website which shows how to publish and fetch modules with a custom module registry.

We have also published the first version of the Modules reference documentation, the canonical documentation page describing how CUE modules work in detail.

Note that support for CUE modules is still experimental and subject to change, and needs to be explicitly enabled via CUE_EXPERIMENT=modules. See cue help environment for more information on the environment variables used below.

The cue mod tidy command is introduced, which rewrites cue.mod/module.cue in its canonical format, adds any missing module dependency requirements, and removes unused ones.

The cue mod publish command is also added. This publishes a version of the current module to a module registry.

When running commands like cue export with CUE_EXPERIMENT=modules, dependencies are automatically fetched from module registries following $CUE_REGISTRY and cached on disk.

Note that support for fetching modules from OCI registries via cue/load isn't ready yet; support for Go library users will be announced at a later time.

Go API

Note that this version of CUE requires Go 1.21 or later, following our policy to support the latest two stable Go releases just like upstream.

CL 1173271 drops support for legacy pkg directories, which have been deprecated since the transition to a cue.mod directory in 2019.

CL 1174069 replaces a few more uses of the deprecated cue.Instance type with cue.InstanceOrValue.

CL 1175779 deprecates the FileOffset and File.Base APIs in cue/token, which were inherited from go/token but never had any effect.

Language

There are no changes to the language in this version.

Spec

CL 1173197 makes the use of the term "builtin function" consistent across the document.

Core Evaluator

CL 1173262 fixed a regression introduced by v0.7.0's upgrade to github.com/cockroachdb/apd/v3 where some arithmetic operations would result in an extra 0 digit.

Encoders

CL 1173689 fixed the YAML encoder so that strings looking like hexadecimal numbers are properly quoted.

Builtins

CL 1173735 replaces the uses of Go's net package with net/netip when dealing with IP addresses, which makes them immutable, comparable, and take less memory.

CL 1173926 adds an IPv6 API to net to check that a value is a valid IPv6 address, mirroring IPv4 and taking advantage of the switch to the Go net/netip package.

CL 1174339 fixes tool/exec so that it correctly applies env defaults in CUE values.

CL 1174623 fixes tool/exec so that it accepts env list values as documented.

cmd/cue

CL 1173892 adds a cue help environment section to document the environment variables used by the CLI, such as CUE_EXPERIMENT and CUE_REGISTRY.

CL 1176665 fixes cue cmd so that legacy commands always get the corresponding CUE schema unified.

CL 1176194 starts adding a language.version field to cue.mod/module.cue, to start tracking what CUE language version a module's config files were written for. This will become necessary to make future language changes as smooth as possible for CUE users. For example, running cue mod init or cue mod tidy with the future CUE v0.8.0 release should add language: version: "v0.8.0" when the field isn't present.

Full list of changes since v0.7.1
  • README: briefly document that we support two Go versions by @mvdan in e69d893
  • cue/interpreter/wasm: rework the way we test Wasm by @4ad in 41b9e66
  • cue/interpreter/wasm: remove Wazero global state by @4ad in 6d68b3a
  • cue/interpreter/wasm: add support for Wasm functions that take and return structs by @4ad in 2ce1036
  • cue/interpreter/wasm: add support for arbitrary types in extern attributes by @4ad in c896078
  • internal/core/runtime: expand runtime.Compile signature to accomodate non-builtins by @4ad in 063b8c1
  • cmd/cue,pkg/tool/exec: rely on cue schema for exec.Run defaults by @nickfiggins in b460e71
  • cmd/cue: unhide mod tidy and mod publish by @myitcv in d37ea66
  • internal/ci: run the end-to-end tests with -race by @mvdan in a948eb5
  • cmd/cue: add testscript for registry auth via logins.json by @mvdan in 64c5656
  • cmd/cue: fix registry client race by @rogpeppe in 3d1c0cb
  • cmd/cue: add mod registry server command by @rogpeppe in 649c7f6
  • clarify that we require Go 1.21 or later now by @mvdan in bef7c4e
  • internal/ci: upgrade Go matrix include go1.22.0 by @myitcv in 63dbc2d
  • internal/ci: use node.js 20-compatible action versions by @myitcv in 15a4b3e
  • README: simplify "install from source" instructions by @mvdan in 5037afc
  • README: add Docker badge and instructions by @mvdan in b6a6f67
  • bump cuelabs.dev/go/oci/ociregistry dependency by @mvdan in 0eb0106
  • cmd/cue: simplify exec trimming in TestX by @nnnkkk7 in eafeb11
  • pkg/path: fix package comment by @jpluscplusm in 4818cf7
  • cue/load: allow conversion of module-local paths to OS paths by @rogpeppe in 20451a6
  • cmd/cue: add test for self import in modules mode by @rogpeppe in 707c6d7
  • internal/e2e: switch all tests to cue mod publish by @mvdan in 2930a8e
  • README: remove obsolete mention of Google by @jpluscplusm in 64a117c
  • cue/load: make the tests less noisy by @mvdan in 079532c
  • cue/load: use fewer absolute paths in tests by @mvdan in a25c24b
  • cue/parser: make the example self-contained by @mvdan in fc77363
  • internal/mod/modload: fix panic on error in tidy by @rogpeppe in 3146f22
  • internal/mod: fix tidy in the presence of local code by @rogpeppe in 2a56875
  • cmd/cue: make the config directory configurable by @mvdan in 22b1ca3
  • internal/e2e: start using cue mod tidy by @mvdan in 34db9eb
  • cmd/cue: add version to module.cue file by @rogpeppe in 9ceec10
  • cue/load: fix crash when there is no module file by @rogpeppe in ec7ca0a
  • internal/e2e: start using cue mod init modpath@version by @mvdan in 7855e15
  • cue/token: deprecate base offset by @rogpeppe in b0358a6
  • cmd/cue/cmd: support major versions in module path by @rogpeppe in e8efa7e
  • internal/mod/modload: support adding language version by @rogpeppe in 2120803
  • internal/mod/modpkgload: support gen directories by @rogpeppe in c6e4adf
  • internal/e2e: tweak expected error string after the cue/load changes by @mvdan in b67300b
  • cue/load: use modpkgload to resolve dependencies by @rogpeppe in fa12218
  • cmd/cue/cmd: add (failing) submodule test by @RogP...
Read more

v0.7.1

12 Feb 15:11
Compare
Choose a tag to compare

This release is a re-build of CUE v0.7.0 with Go 1.22.0 to prevent cue get go panics; see #2802.

v0.7.0

06 Dec 12:10
Compare
Choose a tag to compare

This release comprises a number of bug fixes and small improvements, as well as more ground work for Modules, WebAssembly, and the core evaluator's performance refactors.

Note that v0.7 was originally planned to center around the core evaluator's performance improvements. Since those refactors are not ready, and we have other fixes and improvements we want to release, we have slightly altered the release plan accordingly. We will share more details on our next community call.

As a reminder: users can register their projects with Unity, our regression and performance testing setup. Unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. Unity continues to catch multiple issues with each release. Adding your project to Unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.

Thank you to @SteVwonder, @bozaro, @cedricgc, @howardjohn, @mpvl, @mvdan, @myitcv, @nickfiggins, @rogpeppe, @rudifa, and @uhthomas for contributing to this release!

And a special thanks to all who joined the recent contributor office hours calls on our community calendar, as well as our #contributing channel on Slack! Thanks to their involvement, more issues can be investigated and fixed each release.

Go API

Note that this version of CUE requires Go 1.20 or later, per our policy to support the latest two stable Go releases just like upstream.

CL 1172105 fixes a regression introduced in v0.6.0 where calling Iterator.Selector.Index while iterating over a list would incorrectly panic.

CL 1167597 fixes cue/load so it now errors on package import cycles, following the spec.

CL 1167647 adjusts cue.Value.Decode to decode empty CUE lists into a Go interface{} as a non-nil empty slice.

CL 547369 teaches cue.Value.Decode how to decode values which aren't entirely concrete into a Go type by using cue.Value as part of the destination type.

Language

There are no changes to the language in this version.

Spec

CL 1171216 fixes two errors in a dynamic fields example.

Core Evaluator

CL 1172014 disallows the direct use of unary operators with basic types, since they would result in confusing bounds which seemed incorrect.

CL 1172013 fixes a closedness bug where close did not properly apply when used inside definitions.

CL 1172874 fixes a panic in cue export introduced by v0.6.0.

Encoders

CL 1172314 teaches encoding/protobuf to follow the field_behavior annotation marking a field as either optional or required when decoding.

Builtins

CL 1172991 adds a mustSucceed boolean parameter to tool/exec.Run, which can be set to false to allow a command to fail and set its own field success to false.

CL 557322 fixes the values of math's Log2E and Log10E constants, which were being incorrectly truncated.

cmd/cue

CLs 1170966 and 1171302 fix a number of issues in cue fmt (and by extension the cue/format package), resulting in better and more consistent formatting of CUE files.

CLs 1171292, 1171015, 1170115, and 1171971 implement a variety of improvements and bug fixes for cue get go.

CL 1172017 fixes a number of issues with the line and column positions reported by our YAML decoder, which could result in weird CUE formatting when using cue import or misleading positions being shown to the user.

CL 1169709 increases the robustness of cue export -o, which in some situations could ignore file errors or incorrectly replace an existing file without the -f flag.

CL 1173072 fixes a panic when using cue import --list with empty YAML input.

CL 1168436 updates the cue export documentation to add the missing cue and binary supported export formats.

Modules

A number of changes are included to support an experimental implementation of the proposed modules and package management support. These aren't enabled by default, and will be announced soon.

Full list of changes since v0.6.0
  • internal/ci: bump to Go 1.21.5 for the upcoming release by @mvdan in ce1ad81
  • cmd/cue: fix panic when importing empty files as a list by @uhthomas in b36b477
  • internal/core/adt: change semantics of unary_op(basictype) by @mpvl in e1ceed4
  • internal/core/adt: fix closedness bug by @mpvl in 886eefd
  • internal/core/adt: add test to prepare for fix by @mpvl in 145764d
  • CONTRIBUTING: mention the Slack channel and office hours calls by @mvdan in 16a0cda
  • pkg/tool/exec: add a Run.mustSucceed parameter by @nickfiggins in 10c4796
  • cue: explicitly document values are not safe for concurrent use by @mvdan in d805c22
  • internal/ci: bump Go and GoReleaser for v0.7.0-rc.1 by @mvdan in 8f88dcb
  • internal/slices: move from internal/mod/mvs/internal/slices by @rogpeppe in 0e51dbb
  • internal/mod/internal/par: move from internal/mod/mvs/internal/par by @rogpeppe in fe0e04a
  • internal/registrytest: do not check that dependencies exist by @rogpeppe in 99bdbad
  • internal/mod/modimports: new package by @rogpeppe in 79033c2
  • internal/core/export: fix a recent nil pointer regression by @rudifa in 141925a
  • internal/core/adt: use state directly by @mpvl in bba2263
  • internal/core/adt: expand on permutations for test by @mpvl in 596fdc9
  • internal/cuetxtar: include diff between test and fallback test by @mpvl in 6774d0d
  • internal/txtarfs: factor out from registrytest by @rogpeppe in 265a7a0
  • internal/cueimports: export API and fix for CUE syntax by @rogpeppe in 47d6dce
  • internal/cueimports: copy code from cue/load by @rogpeppe in 9e55783
  • cue/load: remove unused functionality by @rogpeppe in b727189
  • all: replace html/template by text/template by @mvdan in 361ae4f
  • encoding/protobuf: support field_behavior "required" option by @howardjohn in 80b0eee
  • cmd/cue: fix incorrect position in yaml import by @uhthomas in d97b0c3
  • all: adopt .gitignore for new delve binary naming by @mpvl in 68e9d5d
  • internal/core/adt: make ListMarker Src an expression by @mpvl in f59894c
  • internal/core/adt: changes needed for new evaluator by @mpvl in fb88beb
  • cue: don't panic on Iterator.Selector.Index with lists by @mvdan in 9dd0f82
  • cue: allow top level JSON marshalers in EncodeType by @rogpeppe in 8f796bf
  • cue: support decoding into cue.Value fields by @rogpeppe in b25fc05
  • internal/mod/mvs: discard copied par tests by @mvdan in 4e30101
  • CONTRIBUTING: fix repo reference rendering by @cedricgc in 7a4ea86
  • internal/e2e: make unique module names more robust by @mvdan in a404c89
  • cmd/cue: support optional comments in get go by @uhthomas in 67ea9cf
  • cmd/cue: ignore complex types in get go by @uhthomas in 112b0b2
  • pkg/internal/builtintest: don't print superfluous newlines by @uhthomas in 8b32c49
  • internal/tdtest: document how the name field is used by @rogpeppe in deab307
  • internal/e2e: add a test for a private github repo by @mvdan in 4d2ba88
  • internal/ci: add gcloud auth to the e2e tests by @mvdan in 95a88a5
  • CONTRIBUTING: clarify two sections by @cedricgc in d947a69
  • internal/e2e: add a "cue mod upload" end-to-end test with gcloud by @mvdan in a060f85
  • internal/e2e: rename existing testscript and add a summary by @mvdan in 4dba8dd
  • internal/e2e: tweak how we use secret env vars by @mvdan in d3efde7
  • internal/mod/modfile: ...
Read more

v0.7.0-rc.1

04 Dec 14:37
Compare
Choose a tag to compare
v0.7.0-rc.1 Pre-release
Pre-release

This release comprises a number of bug fixes and small improvements, as well as more ground work for Modules, WebAssembly, and the core evaluator's performance refactors.

Note that v0.7 was originally planned to center around the core evaluator's performance improvements. Since those refactors are not ready, and we have other fixes and improvements we want to release, we have slightly altered the release plan accordingly. We will share more details on our next community call.

As a reminder: users can register their projects with unity, our regression and performance testing setup. unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. unity continues to catch multiple issues with each release. Adding your project to unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.

Thank you to @SteVwonder, @bozaro, @cedricgc, @howardjohn, @mpvl, @mvdan, @myitcv, @nickfiggins, @rogpeppe, @rudifa, and @uhthomas for contributing to this release!

And a special thanks to all who joined the recent contributor office hours calls on our community calendar, as well as our #contributing channel on Slack! Thanks to their involvement, more issues can be investigated and fixed each release.

Go API

Note that this version of CUE requires Go 1.20 or later, per our policy to support the latest two stable Go releases just like upstream.

CL 1172105 fixes a regression introduced in v0.6.0 where calling Iterator.Selector.Index while iterating over a list would incorrectly panic.

CL 1167597 fixes cue/load so it now errors on package import cycles, following the spec.

CL 1167647 adjusts cue.Value.Decode to decode empty CUE lists into a Go interface{} as a non-nil empty slice.

CL 547369 teaches cue.Value.Decode how to decode values which aren't entirely concrete into a Go type by using cue.Value as part of the destination type.

Language

There are no changes to the language in this version.

Spec

CL 1171216 fixes two errors in a dynamic fields example.

Core Evaluator

CL 1172014 disallows the direct use of unary operators with basic types, since they would result in confusing bounds which seemed incorrect.

CL 1172013 fixes a closedness bug where close did not properly apply when used inside definitions.

CL 1172874 fixes a panic in cue export introduced by v0.6.0.

Encoders

CL 1172314 teaches encoding/protobuf to follow the field_behavior annotation marking a field as either optional or required when decoding.

Builtins

CL 1172991 adds a mustSucceed boolean parameter to tool/exec.Run, which can be set to false to allow a command to fail and set its own field success to false.

CL 557322 fixes the values of math's Log2E and Log10E constants, which were being incorrectly truncated.

cmd/cue

CLs 1170966 and 1171302 fix a number of issues in cue fmt (and by extension the cue/format package), resulting in better and more consistent formatting of CUE files.

CLs 1171292, 1171015, 1170115, and 1171971 implement a variety of improvements and bug fixes for cue get go.

CL 1172017 fixes a number of issues with the line and column positions reported by our YAML decoder, which could result in weird CUE formatting when using cue import or misleading positions being shown to the user.

CL 1169709 increases the robustness of cue export -o, which in some situations could ignore file errors or incorrectly replace an existing file without the -f flag.

CL 1173072 fixes a panic when using cue import --list with empty YAML input.

CL 1168436 updates the cue export documentation to add the missing cue and binary supported export formats.

Modules

A number of changes are included to support an experimental implementation of the proposed modules and package management support. These aren't enabled by default, and will be announced soon.

Full list of changes since v0.6.0
  • cmd/cue: fix panic when importing empty files as a list by @uhthomas in b36b477
  • internal/core/adt: change semantics of unary_op(basictype) by @mpvl in e1ceed4
  • internal/core/adt: fix closedness bug by @mpvl in 886eefd
  • internal/core/adt: add test to prepare for fix by @mpvl in 145764d
  • CONTRIBUTING: mention the Slack channel and office hours calls by @mvdan in 16a0cda
  • pkg/tool/exec: add a Run.mustSucceed parameter by @nickfiggins in 10c4796
  • cue: explicitly document values are not safe for concurrent use by @mvdan in d805c22
  • internal/ci: bump Go and GoReleaser for v0.7.0-rc.1 by @mvdan in 8f88dcb
  • internal/slices: move from internal/mod/mvs/internal/slices by @rogpeppe in 0e51dbb
  • internal/mod/internal/par: move from internal/mod/mvs/internal/par by @rogpeppe in fe0e04a
  • internal/registrytest: do not check that dependencies exist by @rogpeppe in 99bdbad
  • internal/mod/modimports: new package by @rogpeppe in 79033c2
  • internal/core/export: fix a recent nil pointer regression by @rudifa in 141925a
  • internal/core/adt: use state directly by @mpvl in bba2263
  • internal/core/adt: expand on permutations for test by @mpvl in 596fdc9
  • internal/cuetxtar: include diff between test and fallback test by @mpvl in 6774d0d
  • internal/txtarfs: factor out from registrytest by @rogpeppe in 265a7a0
  • internal/cueimports: export API and fix for CUE syntax by @rogpeppe in 47d6dce
  • internal/cueimports: copy code from cue/load by @rogpeppe in 9e55783
  • cue/load: remove unused functionality by @rogpeppe in b727189
  • all: replace html/template by text/template by @mvdan in 361ae4f
  • encoding/protobuf: support field_behavior "required" option by @howardjohn in 80b0eee
  • cmd/cue: fix incorrect position in yaml import by @uhthomas in d97b0c3
  • all: adopt .gitignore for new delve binary naming by @mpvl in 68e9d5d
  • internal/core/adt: make ListMarker Src an expression by @mpvl in f59894c
  • internal/core/adt: changes needed for new evaluator by @mpvl in fb88beb
  • cue: don't panic on Iterator.Selector.Index with lists by @mvdan in 9dd0f82
  • cue: allow top level JSON marshalers in EncodeType by @rogpeppe in 8f796bf
  • cue: support decoding into cue.Value fields by @rogpeppe in b25fc05
  • internal/mod/mvs: discard copied par tests by @mvdan in 4e30101
  • CONTRIBUTING: fix repo reference rendering by @cedricgc in 7a4ea86
  • internal/e2e: make unique module names more robust by @mvdan in a404c89
  • cmd/cue: support optional comments in get go by @uhthomas in 67ea9cf
  • cmd/cue: ignore complex types in get go by @uhthomas in 112b0b2
  • pkg/internal/builtintest: don't print superfluous newlines by @uhthomas in 8b32c49
  • internal/tdtest: document how the name field is used by @rogpeppe in deab307
  • internal/e2e: add a test for a private github repo by @mvdan in 4d2ba88
  • internal/ci: add gcloud auth to the e2e tests by @mvdan in 95a88a5
  • CONTRIBUTING: clarify two sections by @cedricgc in d947a69
  • internal/e2e: add a "cue mod upload" end-to-end test with gcloud by @mvdan in a060f85
  • internal/e2e: rename existing testscript and add a summary by @mvdan in 4dba8dd
  • internal/e2e: tweak how we use secret env vars by @mvdan in d3efde7
  • internal/mod/modfile: add copyright message by @rogpeppe in f9c8d98
  • cmd/cue: cue mod upload...
Read more

v0.6.0

09 Aug 10:21
Compare
Choose a tag to compare

The main focus of this release is the introduction of required fields, as well as fixing a number of issues and regressions introduced in the v0.5.0 release.

As a reminder: users can register their projects with unity, our regression and performance testing setup. unity is used to ensure that a project's CUE evaluations do not unexpectedly stop working, or regress in terms of performance. unity continues to catch multiple issues with each release. Adding your project to unity not only guarantees that we will not break your tests (if we do, we will work with you to fix your CUE code), but it also helps to improve the quality of each CUE release. Follow this link to learn more about Unity, install it, or get in touch with any questions.

Thank you to @4ad, @Abirdcfly, @alexandear, @chee-zaram, @eraserhd, @ghostwheel42, @joanlopez, @jpluscplusm, @kcburge, @mpvl, @mvdan, @myitcv, @rogpeppe, @toshi0607, and @zeithaste for contributing to this release!

API

CL 543335 adds arch to set of injectable system variables understood by cue/load. The text at cue help injection explains how this in more detail.

CL 552142 adds support for zero values in cue.Value.Float64, which has the effect of fixing the error when attempting to use strconv.FormatFloat with a zero value.

CL 548783 fixes a long-standing bug to make HTML escaping in JSON an opt-in. This means that cue export now respects the --escape flag when set, and encoding/json only escapes HTML when HTMLEscape is used.

Language

Required fields

The main focus of the v0.6.0 release is the introduction of required fields.

CUE already supports the “optional field constraint”, denoted foo?: value.

Required fields add a “required field constraint”, denoted foo!: value, which is like foo?: value, but requires a regular field be provided for foo (a field foo: without !: or ?:).

We refer to optional field constraints and required field constraints collectively as “field constraints”.

As a general rule, all data and data templating should be defined with regular fields, whereas schemas would be defined in terms of field constraints. Of course, CUE being CUE, mixing these two fields is allowed: this rule is not a restriction but suggested as a matter of style and proper usage.

Here are some examples of how exclamation marks can be used to express things that were previously not possible.

#Def: {
    kind!: "def"
    intList!: [...int]
}

Using required fields can also result in better error messages. Consider this schema:

#Person: {
    name: string
    age?: int
}

Note that this is non-idiomatic, because our new guidelines suggest schemas should only be defined in terms of field constraints, but we will use this for illustration purposes.

Now consider this usage of #Person:

jack: #Person & {age: 3}

In data mode, the error message here is currently jack.name: incomplete value string, which does not provide much actionable information to the user to help them fix the problem.

Now consider how #Person looks with required fields, idiomatically only using field constraints:

#Person: {
    name!: string
    age?:  int
}

jack: #Person & {age: 3}

Now the error message reads:

jack.name: field is required but not present

which more closely reflects the underlying problem..

This error could be resolved by adding jack: name: "Jack".

For more details and background on the change, please see the original required fields proposal.

Other changes

Whilst it should not be a breaking change from a CUE perspective, we have upgraded to use github.com/cockroachdb/apd/v3. We have also increased apd.Context precision from 24 to 34.

CL 551207 adds support for making dynamic fields optional or required. For example, the following is now possible:

x:	"y"
(x):  "foo"
(x)?: "foo"
(x)!: "foo"

and yields:

x: "y"
y: "foo"

CL 546886 removes support for old-style :: definitions. This also includes deprecation support. In a similar vein, CL 547011 removes the last vestiges of <foo>: T. This was once the notation for pattern constraints.

Spec

Various bug fixes, with special thanks to @nicuveo for raising many of these.

Builtins

The following four functions have been added to the net package:

  • PathEscape
  • PathUnescape
  • QueryEscape
  • QueryUnescape

Thanks to @eraserhd for this change.

CL 549087 reimplements pkg/list.Sort. The resulting reduction in the number of allocations and other work gives rise to a ~80% reduction in running time against CUE benchmarks.

cmd/cue

CL 547212 improves the documentation for the -l flag passed to cue import. This addresses a frequent point of confusion in questions to GitHub Discussions and on Slack.

CL 550616 fixes cue get go to respect the --exclude flag for constants. This makes it possible to (for example) exclude all unexported identifiers from a cue get go run.

CL 555576 fixed an important bug where cmd/cue vet was not properly consuming all input data.

CL 556526 fixed a bug where CUE files beginning with an underscore were not being loaded when explicitly given as filename arguments.

WebAssembly (Wasm)

We have added preliminary support for Wasm. Users can compile code from any language and toolchain that supports Wasm into plugins that are dynamically loaded by CUE. Users can then call and use functions from these Wasm modules, just like they can use standard library functions.

See the documentation at cuelang.org/go/cue/interpreter/wasm to learn more about Wasm and its current limitations.

Changelog

Expand for the full changelog
  • internal/core/dep: always introduce Environment for Comprehension Value to fix panic by @mpvl in 99e8578
  • internal/core/dep: adapt Recurse to mimic dep.Visit by @mvdan in 97d7109
  • internal/ci: use cue-lang/cuelang.org workflow_dispatch for tip by @myitcv in 33b7393
  • cmd/cue: fix regression when injecting vars with cue cmd by @mvdan in da3ee7d
  • internal/core/adt: lets of comprehensions are multi lets by @mpvl in 43b4674
  • internal/core/adt: always mark let in comprehension as "complete" by @mpvl in 5123737
  • cue/ast: clarify what is a valid identifier by @mvdan in c4ced5e
  • internal/core/adt: find late-stage conflict errors by @mpvl in 0c48837
  • internal/core/adt: add tests to fix 2481 by @mpvl in d3444e3
  • internal/core/adt: fix stack overflow with comprehensions by @mpvl in 33071c0
  • deps: upgrade to go1.20.6 for release builds by @myitcv in 538eb9c
  • internal/core/compile: reject "_" as an alias name by @mvdan in bcbe967
  • all: remove a few more unused bits of code by @mvdan in c8e51a5
  • internal/core/dep: prevent passing "empty" vertices to tools/flow by @mvdan in c3eda1d
  • internal/core/adt: do not delay processing of fields by @mpvl in e7cfb50
  • internal/core/adt: add tests for upcoming issues by @mpvl in cabc1db
  • CONTRIBUTING: fix references to the old Unity repo by @mvdan in 23e265d
  • cmd/cue: print returned error by @mpvl in 450ff90
  • deduplicate content between README and CONTRIBUTING by @mvdan in 4c48cee
  • move doc/contribute.md to CONTRIBUTING.md by @mvdan in db28ec6
  • readme: warn new contributors not to use SSH auth by @jpluscplusm in f4c5639
  • internal/core/adt: pass state to addList by @mpvl in b38aece
  • internal/core/adt: set scalar more proactively by @mpvl in ab15bb8
  • internal/core/adt: better error message for cycles by @mpvl in 5e84a6d
  • internal/ci: count number of Signed-off-by lines by @myitcv in 4ba1b15
  • internal: remove a few unused APIs by @mvdan in 1c1a7b3
  • cue/load: fix Instances race by @rogpeppe in c10d7cb
  • cue/load: allow _*.cue files when explicitly listed by @myitcv in b16f6ce
  • internal/core/dep: fix recursive let processing by @mpvl in ca1f812
  • internal/core/dep: add Dependency.Recurse by @mpvl in f6e49bd
  • internal/core/dep: prepare for public APi by @mpvl in 0554d4e
  • internal/core/adt: mark comprehension key as dynamic by @mpvl in d4fd104...
Read more