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

Change #Lineage.joinSchema from _ (top) to open struct with version #16

Open
sdboyer opened this issue Jan 17, 2022 · 3 comments
Open
Assignees
Labels
invariants Involves the definition or enforcement of a key system invariant
Milestone

Comments

@sdboyer
Copy link
Contributor

sdboyer commented Jan 17, 2022

#Lineage.joinSchema defines the join/least upper bound that must be maintained by all schemas in a lineage. Currently, it starts as top, _:

thema/lineage.cue

Lines 11 to 24 in b7b4330

#Lineage: {
// joinSchema governs the shape of schema that may be expressed in a
// lineage. It is the least upper bound, or join, of the acceptable schema
// value space; the schemas defined in this lineage must be instances of the
// joinSchema.
//
// In the base case, the joinSchema is unconstrained/top - any value may be
// used as a schema.
//
// A lineage's joinSchema may never change as the lineage evolves.
//
// TODO should it be an open struct rather than top?
// TODO can this be a def? should it?
joinSchema: _

This isn't great:

  • It makes injecting a themaVersion field complicated, since we can't universally assume all schemas are a struct at base (could be scalar or list)
    • We can't even assume that all schemas are structs within a lineage
  • It's plausible that other bits of thema's helper CUE logic may be subtly assuming a struct type here as well
  • I don't see a use case for scalars or lists as a base schema type, for essentially the same reasons that

I'm sure i want it to be an open struct, {...}. i was worried about open/closedness here, but after some poking on the playground, i think we can make the shift without forcing any decisions on openness, which is great - that's a can of worms.

I don't see an immediate reason why this change would be anything other than changing just the one line - i'm mostly writing this issue up for posterity and as a place to dump that link to the playground. (also have it in a gist)

@sdboyer sdboyer added the invariants Involves the definition or enforcement of a key system invariant label Jan 17, 2022
@sdboyer sdboyer self-assigned this Jan 17, 2022
@sdboyer
Copy link
Contributor Author

sdboyer commented Jan 17, 2022

Thinking on this further, it may be that we want to actually inject this instead:

joinSchema: {
    themaVersion?: [int & >= 0, int & >= 0]
    ...
}

But i'll probably leave that for a follow-up

@sdboyer sdboyer added this to the Stable milestone Jan 17, 2022
@sdboyer sdboyer changed the title Change #Lineage.joinSchema from _ (top) to {...} Change #Lineage.joinSchema from _ (top) to {themaVersion?: #SyntacticVersion, ...} Apr 7, 2022
@sdboyer sdboyer changed the title Change #Lineage.joinSchema from _ (top) to {themaVersion?: #SyntacticVersion, ...} Change #Lineage.joinSchema from _ (top) to open struct with version Apr 7, 2022
@sdboyer
Copy link
Contributor Author

sdboyer commented Oct 26, 2022

When talking all this through with @Lyoness and @myitcv earlier today, i realized that this, the possibility of adding the themaVersion? field, and #76 can be taken care of all in one motion by something like this:

  1. Making joinSchema into {...} as this originally proposed, and renaming it to `allSchem
  2. Adding an allSchemasMust, which is a struct that must be valid when unified against all schemas in the lineage, but the result of that unification is not part of the actual used schema.

@sdboyer
Copy link
Contributor Author

sdboyer commented Mar 12, 2023

Not going to inject version just yet. Will explore that in a later pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
invariants Involves the definition or enforcement of a key system invariant
Projects
None yet
Development

No branches or pull requests

1 participant