-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
thema: Fix backwards compatibility checking bugs
The entire fix here was: - Checking a closed def (`_#schema`) instead of the original, typically open `schema` field - Getting rid of cue.Schema() and cue.Final() as options to Subsume(), because they weren't doing what we thought they did Then all the backwards compatibility checks just started working, exactly like we'd originally hoped.
- Loading branch information
sam boyer
committed
Aug 14, 2023
1 parent
711d7fd
commit 1673cd5
Showing
7 changed files
with
77 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# reducing the permitted options in a union/disjunction is backwards incompatible | ||
#lineagePath: lin | ||
-- in.cue -- | ||
|
||
import "github.com/grafana/thema" | ||
|
||
lin: thema.#Lineage | ||
lin: name: "union-reduction" | ||
lin: schemas: [{ | ||
version: [0, 0] | ||
schema: { | ||
concreteCross: "foo" | "bar" | 42 | ||
concreteString: "foo" | "bar" | "baz" | ||
crossKind3: string | int32 | bytes | ||
crossKind2: string | int32 | ||
} | ||
}, | ||
{ | ||
version: [0, 1] | ||
schema: { | ||
concreteCross: "foo" | 42 | ||
concreteString: "foo" | "bar" | ||
crossKind3: string | int32 | ||
crossKind2: string | ||
} | ||
}] | ||
|
||
lin: lenses: [{ | ||
from: [0, 1] | ||
to: [0, 0] | ||
input: _ | ||
result: { | ||
concreteCross: input.concreteCross | ||
concreteString: input.concreteString | ||
crossKind3: input.crossKind3 | ||
crossKind2: input.crossKind2 | ||
} | ||
}] | ||
-- out/bindfail -- | ||
schema 0.1 is not backwards compatible with schema 0.0: | ||
field concreteCross not present in {concreteCross:"foo" | "bar" | 42,concreteString:"foo" | "bar" | "baz",crossKind3:string | >=-2147483648 & <=2147483647 & int | bytes,crossKind2:string | >=-2147483648 & <=2147483647 & int}: | ||
/cue.mod/pkg/github.com/grafana/thema/lineage.cue:234:12 | ||
missing field "concreteCross" |