-
Notifications
You must be signed in to change notification settings - Fork 302
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
mod/modfile: allow earlier language versions #3145
Comments
For some more clarity: particularly in terms of regression testing or Unity, it is a lot easier to understand the original writer's intended effect when knowing what version of CUE they were using. For example, even if the language spec didn't have any significant changes between v0.5.0 and v0.8.0, the evaluator still evolved behind the scenes, so it's very possible that their CUE code started behaving differently in some way - perhaps some errors are different, perhaps the exported result is different, or perhaps some errors appeared or disappeared. I think it's fine if commands like |
A passing thought: right now we are coupling the language version with the module.cue schema version. It's convenient to do this for us and for most users, because there is one less version to keep track of. But we don't need to tie the two together; someone might want to use the latest schema version, for example to be able to
which
The fix was to bump Go has started splitting up the I'm not saying we definitely want to split up |
Another example: right now we have some CUE users on ancient versions like v0.4.3 due to regressions or breakage in later versions of the evaluator. Once they do eventually update to v0.9.0 or v0.10.0, the current design would force them to set In this particular case, there aren't any breaking language spec changes between v0.4.3 and v0.9.0, but we do intend to make breaking changes in upcoming language versions: see for instance #2237 or #2932. If a large project makes use of language features that we are removing, a user should be able to stick to the older |
I also note that there are two possible solutions to the problem here:
Either of those will fix the immediate concerns, but longer term, 2 might be the better approach. If e.g. Option 2 could also name the field something like "target version", which wouldn't be a maximum CUE version that can be used, but it would signal for example: even though I use the language spec at version v0.6.0, and that is the oldest version I support for evaluation, our developers use v0.9.0 for maintaining and publishing this module, and we want to make use of new backwards-compatible features like |
Another thing is, trying to publish a module looking like this
using
This seems wrong, as language version 0.8.0 didn't use the |
The original blocking aspect of this for v0.9.0 was the fact that any modules created very early during the CUE modules experiment, such as one of mine with v0.8.0-alpha.3, started failing like:
This immediate issue got fixed by https://review.gerrithub.io/c/cue-lang/cue/+/1194685, where the oldest schema version was lowered from v0.8.0 to v0.8.0-alpha.0. The other blocking bug I see here is what @rustamabd2 brings up in #3145 (comment); existing users of Those users on v0.8 were able to publish with v0.8 versions of the software, and now they cannot, unless they bump https://github.com/cue-labs/services/issues/141 seems to agree with my understanding by saying:
|
See the added comments to the testscript; this shows the current logic. The following commit will tweak the logic to fix the TODO. For #3145. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Ib50b1f6fb0e685ffe7af687fe962ea02d9ef6056
Any users who had created CUE modules with CUE_EXPERIMENT=modules using one of the v0.8 releases could publish to a registry, such as: module: "github.com/example/repo@v0" language: { version: "v0.8.0-alpha.3" } Suddenly, the latest v0.9 alphas started failing on those: no source field found in cue.mod/module.cue This error is a breaking change for the users which isn't necessary. The old logic was basically equivalent to source.kind="self"; we should only require the explicit field on newer language versions. Moreover, the error was confusing: just adding a source.kind field, without bumping language.version to one with the newer schema, failed: invalid module.cue file: source field is not allowed at this language version; need at least v0.9.0-alpha.0 Updates #3145. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I6752e4d6f2e687e2cd568f4a807b76b64e1e057e
https://review.gerrithub.io/c/cue-lang/cue/+/1195526 should fix this last issue brought up by Rustam. We should leave this issue open for v0.10 for the sake of deciding if we want to allow setting very old Earlier in this thread we also discussed decoupling the language version from the |
See the added comments to the testscript; this shows the current logic. The following commit will tweak the logic to fix the TODO. For #3145. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Ib50b1f6fb0e685ffe7af687fe962ea02d9ef6056
Any users who had created CUE modules with CUE_EXPERIMENT=modules using one of the v0.8 releases could publish to a registry, such as: module: "github.com/example/repo@v0" language: { version: "v0.8.0-alpha.3" } Suddenly, the latest v0.9 alphas started failing on those: no source field found in cue.mod/module.cue This error is a breaking change for the users which isn't necessary. The old logic was basically equivalent to source.kind="self"; we should only require the explicit field on newer language versions. Moreover, the error was confusing: just adding a source.kind field, without bumping language.version to one with the newer schema, failed: invalid module.cue file: source field is not allowed at this language version; need at least v0.9.0-alpha.0 Updates #3145. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I6752e4d6f2e687e2cd568f4a807b76b64e1e057e
See the added comments to the testscript; this shows the current logic. The following commit will tweak the logic to fix the TODO. For #3145. Signed-off-by: Daniel Martí <[email protected]> Change-Id: Ib50b1f6fb0e685ffe7af687fe962ea02d9ef6056 Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195525 TryBot-Result: CUEcueckoo <[email protected]> Unity-Result: CUE porcuepine <[email protected]> Reviewed-by: Paul Jolly <[email protected]>
Any users who had created CUE modules with CUE_EXPERIMENT=modules using one of the v0.8 releases could publish to a registry, such as: module: "github.com/example/repo@v0" language: { version: "v0.8.0-alpha.3" } Suddenly, the latest v0.9 alphas started failing on those: no source field found in cue.mod/module.cue This error is a breaking change for the users which isn't necessary. The old logic was basically equivalent to source.kind="self"; we should only require the explicit field on newer language versions. Moreover, the error was confusing: just adding a source.kind field, without bumping language.version to one with the newer schema, failed: invalid module.cue file: source field is not allowed at this language version; need at least v0.9.0-alpha.0 Updates #3145. Signed-off-by: Daniel Martí <[email protected]> Change-Id: I6752e4d6f2e687e2cd568f4a807b76b64e1e057e Reviewed-on: https://review.gerrithub.io/c/cue-lang/cue/+/1195526 TryBot-Result: CUEcueckoo <[email protected]> Reviewed-by: Paul Jolly <[email protected]> Unity-Result: CUE porcuepine <[email protected]>
As of July 2024, no users beyond me have asked for this feature - being able to declare an older language version like The main use case I was thinking of here is Unity, where older projects in the corpus were written for older CUE versions, so I'd like to record that via Closing for now; we can reopen if other users ask for this. |
Currently when parsing in non-legacy mode,
mod/modfile
rejects any language version earlierthan
v0.8.0
, as that's when the language version field started to be supported and themodule syntax became closed, disallowing unrecognized fields.
@mvdan points out that it's useful for users to be able to specify a language version that's
earlier than that, as information about the actual language version that some code was
evaluated against.
We could see that the language version is before v0.8.0 and allow (but discard) any field
other than
module
, mirroring the fact that all fields were allowed before then.The text was updated successfully, but these errors were encountered: