-
-
Notifications
You must be signed in to change notification settings - Fork 118
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
Semver imports #931
Comments
Is there consensus on format of ranges we should support? Here are some alternatives
Further, would we only support major version ranges (as above), or would we support more complex expressions, e.g.
As for the package-lock.json problem ... We'll need to fully resolve versions to do validation and introspection inside the modelManager. It seems reasonable that we could dump the static versions for auditing purposes quite easily. However, the reproducibility problem seems harder, especially that we don't have a mechanism to pull model versions from a repository (we don't even have a standard repository protocol / index!). We could conclude that reproducibility is a client-concern for now! π¨ |
Semver imports also complicates caching / immutability of models. I.e. if I request namespace |
Another consideration is that today the ModelFile has a map (importShortNames) from local short name to FQN that is populated from the AST. This approach would not work, because the FQN to use could change whenever a new model file is added to the ModelManager that matches semver range for the import. We'd have to use logic similar to how strict:false wildcard imports are used, which are resolved on-demand (some performance impact), or introduce some sort of lifecycle control on the Or, we need an eventing mechanism to allow the ModelFiles to dump their |
I'm leaning towards just supporting x-ranges. E.g. Do you think we should give people "the rope" and support x-ranges like |
ππ»
Yes, I can imagine scenarios where version upgrades are forced despite the dependency not changing. Here's the spec for x-ranges from npmjs semver package, https://www.npmjs.com/package/semver.
|
What do we do for pre-release imports? |
Name collisions are possible - that could be breaking changes for specialised types. E.g. when I add a new property to a super type (semver minor) that conflicts with an existing property in a specialised type. |
Let's release this behind a feature flag. |
Feature Request ποΈ
Support imports across semver ranges.
Use Case
Allows less strict management of imports, meaning that when an imported namespace is referenced, if backwards compatible changes to the imported namespace are made, then the version number of the importing namespace does not have to be incremented.
Possible Solution
Support some form of semver range for import statements:
With strict import (as today):
With semver import:
Context
Today you can run Concerto in two modes:
Strict mode is very useful in that it makes the dependency graph between concepts completely deterministic, given a single CTO file. I.e. you can take a single CTO file and follow all its versioned imports and build a deterministic graph of every element the model contains. The downside is that changes to namespaces that are "deep" in the dependency hierarchy cause a ripple of changes through out the entire graph. As the graph gets large this is untenable.
Detailed Description
By supporting semver range imports these ripple updates of import versions are minimised, imports only need to be updated when the semver range constraint no longer matches. The downside is that the dependency graph from a CTO file is no longer purely defined by the CTO file itself, it depends on what other CTO files are present, and their versions. The so-called "package-lock.json" problem - there may need to be another mechanism to ensure deterministic versions of imported packages are used, to ensure fully reproducible builds.
Ensuring Reproducible Builds
Below I illustrate an approach of writing back the resolved namespace version into the AST for the model, allowing semver imports to be "pinned" while maintaining them in the CTO or AST.
With semver import, with ability to specify a "resolved version" for an import:
strict:true
andsemverImports:true
set (do we want a flag for this? Perhaps it should just be supported by default?)ModelManager.resolveMetamodel
is used to create an AST that has theResolvedVersion
decorator added to all semver imports, capturing the version of the namespace that was usedWhen a reproducible ModelManager is required:
strict:true
anduseResolvedImportVersions:true
setResolvedVersion
decorator) and an import to version 1.0.1 is used. An exception is thrown if this exact version of the model file is not in the model manager.When the ModelManager should pick up new namespace versions:
strict:true
set andsemverImports:true
ModelManager.resolveMetamodel
to store this configuration, if necessaryCode Generation
When we generate code we will need to use the resolved imports, rather than imports than contain semver ranges.
Tasks
The text was updated successfully, but these errors were encountered: