Changes which may break some users are marked below with: ⚠️
Language
The parser now allows a newline or a comma before the closing bracket of an index expression, matching how lists and func arguments allow omitting trailing commas:
foo[
"bar"
]
Evaluator
The comprehension algorithm now waits to run a comprehension's body until the fields it reads have a concrete value, rather than trying to produce its fields up front. This resolves a number of long-standing bugs, most notably the last known regressions from evalv2, where a comprehension that should have resolved instead failed as an incomplete value or a cycle.
This design also greatly simplifies upcoming evaluator work, such as introducing new builtins to replace comparing values to bottom, as well as the design of evalv4.
The evaluator no longer deduplicates errors just by position, which was causing some useful errors from disjunctions or standard library calls to be dropped incorrectly.
A number of bugs, panics, and hangs have been resolved as well.
cmd/cue
cue vet -d/--schema now supports hidden fields, and correctly reports an error when the command inputs are CUE only.
cue fix and cue trim no longer change file modification times when no changes are necessary.
Encodings
⚠️ The experimental JSON Schema encoder now emits most definitions without the leading # character, shortening names and ensuring compatibility with the wider JSON Schema ecosystem. This required deprecating encoding/jsonschema.GenerateConfig.NameFunc in favor of NamesFunc.
Several closedness bugs in the JSON Schema encoder have been fixed, ensuring that the generated JSON Schema behaves the same way as the original CUE definition.
The ProtoBuf decoder now resolves relative references following the usual scoping rules, instead of always resolving them against the top-level scope.
Go API
Add Path.Compare and Selector.Compare, providing allocation-free total ordering suitable for slices.SortFunc.
Full list of changes since v0.17.0-alpha.1
- .claude: add a skill to draft release notes from a commit log by @mvdan in 7935fe8
- internal/ci: bump Go and goreleaser for the upcoming alpha by @mvdan in c2a8155
- encoding/jsonschema: mark generation as experimental by @rogpeppe in 223cfa7
- encoding/protobuf: translate google.protobuf.Struct to an open struct by @mvdan in ef3e0ee
- internal/core/adt: report true element count for list length mismatch by @mvdan in d474938
- cue/testdata: add test for list-length error with comprehensions by @mvdan in 40961bb
- cue: fix Value.ReferencePath after Eval when sharing is disabled by @mvdan in 9a6d76d
- cue: clarify Value.ReferencePath path semantics by @mvdan in 0adb8dd
- pkg/list: report a missing less field as a fatal error by @mvdan in 6aa4a11
- cmd/cue: fix vet -d resolving a hidden constraint by @mvdan in 5651def
- cmd/cue: add test for vet -d with a hidden constraint by @mvdan in 1a0c02c
- pkg/encoding: report every Validate conflict by @mvdan in 81f9d1b
- pkg/encoding: add tests for Validate reporting a single conflict by @mvdan in 5310062
- mod/modconfig: delete the dummy $DOCKER_CONFIG dir when the tests are done by @mvdan in ffb2fbd
- cue/errors: deduplicate without rendering errors unnecessarily by @mvdan in e9f02ca
- cue/errors: report all distinct errors at the same position by @mvdan in 774942d
- cue/errors: add a test recording how often removeMultiples renders errors by @mvdan in 2ba0d46
- cue/errors: add tests for distinct errors dropped at the same position by @mvdan in a753484
- modconfig: update ociregistry to pick up ociauth fix by @mvdan in e5e958e
- internal/core/debug: only print integer-labeled arcs of a list value by @mvdan in 8fdf9d5
- pkg/list: add a regression test for list error printing hidden arcs by @mvdan in f9b4c66
- internal/filetypes: clarify error for combined file type and file name by @mvdan in b15022d
- cmd/cue: add a regression test for issue 3187 by @mvdan in 8273d6f
- cue: avoid panic in Value.Path for dereferenced let bindings by @mvdan in 58f2356
- internal/core/adt: recompute cached let results that resolved to a cycle by @mvdan in 4a67df9
- cue/testdata/cycle: add regression test for issue 4357 by @mvdan in ffc0541
- cue/testdata: add #4149 regression test for
or structural cycle by @mvdan in 803c837
- internal/cuetxtar: keep nested inline positions relative by @mpvl in dede65a
- internal/core/adt: detect structural cycle through inline conjunction by @mvdan in f518389
- internal/core/compile: update compile file comments by @mpvl in 5a6110a
- internal/core/adt: loosen structure-sharing skip in cycle detection by @mpvl in aae3830
- internal/core/adt: bound self-recursion in cycle detection skip by @mpvl in 297d254
- internal/core/adt: do not treat structure sharing as a cycle by @mpvl in c37cf24
- internal/core/adt: scope task context error before deferred tasks by @mpvl in 697512f
- cue/testdata: add #4367 regression tests by @mpvl in 2735d5a
- internal/core/adt: skip typo check on cross-context Finalize by @mpvl in a9f3f2a
- all: adopt the cueckoo @-import guidance mechanism by @myitcv in 5f10676
- all: fix reversed argument order in cmp.Diff calls by @mvdan in 82d70cb
- cue/testdata/cycle: add regression test for issue 3364 by @mvdan in 40caafe
- encoding/protobuf: respect lexical scoping rules by @SteveRuble in d34b9f5
- internal/mod/modregistry: bump ociregistry to merge auth sources by @mvdan in 033671e
- cmd/cue: add test for mixing Docker and Podman auth files by @mvdan in 268fe24
- internal/core/adt: skip in-flight nodes when reclaiming buffers by @mpvl in 489f4a9
- cmd/cue: preserve mtimes in cue fix and cue trim no-op rewrites by @mvdan in 28b3474
- cmd/cue: document mtime drift in fix and trim by @mvdan in e56df9e
- cue/parser: allow a newline before the closing bracket of an index expression by @mvdan in fa44ce4
- cue/testdata: add regression test for self-referential builtin cycles by @mvdan in abe46a1
- internal/core/compile: include label-aliased fields in cross-file scope by @mvdan in 4157262
- cue/testdata: add test for issue #4312 by @mvdan in 9888e6f
- internal/core/export: fix label references in pattern constraints by @mvdan in 0c639f4
- internal/core/compile: strip @test attributes from mirrored inputs by @mpvl in b343757
- internal/core/adt: flush label-only cyclic CallExpr deferments by @mpvl in dd5b4c0
- update dependencies ahead of the next alpha release by @mvdan in 2fddd86
- cmd/cue: fix json error tests on Go tip by @mvdan in bd45f3e
- cue/testdata: add comprehension pushdown regression for inline conjunction iterator by @mpvl in 29b71ea
- encoding/ini: make dotted section-name nesting configurable by @ReginaZhangMS in cd0f418
- internal/core/adt: remove unused nodeContextState.hasOpenValidator by @mvdan in ae29eac
- internal/core/adt: remove unused Bottom.Permanent field by @mvdan in 8f8a581
- internal/core/adt: remove unused Bottom.ForCycle field by @mvdan in b24e6fd
- internal/core/adt: remove unused StructLit.isComprehension field by @mvdan in 0e0dbc1
- internal/core/adt: remove unused StructLit.IsOpen field by @mvdan in 023bcd0
- internal/ci: set GORACE in the base config by @mvdan in 0e2745d
- internal/core/adt: fix data race in concurrent FillPath by @mvdan in 06056b9
- pkg/tool/exec: default env to an empty struct by @mvdan in 74211d7
- cmd/cue/cmd: add test for exec.Run JSON marshaling by @mvdan in f44f49a
- all: make use of strings.CutPrefix by @mvdan in 34f13a2
- cue/testdata: add test for issue #4174 by @mvdan in 75c434d
- cue/testdata: add test for issue #4094 by @mvdan in e0a7df6
- cue/testdata: add test for issue #4091 by @mvdan in dd8ef3d
- cue/parser: remove pre-v0.2 alias special error by @mvdan in 1889ee7
- cue/parser: add test cases for pre-v0.2 alias handling by @mvdan in f68b1ed
- cue/parser: remove dead error test code by @mvdan in d636840
- internal/core/compile: isolate txtar goldens by @mpvl in dfc376f
- internal/core/adt: skip Disjunctions on ancestor-cycle arcs by @mpvl in a10029d
- internal/core/adt: fix stale BaseValue cycle on cross-package imports by @mpvl in b7f911d
- cue: add Unify regression test for comp-produced sub-vertex by @mpvl in 6a67e3f
- internal/core/adt: re-deref v in Vertex.lookup after state.process by @mpvl in d30d51a
- internal/core/adt: defer fieldSetKnown while a parent task is still active by @mpvl in 9e96d2c
- internal/core/adt: dependency-tracking comprehension pushdown by @mpvl in 339485d
- encoding/jsonschema: fix closedness handling in Generate by @rogpeppe in 3767108
- encoding/jsonschema: pass closedness mode through OrOp in Generate by @rogpeppe in b01cdb4
- encoding/jsonschema: add test case by @rogpeppe in c0afa64
- encoding/jsonschema: add tests for closedness bugs in Generate by @rogpeppe in 2db6796
- internal/core/toposort: interleave sibling Repeats in field ordering by @mpvl in 00349c2
- internal/core/export: add another test for the toposort bug by @mpvl in 93c3a70
- internal/core/export: add topocomp regression test by @mpvl in 65492ed
- internal/core/export: dedup conjuncts sharing the same body AST by @mpvl in 18911c7
- internal/core/adt: add reproducer for unity failure by @mpvl in defac2f
- cue/testdata: add regression test cases to comprehensions/pushdown by @mpvl in bd146e1
- cmd/cue: surface [inputs] and [flags] in command help by @mvdan in bfa0112
- mod/modcache: retry .partial file writes on Windows by @mvdan in f438e31
- internal/ci: allow specifying a custom ref in checkoutCode by @mvdan in 697a664
- internal/core/adt: propagate cycle errors via state in reportFieldError by @mpvl in 424fe38
- internal/core/adt: tighten up states by @mpvl in e3cf2cd
- internal/core/adt: add some edge case tests by @mpvl in 8421e7e
- cue: handle ArcPending and ArcNotPresent in fromArcType by @mpvl in 3b7b66e
- cue: drop stale same-runtime/build requirement from Value docs by @mvdan in e512a32
- cmd/cue: error when -d/--schema is used without non-CUE input by @mvdan in 0a3d5ba
- cmd/cue: test current -d behavior with only CUE input by @mvdan in 0409f59
- add a SECURITY.md for easier GitHub discovery by @mvdan in 8115669
- cue/testdata: relax test assertions for refactoring stability by @mpvl in 55a7b0a
- internal/golangorgx: remove unused dead files by @mvdan in 84032e7
- tools/fix: remove the unused processor type by @mvdan in a07a818
- internal/core/adt: identified faulty tests by @mpvl in 22e3b46
- internal/core/adt: localize cycle in disjunct sharing path by @mpvl in 7c6198e
- internal/core/adt: yield on incomplete reference to in-flight node by @mpvl in 17a5fa8
- internal/cuetxtar: honor any= in cmpErr (nested @test(err, any, ...)) by @mpvl in 5f571a5
- internal/cuetxtar: replay source @test directives for permute by @mpvl in a90bc50
- internal/cuetxtar: render struct-level errors as bare | with err annotation by @mpvl in a59b4cd
- internal/cuetxtar: auto-promote @test(eq:todo) under CUE_UPDATE by @mpvl in ea842e9
- internal/cuetxtar: tighten cmpStruct/cmpConjunction against silent passes by @mpvl in dbda38d
- internal/core/adt: force update cleanup by @mpvl in b3338e8
- encoding/jsonschema: propagate recursive closedness in Generate by @mvdan in 2b2987e
- encoding/jsonschema: test recursive closedness of generated schemas by @mvdan in 5a0dd64
- encoding/jsonschema: better definition names in Generate by @rogpeppe in 8e638c0
- cue: add Compare methods to Path and Selector by @rogpeppe in 63c8014
- internal/anyhash: new package by @rogpeppe in 019f9df