Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constraints break backward-compatibility check #166

Open
AgnesToulet opened this issue May 25, 2023 · 0 comments
Open

Constraints break backward-compatibility check #166

AgnesToulet opened this issue May 25, 2023 · 0 comments
Labels
prio/mid Medium priority readiness/minimum Requisite for achieving a minimum readiness

Comments

@AgnesToulet
Copy link
Contributor

AgnesToulet commented May 25, 2023

Having constraints in the schemas is breaking the backward-compatibility check when binding lineages.

This following lineage should be valid but is considered invalid and throws the error below:

Lineage:

import (
    "strings"
    "time"

    "github.com/grafana/thema"
)

lin: thema.#Lineage
lin: name: "constraints"
lin: schemas: [{
    version: [0, 0]
    schema: {
	aString: string & strings.MinRunes(1)
	aTime: string & time.Time
	anInt: uint32 & >0 & <=24 | *12
    }
},
{
    version: [0, 1]
    schema: {
	aString: string & strings.MinRunes(1)
	aTime: string & time.Time
	anInt: uint32 & >0 & <=24 | *12

        secondfield?: int32
    }
}]

lin: lenses: [{
    from: [0, 1]
    to: [0, 0]
    input: _
    result: {
        aString: input.aString
        aTime: input.aTime
        anInt: input.anInt
    }
}]

Error:

    lineage_test.go:33: error binding lineage: schema 0.1 is not backwards compatible with schema 0.0:
        (1) forced error mark
          | "invalid lineage"
          | github.com/cockroachdb/errors/withstack/*withstack.withStack::
        Wraps: (2) schema 0.1 is not backwards compatible with schema 0.0:
          | field aString not present in {aString:strings.MinRunes(1),aTime:time.Time(),anInt:*12 | >0 & <=24 & int}:
          |     C:\Users\agnes\Documents\as-code\thema\lineage.cue:247:10
          |     C:\Users\agnes\Documents\as-code\thema\testdata\lineage\in.cue:13:13
          | missing field "aString"
          | invalid value strings.MinRunes(1) (does not satisfy strings.MinRunes(1)): error in call to strings.MinRunes: non-concrete value string:
          |     C:\Users\agnes\Documents\as-code\thema\testdata\lineage\in.cue:22:21
          |     C:\Users\agnes\Documents\as-code\thema\testdata\lineage\in.cue:14:21
          |     C:\Users\agnes\Documents\as-code\thema\testdata\lineage\in.cue:22:38
        Error types: (1) *markers.withMark (2) *errors.errorString

I opened an issue in the CUE repo to fix the behavior of Subsume: cue-lang/cue#2419

Meanwhile, we should ignore these errors.

@joanlopez joanlopez added prio/mid Medium priority readiness/minimum Requisite for achieving a minimum readiness labels Jun 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
prio/mid Medium priority readiness/minimum Requisite for achieving a minimum readiness
Projects
None yet
Development

No branches or pull requests

2 participants