Skip to content

Releases: cue-lang/cue

v0.14.0-alpha.1

26 Jun 11:27
Compare
Choose a tag to compare
v0.14.0-alpha.1 Pre-release
Pre-release

This release introduces a new error builtin, two language changes, and many fixes and optimizations for the new closedness algorithm.

Changes which may break some users are marked below with: ⚠️

Evaluator

error builtin

A new error builtin is added to the language, which allows users to create custom error values with a specified message.

Don't simplify validators into concrete values

A new CUE_EXPERIMENT=keepvalidators experiment is introduced, already on by default, which prevents validators from being simplified into concrete values.

X == Y and == X

Firstly, there were several bug fixes related to ==. Most notably, [int] == [int] incorrectly resolved to true. It now correctly resolves to an error.

All other changes are enabled using the @experiment(structcmp) file-level attribute.
Enabling thix experiment allows all CUE values to be compared for equality. This includes comparing structs.

The same experiment also allows a unary == to enforce that a value is a specific concrete value.

Documentation and examples will be available for the v0.14.0 release.

Other changes

⚠️ The file embedding experiment can no longer be disabled via CUE_EXPERIMENT=embed=0, having been introduced in CUE v0.10.0.

File embedding is now enabled when using the cue/cuecontext or cue/load APIs; earlier versions could not expose it via the Go API due to an import cycle.

⚠️ The topological field sorting experiment can no longer be disabled via CUE_EXPERIMENT=toposort=0, having been introduced in CUE v0.11.0.

⚠️ CUE_EXPERIMENT=cmdreferencepkg, introduced in v0.13.0 to require referencing tool packages to declare cue cmd tasks, is now on by default.

The new closedness algorithm has been adjusted to fix a number of "field not allowed" bugs, particularly in the form of regressions compared to the old evaluator.

A particularly slow part of the new closedness algorithm has been optimized, resulting in improvements of up to 10x in wall times for some projects.

cmd/cue

⚠️ cue def --strict jsonschema:, deprecated in favor of cue def jsonschema+strict: in v0.11.0, is no longer supported.

Go API

cue/load now provides module information via the new Instance.ModuleFile field.

⚠️ In order to support the above change, the mod/modfile.File.Format method has been moved to the function mod/modfile.Format: an API-breaking change but necessary to avoid a cyclic package dependency.

cue/parser gains a new Config API, which allows other packages like cue/load to properly apply the right parser options such as the CUE language version.

⚠️ In order to support the above change, the cue/parser.Config.ParseFile and cue/build.ParseFile signatures have now changed (incompatibly) to add a parser.Config argument, enabling the CUE language version to be passed through.

Fix an issue where cue.Value.Decode did not work with *math/big.Float types.

Full list of changes since v0.13.0
  • all: simplify three iterator uses with range-over-func by @mvdan in bb2494b
  • internal/core/adt: remove cycle check by @mpvl in d92e916
  • internal/core/adt: add tests for 3978 by @mpvl in 81795ac
  • internal/core/adt: revert 1217228 by @mpvl in 47912fc
  • cmd/cue/cmd: fix versiontest test by @rogpeppe in 2bbc359
  • doc/ref/spec.md: support struct and list for equality by @mpvl in d58d1f5
  • internal/core/compile: add version check for builtins by @mpvl in 985e693
  • internal/core/adt: add builtin for user-defined errors by @mpvl in 3ad8663
  • internal/core/adt: rename CallContext.Expr by @mpvl in 64ffd0d
  • doc/ref/spec.md: document error builtin by @mpvl in be18b05
  • internal/ci: update Go and goreleaser versions by @mvdan in 8d463da
  • update golang.org/x/... dependencies by @mvdan in e88d161
  • internal/core/adt: support unary == and != for all types by @mpvl in 030658e
  • internal/core/adt: comparison of values of different types by @mpvl in 34faddf
  • internal/core/adt: consider required fields for final values in Equal by @mpvl in 64d5789
  • internal/core/adt: support comparsion of structs by @mpvl in 2b7dfbd
  • internal/core/adt: fix error gobbling of internal nodes by @mpvl in 665f697
  • internal/core/adt: add tests for Issue 3977 by @mpvl in 996e8b0
  • cue/load: pass language version down to parser by @rogpeppe in d567750
  • cue/load: use error registry in SkipImports mode by @rogpeppe in 5a04616
  • cue/parser: enable cueexperiment.File throughout by @mpvl in 86f7a64
  • internal/cueexperiment: support for per-file experiments by @mpvl in 52988e0
  • internal/core/adt: simplify recursive getReqSets calls by @mvdan in 2d4263e
  • cmd/cue: remove CUE_SYNTAX_OVERRIDE support by @rogpeppe in 450ba7f
  • internal/core/adt: do not repeat replaceIDs calls by @mvdan in 8241d9c
  • cue/load: actually populate build.Instance.ModuleFile correctly by @rogpeppe in 48ec278
  • internal/core/adt: handle incomplete values in comparators by @mpvl in c925040
  • internal/core/adt: use replaceIDs incrementally in checkTypos by @mvdan in 16c782a
  • internal/core/adt: rewrite replaceIDs to scale better by @mvdan in b4212a3
  • internal/core/adt: Equal should take defaults when appropriate by @mpvl in 361384c
  • internal/core/adt: limit closedness check in Equal by @mpvl in e8e8682
  • internal/core/adt: merge validate package with adt by @mpvl in 26e1596
  • internal/core/adt: add tests for incomplete lists comparison by @mpvl in e67898f
  • cue/parser: add Config type by @rogpeppe in 211309c
  • cue/load: include module file in build.Instance by @rogpeppe in ab9ac54
  • internal/core/adt: use pointers for snapshot and result in nodeContext by @mvdan in 1a2d2e7
  • internal/core/adt: add tests for Issue 3929 by @mpvl in 7777230
  • internal/core/adt: handle yields in Resolve by @mpvl in 81e88ee
  • internal/core/adt: add tests for Issue 3972 by @mpvl in 0ac3913
  • internal/core/adt: make small iota enums consistently uint8 by @mvdan in ce44cfb
  • internal/core/adt: allow lookup across disjunction boundary by @mpvl in 20afefd
  • internal/core/adt: apply vertex rewriting to blocked tasks by @mpvl in d713052
  • internal/core/adt: add tests for 3967 by @mpvl in 5c5f970
  • cuecontext: revert support for CUE_EXPERIMENT by @mpvl in 2a70935
  • internal/pkg: only use %s with stringifiable builtin errors by @mvdan in fc4ca40
  • cue/parser: prohibit definition identifiers for package names by @rogpeppe in 548c23c
  • internal/core/export: avoid panic on non-regular identifiers for packages by @rogpeppe in 8bbf9b4
  • cmd/cue: add test cases for issue 3968 by @rogpeppe in e0010dd
  • cmd/cue: add testscript for exp gengotypes output filenames by @mvdan in b20d1a4
  • all: swap math/rand for math/rand/v2 where it affects behavior by @mvdan in 82ff070
  • all: remove a bit of dead code by @mvdan in ab546cf
  • cmd/cue: properly document the keepvalidators experiment by @mvdan in 398cdac
  • all: swap math/rand for math/rand/v2 where it doesn't affect behavior by @mvdan in db84c62
  • cmd/cue: fix error on cue mod rename with a bad module by @rogpeppe in 9f9ebac
  • cmd/cue: add test case for modrename with a bad module by @rogpeppe in 90d9b04
  • internal/core/adt: also create embed scope for disjunctions by @mpvl in c925902
  • internal/core/adt: add tests for 3964 by @mpvl in 2597e9e
  • internal/core/adt: fix default logic by @mpvl in 8dc494c
  • cueexperiment: export Config type and use it by @mpvl in 33a1792
  • internal/core/adt: add tests for 3958 by @mpvl in 5d162df
  • README: minor updates by @jpluscplusm in eb54082
  • internal/core: start removing pre-toposort field ordering code by @mvdan in 6fd9f7d...
Read more

v0.13.2

24 Jun 17:02
Compare
Choose a tag to compare

Evaluator

Fix a regression causing odd number of disjuncts to misbehave in some cases.

Full list of changes since v0.13.1

v0.13.1

10 Jun 15:48
Compare
Choose a tag to compare

Evaluator

The evaluator's core packages no longer depend on the golang.org/x/mod module, which was only used to format version strings.

Fix a regression causing "cyclic field to reference" in some cases.

Fix a regression causing closedness rules to not apply in some cases.

Disable a minor optimization which was also causing closedness rules to not apply in some cases.

cmd/cue

Fix a build error triggered by changes in the upcoming Go 1.25 version, allowing v0.13 to be used further into the future.

cue mod mirror --dry-run now works as documented; it had been left unimplemented by accident.

Full list of changes since v0.13.0
  • internal/ci: bump Go version for v0.13.1 by @mvdan in 65a5178
  • internal/core/adt: also typo check disjuncts by @mpvl in 72bf578
  • internal/core/adt: add tests for Issue 3957 by @mpvl in ea56b5a
  • internal/golangorgx/tools/tokeninternal: remove by @mvdan in e316125
  • internal/core/adt: partially revert CL 1214950 by @mpvl in 0f896f6
  • internal/core/adt: add tests for 3946 by @mpvl in a7ab473
  • internal/cueversion: avoid dependency on golang.org/x/mod by @rogpeppe in 85e1230
  • internal/core/adt: do not always filter disjuncts by @mpvl in c5bc992
  • internal/core/adt: add tests for 3947 by @mpvl in 8350f89
  • cmd/cue: implement mirror --dry-run by @rogpeppe in 8e68892

v0.13.0

22 May 15:35
Compare
Choose a tag to compare

This release finally enables the new evaluator by default -- the culmination of over a year's worth of work!

It also packs in lots of new features, such as support for absolute module packages, dozens of JSON Schema improvements, and a new experimental XML encoding.

Changes which may break some users are marked below with: ⚠️

Evaluator

The new evaluator first introduced in v0.9.0 via CUE_EXPERIMENT=evalv3 is now enabled by default! There are no remaining substantial regressions in our test suite, and the Unity corpus is almost entirely working now. Given that the new evaluator fixes dozens of bugs for many users, and is already significantly faster for the majority of CUE users, we believe it is time to turn it on by default.

We will continue to track any remaining issues for the new evaluator via the evalv3 label. If you encounter any regressions, please file a bug report. You can also revert to the old evaluator to temporarily work around bugs via CUE_EXPERIMENT=evalv3=0. See this FAQ page for more information.

We aim to resolve many of these remaining bugs in an upcoming v0.13.1 bugfix release.

An entirely new algorithm for cue trim and tools/trim has been implemented for evalv3, which resolves all known bugs when trimming CUE.

Closedness in evalv3 has been revisited to match the semantics of evalv2 much more closely, while at the same time reducing its overhead for larger configurations. This fixes most "field not allowed" regressions and improves the performance of some configurations by up to 5x. As a result, CUE_DEBUG=openinline is now removed as it is unnecessary.

Performance work for the new evaluator is ongoing; a number of changes in this release led to performance improvements of between 5% and 80% for a variety of projects. For more details, see Marcel's performance update last month.

⚠️ The new topological sort algorithm for field ordering has been tweaked to avoid becoming too slow in some cases. This may result in some ordering changes, but we expect them to be relatively small. See the change for more details.

The parser now correctly allows keywords as required field labels, such as if!: _, fixing a discrepancy with the spec.

Filenames beginning with a dot can now be embedded as long as the glob pattern uses an explicit dot, such as @embed(glob="dir/.data_*.json").

⚠️ @embed(glob="pattern...") directives whose file globbing results in zero files now result in an error, to avoid situations where a glob pattern silently stops working as intended.

cmd/cue

Initial support for absolute packages is introduced, which allow specifying a remote package at a particular version such as cue export foo.com/data@v1.2.3 or cue vet foo.com/schema@v1.2.3 -d '#schema' data.yaml without requiring a CUE module file locally.

The cue help filetypes logic, written itself in CUE, no longer requires using the evaluator to parse CLI arguments or load CUE packages. This results in significant speed-ups when using the CLI with many inputs.

The new cue refactor imports command rewrites import paths, making it easy to migrate between module locations and major versions.

The new cue mod mirror command copies modules from one registry to another.

cue mod tidy now preserves the top-level custom field as intended.

Hidden files, and files with build tags, should now be correctly filtered when loading a single CUE package.

cue get go should no longer attempt to import types from the Go standard library as CUE, which caused errors.

cue get go no longer fails on Go strings containing certain character escape sequences or non-UTF8 bytes.

cue get go now interprets Go fields with the new json:",omitzero" struct tag as CUE optional fields.

cue cmd now fails if no tasks were actually defined, to avoid situations where a user is misled into thinking a task was defined when it was not.

Encodings

The XML "Koala" encoding proposed in February is now available via an experimental implementation. Try it out via the CLI like cue export xml+koala: data.xml, or via its Go API.

The encoding/jsonschema package gains better support for Kubernetes schemas (CRDs and the core API) although these improvements are as yet only available via the Go API.

⚠️ The JSON Schema decoder now imports schema descriptions as CUE doc comments, which required a change to encoding/jsonschema.Config.DefineSchema.

Empty YAML files are now decoded as *null | _ rather than null, allowing them to be unified with struct schemas as if they were an empty struct.

cue exp gengotypes now allows control over how to generate optional CUE fields via e.g. @(,optional=nullable), where the default now is not to use pointers.

⚠️ cue exp gengotypes tweaks how it parses @(,type=) options to support composite types such as slices and maps. Note that this means package paths with slashes must be quoted now.

Builtins

⚠️ The uuid.ToString function is removed, given that it never did anything useful and could mislead users into thinking it did.

tool/http gained a followRedirects option to let the user disable HTTP redirection.

Go API

⚠️ CUE_EXPERIMENT=decodeint64 can no longer be disabled as we consider the experiment finished, having been introduced in CUE v0.11.0.

⚠️ The long-deprecated cue.Runtime methods Parse, FromExpr, CompileFile, and CompileExpr are now removed.

cuecontext.EvalDefault still pointed to the old evaluator; it now correctly points to the new evaluator, and follows the CUE_EXPERIMENT=evalv3 flag just like cmd/cue and the rest of the Go API.

Mirroring cuecontext.EvalExperiment, the new cuecontext.EvalStable constant is added to track the latest stable version of the evaluator.

module.SplitPathVersion and module.ParseImportPath have been deprecated in favor of cue/ast.SplitPackageVersion and cue/ast.ParseImportPath package to consolidate the API.

The new mod/modfile.File.ModuleForImportPath function allows resolving a module and default major version for a package without consulting a registry.

The new mod/modregistry.Client.Mirror method implements the logic behind the new cue mod mirror command.

The new mod/module.Version.Compare method is added in favor of module.Sort, which is now deprecated.

Full list of changes since v0.12.0
  • internal/ci: bump the pinned Go version for releases by @mvdan in 5ca3b8f
  • internal/encoding/yaml: drop use of kr/pretty in a test by @mvdan in e769e47
  • internal/core/adt: prevent superfluous circular reference by @mpvl in 9418bb0
  • internal/core/adt: add tests for Issue 3941 by @mpvl in 938d270
  • encoding/json: clarify how to encode a cue.Value to JSON by @mvdan in 3bc5784
  • internal/core/adt: allow sharing of lets by @mpvl in 9a44314
  • internal/core/adt: add tests for Issue 3938 by @mpvl in 3045a88
  • internal/core/adt: treat for loop values as non-cyclic by @mpvl in e15f6e4
  • internal/core/adt: relax inline cycles by @mpvl in 4a4d9ef
  • internal/core/adt: disable setting Inline for evalv3 by @mpvl in 406f64c
  • internal/core/adt: add tests for 3903 by @mpvl in eb61a84
  • internal/core/adt: rewrite comprehension structs for disjuncts by @mpvl in 7a0906e
  • internal/core/adt: dereference overlay by @mpvl in 894205c
  • internal/core/adt: add tests for Issue 3935 by @mpvl in 1a2e80e
  • cue/testdata: add a regression test for #3570 by @mvdan in 5a99880
  • internal/core/adt: mark conjunct for incomplete disjunct by @mpvl in a3db8b8
  • internal/core/adt: add tests for 3934 by @mpvl in d9bfe59
  • pkg/encoding/json: fix validator by @mpvl in 17caa72
  • pkg/encoding/json: add tests for issue 3932 by @mpvl in 5d863b6
  • cue: fix path representation for shared nodes by @mpvl in af81550
  • internal/core/adt: partial revert of fixes for 3919 by @mpvl in e12d544
  • internal/core/adt: add tests for 3931 by @mpvl in cff2d7e
  • cue/format: port format tests to cuetxtar by @mvdan in 8f841ee...
Read more

v0.13.0-rc.1

16 May 14:07
Compare
Choose a tag to compare
v0.13.0-rc.1 Pre-release
Pre-release

This release adds further fixes to the new evaluator, and speeds up the CLI when there are many inputs.

Changes which may break some users are marked below with: ⚠️

Evaluator

The new evaluator is improved to fix more regressions which led to incorrect errors. Since the last alpha release, two newly added projects to Unity now succeed with evalv3, and we have resolved eight issues reported on GitHub.

We also fix a bug where anonymous CUE files, such as those without a package clause, did not properly report unused import errors.

cmd/cue

The cue help filetypes logic, written itself in CUE, no longer requires using the evaluator to parse CLI arguments or load CUE packages. This results in significant speed-ups when using the CLI with many inputs.

Fix a bug where some errors shown to the user did not use relative paths to CUE files or directories as expected.

Go API

⚠️ CUE_EXPERIMENT=decodeint64 can no longer be disabled as we consider the experiment finished, having been introduced in CUE v0.11.0.

Fix a recent regression where using os.Getwd alongside the ./cmd/cue/cmd API had stopped working as it did before.

Encodings

cue exp gengotypes now allows control over how to generate optional CUE fields via e.g. @(,optional=nullable), where the default now is not to use pointers.

⚠️ cue exp gengotypes tweaks how it parses @(,type=) options to support composite types such as slices and maps. Note that this means package paths with slashes must be quoted now.

Full list of changes since v0.13.0-alpha.4
  • cmd/cue: add CUE_EXPERIMENT=cmdreferencepkg by @mvdan in 5548932
  • pkg: make $id in tasks a reference to a hidden field by @mvdan in 1c27bdb
  • cmd/cue: add testscript showing input unmarshal behavior with cue cmd by @mvdan in eebcefc
  • internal/core/adt: fix disjunction state management by @mpvl in e145a14
  • internal/core/adt: add tests for Issue 3925 and 3905 by @mpvl in 38357b7
  • Revert "internal/core/adt: carry over enclosing scope" by @mvdan in a6daeb9
  • cue/testdata: add test cases for #3924 by @mvdan in 2740b68
  • internal/core/adt: avoid finalizing too early by @mpvl in f87800d
  • internal/core/adt: add tests for issue 3919 by @mpvl in 47c9e99
  • internal/filetypes: remove version from TODO by @rogpeppe in c456d08
  • cmd/cue: document that embedding is limited to files in the same module by @mvdan in 3559578
  • cmd/cue: update which experiments are on by default by @mvdan in cfe1783
  • cue/load: make MultiplePackageError support relative dir paths by @mvdan in a8f9383
  • cmd/cue: test the "found packages $X and $Y in $DIR" error message by @mvdan in 4f3a215
  • internal/core/adt: fix some embedding issues with closedness by @mpvl in 2597621
  • internal/core/adt: add tests for 3921 by @mpvl in b3caad3
  • internal/encoding/gotypes: handle cyclic types out of the box by @mvdan in 61e0d7f
  • cmd/cue: don't use os.Getwd at init time by @mvdan in e7d687f
  • internal/core/adt: carry over enclosing scope by @mpvl in 7de64e8
  • internal/core/adt: add tests for 3920 by @mpvl in 0f26957
  • encoding/jsonschema: fix x-kubernetes-group-version-kind by @rogpeppe in 9752c3a
  • internal/core/adt: update environment for disjunctions by @mpvl in e231c49
  • internal/core/adt: add tests for issue 3891 by @mpvl in bb2204f
  • all: cue fmt by @mvdan in 5c33e24
  • internal/golangorgx: cuelsp: load cue by @cuematthew in 8ca0f5b
  • internal/golangorgx: cuelsp: remove Go-specific analysis by @cuematthew in b9acd04
  • internal/core/adt: handle vertices properly for comprehensions spanning disjunctions by @mpvl in 56a915b
  • internal/core/adt: add tests for issue 3899 by @mpvl in b17be30
  • encoding/jsonschema: recognize date-time too by @rogpeppe in 398e8be
  • encoding/jsonschema: update format support by @rogpeppe in 59e82a7
  • encoding/jsonschema: add numeric format to CRD test by @rogpeppe in 4e8dc78
  • cmd/cue: move CUE_DEBUG_PARSER_TRACE to CUE_DEBUG=parsertrace by @mvdan in 8fb5fea
  • cmd/cue: add testscript for CUE_DEBUG_PARSER_TRACE by @mvdan in a95cfa8
  • tools/flow: move CUE_DEBUG_TOOLS_FLOW=1 to CUE_DEBUG=toolsflow=1 by @mvdan in 38b8955
  • internal/cueexperiment: phase out DecodeInt64 by @mvdan in 3be8e48
  • cue/testdata: add regression test for issue 2310 by @mvdan in 8fa1079
  • cue/errors: use slices.CompactFunc to deduplicate errors by @mvdan in a1a53e5
  • encoding/jsonschema: avoid adding unnecessary ellipses by @rogpeppe in 68dad74
  • encoding/jsonschema: implement x-kubernetes-group-version-kind by @rogpeppe in 2c01ee5
  • encoding/jsonschema: add VersionKubernetesAPI by @rogpeppe in a918c8b
  • internal/encoding/gotypes: implement optional=nillable by @mvdan in 9ef3b70
  • cmd/cue: add more gengotypes test cases for optional=nillable by @mvdan in defc384
  • internal/encoding/gotypes: parse type options as Go expressions by @mvdan in f2e0b7e
  • encoding/jsonschema: CRD metadata field is not required by @rogpeppe in d0f10ea
  • internal/filetypes: remove dependency on CUE evaluator by @rogpeppe in 050844f
  • internal/filetypes: generate FromFile by @rogpeppe in f37ff95
  • internal/filetypes: generate toFile implementation by @rogpeppe in 6454acb
  • internal/filetypes/internal/genfunc: CUE to Go translation by @rogpeppe in b3e8da8
  • internal/filetypes/internal/genfunc: CUE expression simplification by @rogpeppe in 9c267d8
  • internal/filetypes/internal/genstruct: new package by @rogpeppe in c65ecb4
  • internal/filetypes: remove special cases by @rogpeppe in c7a63ad
  • internal/core/adt: allow stack-based unrolling of blocking by @mpvl in 5c22dc8
  • internal/core/adt: add tests for 3899 by @mpvl in e65a5e0
  • encoding/jsonschema: CRDs always define resources by @rogpeppe in dbe2611
  • encoding/jsonschema: add metadata field to CRD test case by @rogpeppe in f712e19
  • cmd/cue: add a testscript for --inject-vars by @mvdan in aeb0747
  • encoding/openapi: add regression test for issue 1643 by @mvdan in 8e4c818
  • cue/errors: print relative positions when used as arguments too by @mvdan in 80ff2bd
  • internal/ci/goreleaser: adjust after evalv3 fix for #3908 by @mvdan in 6fd7ee4
  • internal/core/adt: fix default handling by @mpvl in db98b5f
  • internal/core/runtime: validate imports in package-less files too by @mvdan in 45bcd34
  • cmd/cue: add testscript to ensure we report unused imports by @mvdan in 21d4ba7
  • cue/testdata: add regression tests for issue 2337 by @mvdan in 4154968
  • pkg/list: add a regression test for issue 3416 by @mvdan in b0a5318
  • cue/testdata: add a regression test for issue 2241 by @mvdan in 17e198c
  • cue/testdata: add a regression test for issue 2229 by @mvdan in 1048634
  • pkg/list: add regression test for issue 2594 by @mvdan in f93b6b9
  • cue/testdata: add regression test for issue 1867 by @mvdan in aacdc3b
  • cue/testdata: remove resolve/002.txtar by @mvdan in 89d1313
  • all: clean up a number of txtar test skips by @mvdan in ebf4e65
  • cue/testdata: add regression test for issue 2209 by @mvdan in 5db678d
  • cue/testdata: add a regression test for issue 1640 by @mvdan in 09dee80
  • cmd/cue: mention vet-c's three behaviours by @jpluscplusm in 8f552be
  • cue/testdata: add a regression test for issue 2526 by @mvdan in 0be3c85
  • internal/cuetxtar: support matrix name skips like #skip-v2 by @mvdan in 6204a0a
  • cue: fix two godoc links by @mvdan in 2aee339
  • encoding/xml/koala: update koala header comm...
Read more

v0.13.0-alpha.4

25 Apr 09:02
Compare
Choose a tag to compare
v0.13.0-alpha.4 Pre-release
Pre-release

This release adds further fixes and optimizations to the new evaluator, and introduces an experimental XML encoding for CUE.

Changes which may break some users are marked below with: ⚠️

Evaluator

The new evaluator is improved to fix a few more regressions which led to incorrect errors. Since the last alpha release, one more project in Unity is fully working with evalv3, and just one remains with a breakage compared to evalv2.

Performance work for the new evaluator is ongoing; a number of changes in this release led to performance improvements of between 5% and 70% for a variety of projects. For more details, see Marcel's last performance update.

As a reminder, the old evaluator is still accessible via CUE_EXPERIMENT=evalv3=0. If you encounter any errors or other problems, please file an issue with details.

Filenames beginning with a dot can now be embedded as long as the glob pattern uses an explicit dot, such as @embed(glob="dir/.data_*.json").

⚠️ @embed(glob="pattern...") directives whose file globbing results in zero files now result in an error, to avoid situations where a glob pattern silently stops working as intended.

⚠️ The CUE_DEBUG=openinline evaluator debug flag is removed, now that evalv3's closedness implementation closely matches the semantics of evalv2.

cmd/cue

cue mod tidy now preserves the top-level custom field as intended.

cue get go now interprets Go fields with the new json:",omitzero" struct tag as CUE optional fields.

cue cmd now fails if no tasks were actually defined, to avoid situations where a user is misled into thinking a task was defined when it was not.

Builtins

⚠️ The uuid.ToString function is removed, given that it never did anything useful and could mislead users into thinking it did.

tool/http gained a followRedirects option to let the user disable HTTP redirection.

Encodings

The XML "Koala" encoding proposed in February is now available via an experimental implementation. Try it out via the CLI like cue export xml+koala: data.xml, or via its Go API.

Full list of changes since v0.13.0-alpha.3
  • internal/ci: bump Go and goreleaser for the next alpha release by @mvdan in d1fb074
  • internal/golangorgx: cuelsp: remove unneeded code by @cuematthew in e223de9
  • cue/interpreter/embed: fix "glob" typo by @mvdan in 2666081
  • cue/interpreter/embed: fail when glob pattern has no matches by @rogpeppe in b6d7332
  • interpreter/embed: allow glob to match explicit dot files by @rogpeppe in 6741c90
  • cmd/cue/cmd: add test case for embedding a pattern with an explicit dot file by @rogpeppe in 572a6cc
  • pkg/tool/http: allow configuration of following redirects by @myitcv in acc06c5
  • cmd/cue: error on useless commands by @myitcv in 4b5dd6b
  • cmd/cue: remove test files related to old old closedness by @myitcv in 93e82f2
  • internal/core/adt: cache reqSets in nodeContext by @mpvl in fac9a30
  • internal/core/adt: add benchmark for 3881 by @mpvl in 3eef4dd
  • internal/core/adt: add stats for new closedness algo by @mpvl in 5f329ce
  • internal/core/adt: fix Vertex dereferencing for disjunctions by @mpvl in 96e0ebc
  • internal/core/adt: add tests for 3850 and 3875 by @mpvl in 7cfe774
  • internal/core/adt: fix test names by @mpvl in 5dcc768
  • internal/core/topsort: prevent duplicates in nodeToStructMeta by @mvdan in a753c37
  • internal/core/adt: remove unused nodeContext fields by @mvdan in b12e201
  • internal/core/adt: show correct path for incomplete values by @mpvl in e714489
  • internal/core/adt: skip work in checkTypos when a vertex has no arcs by @mvdan in 3c149f1
  • internal/core/adt: reuse a local buffer in checkTypos by @mvdan in ab8bd45
  • internal/golangorgx/gopls: Use the correct error. by @alingse in 19403a4
  • internal/core/adt: avoid more allocations when LogEval is disabled by @mvdan in 34a512f
  • internal/core/adt: remove unused code low-hanging fruit by @mvdan in 8fef4d3
  • cmd/cue: convert examples to 'cue vet -c' by @myitcv in 08c3542
  • internal/golangorgx/gopls: Get cue lsp to initialize with emacs lsp by @cuematthew in c54251d
  • internal/core/adt: do not activate ids for non-definitions by @mpvl in 2824405
  • internal/core/adt: add tests for 3858 by @mpvl in eec6a2a
  • internal/core/adt: reuse reqSets slices via OpContext by @mvdan in 1d028fc
  • internal/core/adt: prevent logging overhead when disabled by @mvdan in e778137
  • internal/cuedebug: drop openinline flag by @mvdan in a09a38b
  • pkg/uuid: remove ToString by @mvdan in f836184
  • cmd/cue: go get Go fields with the json omitempty tag as optional by @mvdan in d9da212
  • cmd/cue: add get go test case with the new omitzero json tag by @mvdan in be6c3db
  • internal/encoding/yaml: support alias to scalars as map keys by @OmriSteiner in a6fff27
  • cmd/cue: actually update the _gen.go.want gengotypes testscript files by @mvdan in 52d9689
  • update golang.org/x/... dependencies by @mvdan in 433ac2c
  • update pelletier/go-toml to drop testify by @mvdan in 9b5b10f
  • cmd/cue: wire up xml+koala via encoding/xml/koala by @mvdan in 096a114
  • internal/encoding/gotypes: generate valid json tags for quoted fields by @trumant in 93c1421
  • internal/mod/modload: preserve custom struct in module when tidying requirements by @snuxoll in e058014
  • encoding/xml/koala: introduce the first experimental XML encoder by @matts85 in ebf42e5

v0.12.1

03 Apr 19:51
Compare
Choose a tag to compare

Evaluator

Embedding binary files like @embed(file="foo", type=binary) no longer interprets the files as Unicode text, which mangled invalid UTF-8 bytes.

cmd/cue

The release archives are now built with Go 1.24, which should fix cue get go when used with Go installed at version 1.24.

Full list of changes since v0.12.0

v0.13.0-alpha.3

31 Mar 14:38
Compare
Choose a tag to compare
v0.13.0-alpha.3 Pre-release
Pre-release

This release fixes a handful of bugs in the new evaluator and its Go API.

Evaluator

The new evaluator, now enabled by default since v0.13.0-alpha.2, is improved to fix regressions in OpenAPI, our CUE Go API, two panics, and a few other bugs which could lead to incorrect errors. Since the last alpha release, two more projects in Unity are fully working with the new evaluator.

As a reminder, the old evaluator is still accessible via CUE_EXPERIMENT=evalv3=0. If you encounter any errors or other problems, please file an issue with details.

Go API

cuecontext.EvalDefault still pointed to the old evaluator; it now correctly points to the new evaluator, and follows the CUE_EXPERIMENT=evalv3 flag just like cmd/cue and the rest of the Go API.

Mirroring cuecontext.EvalExperiment, the new cuecontext.EvalStable constant is added to track the latest stable version of the evaluator.

Full list of changes since v0.13.0-alpha.2
  • update golang.org/x dependencies by @mvdan in c565c1d
  • cue/cuecontext: fix EvalDefault to follow the default, add EvalStable by @mvdan in ad0442b
  • internal/core/runtime: select evaluator version with specific constants by @mvdan in 1ec46e7
  • all: do not use Default/Dev/Experiment evaluator versions in tests by @mvdan in 07bccba
  • cue/cuecontext: expand TestEvalVersion to test more combinations by @mvdan in 965e7b1
  • internal/core/adt: fix disjunction corruption issue by @mpvl in 917ae0d
  • cue/cuecontext: evalv3 is no longer experimental by @myitcv in 8080ec5
  • internal/core/adt: fix panic due to envDisjunct corruption by @mpvl in 721ca5d
  • internal/core/adt: disable structure sharing for pending arcs by @mpvl in 4fc579c
  • internal/core/adt: add tests for Issue 3849 by @mpvl in 6ade302
  • internal/core/adt: remove insertArcCC by @mpvl in 6654071
  • internal/core/adt: inline structs in schema are not closed by default by @mpvl in 4e7564e
  • internal/core/adt: add test for Issue 3853 by @mpvl in 5348d04
  • pkg/internal/builtintest: remove "and X more errors" stripping for evalv3 by @mvdan in 32d0400
  • internal/core/adt: support Ellipsis in MatchAndInsert by @mpvl in de69f12
  • internal/core/adt: eliminate recursive processing on bottom by @mpvl in 447e98d
  • internal/core/adt: add test for Issue 3851 by @mpvl in d58c804
  • cmd/cue: re-enable cue exp gengotypes testscript by @mvdan in 18b4ba9
  • internal/core/adt: add missing dereference by @mpvl in e22ea96
  • cue: do not unify "accept" schema with result in UnifyAccept by @mpvl in ff654dc
  • cue: prepare TestConjunctDedup for more cases by @mpvl in 2b82584
  • cue: use fmt instead of MarhalJSON in TestUnifyAccept by @mpvl in 6912a11
  • internal/tdtest: support cuetest.Run by @mpvl in 2402ef3
  • internal/ci: simplify login to Central Registry by @myitcv in f4a2424
  • encoding/jsonschema: clean up TestExtX by @mpvl in c0fc59b
  • internal/core/adt: remove diff/todo for fixed issues by @mpvl in 773741f
  • cue: add missing finalization by @mpvl in 4cbb180

v0.13.0-alpha.2

25 Mar 15:51
Compare
Choose a tag to compare
v0.13.0-alpha.2 Pre-release
Pre-release

This release enables the new evalv3 evaluator by default, and introduces initial support for absolute packages.

Changes which may break some users are marked below with: ⚠️

Evaluator

⚠️ The new evaluator is now enabled by default, given that the majority of our test suite and projects in Unity are now working. While a few regressions remain, dozens of bugs are fixed by the new evaluator, and it already shows better performance by orders of magnitude on many projects.

The old evaluator is still accessible via CUE_EXPERIMENT=evalv3=0. If you encounter any errors or other problems, please file an issue with details.

For more information, see our new guide on upgrading from evalv2 to evalv3.

Closedness in evalv3 has been revisited to match the semantics of evalv2 much more closely, while at the same time reducing its overhead for larger configurations. This fixes most "field not allowed" regressions and improves the performance of some configurations by up to 2-5x.

cmd/cue

Initial support for absolute packages is introduced, which allow specifying a remote package at a particular version such as cue export foo.com/data@v1.2.3 or cue vet foo.com/schema@v1.2.3 -d '#schema' data.yaml.

cue get go no longer fails on Go strings containing certain character escape sequences or non-UTF8 bytes.

Encodings

Empty YAML files are now decoded as *null | _ rather than null, allowing them to be unified with struct schemas as if they were an empty struct.

Full list of changes since v0.13.0-alpha.1
Read more

v0.13.0-alpha.1

12 Mar 17:05
Compare
Choose a tag to compare
v0.13.0-alpha.1 Pre-release
Pre-release

This release brings a new cue trim algorithm, a performance fix for field ordering, two new commands, and many fixes.

Changes which may break some users are marked below with: ⚠️

Evaluator

A great deal of work has happened in the new evaluator, which can be used via CUE_EXPERIMENT=evalv3. Marcel recently posted another update on performance progress.

An entirely new algorithm for cue trim and tools/trim has been implemented for CUE_EXPERIMENT=evalv3, which resolves all known bugs when trimming CUE. Give it a try and report any issues you find.

⚠️ The new topological sort algorithm for field ordering has been tweaked to avoid becoming too slow in some cases. This may result in some ordering changes, but we expect them to be relatively small. See the change for more details.

The parser now correctly allows keywords as required field labels such as if!: _, fixing a discrepancy with the spec.

cmd/cue

The new cue refactor imports command rewrites import paths, making it easy to migrate between module locations and major versions.

The new cue mod mirror command copies modules from one registry to another.

cue get go should no longer attempt to import types from the Go standard library as CUE, which caused errors.

Hidden files and files with build tags should now be correctly filtered when loading a single CUE package.

Encodings

Loading binary files, such as via @embed(file="foo", type=binary), no longer requires the input to be valid UTF-8.

⚠️ The JSON Schema decoder now imports schema descriptions as CUE doc comments, which required a change to encoding/jsonschema.Config.DefineSchema.

Go API

⚠️ The long-deprecated cue.Runtime methods Parse, FromExpr, CompileFile, and CompileExpr are now removed.

module.SplitPathVersion and module.ParseImportPath have been deprecated in favor of cue/ast.SplitPackageVersion and cue/ast.ParseImportPath package to consolidate the API.

The new mod/module.Version.Compare method is added in favor of module.Sort, which is now deprecated.

The new mod/modfile.File.ModuleForImportPath function allows resolving a module and default major version for a package without consulting a registry.

The new mod/modregistry.Client.Mirror method implements the logic behind the new cue mod mirror command.

Full list of changes since v0.12.0
  • encoding/jsonschema: support x-kubernetes-embedded-resource by @rogpeppe in 0cd0a0c
  • encoding/jsonschema: initial support for Kubernetes CRDs by @rogpeppe in 0dcaff5
  • cmd/cue: mention --inject-vars/-T flag for injection help by @myitcv in 90c1965
  • cue/load: respect build tags when determining package by @rogpeppe in 58e09ee
  • internal/mod/modimports: exclude hidden CUE files by @rogpeppe in 8f2c89c
  • cmd/cue, internal/mod/modimports: add test cases for issue 3795 by @rogpeppe in 2742aba
  • cue/load: use iterator range by @rogpeppe in 9ba4189
  • mod/module: add Version.Compare by @mvdan in 931fecb
  • all: start making more use of strings.Cut by @mvdan in 7d62514
  • all: unconvert -apply ./... by @mvdan in cbed854
  • internal/ci: update Go and goreleaser by @mvdan in bebbaa9
  • core/toposort: stop trying to order structinfos/structlits by @cuematthew in bc6c485
  • internal/cuetxtar: Append \n to generated txtar file content by @cuematthew in 5d2da07
  • cmd/cue: adjust the detection of Go standard library packages by @mvdan in 153fc8a
  • cmd/cue: actually drop unsupported Go std types in get go by @mvdan in 97cbf7e
  • cmd/cue: add testscript reproducing get go issues with std packages by @mvdan in 9a53c81
  • internal/_e2e: remove unused CUE_REGISTRY_TOKEN env var by @mvdan in 239f3d3
  • encoding/jsonschema: delete code for Go 1.22 by @mvdan in 24e90ed
  • update golang.org/x dependencies by @mvdan in b6618cc
  • update various dependencies unlikely to cause breakage by @mvdan in 66f9e79
  • all: use a few more newer std APIs by @mvdan in 538fb69
  • core/toposort: Do not calculate cycles within an SCC by @cuematthew in d73e690
  • cue/parser: allow if as a label for a required field by @haoqixu in 18367a6
  • encoding/jsonschema: support single schema not at root by @rogpeppe in cdc4123
  • cmd/cue: fix refactor imports over multiple modules by @rogpeppe in 7cc1de3
  • cue.mod: use exp3 curated modules by @myitcv in fca4a5f
  • internal/core/adt: fix counter issue by @mpvl in a0c6dfe
  • internal/core/adt: fix edge case in structural cycles with structure sharing by @mpvl in 966a504
  • internal/core/adt: fix structural cycle stack overflow by @mpvl in a66eaf3
  • internal/core/adt: remove Inline check by @mpvl in 7bb676e
  • internal/core/adt: make inline expressions addressable by @mpvl in 35ec59b
  • encoding/openapi: convert remaining cue->json tests to txtar by @cuematthew in ba1084a
  • encoding/openapi: convert test suite to txtar by @cuematthew in 374c59e
  • internal/core/adt: do not hasNonCycle in one case by @mpvl in 52c02d0
  • internal/core/adt: refactor unifyNode by @mpvl in e55c7a8
  • internal/core/adt: add tests for issue 3634 by @mpvl in 8ed768a
  • internal/encoding: don't interpret files as UTF8 with the binary encoding by @nichtsundniemand in 0b36c4e
  • cue/interpreter/embed: remove obsolete TODOs by @mvdan in 8585568
  • cmd/cue/cmd: show incorrect handling of binary files when embedded by @nichtsundniemand in 073d23c
  • encoding/jsonschema: pass comments to DefineSchema by @rogpeppe in 880023b
  • Revert "encoding/jsonschema: pass comments to DefineSchema" by @mvdan in b6f250e
  • internal/core/adt: propagate default marker in single nested value by @mpvl in 26a698f
  • cmd/cue: stop marking the login command as experimental by @mvdan in 324b3da
  • internal/core/adt: add tests for issue 3779 by @mpvl in 8b80c3d
  • cmd/cue: embed support is no longer experimental by @mvdan in dce7fda
  • encoding/jsonschema: pass comments to DefineSchema by @rogpeppe in 7a3708e
  • cue/parser: allow for as label for required field by @haoqixu in fc8791f
  • mod/modregistrytest: move from internal/registrytest by @mvdan in b14cfde
  • internal/core/adt: fix FromDef by @mpvl in df327a6
  • cmd/cue/cmd: add test for edge case by @mpvl in 587d5a1
  • internal/core/adt: shorten closeContext graph depth by @mpvl in b17ea50
  • all: start using slices.Backward by @mvdan in 66d4c35
  • internal/vcs: use os.CopyFS from Go 1.23 by @mvdan in 873afd5
  • cue: tweak cue.Value.Decode with Go std changes by @mvdan in 4e0cc47
  • internal/core/adt: remove unnecessary clearing of CloseInfo by @mpvl in 3ed6d8d
  • internal/core/adt: hoist feature checking logic by @mpvl in ae5a017
  • internal/core/adt: do not add arc dependencies for some nodes by @mpvl in 98a3f93
  • internal/core/adt: prepare for shortening root by @mpvl in 58b3e7d
  • internal/core/adt: add test for closeContext graph shortening by @mpvl in 0d33c2e
  • internal/core/adt: simplify ellipsis logic by @mpvl in 694d295
  • internal/core/adt: fix bug when merging closing struct with ellipsis by @mpvl in 7822519
  • internal/core/adt: add ...
Read more